This patch adds command-line help to the libvirt qemu daemon.One small bug: On my machine at least, QEMUD_PID_FILE is defined as (literally) "${prefix}/var/run/libvirt_qemud.pid". It shouldn't have the "${prefix}" at the beginning, and even if that is fixed it looks like this could result in a path like "/usr/var/run/..." which would be wrong. I fiddled with AC_DEFINE_UNQUOTED and the quoting of the string itself inside configure.in and I couldn't work out how to get the quoting right.
Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland)
Index: qemud/qemud.c =================================================================== RCS file: /data/cvs/libvirt/qemud/qemud.c,v retrieving revision 1.37 diff -u -r1.37 qemud.c --- qemud/qemud.c 30 Mar 2007 16:25:02 -0000 1.37 +++ qemud/qemud.c 3 Apr 2007 09:37:27 -0000 @@ -1744,6 +1744,44 @@ free(server); } +/* Print command-line usage. */ +static void +usage (const char *argv0) +{ + fprintf (stderr, + "\n" + "Usage:\n" + " %s [options]\n" + "\n" + "Options:\n" + " -v | --verbose Verbose messages.\n" + " -d | --daemon Run as a daemon & write PID file.\n" + " -s | --system Run as system daemon.\n" + " -t | --timeout <secs> Exit after timeout period.\n" + " -p | --pid-file <file> Change name of PID file.\n" + "\n" + "Notes:\n" + "\n" + "For '--system' option you must be running this daemon as root.\n" + "\n" + "The '--timeout' applies only when the daemon is not servicing\n" + "clients.\n" + "\n" + "Default paths:\n" + "\n" + " Sockets (in system mode):\n" + " " LOCAL_STATE_DIR "/run/libvirt/qemud-sock\n" + " " LOCAL_STATE_DIR "/run/libvirt/qemud-sock-ro\n" + "\n" + " Sockets (not in system mode):\n" + " $HOME/.libvirt/qemud-sock (in Unix abstract namespace)\n" + "\n" + " PID file (unless overridden by --pid-file):\n" + " " QEMUD_PID_FILE "\n" + "\n", + argv0); +} + #define MAX_LISTEN 5 int main(int argc, char **argv) { int sys = 0; @@ -1758,8 +1796,9 @@ { "verbose", no_argument, &verbose, 1}, { "daemon", no_argument, &godaemon, 1}, { "system", no_argument, &sys, 1}, - { "timeout", required_argument, 0, 't'}, - { "pid-file", required_argument, 0, 'p'}, + { "timeout", required_argument, NULL, 't'}, + { "pid-file", required_argument, NULL, 'p'}, + { "help", no_argument, NULL, '?' }, {0, 0, 0, 0} }; @@ -1801,8 +1840,8 @@ break; case '?': + usage (argv[0]); return 2; - break; default: abort();
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature