| 1 |
#pragma once |
| 2 |
|
| 3 |
/* |
| 4 |
* Launcher |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <c-rbtree.h> |
| 8 |
#include <c-stdaux.h> |
| 9 |
#include <stdlib.h> |
| 10 |
#include <systemd/sd-bus.h> |
| 11 |
#include <systemd/sd-event.h> |
| 12 |
#include "util/dirwatch.h" |
| 13 |
#include "util/log.h" |
| 14 |
#include "util/misc.h" |
| 15 |
|
| 16 |
typedef struct Launcher Launcher; |
| 17 |
|
| 18 |
enum { |
| 19 |
_LAUNCHER_E_SUCCESS, |
| 20 |
|
| 21 |
LAUNCHER_E_INVALID_CONFIG, |
| 22 |
LAUNCHER_E_INVALID_SERVICE_FILE, |
| 23 |
}; |
| 24 |
|
| 25 |
struct Launcher { |
| 26 |
sd_event *event; |
| 27 |
sd_bus *bus_controller; |
| 28 |
sd_bus *bus_regular; |
| 29 |
Log log; |
| 30 |
int fd_listen; |
| 31 |
bool audit; |
| 32 |
bool user_scope; |
| 33 |
char *configfile; |
| 34 |
Dirwatch *dirwatch; |
| 35 |
sd_event_source *dirwatch_src; |
| 36 |
CRBTree services; |
| 37 |
CRBTree services_by_name; |
| 38 |
uint64_t service_ids; |
| 39 |
uint32_t uid; |
| 40 |
uint32_t gid; |
| 41 |
uint64_t max_bytes; |
| 42 |
uint64_t max_fds; |
| 43 |
uint64_t max_matches; |
| 44 |
bool at_console; |
| 45 |
}; |
| 46 |
|
| 47 |
int launcher_new(Launcher **launcherp, int listen_fd, bool audit, const char *configfile, bool user_scope); |
| 48 |
Launcher *launcher_free(Launcher *launcher); |
| 49 |
|
| 50 |
C_DEFINE_CLEANUP(Launcher *, launcher_free); |
| 51 |
|
| 52 |
int launcher_listen_inherit(Launcher *launcher); |
| 53 |
int launcher_run(Launcher *launcher); |