Subject: Re: Implementing poll(2)
To: Charles M. Hannum <mycroft@mit.edu>
From: Matt Thomas <matt@lkg.dec.com>
List: tech-kern
Date: 07/17/1996 12:33:29
> 
> I've written an implementation of the SVR4 system call poll(2), which
> I'll be committing `soon'.  For the uneducated, poll(2) is similar to
> select(2), except that it uses an array of {fd,event mask} pairs
> rather than 3 bitmasks.

However one problem with poll is that the units are in milliseconds 
(unlike microseconds like select).  A way to workaround that is to 
create a another poll-like function that uses a more precise timing
scheme.  I'd suggest using timespec instead of a timeval (even though
a timeval is used by select) since timespec has the finest granularity.

Thus the syscall would really be pollts:

	int pollts(struct pollfd *, int, struct timespec *);

and poll(2) would simply convert its argument of milliseconds into
a timespec and that in (or NULL if the argument was -1).  (A polltv
could also be created which simply converts the timeval to a timespec
instead).

The kernel would then use timespec internally for select and poll.

Digital UNIX has poll and select (look in the freeback-hackers mailing
archives for a description of how both are implemented under Digital UNIX)
and I find poll to be superior for select in all respects except for the
timeout parameter.  A pollts would solve that problem.

Thanks for adding poll(2) to NetBSD!

-- 
Matt Thomas               Internet:   matt@3am-software.com
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt.html
Westford, MA              Disclaimer: I disavow all knowledge of this message