Removing the pid 1 code

Jilles Tjoelker jilles at
Sun Mar 20 15:26:58 UTC 2016

On Sat, Mar 19, 2016 at 10:08:26PM +0200, Konstantin Belousov wrote:
> We have very special code executed during the libthr initialisation,
> which attempts to set up session and controlling terminal when running
> as pid 1. I do not see why do we need this, e.g. why behaviour of
> a program must be different due to the presence of libthr and running as
> pid 1.  The code is there from 1998' libc_r.

> Please either provide arguments why should we do that, or agree with
> the following change.  I decided to pre-resolve getpid() just in case,
> as it is done by the current code, but even this is probably not neccessary.

I agree this should be removed. It might cause /rescue/init to behave
strangely, for example.

This change might break rare applications, so mentioning it in the
release notes is wise. The applications will be easy to fix.

Jilles Tjoelker

More information about the freebsd-threads mailing list