summaryrefslogtreecommitdiff
path: root/sbin/shutdown
AgeCommit message (Collapse)Author
2018-08-03Move pledge after getopt when we know whether the operation is reboot,Theo de Raadt
powerdown, halt, or singleuser. Before pledge, unveil access to /dev/console, /etc/rc for singleuser entry, execute of /usr/bin/wall to alert users, and creation of the fastboot and nologin files. Also conditionally allow execute of halt, reboot, or the shell depending on mode. Believe all scenarios were tested -- please exercise this one a bit.
2018-04-07Display local timezone in all deadline estimates.cheloha
Admins don't necessarily reside in the same timezone as the machine. If an admin mistakenly schedules downtime for a machine at the wrong time this could be quite bad. Users, too, don't necessarily reside in the same timezone as the machine. Saying the box is going down at "15:40" is potentially ambiguous. So, display the local timezone in all logs, broadcasts, printouts, messages, etc. Give the admin a chance to correct the mistake; give the user a better idea of when the box is actually going down. This also updates the process' understanding of the present time before printing estimates. The system's wall clock could have changed after the shutdown was scheduled, making subsequent broadcasts potentially misleading for users. ok deraadt@
2018-03-19Disallow "++minutes".cheloha
strtonum(3) accepts a single leading '+', so if we increment timearg we allow input with two leading pluses. If we don't increment, we still have a valid input for strtonum(3). While here, use errstr to say what was wrong with timearg. Don't increase the range for offsets yet: it exposes segfaults elsewhere in the program that need to be addressed. ok millert@ tb@
2018-03-02Refactor the countdown loop() to simplify it.cheloha
If we insert our offset into tlist[] and then process tlist[] like an array we can eliminate many of the special cases and duplicate calls in loop(). While we're at it, change struct interval and timewarn() to use time_t to eliminate the need for some of the casting and add explicit long-long suffixes to the constants in tlist[] to head off overflow if the code wanders off. With type-related input from tb@ and a style tweak from anton@. ok tb@
2018-02-24Replace popen/setjmp/pclose with a manual pipe/fork/exec/wait.cheloha
We can limit the time we wait on wall(1) without the complexity inherent to setjmp. Actually wait (instead of waitpid) to pick up any straggler wall processes from prior timewarn() calls. With a tweak from millert@ to ensure we don't accidentally close stdin before we exec wall. ok millert@ tb@
2018-02-04fprintf(stderr -> warnxcheloha
ok jca@ tb@
2017-04-03warn format string should be literal.Frederic Cambus
OK deraadt@, millert@
2016-09-01Aggressively use dprintf, rather than crazy unchecked writes. UseTheo de Raadt
localtime() since it tends to work better than ctime() when some filesystems are absent. ok guenther
2015-11-16initially, pledge "stdio rpath wpath cpath getpw tty id proc exec", yesTheo de Raadt
it sounds like a lot, but this will eventually run the /etc/rc scripts to shutdown, then run reboot or halt. After looking at getpw*, drop pledge "getpw". Later drop to just "stdio exec"... This depends on new pledge semantics for revoke(2). with help from jca ok guenther millert semarie tedu jca
2015-04-23error in strtonum() conversion; found by Nathanael RensenTheo de Raadt
2015-04-18Convert many atoi() calls to strtonum(), adding range checks and failureTheo de Raadt
handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
2015-03-15tzfile.h is an internal header that should never have been installed.Todd C. Miller
What's worse, the tzfile.h that gets installed is over 20 years old and doesn't match the real tzfile.h in libc/time. This makes the tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE define has been moved to time.h temporarily until its usage is replaced by 1900 in the tree. Actual removal of tzfile.h is pending a ports build. Based on a diff from deraadt@
2015-01-21Build the argument list for halt/reboot without excessive use ofChristian Weisgerber
the conditional operator. Adapted from NetBSD. ok miod@
2015-01-21Use plain "-p" to specify "halt and power down", for consistencyChristian Weisgerber
and compatibility with other BSDs. Adapted from FreeBSD. Still permit the combination "-hp" as requested by many. ok sthen@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2013-11-22Whole bunch of (unsigned char) casts carefully added for ctype calls.Theo de Raadt
Careful second audit by millert
2009-12-24spelling fixes, from Brad Tilley; we will not fix src/sbin/dump/dump.hIgor Sobrado
as neither arrayified not arrayfied exist -- sanctioned dictionaries like Merriam-Webster ones suggest a few alternatives (e.g., arrayed), however these made up words are easy to understand and we are not certain that current ones are not ok. ok jmc@
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2007-11-19remove another list which just keeps going out of date;Jason McIntyre
2007-05-31convert to new .Dd format;Jason McIntyre
2007-01-29sort FILES;Jason McIntyre
2006-10-18Replace gcc __attribute with __dead. Recompile yields no binary change.Chad Loder
2005-12-02more sig_atomic_tTheo de Raadt
2005-05-19sort options + sync usage();Jason McIntyre
2005-03-09Sync with reboot(8) man page.Kenji Aoyama
(luna88k and zaurus also work with -p option.) ok miod@
2004-01-24minor knfTheo de Raadt
2003-07-30NULL -> (char *)NULL in execle; ok millert@Anil Madhavapeddy
2003-07-15.Ql Fl -> .Sq Fl where literal makes no sense;Jason McIntyre
2003-06-03- section reorderJason McIntyre
- some mdoc fixes
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-04-16use errx instead of fprintf+exit; millert@ okMichael Shalayeff
2002-12-08GNU semantics say that if optstring begins with '-' thenTodd C. Miller
each non-option shall be treated as arguments to option '\1'. BSD getopt match '-' in optstring with a '-' on the command line. This is used to support deprecated options like "su -" that would otherwise prevent the use of getopt(). Resolving this simply requires that the leading '-' be moved somewhere else (I moved it to the end of optstring) since position within optstring is not meaningful.
2002-07-03ansiTheo de Raadt
2002-05-26pid_t cleanupTheo de Raadt
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2001-12-13o) start new sentence on a new line;Mike Pechkin
o) wrap long lines; o) fix bogus .Xr usage; o) we don't like blank lines; o) always close .Bl tags; o) OpenBSD -> .Ox; o) don't like .Pp before .Ss; millert@ ok;
2001-11-05kill more registers;Mike Pechkin
millert@ ok
2001-10-11Add sparc64 to the list of arches which can poweroff at shutdown, andMiod Vallat
sort it.
2001-09-18Mention macppc in the list of platforms which can do poweroff at shutdown.Miod Vallat
2001-08-07No need to remove /etc/nologin after killing shutdown; signalHeikki Korpela
handler will take care of this. Pointed out by bk@rt.fm; millert@ ok. (Although it was millert@ who asked for it in the first place, bad me for not checking the source. :-)
2001-08-07Document how to cancel a scheduled shutdown with kill(1).Heikki Korpela
Also mention that /etc/nologin should be deleted after this if needed. ok millert@
2001-07-09correct type on last arg to execl(); nordin@cse.ogi.eduTheo de Raadt
2001-07-07major -Wall cleanup, almost completeTheo de Raadt
2001-06-05Alphabetize SEE ALSO entries; mpech@prosoft.org.lvAaron Campbell
2001-01-28remove i386 md note per Theo's requestMarco S Hyman
2001-01-28remove i386 md note per Theo's requestMarco S Hyman
2001-01-26Mention that shutdown brings the system to single user mode when issuedMarco S Hyman
without options. Other wording tweaks. Move comment related to -p to where -p is defined, not where -h is defined.
2001-01-19mark signal races i cannot fix at the momentTheo de Raadt
2001-01-15use _exit() in term handler if real signalTheo de Raadt
2001-01-05Add i386 specific sysctl to modify halt -p processing, required to makeMarco S Hyman
powerdown work correctly on some processors. Idea from mickey@ and smcho@tsp.korea.ac.kr. Tested my me and angelos@. Note: If you want to try these out you'll need to cd /sys/arch/i386/include && sudo install -m 444 -o root -g root cpu.h /usr/include/i386 cd /usr/src/sbin/sysctl && make obj && make && sudo make install to get a sysctl that understands the new variable (machdep.apmhalt).