From: Timo Sirainen Date: Fri, 24 Mar 2023 00:02:58 +0000 (+0200) Subject: lib: Add process_title_get_counter() X-Git-Tag: 2.3.21~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d591711cdb0041d3617bac24562f0442401d46a8;p=thirdparty%2Fdovecot%2Fcore.git lib: Add process_title_get_counter() --- diff --git a/src/lib/process-title.c b/src/lib/process-title.c index 6c680c32f1..15192ce5c3 100644 --- a/src/lib/process-title.c +++ b/src/lib/process-title.c @@ -12,6 +12,7 @@ static char *process_name = NULL; static char *current_process_title; +static unsigned int process_title_counter = 0; #ifdef HAVE_SETPROCTITLE # undef PROCTITLE_HACK @@ -146,6 +147,7 @@ void process_title_set(const char *title) { i_assert(process_name != NULL); + process_title_counter++; i_free(current_process_title); current_process_title = i_strdup(title); #ifdef HAVE_SETPROCTITLE @@ -165,6 +167,11 @@ const char *process_title_get(void) return current_process_title; } +unsigned int process_title_get_counter(void) +{ + return process_title_counter; +} + void process_title_deinit(void) { #ifdef PROCTITLE_HACK diff --git a/src/lib/process-title.h b/src/lib/process-title.h index 1e63b49349..0f5480f981 100644 --- a/src/lib/process-title.h +++ b/src/lib/process-title.h @@ -9,6 +9,8 @@ void process_title_set(const char *title); /* Return the previously set process title. NULL means that it's either not set, or the title was explicitly set to NULL previously. */ const char *process_title_get(void); +/* Return the number of times process_title_set() has been called. */ +unsigned int process_title_get_counter(void); /* Free all memory used by process title hacks. This should be the last function called by the process, since it frees argv and environment. */