svn commit: r276802 - head/lib/libc/gen

Bruce Evans brde at optusnet.com.au
Thu Jan 8 12:39:29 UTC 2015


On Thu, 8 Jan 2015, Konstantin Belousov wrote:

> On Thu, Jan 08, 2015 at 01:27:44AM +0000, Craig Rodrigues wrote:
>> @@ -43,11 +43,11 @@
>>  .Sh DESCRIPTION
>>  The
>>  .Fn sleep
>> -function suspends execution of the calling process until either
>> +function suspends execution of the calling thread until either
>>  .Fa seconds
>> -seconds have elapsed or a signal is delivered to the process and its
>> +seconds have elapsed or a signal is delivered to the thread and its
>>  action is to invoke a signal-catching function or to terminate the
>> -process.
>> +thread or process.
> There is no signal action to terminate thread.

There is another bug: the process may be terminated by means other than
a signal (usually just by exit() in another thread).  This case is not
mentioned.

These bugs are missing in POSIX.  It says:

   "or a signal is delivered to the calling thread and its action is to
   invoke a signal-catching function, or the process is terminated"

The second clause (after the comma) seems hard to parse until you realise
that it is intentionally separate from the signal case.  When there was
only 1 thread per process, the only way to terminate a process was via
a signal.  The FreeBSD description still covers only that case.

Related bugs found by grepping for "process" and "thread" in sleep man
pages (unless I missed other changes):

- nanosleep(2) still says "process" in its NAME and ERRORS sections
   It has no other uses of "process" so no correct ones.
- nanosleep(2) is missing the description of early returns for signals
   and terminations in the DESCRIPTION section.  It has a little about
   this in the RETURN VALUES section.  The latter has the only use of
   "thread".  Many more are needed
- usleep(3) is still almost identical to the old version of sleep(3)
- clock_nanosleep(2) is broken (not supported).

In POSIX, the above POSIX wording is used in these 3 functions and
nowhere else.  Both POSIX and FreeBSD are less verbose in describing
when [p]select() and poll() return early due to a timeout.

Bruce


More information about the svn-src-head mailing list