dovecot-2.0: lib-master: Added MASTER_SERVICE_FLAG_UPDATE_PROCTI...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 3 17:31:55 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/4d91cec713cf
changeset: 12372:4d91cec713cf
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 03 15:23:52 2010 +0000
description:
lib-master: Added MASTER_SERVICE_FLAG_UPDATE_PROCTITLE for showing number of connections in ps.
The title is still only updated if verbose_proctitle=yes, so this allows
binaries to easily just set the flag and lib-master handles the rest.
diffstat:
src/lib-master/master-service-settings.c | 4 +++-
src/lib-master/master-service-settings.h | 1 +
src/lib-master/master-service.c | 9 +++++++++
src/lib-master/master-service.h | 5 ++++-
4 files changed, 17 insertions(+), 2 deletions(-)
diffs (66 lines):
diff -r 3ce7879e3ac0 -r 4d91cec713cf src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c Wed Nov 03 14:59:39 2010 +0000
+++ b/src/lib-master/master-service-settings.c Wed Nov 03 15:23:52 2010 +0000
@@ -41,6 +41,7 @@
DEF(SET_SIZE, config_cache_size),
DEF(SET_BOOL, version_ignore),
DEF(SET_BOOL, shutdown_clients),
+ DEF(SET_BOOL, verbose_proctitle),
SETTING_DEFINE_LIST_END
};
@@ -53,7 +54,8 @@
.syslog_facility = "mail",
.config_cache_size = 1024*1024,
.version_ignore = FALSE,
- .shutdown_clients = TRUE
+ .shutdown_clients = TRUE,
+ .verbose_proctitle = FALSE
};
const struct setting_parser_info master_service_setting_parser_info = {
diff -r 3ce7879e3ac0 -r 4d91cec713cf src/lib-master/master-service-settings.h
--- a/src/lib-master/master-service-settings.h Wed Nov 03 14:59:39 2010 +0000
+++ b/src/lib-master/master-service-settings.h Wed Nov 03 15:23:52 2010 +0000
@@ -15,6 +15,7 @@
uoff_t config_cache_size;
bool version_ignore;
bool shutdown_clients;
+ bool verbose_proctitle;
};
struct master_service_settings_input {
diff -r 3ce7879e3ac0 -r 4d91cec713cf src/lib-master/master-service.c
--- a/src/lib-master/master-service.c Wed Nov 03 14:59:39 2010 +0000
+++ b/src/lib-master/master-service.c Wed Nov 03 15:23:52 2010 +0000
@@ -827,6 +827,15 @@
ssize_t ret;
bool important_update;
+ if ((service->flags & MASTER_SERVICE_FLAG_UPDATE_PROCTITLE) != 0 &&
+ service->set != NULL && service->set->verbose_proctitle) T_BEGIN {
+ unsigned int used_count = service->total_available_count -
+ service->master_status.available_count;
+
+ process_title_set(t_strdup_printf("[%u connections]",
+ used_count));
+ } T_END;
+
important_update = master_status_update_is_important(service);
if (service->master_status.pid == 0 ||
service->master_status.available_count ==
diff -r 3ce7879e3ac0 -r 4d91cec713cf src/lib-master/master-service.h
--- a/src/lib-master/master-service.h Wed Nov 03 14:59:39 2010 +0000
+++ b/src/lib-master/master-service.h Wed Nov 03 15:23:52 2010 +0000
@@ -19,7 +19,10 @@
/* Use MASTER_LOGIN_NOTIFY_FD to track login overflow state */
MASTER_SERVICE_FLAG_TRACK_LOGIN_STATE = 0x40,
/* If master sends SIGINT, don't die even if we don't have clients */
- MASTER_SERVICE_FLAG_NO_IDLE_DIE = 0x80
+ MASTER_SERVICE_FLAG_NO_IDLE_DIE = 0x80,
+ /* Show number of connections in process title
+ (only if verbose_proctitle setting is enabled) */
+ MASTER_SERVICE_FLAG_UPDATE_PROCTITLE = 0x100
};
struct master_service_connection {
More information about the dovecot-cvs
mailing list