chiark / gitweb /
polypath: Log pid of long-running interface monitor
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 1 Oct 2014 22:42:04 +0000 (23:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 2 Oct 2014 15:41:57 +0000 (16:41 +0100)
This new reporting is going to be particularly useful for privsep,
which has a child and also a grandchild.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
polypath.c

index fa7b9a4df10b59ea0e5603b90681ad08bf4c769b..2d337545278cf4f06bedaa6657b641b4a8acb057 100644 (file)
@@ -462,7 +462,8 @@ static void child_monitor(struct polypath *st, int childfd)
 }
 
 static void start_subproc(struct polypath *st, void (*make_fdpair)(int[2]),
-                         void (*child)(struct polypath *st, int childfd))
+                         void (*child)(struct polypath *st, int childfd),
+                         const char *desc)
 {
     int pfds[2];
 
@@ -486,12 +487,15 @@ static void start_subproc(struct polypath *st, void (*make_fdpair)(int[2]),
     st->monitor_pid=pid;
     st->monitor_fd=pfds[0];
     setnonblock(st->monitor_fd);
+
+    lg_perror(LG,M_NOTICE,0, "%s: spawning %s [pid %ld]",
+             st->uc.cc.cl.description, desc, (long)st->monitor_pid);
 }
 
 static void polypath_phase_startmonitor(void *sst, uint32_t newphase)
 {
     struct polypath *st=sst;
-    start_subproc(st,pipe_cloexec,child_monitor);
+    start_subproc(st,pipe_cloexec,child_monitor,"interface monitor");
     register_for_poll(st,polypath_beforepoll,
                      polypath_afterpoll_monitor,"polypath");
 }