summaryrefslogtreecommitdiff
path: root/src/daemon.h
blob: d060cb888b5f9a1bbdf30c941e379a3fd875d337 (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
28
29
30
31
32
33
34
35
36
#ifndef __DAEMON_H
#define __DAEMON_H

#include "errors.h"

#ifdef __cplusplus
extern "C" {
#endif

extern int daemon_parent_pipe[2];
extern int daemon_signal_pipe[2];

typedef struct daemon_t *daemon_p;

typedef struct daemon_params_t {
	const char *daemon_name;		/**< name of the daemon (used for setproctitle,
						     default name of the  pidfile, logfile) */
	const char *pid_filename;		/**< name of the pid/lock file */
	const char *group_name;			/**< group of the effective user */
	const char *user_name;			/**< name of the effective user */
} daemon_params_t;
		
daemon_p daemon_new( daemon_params_t params,
		     error_t *error );

void daemon_free( daemon_p demon );

error_t daemon_start( daemon_p demon );

void daemon_exit( daemon_p demon );

#ifdef __cplusplus
}
#endif

#endif /* ifndef __DAEMON_H */