Date: Sun, 10 Feb 2002 01:27:25 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Julian Elischer <julian@elischer.org> Cc: John Baldwin <jhb@FreeBSD.ORG>, <current@FreeBSD.ORG> Subject: Re: cred stuff.. Message-ID: <20020212021227.149F59F134@okeeffe.bestweb.net>
next in thread | raw e-mail | index | archive | help
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
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020212021227.149F59F134>
