^
(By the way, I assume that back there, there was a missing "not",
right?)
You are asserting this in the face of two previous APIs designed
by people who (at least in the case of POSIX timers) probably
thoroughly examined and discussed existing APIs and practice.
I'm not sure what problem this code is supposed to solve. It
doesn't solve the problem I have in mind; see below.
This function is *not at all* equivalent to the "get"
functionality of the previous APIs. The "get" functionality
of POSIX timers (for example) returns a structure that contains
the timer interval and the *time until the next expiration of
the timer* (not the initial timer string, as your code above
does).
So come up with a reliable, race-free way of doing that in
userspace. Then make it work for both CLOCK_MONOTONIC and
CLOCK_REALTIME timers. (You'll certainly need to be making
some additional system calls, by the way: at least some
calls to clock_gettime().)
See my comments above in this message. You may doubt it, but
all of the earlier API designers did not.
No! In the example I described the library is able to create and
control exactly *one* timerfd file descriptor. It wants to hand
that fd back to the application and then perform arbitrary
manipulations of the timer's settings. Meanwhile the application
needs to (repeatedly) monitor that one file descriptor in a
select()/poll()/epoll() (and so the library can't just arbitrarily
create further file descriptors).
You have not demonstrated this ;-). Your userspace code does
not solve the problem.
Best regards,
Michael
--
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7
Want to help with man page maintenance?
Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages ,
read the HOWTOHELP file and grep the source
files for 'FIXME'.
-