#endif
static char *process_name = NULL;
+static char *current_process_title;
#ifdef HAVE_SETPROCTITLE
# undef PROCTITLE_HACK
process_name = (*argv)[0];
}
-void process_title_set(const char *title ATTR_UNUSED)
+void process_title_set(const char *title)
{
i_assert(process_name != NULL);
+ i_free(current_process_title);
+ current_process_title = i_strdup(title);
#ifdef HAVE_SETPROCTITLE
if (title == NULL)
setproctitle(NULL);
#endif
}
+const char *process_title_get(void)
+{
+ return current_process_title;
+}
+
void process_title_deinit(void)
{
#ifdef PROCTITLE_HACK
the environ_p to its original state, but that's a bit complicated. */
*environ_p = NULL;
#endif
+ i_free(current_process_title);
}
/* Change the process title if possible. */
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);
+
/* Free all memory used by process title hacks. This should be the last
function called by the process, since it frees argv and environment. */
void process_title_deinit(void);