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