Suppose I'm a (root) process:  I have an appointment in exactly
one hour.  I call select() and specify a timeout of 3600 seconds,
trusting that the system will wake me up just in time.  But
unbeknownst to me someone sets the clock back 10 minutes while I'm
asleep (using settimeofday(), not adjtime()).  When select() returns
I find that I'm 10 minutes late!

My question is:

        How can I arrange to be notified when someone and makes a
        corse change to the system clock?

One idea I had was to generate a klog message for each call to
settimeofday().  This would put the information in syslog, and I
could simply add /dev/klog to the list of file descriptors in it's
select() call (there will be lots of false alarms, but that's
probably not a problem for this application).

Another idea was to add a new minor device to klog that just logs
calls to settimeofday().  Could this be generalized?

Alternately such a device file could be put in /proc (smells like
a Linux solution).

Or perhaps I could select() for "read" or "err" conditions on
/kern/time (from kernfs).

Any thoughts?


P.S.  The application in question is a new schedular for cron/at
that can sleep between jobs.  This would seem to be a good first
step toward better laptop power management.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to