tizen 2.4 release
[external/systemd.git] / man / sd-daemon.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
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
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
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
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd-daemon"
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 &lt;systemd/sd-daemon.h&gt;</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
74                 <para><filename>sd-daemon.h</filename> provide APIs
75                 for new-style daemons, as implemented by the
76                 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
77                 init system.</para>
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
86                 implemented. In addition to these functions, a couple
87                 of logging prefixes are defined as macros:</para>
88
89                 <programlisting>#define SD_EMERG   "&lt;0&gt;"  /* system is unusable */
90 #define SD_ALERT   "&lt;1&gt;"  /* action must be taken immediately */
91 #define SD_CRIT    "&lt;2&gt;"  /* critical conditions */
92 #define SD_ERR     "&lt;3&gt;"  /* error conditions */
93 #define SD_WARNING "&lt;4&gt;"  /* warning conditions */
94 #define SD_NOTICE  "&lt;5&gt;"  /* normal but significant condition */
95 #define SD_INFO    "&lt;6&gt;"  /* informational */
96 #define SD_DEBUG   "&lt;7&gt;"  /* debug-level messages */</programlisting>
97
98                 <para>These prefixes are intended to be used in
99                 conjunction with stderr-based logging as implemented
100                 by systemd. If a systemd service definition file is
101                 configured with
102                 <varname>StandardError=journal</varname>,
103                 <varname>StandardError=syslog</varname> or
104                 <varname>StandardError=kmsg</varname>, these prefixes
105                 can be used to encode a log level in lines
106                 printed. This is similar to the kernel
107                 <function>printk()</function>-style logging. See
108                 <citerefentry><refentrytitle>klogctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
109                 for more information.</para>
110
111                 <para>The log levels are identical to
112                 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>'s
113                 log level system. To use these prefixes simply prefix
114                 every line with one of these strings. A line that is
115                 not prefixed will be logged at the default log level
116                 SD_INFO.</para>
117
118                 <example>
119                         <title>Hello World</title>
120
121                         <para>A daemon may log with the log level
122                         NOTICE by issuing this call:</para>
123
124                         <programlisting>fprintf(stderr, SD_NOTICE "Hello World!\n");</programlisting>
125                 </example>
126         </refsect1>
127
128         <xi:include href="libsystemd-pkgconfig.xml" />
129
130         <refsect1>
131                 <title>See Also</title>
132                 <para>
133                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
134                         <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135                         <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136                         <citerefentry><refentrytitle>sd_booted</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137                         <citerefentry><refentrytitle>sd_is_fifo</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138                         <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139                         <citerefentry><refentrytitle>daemon</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
140                         <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
141                         <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
142                         <citerefentry project='man-pages'><refentrytitle>fprintf</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
143                         <citerefentry><refentrytitle>sd-readahead</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
144                         <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
145                 </para>
146         </refsect1>
147
148 </refentry>