Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2000 13:20:55 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        chris@calldei.com
Cc:        hackers@freebsd.org
Subject:   Re: struct proc
Message-ID:  <200006262020.NAA16125@vashon.polstra.com>
In-Reply-To: <20000626111453.E20702@holly.calldei.com>
References:  <3957ABBD.6010407@mail.ru> <20000626111453.E20702@holly.calldei.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <20000626111453.E20702@holly.calldei.com>,
Chris Costello  <chris@calldei.com> wrote:
> On Monday, June 26, 2000, Fox Anderson wrote:
> > What is the difference between p and curproc in my syscall?
> > 
> > static int
> > my_syscall(struct proc *p, my_syscallargs *uap) {
> > 		curproc->......
> > }
> 
>    p is the process that made the syscall, curproc is the current
> running process.  You should be using p for the process that
> called my_syscall.

Since only one process can enter the kernel at a time (currently),
and p is the process that made the system call, it is also the
current process.  I claim that (p == curproc) in this example, and
that it would be better to code with p than with curproc.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006262020.NAA16125>