164 lines
4.5 KiB
HTML
164 lines
4.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD-DAEMON</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD-DAEMON</H1>
|
|
Section: sd-daemon (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd-daemon, SD_EMERG, SD_ALERT, SD_CRIT, SD_ERR, SD_WARNING, SD_NOTICE, SD_INFO, SD_DEBUG - APIs for new-style daemons
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-daemon.h">systemd/sd-daemon.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>pkg-config --cflags --libs libsystemd</B>
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<DD>sd-daemon.h
|
|
provides APIs for new-style daemons, as implemented by the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1)
|
|
service manager.
|
|
<P>
|
|
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_listen_fds">sd_listen_fds</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_notify">sd_notify</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_booted">sd_booted</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_is_fifo">sd_is_fifo</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_watchdog_enabled">sd_watchdog_enabled</A></B>(3)
|
|
for more information about the functions implemented. In addition to these functions, a couple of logging prefixes are defined as macros:
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
#define SD_EMERG "<0>" /* system is unusable */
|
|
#define SD_ALERT "<1>" /* action must be taken immediately */
|
|
#define SD_CRIT "<2>" /* critical conditions */
|
|
#define SD_ERR "<3>" /* error conditions */
|
|
#define SD_WARNING "<4>" /* warning conditions */
|
|
#define SD_NOTICE "<5>" /* normal but significant condition */
|
|
#define SD_INFO "<6>" /* informational */
|
|
#define SD_DEBUG "<7>" /* debug-level messages */
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
These prefixes are intended to be used in conjunction with stderr-based logging (or stdout-based logging) as implemented by systemd. If a systemd service definition file is configured with
|
|
<I>StandardError=journal</I>,
|
|
<I>StandardError=syslog</I>
|
|
or
|
|
<I>StandardError=kmsg</I>
|
|
(and similar with
|
|
<I>StandardOutput=</I>), these prefixes can be used to encode a log level in lines printed. This is similar to the kernel
|
|
<B>printk()</B>-style logging. See
|
|
<B><A HREF="/cgi-bin/man/man2html?2+klogctl">klogctl</A></B>(2)
|
|
for more information.
|
|
<P>
|
|
|
|
The log levels are identical to
|
|
<B><A HREF="/cgi-bin/man/man2html?3+syslog">syslog</A></B>(3)'s 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.
|
|
<P>
|
|
|
|
<B>Example 1. Hello World</B>
|
|
<P>
|
|
|
|
A daemon may log with the log level NOTICE by issuing this call:
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
fprintf(stderr, SD_NOTICE "Hello World!\n");
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<P>
|
|
|
|
These APIs are implemented as a shared library, which can be compiled and linked to with the
|
|
<B>libsystemd</B> <B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
file.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_listen_fds">sd_listen_fds</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_notify">sd_notify</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_booted">sd_booted</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_is_fifo">sd_is_fifo</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_watchdog_enabled">sd_watchdog_enabled</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?7+daemon">daemon</A></B>(7),
|
|
<B><A HREF="/cgi-bin/man/man2html?5+systemd.service">systemd.service</A></B>(5),
|
|
<B><A HREF="/cgi-bin/man/man2html?5+systemd.socket">systemd.socket</A></B>(5),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fprintf">fprintf</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="7"><A HREF="#lbAE">NOTES</A><DD>
|
|
<DT id="8"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:55 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|