From owner-freebsd-current Sat Feb 9 6:24:57 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0867737B404; Sat, 9 Feb 2002 06:24:52 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA18023; Sun, 10 Feb 2002 01:24:46 +1100 Date: Sun, 10 Feb 2002 01:27:25 +1100 (EST) From: Bruce Evans X-X-Sender: To: Julian Elischer Cc: John Baldwin , Subject: Re: cred stuff.. In-Reply-To: Message-ID: <20020210012027.E3321-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Fri, 8 Feb 2002, Julian Elischer wrote: > I'd like to commit the code to keep the ucred across userland, > with the code to clear it to NULL kept under DEBUG ifdefs. > > i.e. > > > in trap(), ast() and syscall() > > > > if (td->td_ucred != p->p_ucred) { > > PROC_LOCK(p); > > if (td->td_ucred) { > > crfree(td->td_ucred); > > td->td_ucred = NULL; > > } > > if (p->p_ucred != NULL) { > > td->td_ucred = crhold(p->p_ucred); > > } > > PROC_UNLOCK(p); > > } Please fix the style bugs in this before committing: - explicit NULL in only one null pointer checks - excessive braces for one of the ifs. > and in userret() and ast() > > >#ifdef DEBUG /*your choice of variable here*/ > > PROC_LOCK(p); > > if (td->td_ucred) { > > crfree(td->td_ucred); > > td->td_ucred = NULL; > > } > > PROC_UNLOCK(p); > >#endif I think this is better left where it is in the functions that aquire the locks. It can then be done unconditionally, and not in a loop. The style of the null pointer check in this is bug for bug compatible with the corresponding one above. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message