All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Wei Liu <wl@xen.org>,
	Julien Grall <julien@xen.org>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [PATCH v2 5/5] tools/xenstored: remove "-N" command line option
Date: Tue, 21 Nov 2023 12:40:48 +0100	[thread overview]
Message-ID: <20231121114048.31294-6-jgross@suse.com> (raw)
In-Reply-To: <20231121114048.31294-1-jgross@suse.com>

The "-N" (do not daemonize) command line option is of questionable use:
its sole purpose seems to be to aid debugging of xenstored by making it
easier to start xenstored under gdb, or to see any debug messages
easily.

Debug messages can as well be sent to syslog(), while gdb can be
attached to the daemon easily. The only not covered case is an error
while initializing xenstored, but this could be handled e.g. by saving
a core dump, which can be analyzed later.

The call of talloc_enable_leak_report_full() done only with "-N"
specified is no longer needed, as the same can be achieved via
"xenstore-control memreport".

Signed-off-by: Juergen Gross <jgross@suse.com>
---
Slightly RFC, as this is making debugging a little bit harder in
specific cases. OTOH I didn't use this option since years, in spite of
having done a _lot_ of xenstore hacking.

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

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 43be89c4fc..f5766452fe 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2646,7 +2646,6 @@ static void usage(void)
 "\n"
 "  -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"
 "  -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"
@@ -2691,7 +2690,6 @@ static struct option options[] = {
 	{ "event", 1, NULL, 'e' },
 	{ "master-domid", 1, NULL, 'm' },
 	{ "help", 0, NULL, 'H' },
-	{ "no-fork", 0, NULL, 'N' },
 	{ "priv-domid", 1, NULL, 'p' },
 	{ "entry-size", 1, NULL, 'S' },
 	{ "trace-file", 1, NULL, 'T' },
@@ -2813,7 +2811,6 @@ int main(int argc, char *argv[])
 {
 	int opt;
 	int sock_pollfd_idx = -1;
-	bool dofork = true;
 	bool live_update = false;
 	const char *pidfile = NULL;
 	int timeout;
@@ -2822,7 +2819,7 @@ int main(int argc, char *argv[])
 	orig_argv = argv;
 
 	while ((opt = getopt_long(argc, argv,
-				  "E:F:H::KNS:t:A:M:Q:q:T:W:w:U",
+				  "E:F:H::KS:t:A:M:Q:q:T:W:w:U",
 				  options, NULL)) != -1) {
 		switch (opt) {
 		case 'E':
@@ -2834,9 +2831,6 @@ int main(int argc, char *argv[])
 		case 'H':
 			usage();
 			return 0;
-		case 'N':
-			dofork = false;
-			break;
 		case 'S':
 			hard_quotas[ACC_NODESZ].val = get_optval_uint(optarg);
 			break;
@@ -2899,18 +2893,13 @@ int main(int argc, char *argv[])
 	/* Errors ignored here, will be reported when we open files */
 	mkdir(xenstore_daemon_rundir(), 0755);
 
-	if (dofork) {
-		openlog("xenstored", 0, LOG_DAEMON);
-		if (!live_update)
-			daemonize();
-	}
+	openlog("xenstored", 0, LOG_DAEMON);
+	if (!live_update)
+		daemonize();
+
 	if (pidfile)
 		write_pidfile(pidfile);
 
-	/* Talloc leak reports go to stderr, which is closed if we fork. */
-	if (!dofork)
-		talloc_enable_leak_report_full();
-
 	/* Don't kill us with SIGPIPE. */
 	signal(SIGPIPE, SIG_IGN);
 
@@ -2930,11 +2919,10 @@ int main(int argc, char *argv[])
 	}
 
 	/* redirect to /dev/null now we're ready to accept connections */
-	if (dofork && !live_update)
+	if (!live_update)
 		finish_daemonize();
 #ifndef __MINIOS__
-	if (dofork)
-		xprintf = trace;
+	xprintf = trace;
 #endif
 
 	signal(SIGHUP, trigger_reopen_log);
-- 
2.35.3



  parent reply	other threads:[~2023-11-21 11:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 11:40 [PATCH v2 0/5] tools/xenstored: remove some command line options Juergen Gross
2023-11-21 11:40 ` [PATCH v2 1/5] tools/xenstored: remove "-D" command line parameter Juergen Gross
2023-11-21 11:40 ` [PATCH v2 2/5] tools/xenstored: remove "-V" command line option Juergen Gross
2023-11-21 11:40 ` [PATCH v2 3/5] tools/xenstored: remove the "-P" " Juergen Gross
2023-11-21 11:40 ` [PATCH v2 4/5] tools/xenstored: remove the "-R" " Juergen Gross
2023-11-21 11:40 ` Juergen Gross [this message]
2023-12-08 15:46   ` [PATCH v2 5/5] tools/xenstored: remove "-N" " Andrew Cooper
2023-12-08 15:58     ` Juergen Gross
2023-12-08 16:16       ` Anthony PERARD
2023-12-08 16:35         ` Juergen Gross
2023-12-07  8:26 ` [PATCH v2 0/5] tools/xenstored: remove some command line options Juergen Gross
2023-12-07  9:30   ` Jan Beulich
2023-12-07 12:14     ` Julien Grall
2023-12-07 12:39       ` Jan Beulich
2023-12-07 12:53         ` Julien Grall
2023-12-07 12:59   ` Julien Grall
2023-12-08 15:33 ` Anthony PERARD
2023-12-08 15:35   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231121114048.31294-6-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=anthony.perard@citrix.com \
    --cc=julien@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.