[lttng-dev] [PATCH lttng-tools] Fix: document lttng-sessiond short options

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Wed Sep 4 16:54:24 EDT 2013


Fixes #588, which was closed prematurely

'lttng-sessiond -h' documents its short options; '-Z' no longer requires an argument; '-s' removed; '-GHTU' handled; usage formatted to 80 columns; usage, parse_args and long_options[] now in synch
(The attached diff was prepared semi-manually and is missing the 'index' line, my apologies)

Signed-off-by: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
---
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -3861,28 +3861,31 @@
 static void usage(void)
 {
 	fprintf(stderr, "Usage: %s OPTIONS\n\nOptions:\n", progname);
-	fprintf(stderr, "  -h, --help                         Display this usage.\n");
-	fprintf(stderr, "  -c, --client-sock PATH             Specify path for the client unix socket\n");
-	fprintf(stderr, "  -a, --apps-sock PATH               Specify path for apps unix socket\n");
-	fprintf(stderr, "      --kconsumerd-err-sock PATH     Specify path for the kernel consumer error socket\n");
-	fprintf(stderr, "      --kconsumerd-cmd-sock PATH     Specify path for the kernel consumer command socket\n");
-	fprintf(stderr, "      --ustconsumerd32-err-sock PATH Specify path for the 32-bit UST consumer error socket\n");
-	fprintf(stderr, "      --ustconsumerd64-err-sock PATH Specify path for the 64-bit UST consumer error socket\n");
-	fprintf(stderr, "      --ustconsumerd32-cmd-sock PATH Specify path for the 32-bit UST consumer command socket\n");
-	fprintf(stderr, "      --ustconsumerd64-cmd-sock PATH Specify path for the 64-bit UST consumer command socket\n");
-	fprintf(stderr, "      --consumerd32-path PATH     Specify path for the 32-bit UST consumer daemon binary\n");
-	fprintf(stderr, "      --consumerd32-libdir PATH   Specify path for the 32-bit UST consumer daemon libraries\n");
-	fprintf(stderr, "      --consumerd64-path PATH     Specify path for the 64-bit UST consumer daemon binary\n");
-	fprintf(stderr, "      --consumerd64-libdir PATH   Specify path for the 64-bit UST consumer daemon libraries\n");
+	fprintf(stderr, "  -h, --help                         Display this usage and quit.\n");
+	fprintf(stderr, "  -V, --version                      Show version number and quit.\n");
 	fprintf(stderr, "  -d, --daemonize                    Start as a daemon.\n");
-	fprintf(stderr, "  -g, --group NAME                   Specify the tracing group name. (default: tracing)\n");
-	fprintf(stderr, "  -V, --version                      Show version number.\n");
-	fprintf(stderr, "  -S, --sig-parent                   Send SIGCHLD to parent pid to notify readiness.\n");
 	fprintf(stderr, "  -q, --quiet                        No output at all.\n");
-	fprintf(stderr, "  -v, --verbose                      Verbose mode. Activate DBG() macro.\n");
-	fprintf(stderr, "  -p, --pidfile FILE                 Write a pid to FILE name overriding the default value.\n");
-	fprintf(stderr, "      --verbose-consumer             Verbose mode for consumer. Activate DBG() macro.\n");
-	fprintf(stderr, "      --no-kernel                    Disable kernel tracer\n");
+	fprintf(stderr, "  -v, --verbose                      Verbose mode. Activates DBG() macro.\n");
+	fprintf(stderr, "  -Z, --verbose-consumer             Verbose consumer. Activates DBG() macro.\n");
+	fprintf(stderr, "  -S, --sig-parent                   Send SIGCHLD to parent to notify readiness.\n");
+	fprintf(stderr, "  -N, --no-kernel                    Disable kernel tracer\n");
+	fprintf(stderr, "  -g, --group NAME                   Specify the tracing group name.\n");
+	fprintf(stderr, "                                     (default: tracing)\n");
+	fprintf(stderr, "  -p, --pidfile FILE                 Write the daemon's pid to FILE.\n");
+	fprintf(stderr, "                                     (default: lttng-sessiond.pid)\n");
+	fprintf(stderr, "Specify paths for unix sockets, binaries and libraries:\n");
+	fprintf(stderr, "  -a, --apps-sock PATH               Apps unix socket.\n");
+	fprintf(stderr, "  -c, --client-sock PATH             Client unix socket.\n");
+	fprintf(stderr, "  -C, --kconsumerd-cmd-sock PATH     Kernel consumer command socket.\n");
+	fprintf(stderr, "  -E, --kconsumerd-err-sock PATH     Kernel consumer error socket.\n");
+	fprintf(stderr, "  -D, --ustconsumerd64-cmd-sock PATH 64-bit UST consumer command socket.\n");
+	fprintf(stderr, "  -F, --ustconsumerd64-err-sock PATH 64-bit UST consumer error socket.\n");
+	fprintf(stderr, "  -G, --ustconsumerd32-cmd-sock PATH 32-bit UST consumer command socket.\n");
+	fprintf(stderr, "  -H, --ustconsumerd32-err-sock PATH 32-bit UST consumer error socket.\n");
+	fprintf(stderr, "  -t, --consumerd64-path PATH        64-bit UST consumer daemon binary.\n");
+	fprintf(stderr, "  -T, --consumerd64-libdir PATH      64-bit UST consumer daemon libraries.\n");
+	fprintf(stderr, "  -u, --consumerd32-path PATH        32-bit UST consumer daemon binary.\n");
+	fprintf(stderr, "  -U, --consumerd32-libdir PATH      32-bit UST consumer daemon libraries.\n");
 }
 
 /*
@@ -3893,34 +3896,34 @@
 	int c;
 
 	static struct option long_options[] = {
-		{ "client-sock", 1, 0, 'c' },
-		{ "apps-sock", 1, 0, 'a' },
-		{ "kconsumerd-cmd-sock", 1, 0, 'C' },
-		{ "kconsumerd-err-sock", 1, 0, 'E' },
-		{ "ustconsumerd32-cmd-sock", 1, 0, 'G' },
-		{ "ustconsumerd32-err-sock", 1, 0, 'H' },
-		{ "ustconsumerd64-cmd-sock", 1, 0, 'D' },
-		{ "ustconsumerd64-err-sock", 1, 0, 'F' },
-		{ "consumerd32-path", 1, 0, 'u' },
-		{ "consumerd32-libdir", 1, 0, 'U' },
-		{ "consumerd64-path", 1, 0, 't' },
-		{ "consumerd64-libdir", 1, 0, 'T' },
-		{ "daemonize", 0, 0, 'd' },
-		{ "sig-parent", 0, 0, 'S' },
 		{ "help", 0, 0, 'h' },
-		{ "group", 1, 0, 'g' },
 		{ "version", 0, 0, 'V' },
+		{ "daemonize", 0, 0, 'd' },
 		{ "quiet", 0, 0, 'q' },
 		{ "verbose", 0, 0, 'v' },
 		{ "verbose-consumer", 0, 0, 'Z' },
+		{ "sig-parent", 0, 0, 'S' },
 		{ "no-kernel", 0, 0, 'N' },
+		{ "group", 1, 0, 'g' },
 		{ "pidfile", 1, 0, 'p' },
+		{ "apps-sock", 1, 0, 'a' },
+		{ "client-sock", 1, 0, 'c' },
+		{ "kconsumerd-cmd-sock", 1, 0, 'C' },
+		{ "kconsumerd-err-sock", 1, 0, 'E' },
+		{ "ustconsumerd64-cmd-sock", 1, 0, 'D' },
+		{ "ustconsumerd64-err-sock", 1, 0, 'F' },
+		{ "ustconsumerd32-cmd-sock", 1, 0, 'G' },
+		{ "ustconsumerd32-err-sock", 1, 0, 'H' },
+		{ "consumerd64-path", 1, 0, 't' },
+		{ "consumerd64-libdir", 1, 0, 'T' },
+		{ "consumerd32-path", 1, 0, 'u' },
+		{ "consumerd32-libdir", 1, 0, 'U' },
 		{ NULL, 0, 0, 0 }
 	};
 
 	while (1) {
 		int option_index = 0;
-		c = getopt_long(argc, argv, "dhqvVSN" "a:c:g:s:C:E:D:F:Z:u:t:p:",
+		c = getopt_long(argc, argv, "hVdqvZSN" "g:p:a:c:C:E:D:F:G:H:t:T:u:U:",
 				long_options, &option_index);
 		if (c == -1) {
 			break;
@@ -3933,57 +3936,66 @@
 				fprintf(stderr, " with arg %s\n", optarg);
 			}
 			break;
-		case 'c':
-			snprintf(client_unix_sock_path, PATH_MAX, "%s", optarg);
-			break;
-		case 'a':
-			snprintf(apps_unix_sock_path, PATH_MAX, "%s", optarg);
-			break;
-		case 'd':
-			opt_daemon = 1;
-			break;
-		case 'g':
-			opt_tracing_group = optarg;
-			break;
 		case 'h':
 			usage();
 			exit(EXIT_FAILURE);
 		case 'V':
 			fprintf(stdout, "%s\n", VERSION);
 			exit(EXIT_SUCCESS);
+		case 'd':
+			opt_daemon = 1;
+			break;
+		case 'q':
+			lttng_opt_quiet = 1;
+			break;
+		case 'v':
+			/* Verbose level can increase using multiple -v */
+			lttng_opt_verbose += 1;
+			break;
+		case 'Z':
+			opt_verbose_consumer += 1;
+			break;
 		case 'S':
 			opt_sig_parent = 1;
 			break;
