1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "sd-bus.h"
5 #include "sd-event.h"
6 
7 typedef struct Manager Manager;
8 
9 #include "hashmap.h"
10 #include "varlink.h"
11 #include "ratelimit.h"
12 
13 #define USERDB_WORKERS_MIN 3
14 #define USERDB_WORKERS_MAX 4096
15 
16 struct Manager {
17         sd_event *event;
18 
19         Set *workers_fixed;    /* Workers 0…USERDB_WORKERS_MIN */
20         Set *workers_dynamic;  /* Workers USERD_WORKERS_MIN+1…USERDB_WORKERS_MAX */
21 
22         sd_event_source *sigusr2_event_source;
23         sd_event_source *sigchld_event_source;
24 
25         int listen_fd;
26 
27         RateLimit worker_ratelimit;
28 };
29 
30 int manager_new(Manager **ret);
31 Manager* manager_free(Manager *m);
32 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
33 
34 int manager_startup(Manager *m);
35