CVS commit: src/bin/sleep
Module Name:src Committed By: kre Date: Sun Mar 10 15:18:45 UTC 2019 Modified Files: src/bin/sleep: sleep.c Log Message: Deal with overflow when the sleep duration given is a simple integer (previously it was just clamped at the max possible value). This would have caused sleep 1000 (or anything bigger) to have only actually slept for 9223372036854775807 secs. Someone would have noticed that happen, one day, in some other universe. This is now an error, as it was previously if this had been entered as sleep 1e19 Also detect an attempt to sleep for so long that a time_t will no longer be able to represent the current time when the sleep is done. Undo the attempts to work around a broken kernel nanosleep() implementation (by only ever issuing shortish sleep requests, and looping). That code was broken (idiot botch of mine) though you would have had to wait a month to observe it happen. I was going to just fix it, but sanity prevailed, and the kernel got fixed instead. That allows this to be much simplified, only looping as needed to handle dealing with SIGINFO. Switch to using clock_nanosleep() to implement the delay, as while our nanosleep() uses CLOCK_MONOTONIC the standards say it should use CLOCK_REALTIME, and if that we ever changed that, the old way would alter "sleep 5" from "sleep for 5 seconds" to "sleep until now + 5 secs", which is subtly different. Always use %g format to print the original sleep duration in reports of how much time remains - this works best for both long and short durations. A couple of other minor (frill) mods to the SIGINFO report message as well. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: wiz Date: Sun Jan 27 17:42:53 UTC 2019 Modified Files: src/bin/sleep: sleep.1 Log Message: Sort sections. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/bin/sleep/sleep.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: christos Date: Sun Jan 27 02:00:45 UTC 2019 Modified Files: src/bin/sleep: sleep.c Log Message: cast to intmax_t instead of long, since time_t is "long long" To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: martin Date: Sat Jan 26 18:14:22 UTC 2019 Modified Files: src/bin/sleep: sleep.c Log Message: Explicitly cast time_t to match format string - should fix the build on some 32bit architectures. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: kre Date: Sat Jan 26 15:20:50 UTC 2019 Modified Files: src/bin/sleep: sleep.1 sleep.c Log Message: While cute, the previous version is not really safe. After all, a system might want to sleep for several thousand years on a spaceship headed to a distant solar system... So, remove the pause() code, deal with limits on the range (it is just an int) that can be passed to sleep() by looping, and do a much better job of checking for out of range input values. With this change sleep(1) should work for durations up to something more than 250 billion years. It fails (at startup, with an error) if the requested duration is beyond what can be handled. Here no changes at all related to locales and arg parsing.Still for another day. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/bin/sleep/sleep.1 cvs rdiff -u -r1.26 -r1.27 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: kre Date: Sat Jan 26 15:19:08 UTC 2019 Modified Files: src/bin/sleep: sleep.1 sleep.c Log Message: Adjust the way the arg string is parsed in the "not entirely integer" case, so we avoid adjusting the locale of sleep, and generally be more reliable and simpler. In addition, deal with weirdness in nanosleep() when the interval gets long, by avoiding using it. In this version when the sleep interval < 1 seconds, we use nanosleep() as before, for delays longer than that we use sleep() instead, and ignore any fractional seconds. We avoid overflow problems here by not bothering to sleep at all for delays longer than 135 years (approx) and simply pause() instead. That sleep never terminates in such a case is unlikely to ever be observed. This commit makes no decision on the question of whether the arg should be interpreted in the locale of the user, or always in the C locale. That is for another day. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/sleep/sleep.1 cvs rdiff -u -r1.25 -r1.26 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: kre Date: Sat Jan 19 13:27:12 UTC 2019 Modified Files: src/bin/sleep: sleep.c Log Message: Allow the decimal radix character '.' to work, regardless of what the current locale's radix character happens to be, while still allowing locale specific entry of fractional seconds (ie: if you're in locale where the radix character is ',' you san use "sleep 2.5" or "sleep 2,5" and they accomplish the same thing). This avoids issues with the "sleep 0.05" in rc.subr which generated usage messages when a locale that does not use '.' as its radix character was in use. Reported on netbsd-users by Dima Veselov, with the problem diagnosed by Martin Husemann While here, tighten the arg validity checking (3+4 is no longer permitted as a synonym of 3) and allow 0.0 to mean the same thing as 0 rather than being an error. Also, make the SIGINFO reports a little nicer (IMO). The ATF tests for sleep all pass (not that that means a lot). To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: sevan Date: Fri Aug 12 02:36:38 UTC 2016 Modified Files: src/bin/sleep: sleep.1 Log Message: Document the version sleep first appeared. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/bin/sleep/sleep.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: wiz Date: Mon Aug 15 14:45:36 UTC 2011 Modified Files: src/bin/sleep: sleep.1 Log Message: Improve wording. >From Snader_LB. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/bin/sleep/sleep.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: wiz Date: Sat Oct 9 07:40:58 UTC 2010 Modified Files: src/bin/sleep: sleep.1 Log Message: Bump date for SIGINFO. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/bin/sleep/sleep.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/sleep
Module Name:src Committed By: mrg Date: Sat Oct 9 04:57:30 UTC 2010 Modified Files: src/bin/sleep: sleep.1 sleep.c Log Message: add SIGINFO support; from freebsd: when a SIGINFO is delivered, display the approximate remaining seconds. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/bin/sleep/sleep.1 cvs rdiff -u -r1.22 -r1.23 src/bin/sleep/sleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.