From: Alan Stern <stern@rowland.harvard.edu>
To: mtk.manpages@gmail.com, <linux-man@vger.kernel.org>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Error (?) in man page for ppoll(2)
Date: Sun, 21 Jul 2019 11:32:16 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1907211104350.15063-100000@netrider.rowland.org> (raw)
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
next reply other threads:[~2019-07-21 15:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-21 15:32 Alan Stern [this message]
2019-07-29 12:07 ` Error (?) in man page for ppoll(2) Michael Kerrisk (man-pages)
2019-07-29 13:23 ` Alan Stern
2019-07-29 18:56 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44L0.1907211104350.15063-100000@netrider.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).