chiark / gitweb /
systemadm: update UI when jobs/units change
[elogind.git] / sd-daemon.h
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 #ifndef foosddaemonhfoo
4 #define foosddaemonhfoo
5
6 /***
7   Copyright 2010 Lennart Poettering
8
9   Permission is hereby granted, free of charge, to any person
10   obtaining a copy of this software and associated documentation files
11   (the "Software"), to deal in the Software without restriction,
12   including without limitation the rights to use, copy, modify, merge,
13   publish, distribute, sublicense, and/or sell copies of the Software,
14   and to permit persons to whom the Software is furnished to do so,
15   subject to the following conditions:
16
17   The above copyright notice and this permission notice shall be
18   included in all copies or substantial portions of the Software.
19
20   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27   SOFTWARE.
28 ***/
29
30 /* Reference implementation of a few systemd related interfaces for
31  * writing daemons. These interfaces are trivial to implement, however
32  * to simplify porting we provide this reference
33  * implementation. Applications are free to reimplement the algorithms
34  * described here. */
35
36 /*
37   Log levels for usage on stderr:
38
39           fprintf(stderr, SD_NOTICE "Hello World!");
40
41   This is similar to printk() usage in the kernel.
42 */
43
44 #define SD_EMERG   "<0>"  /* system is unusable */
45 #define SD_ALERT   "<1>"  /* action must be taken immediately */
46 #define SD_CRIT    "<2>"  /* critical conditions */
47 #define SD_ERR     "<3>"  /* error conditions */
48 #define SD_WARNING "<4>"  /* warning conditions */
49 #define SD_NOTICE  "<5>"  /* normal but significant condition */
50 #define SD_INFO    "<6>"  /* informational */
51 #define SD_DEBUG   "<7>"  /* debug-level messages */
52
53 /* The first passed file descriptor is fd 3 */
54 #define SD_LISTEN_FDS_START 3
55
56 /* Returns how many file descriptors have been passed, or a negative
57  * errno code on failure. Optionally removes the $LISTEN_FDS and
58  * $LISTEN_PID file descriptors from the environment (recommended). */
59 int sd_listen_fds(int unset_environment);
60
61 #endif