]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add process_title_get_counter()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Mar 2023 00:02:58 +0000 (02:02 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Sun, 14 May 2023 17:52:36 +0000 (17:52 +0000)
src/lib/process-title.c
src/lib/process-title.h

index 6c680c32f18252532d2c0a7672e6444ac3ffe70b..15192ce5c3bc547b72f02959aa08ae6ec14be9a9 100644 (file)
@@ -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
index 1e63b49349d58d09b05e82fdb2c27979b49c0eec..0f5480f981f028a863036cd931e0798063121a63 100644 (file)
@@ -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. */