Create vlog sockets after daemonizing, so that pidfiles can be used.
Otherwise, pidfiles contain the process ID of the process that forked and exited, so that "vlogconf --target <program.pid>" will fail.
This commit is contained in:
1 parent
efffd49643
commit
fe6988251d
4 files changed
+16
-11
No files matched your search
@@ -101,11 +101,6 @@ main(int argc, char *argv[])
|
||||
"use --help for usage");
|
||||
}
|
||||
|
||||
retval = vlog_server_listen(NULL, NULL);
|
||||
if (retval) {
|
||||
ofp_fatal(retval, "Could not listen for vlog connections");
|
||||
}
|
||||
|
||||
n_switches = n_listeners = 0;
|
||||
for (i = optind; i < argc; i++) {
|
||||
const char *name = argv[i];
|
||||
@@ -140,6 +135,11 @@ main(int argc, char *argv[])
|
||||
die_if_already_running();
|
||||
daemonize();
|
||||
|
||||
retval = vlog_server_listen(NULL, NULL);
|
||||
if (retval) {
|
||||
ofp_fatal(retval, "Could not listen for vlog connections");
|
||||
}
|
||||
|
||||
while (n_switches > 0 || n_listeners > 0) {
|
||||
int iteration;
|
||||
int i;
|
||||
|
||||
@@ -79,6 +79,11 @@ static void poll_server(int fd, short int events, void *server_);
|
||||
* - An absolute path (starting with '/') that gives the exact name of
|
||||
* the Unix domain socket to listen on.
|
||||
*
|
||||
* A program that (optionally) daemonizes itself should call this function
|
||||
* *after* daemonization, so that the socket name contains the pid of the
|
||||
* daemon instead of the pid of the program that exited. (Otherwise, "vlogconf
|
||||
* --target <program>.pid" will fail.)
|
||||
*
|
||||
* Returns 0 if successful, otherwise a positive errno value. If successful,
|
||||
* sets '*serverp' to the new vlog_server, otherwise to NULL. */
|
||||
int
|
||||
|
||||
+3
-3
@@ -140,15 +140,15 @@ main(int argc, char *argv[])
|
||||
/* Initialize switch status hook. */
|
||||
switch_status_start(&secchan, &s, &switch_status);
|
||||
|
||||
die_if_already_running();
|
||||
daemonize();
|
||||
|
||||
/* Start listening for vlogconf requests. */
|
||||
retval = vlog_server_listen(NULL, NULL);
|
||||
if (retval) {
|
||||
ofp_fatal(retval, "Could not listen for vlog connections");
|
||||
}
|
||||
|
||||
die_if_already_running();
|
||||
daemonize();
|
||||
|
||||
VLOG_WARN("OpenFlow reference implementation version %s", VERSION BUILDNR);
|
||||
VLOG_WARN("OpenFlow protocol version 0x%02x", OFP_VERSION);
|
||||
|
||||
|
||||
+3
-3
@@ -119,14 +119,14 @@ main(int argc, char *argv[])
|
||||
add_ports(dp, port_list);
|
||||
}
|
||||
|
||||
die_if_already_running();
|
||||
daemonize();
|
||||
|
||||
error = vlog_server_listen(NULL, NULL);
|
||||
if (error) {
|
||||
ofp_fatal(error, "could not listen for vlog connections");
|
||||
}
|
||||
|
||||
die_if_already_running();
|
||||
daemonize();
|
||||
|
||||
for (;;) {
|
||||
dp_run(dp);
|
||||
dp_wait(dp);
|
||||
|
||||
Reference in new issue
Block a user