History log of /freebsd-current/bin/sleep/sleep.c
Revision Date Author Comments
# 2295cae7 25-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

sleep: Overhaul.

Program:

* Add a dummy getopt(3) loop to handle `--`.
* Move interval parsing out into a separate function.
* Print a diagnostic for every invalid interval.
* Check for NaN and infinity.
* Improve bounds checks.

Manual page:

* Miscellaneous markup fixes.
* Reword DESCRIPTION section.
* Move text about GNU compatibility to STANDARDS section.
* Convert examples from csh to sh.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44471


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# e9746806 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735


# be038c3a 24-May-2022 Stefan Eßer <se@FreeBSD.org>

bin/sleep: add support for multiple delay values

The sleep time is calculated as the sum of all arguments passed.

This makes the FreeBSD version of sleep functionally compatible with
the version in GNU coreutils.

MFC after: 1 week


# 34978f7e 24-May-2022 A. Mallory <mallorya@fastmail.com>

bin/sleep: add support for units other than seconds

The coreutils version of this command accepts a unit designation of s,
m, h, or d (for seconds, minutes, hours, days) immediately following
the number of (fractional) units to delay.

The submitted patch has been modified in one detail: the test meant to
detect the presence of the unit modified was not specific (!= 1) and
would have accepted a non-numeric initial element or extra characters
following the union. The committed version accepts only the number
immediately followed by one of the defined unit designators and no
further characters.

PR: 264162
MFC after: 1 week


# 1cc908de 22-Dec-2020 Xin LI <delphij@FreeBSD.org>

Remove unused includes.


# 7672a014 19-Jun-2018 Mariusz Zaborski <oshogbo@FreeBSD.org>

Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.

No functional change intended.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# cd1693d3 07-Nov-2016 Conrad Meyer <cem@FreeBSD.org>

Capsicumize some trivial stdio programs

Trivially capsicumize some simple programs that just interact with
stdio. This list of programs uses 'pledge("stdio")' in OpenBSD.

No objection from: allanjude, emaste, oshogbo
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8307


# c6ef00e3 05-Jun-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sleep: Explain in a comment why the [EINTR] check is there.

Suggested by: eadler


# c2cfcb60 28-May-2013 Jilles Tjoelker <jilles@FreeBSD.org>

sleep: Improve nanosleep() error handling:

* Work around kernel bugs that cause a spurious [EINTR] return if a
debugger (such as truss(1)) is attached.

* Write an error message if an error other than [EINTR] occurs.

PR: bin/178664


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# f6e6dc63 02-Aug-2010 Konstantin Belousov <kib@FreeBSD.org>

Simplify argument parser by using sscanf(); simplify usage() by not
refusing to use stdio.
Reduce nesting level in the sleep loop by returning earlier for negative
timeouts.
Limit the maximum timeout to INT_MAX seconds.

Submitted by: bde
MFC after: 3 weeks


# bc9bbbe0 31-Jul-2010 Konstantin Belousov <kib@FreeBSD.org>

Deal with proper format for printing time_t.

Reported by: ache
MFC after: 3 weeks


# 13d8eeda 31-Jul-2010 Konstantin Belousov <kib@FreeBSD.org>

Report the time left for the sleep on SIGINFO.
Be stricter in the checking of interval specification.

PR: bin/139345
MFC after: 3 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5d3e07d4 07-Aug-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Fix a comment.

Submitted by: Liam J. Foy


# 9ddb49cb 10-Jan-2005 Warner Losh <imp@FreeBSD.org>

/*- or .\"- or #- to begin license clauses.


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# fcfa4c95 03-May-2003 Mark Murray <markm@FreeBSD.org>

Fix warnings. This is now WARNS=9, std=c99 clean in i386.
Use return(0) for main() instead of exit(0). Makes it a
wee bit smaller.


# 09a80d48 01-May-2003 David E. O'Brien <obrien@FreeBSD.org>

Quiet warnings about copyright[].


# e9a4552b 13-Nov-2002 Nate Lawson <njl@FreeBSD.org>

Minimal take on previous commit -- remove getopt and printf. Static size
is reduced by 40k, dynamic by a few bytes.
Functional changes:
* "sleep -- arg" now returns usage() instead of ignoring the --
* "sleep -1" now returns immediately instead of returning usage()

Reviewed by: jmallett


# e0219384 13-Nov-2002 Nate Lawson <njl@FreeBSD.org>

Back out previous commit since there is controversy about changing so much
in sleep including duping strtol(3). Code changes also increased
dynamic size of sleep(1).


# 174005b7 13-Nov-2002 Nate Lawson <njl@FreeBSD.org>

Remove getopt and strtol dependencies, reducing size of static exe.
Preserve older desired behavior, accept [+-]*[0-9]*\.[0-9]*
Remove a few unnecessary casts.

%ls -l /bin/sleep
-r-xr-xr-x 1 root wheel 61332 Oct 28 05:16 /bin/sleep
%ls -l /usr/obj/usr/src/bin/sleep/sleep
-rwxr-xr-x 1 root wheel 19124 Nov 13 12:12 /usr/obj/usr/src/bin/sleep/sleep

Submitted by: Tim Kientzle <kientzle@acm.org>


# 2749b141 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use FBSDID


# 5134c3f7 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...


# 0a26b6bb 19-May-2001 Kris Kennaway <kris@FreeBSD.org>

Silence WARNS=2 and BDECFLAGS on alpha and i386

MFC After: 1 week


# ac14c311 01-Oct-1999 Ruslan Ermilov <ru@FreeBSD.org>

Let sleep(1) handle fractions of a second (up to nanosecond).

This is a conservative change. It does the same thing in weird
cases like the old one. For example, 'sleep abcd' still sleeps
for zero seconds. `sleep 10.a' and `sleep 10.05aa' do the best
and not abort (ie: 10.a == 10 seconds, 10.05a == 10.05 seconds).


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 9ba8bd65 18-May-1998 Philippe Charnier <charnier@FreeBSD.org>

Correct use of .Nm. Add rcsid.


# 93ef08af 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# db5b8caf 13-Dec-1996 Steve Price <steve@FreeBSD.org>

Cleanup man page and -Wall cleaning.


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources