summaryrefslogtreecommitdiff
path: root/lib/daemon.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-08-12 09:47:33 -0700
committerBen Pfaff <blp@nicira.com>2010-08-12 09:47:33 -0700
commitdf5d2ed998115b4aace007508e0cc374f5f84ab5 (patch)
treefced80db0ef6f4e4bade3429e9ba365aeef58ab3 /lib/daemon.c
parent3d41239d308452b43bdf64d8acf7dde20e0fb986 (diff)
downloadopenvswitch-df5d2ed998115b4aace007508e0cc374f5f84ab5.tar.gz
daemon: Make sure that vlog is initialized when a process daemonizes.
If a process daemonizes itself, then it should be possible to control that process's log levels with "ovs-appctl vlog/set" and related commands. The vlog_init() function registers those commands. But vlog_init() doesn't normally get called until the first log message is issued. This can take a while, especially for ovs-controller, where I first noticed the problem. This commit fixes the problem by calling vlog_init() from daemonize_start(), which always gets called as a process daemonizes.
Diffstat (limited to 'lib/daemon.c')
-rw-r--r--lib/daemon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/daemon.c b/lib/daemon.c
index 6cb553acf..c8033fbec 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -448,6 +448,10 @@ daemonize_start(void)
}
make_pidfile();
+
+ /* Make sure that the unixctl commands for vlog get registered in a
+ * daemon, even before the first log message. */
+ vlog_init();
}
/* If daemonization is configured, then this function notifies the parent