From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 8 01:23:18 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 804CA16A4CE for ; Thu, 8 Jul 2004 01:23:18 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A94E43D3F for ; Thu, 8 Jul 2004 01:23:18 +0000 (GMT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc11) with ESMTP id <2004070801231501100icsthe>; Thu, 8 Jul 2004 01:23:17 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id SAA85425; Wed, 7 Jul 2004 18:23:14 -0700 (PDT) Date: Wed, 7 Jul 2004 18:23:12 -0700 (PDT) From: Julian Elischer To: pradeep reddy punnam In-Reply-To: <20040708005524.19141.qmail@web53407.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: unable to copy data from the kernel to the user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2004 01:23:18 -0000 hmmm On Wed, 7 Jul 2004, pradeep reddy punnam wrote: > hi hackers, > > i am new to kernel hacking , i am just trying to play with the networking code. > i wrote a system call that will copy the mbuf address from the kernel to user space.. > the sys call look like this > > 355 STD BSD { int sn_rqueue(struct mbuf *m);} > > and the code in the sn_rqueue syscall look like > struct mbuf *x; > copyout(x,uap->m;sizeof(x)); sizeof(*x) > > and the code in the user program look like > struct mbuf *m=NULL; > syscall(355,m); you are calling the syscall with a NULL pointer.. of course the copyout will fail but you are not looking at teh error result.. I think you want: if you want the address of the mbuf to be sent to user space. (Why on earth?) then you need. 355 STD BSD { int sn_rqueue(struct mbuf **m);} copyout(&x, uap->m, sizeof(x)) struct mbuf *m=NULL; syscall(355,&m); > > and when i tryed to read the ' m ' value it still stays as NULL, > may be this question is trivial for u guys..but i was struck at this point... > i will be very thankful if somebody can help in this... > I'm guessing you want to look at the mbuf directly using /dev/kmem? there has to be a better way :-) > > -prady > > > > > > --------------------------------- > Do you Yahoo!? > Yahoo! Mail - 50x more storage than other providers! > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >