From 4aaf4fd8dc930cfe68afa124fb09272104da064d Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Tue, 14 Nov 2023 06:05:09 +0000 Subject: [PATCH] debug pidfile Signed-off-by: zhangzujian --- lib/daemon-unix.c | 6 +++++- lib/daemon.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c index 1a7ba427d7a..49273d78286 100644 --- a/lib/daemon-unix.c +++ b/lib/daemon-unix.c @@ -17,7 +17,7 @@ #include #include "backtrace.h" #include "daemon.h" -#include "daemon-private.h" +// #include "daemon-private.h" #include #include #include @@ -29,6 +29,7 @@ #include #include #include +#include #if HAVE_LIBCAPNG #include #endif @@ -490,6 +491,9 @@ daemonize_start(bool access_datapath) if (pidfile) { make_pidfile(); + } else { + pid_t tid = gettid(); + VLOG_WARN("pidfile %x in thread %u is NULL", &pidfile, tid); } /* Make sure that the unixctl commands for vlog get registered in a diff --git a/lib/daemon.c b/lib/daemon.c index 3249c5ab4b5..2f0718610c4 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "util.h" #include "ovs-thread.h" #include "openvswitch/vlog.h" @@ -61,9 +62,14 @@ daemonize(void) void set_pidfile(const char *name) { + printf("set_pidfile(%s)\n", name); + VLOG_WARN("set_pidfile(%s)", name); assert_single_threaded(); free(pidfile); pidfile = make_pidfile_name(name); + pid_t tid = gettid(); + VLOG_WARN("pidfile %x in thread %u is set to %s", &pidfile, tid, pidfile); + printf("pidfile %x in thread %u is set to %s\n", &pidfile, tid, pidfile); } /* Disables self confinement. */