mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
lib: Move addition of program_name to proctitle_set
Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -140,8 +140,8 @@ proctitle_init(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Changes the name of the process, as shown by "ps", to 'format', which is
|
||||
* formatted as if by printf(). */
|
||||
/* Changes the name of the process, as shown by "ps", to the program name
|
||||
* followed by 'format', which is formatted as if by printf(). */
|
||||
void
|
||||
proctitle_set(const char *format, ...)
|
||||
{
|
||||
@@ -157,7 +157,10 @@ proctitle_set(const char *format, ...)
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
n = vsnprintf(argv_start, argv_size, format, args);
|
||||
n = snprintf(argv_start, argv_size, "%s: ", program_name);
|
||||
if (n < argv_size) {
|
||||
n += vsnprintf(argv_start + n, argv_size - n, format, args);
|
||||
}
|
||||
if (n >= argv_size) {
|
||||
/* The name is too long, so add an ellipsis at the end. */
|
||||
strcpy(&argv_start[argv_size - 4], "...");
|
||||
|
||||
@@ -385,9 +385,8 @@ monitor_daemon(pid_t daemon_pid)
|
||||
int retval;
|
||||
int status;
|
||||
|
||||
proctitle_set("%s: monitoring pid %lu (%s)",
|
||||
program_name, (unsigned long int) daemon_pid,
|
||||
status_msg);
|
||||
proctitle_set("monitoring pid %lu (%s)",
|
||||
(unsigned long int) daemon_pid, status_msg);
|
||||
|
||||
do {
|
||||
retval = waitpid(daemon_pid, &status, 0);
|
||||
|
||||
@@ -335,8 +335,7 @@ worker_main(int fd)
|
||||
server_sock = fd;
|
||||
|
||||
subprogram_name = "worker";
|
||||
proctitle_set("%s: worker process for pid %lu",
|
||||
program_name, (unsigned long int) getppid());
|
||||
proctitle_set("worker process for pid %lu", (unsigned long int) getppid());
|
||||
VLOG_INFO("worker process started");
|
||||
|
||||
rxbuf_init(&rx);
|
||||
|
||||
Reference in New Issue
Block a user