2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

util: Introduce "subprogram_name" to identify subprocesses and threads.

This will be more useful later when we introduces "worker" subprocesses.
I don't have any current plans to introduce threading, but I can't
think of a disadvantage to wording this in a general manner.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-07-18 10:30:47 -07:00
parent fd94a42c43
commit 781dee0835
7 changed files with 42 additions and 11 deletions

View File

@@ -351,13 +351,11 @@ static void
monitor_daemon(pid_t daemon_pid)
{
/* XXX Should log daemon's stderr output at startup time. */
const char *saved_program_name;
time_t last_restart;
char *status_msg;
int crashes;
saved_program_name = program_name;
program_name = xasprintf("monitor(%s)", program_name);
subprogram_name = "monitor";
status_msg = xstrdup("healthy");
last_restart = TIME_MIN;
crashes = 0;
@@ -366,7 +364,7 @@ monitor_daemon(pid_t daemon_pid)
int status;
proctitle_set("%s: monitoring pid %lu (%s)",
saved_program_name, (unsigned long int) daemon_pid,
program_name, (unsigned long int) daemon_pid,
status_msg);
do {
@@ -428,8 +426,7 @@ monitor_daemon(pid_t daemon_pid)
/* Running in new daemon process. */
proctitle_restore();
free((char *) program_name);
program_name = saved_program_name;
subprogram_name = "";
}
/* Close standard file descriptors (except any that the client has requested we