From owner-freebsd-hackers Mon Jun 26 13:21: 9 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id B6AF637BE37 for ; Mon, 26 Jun 2000 13:20:59 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id NAA07426; Mon, 26 Jun 2000 13:20:56 -0700 (PDT) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id NAA16125; Mon, 26 Jun 2000 13:20:55 -0700 (PDT) (envelope-from jdp@polstra.com) Date: Mon, 26 Jun 2000 13:20:55 -0700 (PDT) Message-Id: <200006262020.NAA16125@vashon.polstra.com> To: chris@calldei.com Subject: Re: struct proc In-Reply-To: <20000626111453.E20702@holly.calldei.com> References: <3957ABBD.6010407@mail.ru> <20000626111453.E20702@holly.calldei.com> Organization: Polstra & Co., Seattle, WA Cc: hackers@freebsd.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <20000626111453.E20702@holly.calldei.com>, Chris Costello 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