lkml.org 
[lkml]   [2019]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectError (?) in man page for ppoll(2)
Here are two extracts from the man page for ppoll(2) (from the
man-pages 4.16 package; the 5.01 version is the same):

Specifying a negative value in timeout means an infinite timeout.


Other than the difference in the precision of the timeout argument, the
following ppoll() call:

ready = ppoll(&fds, nfds, tmo_p, &sigmask);

is equivalent to atomically executing the following calls:

sigset_t origmask;
int timeout;

timeout = (tmo_p == NULL) ? -1 :
(tmo_p->tv_sec * 1000 + tmo_p->tv_nsec / 1000000);
pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);
ready = poll(&fds, nfds, timeout);
pthread_sigmask(SIG_SETMASK, &origmask, NULL);

But if tmo_p->tv_sec is negative, the ppoll() call is not equivalent to
the corresponding poll() call. The kernel rejects negative values of
tv_sec with an EINVAL error; it does not interpret the value as meaning
an infinite timeout.

(Yes, the kernel interprets tmo_p == NULL as an infinite timeout, but
the man page is still wrong for the case tmo_p->tv_sec < 0.)

Suggested fix: Following the end of the second extract above, add:

except that negative time values in tmo_p are not interpreted
as an infinite timeout.

Also, in the ERRORS section, change the text for EINVAL to:

EINVAL The nfds value exceeds the RLIMIT_NOFILE value or
*tmo_p contains an invalid (negative) time value.

Alan Stern

\
 
 \ /
  Last update: 2019-07-21 17:32    [W:0.111 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site