[LinuxPPS] multiple access to /dev/ppsN entries

George Spelvin linux at horizon.com
Fri Mar 19 11:20:14 CET 2010


> George's patch makes a read() possible every time.
> So  a  select(...) on  *readfds makes  no sense. The only way is to "fill" 
> *exceptfds by the driver when receiving a new timestamp.

No, it doesn't.  Read blocks until there's a new timestamp; the simplest
way to view it is "cat /dev/ppsX".

Also, both the read() and ioctl() accesses use the same "read pointer", so
select()/poll() can also be used to wait until there's new ioctl() data.

What my patch set also did was use the poll() feature to make the
*ioctl* non-blocking; it can have the timeout eliminated and
greatly simplified to always return the most recent timestamp,
immediately.  (The sequence numbers let you identify duplicates
very easily.)

It does mean that implementing a get-pps with a timeout takes two
system calls (poll + ioctl) rather than one, but I think gaining
the ability to wait for a PPS event *or* a different event
is hugely worth it.

The onle big *mistake* in my patch set was that I made *all* the
parameters per-fd, but while nothing in the PPSAPI spec requires all
users to have the same event set (and letting different readers use
different ines is quite useful), a careful reading shows that it expects
the offset values to be global.



More information about the LinuxPPS mailing list