From owner-freebsd-arch Tue Oct 3 13:17:53 2000 Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 9DE4537B503; Tue, 3 Oct 2000 13:17:45 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e93KHgM08579; Tue, 3 Oct 2000 13:17:42 -0700 (PDT) Date: Tue, 3 Oct 2000 13:17:42 -0700 From: Alfred Perlstein To: Chuck Paterson Cc: John Baldwin , arch@freebsd.org, John Polstra , Daniel Eischen , Matt Dillon , Greg Lehey Subject: Re: Mutexes and semaphores Message-ID: <20001003131741.K27736@fw.wintelcom.net> References: <20001003121604.H27736@fw.wintelcom.net> <200010032001.OAA12968@berserker.bsdi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <200010032001.OAA12968@berserker.bsdi.com>; from cp@bsdi.com on Tue, Oct 03, 2000 at 02:01:02PM -0600 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Chuck Paterson [001003 13:01] wrote: > > concerning asmlinkage long sys_getppid(void) > > > I would point out that the kernel could be pre-empted > for an arbitrary long period of time and that by the time > you look at the pointer it may no longer point at anything > usefull, and could even fault. With the multi-threaded kernel this > can happen just from interrupts, you don't even have to wander > into the much less likely, but still possible, case of having > a top half preempt. The idea is that the parent pointer will always reference something, 'struct proc' in Linux and I'm pretty sure FreeBSD is never free'd back to the system, therefore one can safely dereference the pointer at any time, you just need to make sure it didn't change afterwards. You also need to order your assignment of ppid properly and at all times make sure it's either pointing to it's parent, or init. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message