}
/* If daemonization is configured, then this function notifies the parent
- * process that the child process has completed startup successfully. */
+ * process that the child process has completed startup successfully.
+ *
+ * Calling this function more than once has no additional effect. */
void
daemonize_complete(void)
{
fork_notify_startup(daemonize_fd);
+ daemonize_fd = -1;
if (detach) {
setsid();
ignore(chdir("/"));
}
close_standard_fds();
+ detach = false;
}
}
.TP
\fB\-\-detach\fR
Causes \fB\*(PN\fR to detach itself from the foreground session and
-run as a background process.
+run as a background process. \*(DD
.
.TP
\fB\-\-monitor\fR
run a single command, e.g.:
.B "ovsdb\-server \-\-remote=punix:socket \-\-run='ovsdb\-client dump unix:socket Open_vSwitch'"
.SS "Daemon Options"
+.ds DD \
+\fBovsdb\-server\fR detaches only after it starts listening on all \
+configured remotes.
.so lib/daemon.man
.SS "Logging Options"
.so lib/vlog.man
#include "cfm.h"
#include "classifier.h"
#include "coverage.h"
+#include "daemon.h"
#include "dirs.h"
#include "dpif.h"
#include "dynamic-string.h"
}
free(managers);
+
+ /* ovs-vswitchd has completed initialization, so allow the process that
+ * forked us to exit successfully. */
+ daemonize_complete();
}
static const char *
.IP
On non-Linux hosts, this option is accepted but has no effect.
.
+.ds DD \
+\fBovs\-vswitchd\fR detaches only after it has connected to the \
+database, retrieved the initial configuration, and set up that \
+configuration.
.so lib/daemon.man
.SS "Public Key Infrastructure Options"
.so lib/ssl.man
-/* Copyright (c) 2008, 2009, 2010 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
unixctl_command_register("exit", ovs_vswitchd_exit, &exiting);
- daemonize_complete();
-
bridge_init(remote);
exiting = false;
while (!exiting) {