Skip to contentSkip to conversation

xl: don't emit misleading daemon pid message

PATCH In review Matthew Daley 2 participants 2 messages Oct 27, 2013 – Oct 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: don't emit misleading daemon pid message

After creating a domain, xl forks off a process to handle domain events (shutdown, disk eject, ...). It prints out the pid of the process created by the fork to stdout. However, the newly forked process soon after calls daemon(), which itself forks once more (and exit()s the original process). This means that the pid printed out is not the pid of the actual process which remains in the background after all is said and done, instead it is the pid of the transient process that exists between xl's fork() and the fork'd process's daemon() call.

We could resolve this by printing the correct pid, ie. by open-coding daemon() (we already do most of the heavy lifting it does ourselves by fiddling with the standard fds). However, since no-one seems to be complaining about the misleading message to begin with, and since it seems like a pointless message anyway, just remove it outright instead.

---
Perhaps the only other remaining xl create stdout message, 'Parsing config from ...' could be removed too?

 tools/libxl/xl_cmdimpl.c |    2 --
 1 file changed, 2 deletions(-)
tools/libxl/xl_cmdimpl.c +0 -2
index a8261be..fddaa80 100644
@@ -2140,8 +2140,6 @@ start:
 
         child1 = xl_fork(child_waitdaemon);
         if (child1) {
-            printf("Daemon running with PID %d\n", child1);
-
             for (;;) {
                 got_child = xl_waitpid(child_waitdaemon, &status, 0);
                 if (got_child == child1) break;
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw

Matthew Daley writes ("[PATCH] xl: don't emit misleading daemon pid message"):

Quoted 9 lines

After creating a domain, xl forks off a process to handle domain events (shutdown, disk eject, ...). It prints out the pid of the process created by the fork to stdout. However, the newly forked process soon after calls daemon(), which itself forks once more (and exit()s the original process). This means that the pid printed out is not the pid of the actual process which remains in the background after all is said and done, instead it is the pid of the transient process that exists between xl's fork() and the fork'd process's daemon() call.

Quoted 7 lines

We could resolve this by printing the correct pid, ie. by open-coding daemon() (we already do most of the heavy lifting it does ourselves by fiddling with the standard fds). However, since no-one seems to be complaining about the misleading message to begin with, and since it seems like a pointless message anyway, just remove it outright instead.

Thanks,
Ian.