diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2011-08-20 19:03:40 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2011-08-20 19:03:40 +0000 |
commit | 9c3ef0d88afe19d6cfccd3ca29d65d8cc0df4764 (patch) | |
tree | 55b47da8165b4cb2daba650230fbb847720fba3d | |
parent | abb7f3e568a613a7d6daf6af3556386e08bfee52 (diff) |
Add support for -v (enable verbose logging on the command line).
Previously only available via iscsictl. ok claudio@
-rw-r--r-- | usr.sbin/iscsid/iscsid.8 | 8 | ||||
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 14 | ||||
-rw-r--r-- | usr.sbin/iscsid/log.c | 3 |
3 files changed, 16 insertions, 9 deletions
diff --git a/usr.sbin/iscsid/iscsid.8 b/usr.sbin/iscsid/iscsid.8 index 66a2b26f8e6..85c69306fc5 100644 --- a/usr.sbin/iscsid/iscsid.8 +++ b/usr.sbin/iscsid/iscsid.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: iscsid.8,v 1.3 2010/09/25 14:09:52 jmc Exp $ +.\" $OpenBSD: iscsid.8,v 1.4 2011/08/20 19:03:39 sthen Exp $ .\" .\" Copyright (c) 2010 David Gwynne <dlg@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 25 2010 $ +.Dd $Mdocdate: August 20 2011 $ .Dt ISCSID 8 .Os .Sh NAME @@ -22,7 +22,7 @@ .Nd "iSCSI (Internet SCSI) daemon" .Sh SYNOPSIS .Nm -.Op Fl d +.Op Fl dv .Op Fl n Ar device .Op Fl s Ar socket .Sh DESCRIPTION @@ -52,6 +52,8 @@ will run in the foreground and log to Use an alternate /dev entry for communicating with the kernel. .It Fl s Ar socket Use an alternate location for the default control socket. +.It Fl v +Produce more verbose output. .El .Sh FILES .Bl -tag -width "/var/run/iscsid.sockXX" -compact diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 28dc39c6d25..3a0112c3a50 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.c,v 1.7 2011/05/04 21:00:04 claudio Exp $ */ +/* $OpenBSD: iscsid.c,v 1.8 2011/08/20 19:03:39 sthen Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -68,11 +68,12 @@ main(int argc, char *argv[]) struct passwd *pw; char *ctrlsock = ISCSID_CONTROL; char *vscsidev = ISCSID_DEVICE; - int ch, debug = 0; + int ch, debug = 0, verbose = 0; log_init(1); /* log to stderr until daemonized */ + log_verbose(1); - while ((ch = getopt(argc, argv, "dn:s:")) != -1) { + while ((ch = getopt(argc, argv, "dn:s:v")) != -1) { switch (ch) { case 'd': debug = 1; @@ -83,6 +84,9 @@ main(int argc, char *argv[]) case 's': ctrlsock = optarg; break; + case 'v': + verbose = 1; + break; default: usage(); /* NOTREACHED */ @@ -100,6 +104,8 @@ main(int argc, char *argv[]) errx(1, "need root privileges"); log_init(debug); + log_verbose(verbose); + if (!debug) daemon(1, 0); log_info("startup"); @@ -173,7 +179,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-d] [-n device] [-s socket]\n", + fprintf(stderr, "usage: %s [-dv] [-n device] [-s socket]\n", __progname); exit(1); } diff --git a/usr.sbin/iscsid/log.c b/usr.sbin/iscsid/log.c index 24d2e6d57ec..df06d281090 100644 --- a/usr.sbin/iscsid/log.c +++ b/usr.sbin/iscsid/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.4 2011/04/27 18:59:01 claudio Exp $ */ +/* $OpenBSD: log.c,v 1.5 2011/08/20 19:03:39 sthen Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -47,7 +47,6 @@ log_init(int n_debug) extern char *__progname; debug = n_debug; - verbose = n_debug; if (!debug) openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON); |