From owner-freebsd-fs Wed Dec 25 20: 2: 0 2002 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7A3B37B401 for ; Wed, 25 Dec 2002 20:01:58 -0800 (PST) Received: from smtp03.iprimus.com.au (smtp03.iprimus.com.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6586843E4A for ; Wed, 25 Dec 2002 20:01:57 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from smtp02.iprimus.net.au (210.50.76.70) by smtp03.iprimus.com.au (6.7.010) id 3E026CA70007AE05 for freebsd-fs@FreeBSD.org; Thu, 26 Dec 2002 15:01:45 +1100 Received: from dilbert.robbins.dropbear.id.au ([210.50.112.99]) by smtp02.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Thu, 26 Dec 2002 15:01:44 +1100 Received: from dilbert.robbins.dropbear.id.au (w6qubam4hrjf8nri@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id gBQ42OCv007163; Thu, 26 Dec 2002 15:02:24 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id gBQ42NlR007134; Thu, 26 Dec 2002 15:02:23 +1100 (EST) (envelope-from tim) Date: Thu, 26 Dec 2002 15:02:23 +1100 From: Tim Robbins To: Tony Gogoi Cc: freebsd-fs@FreeBSD.org Subject: Re: Pointer to proc structure Message-ID: <20021226150223.B10752@dilbert.robbins.dropbear.id.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from tgogoi@cse.Buffalo.EDU on Wed, Dec 25, 2002 at 07:18:14PM -0500 X-OriginalArrivalTime: 26 Dec 2002 04:01:45.0211 (UTC) FILETIME=[81784CB0:01C2AC93] Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 on FreeBSD 4.x: extern struct proc *curproc; /* Current running proc. */ It is a macro defined in 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