diff mbox series

[3/5] tools/xenstored: remove the "-P" command line option

Message ID 20231113124309.10862-4-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series tools/xenstored: remove some command line options | expand

Commit Message

Jürgen Groß Nov. 13, 2023, 12:43 p.m. UTC
The "-P" command line option just results in printing the PID of the
xenstored daemon to stdout before stdout is being closed. The same
information can be retrieved from the PID file via the "-F" option.

Remove the redundant "-P" option.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstored/core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Julien Grall Nov. 14, 2023, 9:05 p.m. UTC | #1
Hi Juergen,

On 13/11/2023 12:43, Juergen Gross wrote:
> The "-P" command line option just results in printing the PID of the
> xenstored daemon to stdout before stdout is being closed. The same
> information can be retrieved from the PID file via the "-F" option.

I looked at the git history to figure out whether -P was added before 
-F. But it looks like they were added together. It is not entirely clear 
to me the author thought the both options were necessary.

Anyway, I agree this is a bit redundant.

> 
> Remove the redundant "-P" option.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 3e31e74933..5a6378316a 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2653,7 +2653,6 @@  static void usage(void)
 "  -F, --pid-file <file>   giving a file for the daemon's pid to be written,\n"
 "  -H, --help              to output this message,\n"
 "  -N, --no-fork           to request that the daemon does not fork,\n"
-"  -P, --output-pid        to request that the pid of the daemon is output,\n"
 "  -T, --trace-file <file> giving the file for logging, and\n"
 "      --trace-control=+<switch> activate a specific <switch>\n"
 "      --trace-control=-<switch> deactivate a specific <switch>\n"
@@ -2702,7 +2701,6 @@  static struct option options[] = {
 	{ "help", 0, NULL, 'H' },
 	{ "no-fork", 0, NULL, 'N' },
 	{ "priv-domid", 1, NULL, 'p' },
-	{ "output-pid", 0, NULL, 'P' },
 	{ "entry-size", 1, NULL, 'S' },
 	{ "trace-file", 1, NULL, 'T' },
 	{ "trace-control", 1, NULL, 1 },
@@ -2825,7 +2823,6 @@  int main(int argc, char *argv[])
 	int opt;
 	int sock_pollfd_idx = -1;
 	bool dofork = true;
-	bool outputpid = false;
 	bool live_update = false;
 	const char *pidfile = NULL;
 	int timeout;
@@ -2834,7 +2831,7 @@  int main(int argc, char *argv[])
 	orig_argv = argv;
 
 	while ((opt = getopt_long(argc, argv,
-				  "E:F:H::KNPS:t:A:M:Q:q:T:RW:w:U",
+				  "E:F:H::KNS:t:A:M:Q:q:T:RW:w:U",
 				  options, NULL)) != -1) {
 		switch (opt) {
 		case 'E':
@@ -2849,9 +2846,6 @@  int main(int argc, char *argv[])
 		case 'N':
 			dofork = false;
 			break;
-		case 'P':
-			outputpid = true;
-			break;
 		case 'R':
 			recovery = false;
 			break;
@@ -2947,11 +2941,6 @@  int main(int argc, char *argv[])
 		dom0_init();
 	}
 
-	if (outputpid) {
-		printf("%ld\n", (long)getpid());
-		fflush(stdout);
-	}
-
 	/* redirect to /dev/null now we're ready to accept connections */
 	if (dofork && !live_update)
 		finish_daemonize();