Official MINIX sources - Automatically replicated from gerrit.minix3.org
Go to file
David van Moolenbroek cfd712b424 Various timer improvements
Now that clock_t is an unsigned value, we can also allow the system
uptime to wrap.  Essentially, instead of using (a <= b) to see if time
a occurs no later than time b, we use (b - a <= CLOCK_MAX / 2).  The
latter value does not exist, so instead we add TMRDIFF_MAX for that
purpose.

We must therefore also avoid using values like 0 and LONG_MAX as
special values for absolute times.  This patch extends the libtimers
interface so that it no longer uses 0 to indicate "no timeout".
Similarly, TMR_NEVER is now used as special value only when
otherwise a relative time difference would be used.  A minix_timer
structure is now considered in use when it has a watchdog function set,
rather than when the absolute expiry time is not TMR_NEVER.  A few new
macros in <minix/timers.h> help with timer comparison and obtaining
properties from a minix_timer structure.

This patch also eliminates the union of timer arguments, instead using
the only union element that is only used (the integer).  This prevents
potential problems with e.g. live update.  The watchdog function
prototype is changed to pass in the argument value rather than a
pointer to the timer structure, since obtaining the argument value was
the only current use of the timer structure anyway.  The result is a
somewhat friendlier timers API.

The VFS select code required a few more invasive changes to restrict
the timer value to the new maximum, effectively matching the timer
code in PM.  As a side effect, select(2) has been changed to reject
invalid timeout values.  That required a change to the test set, which
relied on the previous, erroneous behavior.

Finally, while we're rewriting significant chunks of the timer code
anyway, also covert it to KNF and add a few more explanatory comments.

Change-Id: Id43165c3fbb140b32b90be2cca7f68dd646ea72e
2016-08-05 11:12:44 +00:00
bin Import NetBSD ps(1) 2016-01-13 20:32:52 +01:00
common w(1): switch to libkvm 2016-01-13 20:32:50 +01:00
crypto Fix ARM noassert builds -g/-O{s/0/1/2/3} 2016-01-24 18:56:38 +01:00
dist/pf/sbin/pfctl Import a subset of PF distribution files 2016-06-18 12:20:46 +00:00
distrib Clean up traces from long-gone sys_int86 interface 2016-07-20 19:00:44 +02:00
docs Import locale tools and ressource files 2016-07-09 12:18:33 +02:00
etc Import locale tools and ressource files 2016-07-09 12:18:33 +02:00
external Typo in hardfloat command-line fixup/replacement 2016-07-02 13:18:46 +02:00
games Fix ARM noassert builds -g/-O{s/0/1/2/3} 2016-01-24 18:56:38 +01:00
gnu gnu/texinfo: Disable -Werror for clang 2016-07-09 12:11:26 +02:00
include Start using sysctl(3) throughout userland 2016-01-13 20:32:45 +01:00
lib Import locale tools and ressource files 2016-07-09 12:18:33 +02:00
libexec ld.elf_so: sysctl support uncommented 2016-01-16 14:04:24 +01:00
minix Various timer improvements 2016-08-05 11:12:44 +00:00
releasetools made minix3 bootable via EFI 2016-07-02 13:43:03 +02:00
sbin Fix ARM noassert builds -g/-O{s/0/1/2/3} 2016-01-24 18:56:38 +01:00
share Preparations for PAE support 2016-08-04 09:24:42 +02:00
sys Do not hide the MSG_NOSIGNAL flag 2016-06-18 12:20:48 +00:00
tests tests: add most kyua kernel tests 2016-01-16 14:04:25 +01:00
tools Import locale tools and ressource files 2016-07-09 12:18:33 +02:00
usr.bin Import locale tools and ressource files 2016-07-09 12:18:33 +02:00
usr.sbin Adapt MINIX-specific part of tools/installboot 2016-08-03 08:09:00 +02:00
.gitignore gitignore: ignore some more generated files 2012-12-06 13:29:20 +00:00
.gitreview build:update 'git review' config to match gerrit.minix3.org 2014-07-28 17:05:15 +02:00
build.sh NetBSD re-synchronization of the source tree 2016-01-13 20:32:14 +01:00
LICENSE Fix parameter parsing in cut 2010-01-21 10:16:05 +00:00
Makefile NetBSD re-synchronization of the source tree 2016-01-13 20:32:14 +01:00
Makefile.inc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00