]>
Commit | Line | Data |
---|---|---|
f9378423 LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
f9378423 LP |
4 | |
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
f9378423 LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
f9378423 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
f9378423 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
6a70f3aa | 24 | <refentry id="sd-daemon" |
798d3a52 ZJS |
25 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
26 | ||
27 | <refentryinfo> | |
28 | <title>sd-daemon</title> | |
29 | <productname>systemd</productname> | |
30 | ||
31 | <authorgroup> | |
32 | <author> | |
33 | <contrib>Developer</contrib> | |
34 | <firstname>Lennart</firstname> | |
35 | <surname>Poettering</surname> | |
36 | <email>lennart@poettering.net</email> | |
37 | </author> | |
38 | </authorgroup> | |
39 | </refentryinfo> | |
40 | ||
41 | <refmeta> | |
42 | <refentrytitle>sd-daemon</refentrytitle> | |
43 | <manvolnum>3</manvolnum> | |
44 | </refmeta> | |
45 | ||
46 | <refnamediv> | |
47 | <refname>sd-daemon</refname> | |
48 | <refname>SD_EMERG</refname> | |
49 | <refname>SD_ALERT</refname> | |
50 | <refname>SD_CRIT</refname> | |
51 | <refname>SD_ERR</refname> | |
52 | <refname>SD_WARNING</refname> | |
53 | <refname>SD_NOTICE</refname> | |
54 | <refname>SD_INFO</refname> | |
55 | <refname>SD_DEBUG</refname> | |
56 | <refpurpose>APIs for | |
57 | new-style daemons</refpurpose> | |
58 | </refnamediv> | |
59 | ||
60 | <refsynopsisdiv> | |
61 | <funcsynopsis> | |
62 | <funcsynopsisinfo>#include <systemd/sd-daemon.h></funcsynopsisinfo> | |
63 | </funcsynopsis> | |
64 | ||
65 | <cmdsynopsis> | |
66 | <command>pkg-config --cflags --libs libsystemd</command> | |
67 | </cmdsynopsis> | |
68 | ||
69 | </refsynopsisdiv> | |
70 | ||
71 | <refsect1> | |
72 | <title>Description</title> | |
73 | ||
dc83f27a | 74 | <para><filename>sd-daemon.h</filename> provides APIs for new-style |
798d3a52 ZJS |
75 | daemons, as implemented by the |
76 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
dc83f27a | 77 | service manager.</para> |
798d3a52 ZJS |
78 | |
79 | <para>See | |
80 | <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
81 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
82 | <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
83 | <citerefentry><refentrytitle>sd_is_fifo</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
84 | <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
85 | for more information about the functions implemented. In addition | |
86 | to these functions, a couple of logging prefixes are defined as | |
87 | macros:</para> | |
88 | ||
89 | <programlisting>#define SD_EMERG "<0>" /* system is unusable */ | |
f9378423 LP |
90 | #define SD_ALERT "<1>" /* action must be taken immediately */ |
91 | #define SD_CRIT "<2>" /* critical conditions */ | |
92 | #define SD_ERR "<3>" /* error conditions */ | |
93 | #define SD_WARNING "<4>" /* warning conditions */ | |
94 | #define SD_NOTICE "<5>" /* normal but significant condition */ | |
95 | #define SD_INFO "<6>" /* informational */ | |
96 | #define SD_DEBUG "<7>" /* debug-level messages */</programlisting> | |
97 | ||
798d3a52 ZJS |
98 | <para>These prefixes are intended to be used in conjunction with |
99 | stderr-based logging as implemented by systemd. If a systemd | |
100 | service definition file is configured with | |
101 | <varname>StandardError=journal</varname>, | |
102 | <varname>StandardError=syslog</varname> or | |
103 | <varname>StandardError=kmsg</varname>, these prefixes can be used | |
104 | to encode a log level in lines printed. This is similar to the | |
105 | kernel <function>printk()</function>-style logging. See | |
106 | <citerefentry><refentrytitle>klogctl</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
107 | for more information.</para> | |
108 | ||
109 | <para>The log levels are identical to | |
110 | <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>'s | |
111 | log level system. To use these prefixes simply prefix every line | |
112 | with one of these strings. A line that is not prefixed will be | |
113 | logged at the default log level SD_INFO.</para> | |
114 | ||
115 | <example> | |
116 | <title>Hello World</title> | |
117 | ||
118 | <para>A daemon may log with the log level NOTICE by issuing this | |
119 | call:</para> | |
120 | ||
121 | <programlisting>fprintf(stderr, SD_NOTICE "Hello World!\n");</programlisting> | |
122 | </example> | |
123 | </refsect1> | |
124 | ||
125 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
126 | ||
127 | <refsect1> | |
128 | <title>See Also</title> | |
129 | <para> | |
130 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
131 | <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
132 | <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
133 | <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
134 | <citerefentry><refentrytitle>sd_is_fifo</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
135 | <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
136 | <citerefentry><refentrytitle>daemon</refentrytitle><manvolnum>7</manvolnum></citerefentry>, | |
137 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
138 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
139 | <citerefentry project='man-pages'><refentrytitle>fprintf</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
140 | <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
141 | </para> | |
142 | </refsect1> | |
f9378423 LP |
143 | |
144 | </refentry> |