blob: b992ab3d460a51a1700aef776eed4eceff783cc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef UMBRELLA_DAEMON_H
#define UMBRELLA_DAEMON_H
/*
* daemon_init: set up signal handling, pid file, and socket directory.
* Returns 0 on success, -1 on error.
*/
int daemon_init(void);
/*
* daemon_daemonize: fork into background, detach from terminal.
* Call before daemon_init if running as a true background daemon.
* Pass 0 to run in foreground (useful for debugging/systemd).
*/
int daemon_daemonize(int foreground);
/*
* daemon_cleanup: remove pid file and socket on exit.
*/
void daemon_cleanup(void);
/*
* daemon_write_pid: write our pid to UMBRELLA_PID_FILE.
*/
int daemon_write_pid(void);
#endif /* UMBRELLA_DAEMON_H */
|