From: Bastian Blank <bastian@waldi.eu.org>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/3] xenstored - postpone fork after initialization
Date: Wed, 26 Mar 2008 12:00:16 +0100 [thread overview]
Message-ID: <20080326110016.GA20300@wavehammer.waldi.eu.org> (raw)
# HG changeset patch
# User Bastian Blank <waldi@debian.org>
# Date 1206528849 -3600
# Node ID 5e0412c5f5798b5c0acdd4057c91b3820d6c4afd
# Parent f5e6cccfdda5537876d6fc2b87ea1124d6043fc8
Postpone fork after initialization.
Signed-off-by: Bastian Blank <waldi@debian.org>
diff -r f5e6cccfdda5 -r 5e0412c5f579 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c Tue Mar 25 18:02:00 2008 +0000
+++ b/tools/xenstore/xenstored_core.c Wed Mar 26 11:54:09 2008 +0100
@@ -1839,13 +1839,6 @@ int main(int argc, char *argv[])
}
}
- if (dofork) {
- openlog("xenstored", 0, LOG_DAEMON);
- 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();
@@ -1899,22 +1892,30 @@ int main(int argc, char *argv[])
/* Restore existing connections. */
restore_existing_connections();
- if (outputpid) {
- printf("%ld\n", (long)getpid());
- fflush(stdout);
- }
-
/* redirect to /dev/null now we're ready to accept connections */
if (dofork) {
int devnull = open("/dev/null", O_RDWR);
if (devnull == -1)
barf_perror("Could not open /dev/null\n");
+
+ openlog("xenstored", 0, LOG_DAEMON);
+
+ daemonize();
+
+ if (outputpid) {
+ printf("%ld\n", (long)getpid());
+ fflush(stdout);
+ }
+
dup2(devnull, STDIN_FILENO);
dup2(devnull, STDOUT_FILENO);
dup2(devnull, STDERR_FILENO);
close(devnull);
xprintf = trace;
}
+
+ if (pidfile)
+ write_pidfile(pidfile);
signal(SIGHUP, trigger_reopen_log);
--
History tends to exaggerate.
-- Col. Green, "The Savage Curtain", stardate 5906.4
next reply other threads:[~2008-03-26 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-26 11:00 Bastian Blank [this message]
2008-03-27 9:15 ` [PATCH 1/3] xenstored - postpone fork after initialization Keir Fraser
2008-03-27 11:27 ` Bastian Blank
2008-03-27 11:36 ` Keir Fraser
2008-03-27 16:20 ` John Levon
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=20080326110016.GA20300@wavehammer.waldi.eu.org \
--to=bastian@waldi.eu.org \
--cc=xen-devel@lists.xensource.com \
/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.