Subject: Re: Truncated output from ptys at slave exit
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: enami tsugutomo <enami@but-b.or.jp>
List: tech-kern
Date: 09/10/2003 11:31:46
Trimmed CC: only to tech-kern.

> yeah, this is one of my least favorite parts of the stuff I did. What
> the multi-lwp processes need is for lwps other than the one calling
> exit() to get EINTR in any interruptable tsleep() calls they make so
> that they can be terminated (other LWPs in select() or wait() are
> particularly troublesome). That situation only needs to hold while
> there is more than one LWP, a fact your patch makes use of. I'm open
> to suggestions for a less-hackish way to make that happen (track the
> id of the LWP that's in exit()? set a flag on the other ones? dunno).

Drawback of this hack (P_WEXIT bit is set && there is more than one
lwp) is that we need to do some effort to assert that the exiting lwp
itself doesn't do interruptible sleep before the exit_lwps() call.
E.g., is coredump() (called via sigexit()) safe?

Probably, it may be better to introduce more explicit way; like
introducing a flag to distinguish exiting lwp or a flag to indicate
executing exit_lwps().

BTW, sys_execve() simply sets P_WEXIT and calls exit_lwps() but really
no race here?  Both exit and exec path has few sleep point before the
call.

enami.