From: Timo Sirainen Date: Mon, 19 Oct 2009 22:31:46 +0000 (-0400) Subject: master: Keep service's processes in an easily accessible linked list. X-Git-Tag: 2.0.alpha2~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cd2518bab14292a67cf8a490b58ab9ef89879da;p=thirdparty%2Fdovecot%2Fcore.git master: Keep service's processes in an easily accessible linked list. --HG-- branch : HEAD --- diff --git a/src/master/service-process.c b/src/master/service-process.c index c0f21eaf2d..de35c59578 100644 --- a/src/master/service-process.c +++ b/src/master/service-process.c @@ -10,6 +10,7 @@ #include "base64.h" #include "hash.h" #include "str.h" +#include "llist.h" #include "hostpid.h" #include "env-util.h" #include "fd-close-on-exec.h" @@ -566,7 +567,8 @@ service_process_create(struct service *service, const char *const *auth_args, i_assert(fd[0] == -1); break; } - + + DLLIST_PREPEND(&service->processes, process); process->refcount = 1; process->pid = pid; process->uid = uid; @@ -588,6 +590,7 @@ void service_process_destroy(struct service_process *process) struct service *service = process->service; struct service_list *service_list = service->list; + DLLIST_REMOVE(&service->processes, process); hash_table_remove(service_pids, &process->pid); if (process->available_count > 0) diff --git a/src/master/service-process.h b/src/master/service-process.h index 102c0b34fb..1d780c5b15 100644 --- a/src/master/service-process.h +++ b/src/master/service-process.h @@ -2,6 +2,7 @@ #define SERVICE_PROCESS_H struct service_process { + struct service_process *prev, *next; struct service *service; int refcount; diff --git a/src/master/service.h b/src/master/service.h index 5b0238dde6..1a17ec106b 100644 --- a/src/master/service.h +++ b/src/master/service.h @@ -62,6 +62,8 @@ struct service { /* all listeners, even those that aren't currently listening */ ARRAY_DEFINE(listeners, struct service_listener *); + /* linked list of all processes belonging to this service */ + struct service_process *processes; /* number of processes currently created for this service */ unsigned int process_count;