2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +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

@@ -34,7 +34,14 @@ VLOG_DEFINE_THIS_MODULE(util);
COVERAGE_DEFINE(util_xalloc);
/* argv[0] without directory names. */
const char *program_name;
/* Ordinarily "" but set to "monitor" for a monitor process or "worker" for a
* worker process. */
const char *subprogram_name = "";
/* --version option output. */
static char *program_version;
void
@@ -243,7 +250,12 @@ ovs_error_valist(int err_no, const char *format, va_list args)
{
int save_errno = errno;
fprintf(stderr, "%s: ", program_name);
if (subprogram_name[0]) {
fprintf(stderr, "%s(%s): ", program_name, subprogram_name);
} else {
fprintf(stderr, "%s: ", program_name);
}
vfprintf(stderr, format, args);
if (err_no != 0) {
fprintf(stderr, " (%s)", ovs_retval_to_string(err_no));