]> git.proxmox.com Git - systemd.git/blob - man/sd-daemon.3
Imported Upstream version 214
[systemd.git] / man / sd-daemon.3
1 '\" t
2 .TH "SD\-DAEMON" "3" "" "systemd 214" "sd-daemon"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd-daemon, SD_EMERG, SD_ALERT, SD_CRIT, SD_ERR, SD_WARNING, SD_NOTICE, SD_INFO, SD_DEBUG \- APIs for new\-style daemons
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-daemon\&.h>
29 .fi
30 .ft
31 .HP \w'\fBpkg\-config\ \-\-cflags\ \-\-libs\ libsystemd\fR\ 'u
32 \fBpkg\-config \-\-cflags \-\-libs libsystemd\fR
33 .SH "DESCRIPTION"
34 .PP
35 sd\-daemon\&.h
36 provide APIs for new\-style daemons, as implemented by the
37 \fBsystemd\fR(1)
38 init system\&.
39 .PP
40 See
41 \fBsd_listen_fds\fR(3),
42 \fBsd_notify\fR(3),
43 \fBsd_booted\fR(3),
44 \fBsd_is_fifo\fR(3),
45 \fBsd_watchdog_enabled\fR(3)
46 for more information about the functions implemented\&. In addition to these functions, a couple of logging prefixes are defined as macros:
47 .sp
48 .if n \{\
49 .RS 4
50 .\}
51 .nf
52 #define SD_EMERG "<0>" /* system is unusable */
53 #define SD_ALERT "<1>" /* action must be taken immediately */
54 #define SD_CRIT "<2>" /* critical conditions */
55 #define SD_ERR "<3>" /* error conditions */
56 #define SD_WARNING "<4>" /* warning conditions */
57 #define SD_NOTICE "<5>" /* normal but significant condition */
58 #define SD_INFO "<6>" /* informational */
59 #define SD_DEBUG "<7>" /* debug\-level messages */
60 .fi
61 .if n \{\
62 .RE
63 .\}
64 .PP
65 These prefixes are intended to be used in conjunction with stderr\-based logging as implemented by systemd\&. If a systemd service definition file is configured with
66 \fIStandardError=syslog\fR
67 or
68 \fIStandardError=kmsg\fR, these prefixes can be used to encode a log level in lines printed\&. This is similar to the kernel
69 \fBprintk()\fR\-style logging\&. See
70 \fBklogctl\fR(2)
71 for more information\&.
72 .PP
73 The log levels are identical to
74 \fBsyslog\fR(3)\*(Aqs log level system\&. To use these prefixes simply prefix every line with one of these strings\&. A line that is not prefixed will be logged at the default log level SD_INFO\&.
75 .PP
76 \fBExample\ \&1.\ \&Hello World\fR
77 .PP
78 A daemon may log with the log level NOTICE by issuing this call:
79 .sp
80 .if n \{\
81 .RS 4
82 .\}
83 .nf
84 fprintf(stderr, SD_NOTICE "Hello World!\en");
85 .fi
86 .if n \{\
87 .RE
88 .\}
89 .SH "NOTES"
90 .PP
91 These APIs are implemented as a shared library, which can be compiled and linked to with the
92 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
93 file\&.
94 .SH "SEE ALSO"
95 .PP
96 \fBsystemd\fR(1),
97 \fBsd_listen_fds\fR(3),
98 \fBsd_notify\fR(3),
99 \fBsd_booted\fR(3),
100 \fBsd_is_fifo\fR(3),
101 \fBsd_watchdog_enabled\fR(3),
102 \fBdaemon\fR(7),
103 \fBsystemd.service\fR(5),
104 \fBsystemd.socket\fR(5),
105 \fBfprintf\fR(3),
106 \fBsd-readahead\fR(3),
107 \fBpkg-config\fR(1)