Date: Thu, 26 Dec 2002 15:02:23 +1100 From: Tim Robbins <tjr@FreeBSD.org> To: Tony Gogoi <tgogoi@cse.Buffalo.EDU> Cc: freebsd-fs@FreeBSD.org Subject: Re: Pointer to proc structure Message-ID: <20021226150223.B10752@dilbert.robbins.dropbear.id.au> In-Reply-To: <Pine.SOL.4.30.0212251909260.1424-100000@pollux.cse.buffalo.edu>; from tgogoi@cse.Buffalo.EDU on Wed, Dec 25, 2002 at 07:18:14PM -0500 References: <Pine.SOL.4.30.0212231823330.24955-100000@pollux.cse.buffalo.edu> <Pine.SOL.4.30.0212251909260.1424-100000@pollux.cse.buffalo.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 25, 2002 at 07:18:14PM -0500, Tony Gogoi wrote: > I've 2 questions... > > 1) how do I join this newsgroup ? I've never joined a newgroup before so > have no clue... http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/eresources.html#ERESOURCES-MAIL > > 2) Lets say there's a function "Func" in the BSD kernel....Is there any > way I could get a pointer to the proc structure to which "Func" belongs... > > void Func() { > > struct proc *p; > > p = ???????? > > } > > I mean, how could I get "p" to point to the current proc structure.... You probably want `curproc', prototyped in <sys/proc.h> on FreeBSD 4.x: extern struct proc *curproc; /* Current running proc. */ It is a macro defined in <sys/pcpu.h> on FreeBSD 5.x. > The reason i asked this is NDINIT() requires the proc structure to be > passed as an argument, and only after that the vnode can be accessed. You could use curproc, but it would be better to use the proc pointer passed in to the vnode operation. For example struct vop_open_args, passed to your xxx_open() function, will contain a proc pointer to use. > If there is a way in BSD to get the vnode just by giving the pathname as > an argument, that would be very helpful. Should be a fairly simple matter of calling NDINIT() then vn_open(). Check out open() in vfs_syscalls.c for ideas. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021226150223.B10752>