From owner-freebsd-current Fri Jul 20 9:18:14 2001 Delivered-To: freebsd-current@freebsd.org Received: from InterJet.elischer.org (c421509-a.pinol1.sfba.home.com [24.7.86.9]) by hub.freebsd.org (Postfix) with ESMTP id F25BE37B409 for ; Fri, 20 Jul 2001 09:18:05 -0700 (PDT) (envelope-from julian@elischer.org) Received: from elischer.org (InterJet.elischer.org [192.168.1.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id LAA04903 for ; Fri, 20 Jul 2001 11:02:29 -0700 (PDT) Message-ID: <3B5854E3.B6D9C86D@elischer.org> Date: Fri, 20 Jul 2001 08:57:23 -0700 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: current@freebsd.org Subject: huh? in Selrecord(): what is this for? Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG void selrecord(selector, sip) struct proc *selector; struct selinfo *sip; { struct proc *p; pid_t mypid; mypid = selector->p_pid; if (sip->si_pid == mypid) return; if (sip->si_pid && (p = pfind(sip->si_pid))) { Why do we look up 'p' when we got it as an argument? (race condition detection?) (I'm modifying things for threads so I came up against this....) mtx_lock_spin(&sched_lock); if (p->p_wchan == (caddr_t)&selwait) { mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); sip->si_flags |= SI_COLL; return; } mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); } sip->si_pid = mypid; } -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message