-
Notifications
You must be signed in to change notification settings - Fork 0
/
cobalt-daemon.h
54 lines (42 loc) · 1.05 KB
/
cobalt-daemon.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* cobalt-daemon
*
* This is a little C language module to include into your Linux (or
* other POSIX compatible) applications, which will allow to easily
* drop root privileges and become a daemon service process running
* under a special user or *nobody*.
*
* See the provided example program for a quick start.
*
* https://github.com/0xebef/cobalt-daemon
*
* License: LGPLv3 or later
*
* Copyright (c) 2016, 0xebef
*/
#ifndef COBALT_DAEMON_H_INCLUDED
#define COBALT_DAEMON_H_INCLUDED
#if defined(__cplusplus)
extern "C" {
#endif
#include <limits.h>
/*
* configuration
*/
/* umask of the daemon, see umask(2) manual page */
#define DAEMON_UMASK (S_IWGRP | S_IWOTH) /* umask 022 */
/* syslog facility, see syslog(3) manual page */
#define DAEMON_LOG_FACILITY (LOG_USER)
/*
* external variable declarations
*/
extern int pidfile_fd;
extern char pidfile_name[PATH_MAX];
/*
* function declarations
*/
int cobalt_daemon(const char *username, const char *daemonname);
#if defined(__cplusplus)
}
#endif
#endif /* COBALT_DAEMON_H_INCLUDED */