-		case 'E':
-			snprintf(kconsumer_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
+		case 'N':
+			opt_no_kernel = 1;
+			break;
+		case 'g':
+			opt_tracing_group = optarg;
+			break;
+		case 'p':
+			opt_pidfile = optarg;
+			break;
+		case 'a':
+			snprintf(apps_unix_sock_path, PATH_MAX, "%s", optarg);
+			break;
+		case 'c':
+			snprintf(client_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
 		case 'C':
 			snprintf(kconsumer_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
-		case 'F':
-			snprintf(ustconsumer64_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
+		case 'E':
+			snprintf(kconsumer_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
 		case 'D':
 			snprintf(ustconsumer64_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
-		case 'H':
-			snprintf(ustconsumer32_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
+		case 'F':
+			snprintf(ustconsumer64_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
 		case 'G':
 			snprintf(ustconsumer32_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
-		case 'N':
-			opt_no_kernel = 1;
-			break;
-		case 'q':
-			lttng_opt_quiet = 1;
+		case 'H':
+			snprintf(ustconsumer32_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
 			break;
-		case 'v':
-			/* Verbose level can increase using multiple -v */
-			lttng_opt_verbose += 1;
+		case 't':
+			consumerd64_bin = optarg;
 			break;
-		case 'Z':
-			opt_verbose_consumer += 1;
+		case 'T':
+			consumerd64_libdir = optarg;
 			break;
 		case 'u':
 			consumerd32_bin= optarg;
@@ -3991,15 +4003,6 @@
 		case 'U':
 			consumerd32_libdir = optarg;
 			break;
-		case 't':
-			consumerd64_bin = optarg;
-			break;
-		case 'T':
-			consumerd64_libdir = optarg;
-			break;
-		case 'p':
-			opt_pidfile = optarg;
-			break;
 		default:
 			/* Unknown option or other error.
 			 * Error is printed by getopt, just return */
--
Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence R&D Canada - Valcartier (DRDC Valcartier)
2459 route de la Bravoure
Québec QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list