Commit graph

46 commits

Author SHA1 Message Date
Warner Losh 0b8224d1cc 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
2023-11-26 22:23:58 -07:00
Warner Losh 51e16cb8fc sbin: 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
2023-11-26 22:23:29 -07:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Mitchell Horne 7b0a665d72 boottrace: annotate init and shutdown utilities
Add boottrace annotations to record events in init(8), shutdown(8), and
reboot(8).

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#23
Differential Revision:	https://reviews.freebsd.org/D31928
2022-02-21 20:16:07 -04:00
Eitan Adler 7d3df1907a shutdown: Fix r327476 by adding init
Initialize maybe_today. While here sort.

PR:				32411
Additionally reported by:	rgrimes, ian
2018-01-02 09:02:42 +00:00
Eitan Adler cb1101afd7 shutdown: Assume absolute time is in the future
The original bug describes it best:

When an absolute time is specified to shutdown, the program's
behavior depends on whether that time has passed during the
current calendar day.  POLA would suggest that for shutdown,
whose time argument is always supposed to be in the future,
absolute times specified without a specific date should refer
to the next occurrence of that time, rather than erroring out
if that time has already passed during the current day.

PR:		32411
Submitted by:	wollman@khavrinen.lcs.mit.edu
Submitted on:	2001-11-30 20:30:01 UTC
Reviewed by:	asmodai (at time of bug submission)
2018-01-01 22:33:57 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh 25fd081525 Add -c to the usage statements.
Submitted by: Maxim Konovalov
2017-10-31 03:39:36 +00:00
Warner Losh e60baa7252 Add power cycle support (-c) to shutdown.
Sponsored by: Netflix
2017-10-25 15:30:30 +00:00
Warner Losh fbbd9655e5 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
2017-02-28 23:42:47 +00:00
Gleb Kurtsou c7d73a4d23 sbin/shutdown: Support time units as in 'shutdown -r +5sec'
Units supported: s, sec, m, min, h, hour.

Differential Revision:	https://reviews.freebsd.org/D1272
2014-12-16 08:29:02 +00:00
Dag-Erling Smørgrav 39faed57b6 Restore a piece of BSD history.
PR:		169127
Submitted by:	Ruben de Groot <ruben@hacktor.com>
MFC after:	1 week
2012-08-01 09:10:21 +00:00
Jilles Tjoelker 23124c879c shutdown: Remove unnecessary 2-second delay. 2012-05-23 19:25:46 +00:00
Ed Schouten b3608ae18f Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
2012-01-03 18:51:58 +00:00
Ed Schouten 1efe3c6b58 Add missing static keywords for global variables to tools in sbin/.
These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.
2011-11-04 13:36:02 +00:00
Pawel Jakub Dawidek 6868734cbe For compatibility with Linux and Solaris add poweroff(8).
It is implemented as a hard link to shutdown(8) and it is equivalent of:

	# shutdown -p now

While I'm here put one line of usage into one line of C code so it is easier to
grep(1) and separate unrelated code with empty line.

MFC after:	2 weeks
2010-12-30 18:06:31 +00:00
Ed Schouten 27d434af3e Add missing `void' for functions without arguments.
While there, rename die_you_gravy_sucking_pig_dog() to something that's
less moronic.
2009-12-29 08:49:43 +00:00
Xin LI 9534110f48 Static'ify internal methods and use prototype. 2009-09-28 07:42:52 +00:00
Xin LI f74b6bc2c1 Use new style declarations instead of K&R ones. 2005-01-25 08:40:51 +00:00
Xin LI f906f84330 Use modern style defination for main() and move a extern
declaration to global section.

Bump WARNS?= to 6
2005-01-25 08:37:04 +00:00
Mark Murray 4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
David E. O'Brien 8d5c19ffbc Centralize _PATH_* definitions.
Submitted by:	Tim Kientzle <kientzle@acm.org> (embellished by me)
2003-05-05 22:49:23 +00:00
David E. O'Brien c69284ca08 Use __FBSDID() to quiet GCC 3.3 warnings. 2003-05-03 18:41:59 +00:00
Warner Losh d476a036e2 o remove __P
o remove main prototype
2002-03-21 13:20:49 +00:00
Dima Dorfman 04983c4fe5 Constify, de-register-ify, __unused-ify, and set WARNS=2.
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-07-15 05:46:07 +00:00
Peter Wemm 7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Bill Fumerola c1160fe492 Avoid ambigious if/else 1999-07-21 02:49:42 +00:00
Ruslan Ermilov 35cd460f8a Signal init(8) instead of executing halt(8) or reboot(8)
when halting or rebooting the system.  It benefits from
running /etc/rc.shutdown by init(8).

``-o'' flag is provided for backward compatibility.

PR:		5451
Discussed with:	des
1999-06-21 16:06:21 +00:00
Joseph Koshy 1d4f4c0d21 Minor cleanups to shutdown(8):
- Make the -k "don't actually halt" flag incompatible with
  the halt/reboot options -h, -p, and -r.
- The -n "don't sync" option is ignored if -k is specified.
  Issue a warning message.
- Compute the actual shutdown time written to /var/run/nologin
  correctly in the case of "now" being specified.
1999-06-21 06:21:05 +00:00
Ruslan Ermilov 966ea00a57 Fix a coredump with negative (due to overflow) offset values. 1999-06-18 14:26:07 +00:00
Bruce Evans 39b831af10 Merged from Lite2 (one bcopy -> memmove, one significant change:
don't unlink _PATH_NOLOGIN for the -k case even if shutdown terminates
abnormally.  NetBSD already has this change).
1998-12-11 11:21:47 +00:00
Bruce Evans 689419f325 Fixed missing 'p' and `-' flags and other defects in the usage message.
Fixed some style bugs.
1998-12-11 11:04:19 +00:00
Mike Smith 7e2d04d7c3 Add a '-p' flag to shutdown which corresponds to the '-p' flag to halt,
requesting a system power-off after shutdown.
1998-12-10 23:54:02 +00:00
Philippe Charnier d371486332 Correct use of .Nm. Add rcsid. Do not dot terminate err(3) strings. Spelling. 1998-08-03 06:22:43 +00:00
Alexander Langer f6faa785f2 Pass an actual empty environment to execle() as per POSIX rather than
rely on undocumented behavior.

The following fixes were obtained from OpenBSD:

  o -Wall fixes to tlist array initialization and assignment used
    as truth value.
  o Use a restricted environment.
  o Improved error message when shutdown fails to exec reboot or halt.
1998-01-10 20:11:06 +00:00
Alexander Langer 42f9a8963d Added environment parameter to execle calls.
Obtained from:	NetBSD PR2737 (augustss@cs.chalmers.se) via OpenBSD
1998-01-08 20:05:45 +00:00
Alexander Langer 7417978572 Correct a comment from my last commit. 1998-01-08 02:23:59 +00:00
Alexander Langer 2dc3422762 Allow 'shutdown datespec' to work into the next century. Handle dates
in the 22nd century and beyond even though it's irrelevant with a 32-bit
time_t which expires in the year 2038.
1998-01-08 02:21:30 +00:00
Joerg Wunsch 32c9dffb9d Make the daemon process a true daemon by calling setsid().
PR:		bin/3202
Submitted by:	Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
1997-08-23 14:10:34 +00:00
Philippe Charnier a2bfcdfd76 Use err(3). 1997-06-19 14:28:32 +00:00
Warner Losh 8d64695c7c compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 03:33:12 +00:00
Adam David 3cf6d2e792 -n was broken
2.2 candidate (probably)
1997-01-21 21:07:29 +00:00
Garrett Wollman 656dcd4316 Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.
1995-08-07 19:17:46 +00:00
David Greenman 32e68582d1 Yanked out (now obsolete) support for 'fastboot'. 1995-02-15 14:35:29 +00:00
Andreas Schulz 7dd4667fed Submitted by: M.C. Wong
Obtained from:
Don't throw away the /etc/nologin file in the -k case.
1994-11-27 23:52:13 +00:00
Rodney W. Grimes 8fae3551ec BSD 4.4 Lite sbin Sources
Note:  XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.
1994-05-26 06:35:07 +00:00