Hi Scott, Scott Cheloha wrote on Fri, Aug 17, 2018 at 10:20:09AM -0500:
> I don't think we should encourage or even mention the possibility of the > use of poll(2) to effect millisecond timeouts. Even if the standard > library lacks such an interface. > > I'm pretty sure you can't use this hack portably, either. > > But mostly I just think it's a misuse of the interface and potentially > confusing to a reader of such code: Nowadays, POSIX has nanosleep(2). Before that, XPG had the now obsolete usleep(3) that appeared in 4.3BSD, but which never made it into POSIX. Before nanosleep(2) became firmly established, using select(2) for portably sleeping less than a second was common IIRC. So the reason for the recommendation may be that poll(2) intends to replace select(2). I agree that recommending poll(2) for the functionality of nanosleep(2) no longer makes sense. Note that your diff also removes the information about what happens when fds == NULL. If i read it correctly, POSIX does not specify that, so you may be right that there might be some system out there where it doesn't work. Leaving behaviour that is unspecified by the standard unspecified in the manual page is often a good idea, unless we specifically want to support it as an extension. Guaranteeing such an extension does not seem useful to me in the present case. So, your diff is OK schwarze@, but i think you need another OK from a developer who is more familiar with networking or low-level I/O. Yours, Ingo > Index: lib/libc/sys/poll.2 > =================================================================== > RCS file: /cvs/src/lib/libc/sys/poll.2,v > retrieving revision 1.35 > diff -u -p -r1.35 poll.2 > --- lib/libc/sys/poll.2 14 Feb 2017 17:51:14 -0000 1.35 > +++ lib/libc/sys/poll.2 17 Aug 2018 14:55:48 -0000 > @@ -183,12 +183,6 @@ and > flags may be used to detect when out-of-band socket data may be read > without blocking. > .Pp > -In addition to I/O multiplexing, > -.Fn poll > -can be used to generate simple timeouts. > -This functionality may be achieved by passing a null pointer for > -.Fa fds . > -.Pp > The > .Fn ppoll > function is similar to