cvs commit: src/sys/kern tty.c

Attilio Rao attilio at freebsd.org
Wed Dec 20 08:17:48 PST 2006


2006/12/20, Martin Blapp <mb at imp.ch>:
>
> Hi,
>
> > Since proctree_lock is a sx lock which uses 2 condition variables,
> > they alredy drop Giant (DROP_GIANT()) before sleeping. Are you secure
> > it is the right thing to do here?
>
> Sorry, the commit message was not 100% clear. It should have been:
>
> Retest a variable after sx_slock has been called. Giant might have been
> temporarily dropped while waiting for proctree_lock, allowing for an
> intervening tty_close() that cleared tp->t_session.

Ok, after a quick look at the patch (and this note) it makes more
sense to me, but then would not be cleaner to do something like:

sx_slock(&proctree_lock);
if (tp->t_session && tp->t_session->s_leader) { ...
}
sx_sunlock(&proctree_lock);

more than leaving the clobbering check?

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the cvs-src mailing list