Skip to content

Commit

Permalink
debug pidfile
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Nov 13, 2023
1 parent 6a29598 commit c784c74
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/daemon-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ daemonize_start(bool access_datapath)

if (pidfile) {
make_pidfile();
} else {
VLOG_WARN("pidfile is NULL");
}

/* Make sure that the unixctl commands for vlog get registered in a
Expand All @@ -507,6 +509,7 @@ daemonize_complete(void)
{
if (pidfile) {
free(pidfile);
VLOG_WARN("daemonize_complete, setting pidfile to NULL");
pidfile = NULL;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ daemonize(void)
void
set_pidfile(const char *name)
{
VLOG_WARN("set_pidfile(%s)", name);
assert_single_threaded();
free(pidfile);
pidfile = make_pidfile_name(name);
VLOG_WARN("pidfile is set to %s", pidfile);
}

/* Disables self confinement. */
Expand Down
4 changes: 2 additions & 2 deletions lib/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{"detach", no_argument, NULL, OPT_DETACH}, \
{"no-self-confinement", no_argument, NULL, OPT_NO_SELF_CONFINEMENT}, \
{"no-chdir", no_argument, NULL, OPT_NO_CHDIR}, \
{"pidfile", optional_argument, NULL, OPT_PIDFILE}, \
{"pidfile", required_argument, NULL, OPT_PIDFILE}, \
{"overwrite-pidfile", no_argument, NULL, OPT_OVERWRITE_PIDFILE}, \
{"monitor", no_argument, NULL, OPT_MONITOR}, \
{"user", required_argument, NULL, OPT_USER_GROUP}
Expand Down Expand Up @@ -113,7 +113,7 @@ pid_t read_pidfile(const char *name);
{"detach", no_argument, NULL, OPT_DETACH}, \
{"no-self-confinement", no_argument, NULL, OPT_NO_SELF_CONFINEMENT}, \
{"no-chdir", no_argument, NULL, OPT_NO_CHDIR}, \
{"pidfile", optional_argument, NULL, OPT_PIDFILE}, \
{"pidfile", required_argument, NULL, OPT_PIDFILE}, \
{"pipe-handle", required_argument, NULL, OPT_PIPE_HANDLE}, \
{"service", no_argument, NULL, OPT_SERVICE}, \
{"service-monitor", no_argument, NULL, OPT_SERVICE_MONITOR}, \
Expand Down

0 comments on commit c784c74

Please sign in to comment.