diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:36:47 +0000 |
commit | 0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch) | |
tree | 3f3789daa2f6db22da6e55e92bee0062a7d613fe /src/master/service-process.h | |
parent | Initial commit. (diff) | |
download | dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip |
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/master/service-process.h')
-rw-r--r-- | src/master/service-process.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/master/service-process.h b/src/master/service-process.h new file mode 100644 index 0000000..f3e47bb --- /dev/null +++ b/src/master/service-process.h @@ -0,0 +1,56 @@ +#ifndef SERVICE_PROCESS_H +#define SERVICE_PROCESS_H + +struct service_process { + struct service_process *prev, *next; + struct service *service; + int refcount; + + pid_t pid; + /* uid is used to check for old/invalid status messages */ + unsigned int uid; + + /* number of new connections process is currently accepting */ + unsigned int available_count; + /* Approximate number of connections process has ever accepted. + This isn't exact, because its calculation is based on + available_count updates, which aren't done on every single + connection/disconnection. With a busy process it might be a lot + smaller than the correct value. */ + unsigned int total_count; + + /* Time when process started idling, or 0 if we're not idling. This is + updated when the process sends a notification via its status pipe + about the number of clients it is processing. + + This field also determines whether the process is in the service's + "busy" or "idle" processes linked list. */ + time_t idle_start; + /* Timeout for processing idle-kill SIGINT. Either the process will die + or it sends a notification about not being idling anymore */ + struct timeout *to_idle_kill; + + /* time when we last received a status update */ + time_t last_status_update; + /* time when we last sent SIGINT to process */ + time_t last_kill_sent; + + /* kill the process if it doesn't send initial status notification */ + struct timeout *to_status; + + bool destroyed:1; +}; + +#define SERVICE_PROCESS_IS_INITIALIZED(process) \ + ((process)->to_status == NULL) + +struct service_process *service_process_create(struct service *service); +void service_process_destroy(struct service_process *process); + +void service_process_ref(struct service_process *process); +void service_process_unref(struct service_process *process); + +void service_process_log_status_error(struct service_process *process, + int status); + +#endif |