Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin Add flags -v, -x, and -z for verbose, debug, and silent...
details: https://anonhg.NetBSD.org/src/rev/c1382ea315e7
branches: trunk
changeset: 762136:c1382ea315e7
user: dyoung <dyoung%NetBSD.org@localhost>
date: Wed Feb 16 17:53:31 2011 +0000
description:
Add flags -v, -x, and -z for verbose, debug, and silent shutdowns,
respectively, by passing flags AB_VERBOSE, AB_DEBUG, and/or AB_SILENT to
reboot(2).
diffstat:
sbin/reboot/reboot.8 | 25 +++++++++++++++++++++++--
sbin/reboot/reboot.c | 15 ++++++++++++---
sbin/shutdown/shutdown.8 | 25 +++++++++++++++++++++++--
sbin/shutdown/shutdown.c | 24 ++++++++++++++++++++----
4 files changed, 78 insertions(+), 11 deletions(-)
diffs (208 lines):
diff -r 87de463716fc -r c1382ea315e7 sbin/reboot/reboot.8
--- a/sbin/reboot/reboot.8 Wed Feb 16 16:22:13 2011 +0000
+++ b/sbin/reboot/reboot.8 Wed Feb 16 17:53:31 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: reboot.8,v 1.27 2010/12/12 11:38:42 pooka Exp $
+.\" $NetBSD: reboot.8,v 1.28 2011/02/16 17:53:31 dyoung Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)reboot.8 8.1 (Berkeley) 6/9/93
.\"
-.Dd October 21, 2008
+.Dd February 16, 2011
.Dt REBOOT 8
.Os
.Sh NAME
@@ -81,6 +81,27 @@
software powerdown, the system will halt.
This option is only valid for
.Nm halt .
+.It Fl v
+To enable verbose messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_VERBOSE
+to
+.Xr reboot 2 .
+.It Fl x
+To enable debugging messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_DEBUG
+to
+.Xr reboot 2 .
+.It Fl z
+To silence some shutdown messages on the console, pass the
+.Xr boothowto 9
+flag
+.Dv AB_SILENT
+to
+.Xr reboot 2 .
.It Fl q
Do not give processes a chance to shut down before halting or restarting.
This option should not normally be used.
diff -r 87de463716fc -r c1382ea315e7 sbin/reboot/reboot.c
--- a/sbin/reboot/reboot.c Wed Feb 16 16:22:13 2011 +0000
+++ b/sbin/reboot/reboot.c Wed Feb 16 17:53:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $ */
+/* $NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93";
#else
-__RCSID("$NetBSD: reboot.c,v 1.36 2008/07/20 01:20:23 lukem Exp $");
+__RCSID("$NetBSD: reboot.c,v 1.37 2011/02/16 17:53:31 dyoung Exp $");
#endif
#endif /* not lint */
@@ -85,7 +85,7 @@
} else
howto = 0;
lflag = nflag = qflag = 0;
- while ((ch = getopt(argc, argv, "dlnpq")) != -1)
+ while ((ch = getopt(argc, argv, "dlnpqvxz")) != -1)
switch(ch) {
case 'd':
howto |= RB_DUMP;
@@ -105,6 +105,15 @@
case 'q':
qflag = 1;
break;
+ case 'v':
+ howto |= AB_VERBOSE;
+ break;
+ case 'x':
+ howto |= AB_DEBUG;
+ break;
+ case 'z':
+ howto |= AB_SILENT;
+ break;
case '?':
default:
usage();
diff -r 87de463716fc -r c1382ea315e7 sbin/shutdown/shutdown.8
--- a/sbin/shutdown/shutdown.8 Wed Feb 16 16:22:13 2011 +0000
+++ b/sbin/shutdown/shutdown.8 Wed Feb 16 17:53:31 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: shutdown.8,v 1.28 2008/10/21 02:35:51 lukem Exp $
+.\" $NetBSD: shutdown.8,v 1.29 2011/02/16 17:53:31 dyoung Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
.\"
-.Dd October 21, 2008
+.Dd February 16, 2011
.Dt SHUTDOWN 8
.Os
.Sh NAME
@@ -110,6 +110,27 @@
.Ar time ,
using
.Xr reboot 8 .
+.It Fl v
+To enable verbose messages on the console, pass
+.Fl v
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl x
+To enable debugging messages on the console, pass
+.Fl x
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
+.It Fl z
+To silence some shutdown messages on the console, pass
+.Fl z
+to
+.Xr reboot 8
+or
+.Xr halt 8 .
.It Fl D
Prevents
.Nm
diff -r 87de463716fc -r c1382ea315e7 sbin/shutdown/shutdown.c
--- a/sbin/shutdown/shutdown.c Wed Feb 16 16:22:13 2011 +0000
+++ b/sbin/shutdown/shutdown.c Wed Feb 16 17:53:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $ */
+/* $NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)shutdown.c 8.4 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: shutdown.c,v 1.52 2010/06/09 04:51:53 riz Exp $");
+__RCSID("$NetBSD: shutdown.c,v 1.53 2011/02/16 17:53:31 dyoung Exp $");
#endif
#endif /* not lint */
@@ -91,6 +91,7 @@
static int dofast, dohalt, doreboot, killflg, nofork, nosync, dodump;
static size_t mbuflen;
static int dopowerdown;
+static int dodebug, dosilent, doverbose;
static const char *whom;
static char mbuf[BUFSIZ];
static char *bootstr;
@@ -120,7 +121,7 @@
if (geteuid())
errx(1, "%s: Not super-user", strerror(EPERM));
#endif
- while ((ch = getopt(argc, argv, "b:Ddfhknpr")) != -1)
+ while ((ch = getopt(argc, argv, "b:Ddfhknprvxz")) != -1)
switch (ch) {
case 'b':
bootstr = optarg;
@@ -149,6 +150,15 @@
case 'r':
doreboot = 1;
break;
+ case 'v':
+ doverbose = 1;
+ break;
+ case 'x':
+ dodebug = 1;
+ break;
+ case 'z':
+ dosilent = 1;
+ break;
case '?':
default:
usage();
@@ -370,7 +380,7 @@
doitfast();
dorcshutdown();
if (doreboot || dohalt) {
- const char *args[16];
+ const char *args[20];
const char **arg, *path;
#ifndef DEBUG
int serrno;
@@ -384,6 +394,12 @@
path = _PATH_HALT;
*arg++ = "halt";
}
+ if (doverbose)
+ *arg++ = "-v";
+ if (dodebug)
+ *arg++ = "-x";
+ if (dosilent)
+ *arg++ = "-z";
if (dodump)
*arg++ = "-d";
if (nosync)
Home |
Main Index |
Thread Index |
Old Index