sd_notify.xml revision 8dd4c05b5495c7ffe0f12ace87e71abe17bd0a0e
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync This file is part of systemd.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync Copyright 2010 Lennart Poettering
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync systemd is free software; you can redistribute it and/or modify it
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync under the terms of the GNU Lesser General Public License as published by
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync the Free Software Foundation; either version 2.1 of the License, or
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync (at your option) any later version.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync systemd is distributed in the hope that it will be useful, but
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync WITHOUT ANY WARRANTY; without even the implied warranty of
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync Lesser General Public License for more details.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync You should have received a copy of the GNU Lesser General Public License
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync along with systemd; If not, see <http://www.gnu.org/licenses/>.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <refentryinfo>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <authorgroup>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </authorgroup>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </refentryinfo>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <refnamediv>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <refpurpose>Notify service manager about start-up completion and other service status changes</refpurpose>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </refnamediv>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <refsynopsisdiv>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcsynopsis>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcsynopsisinfo>#include <systemd/sd-daemon.h></funcsynopsisinfo>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcdef>int <function>sd_notify</function></funcdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>int <parameter>unset_environment</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const char *<parameter>state</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcdef>int <function>sd_notifyf</function></funcdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>int <parameter>unset_environment</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const char *<parameter>format</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcdef>int <function>sd_pid_notify</function></funcdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>pid_t <parameter>pid</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>int <parameter>unset_environment</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const char *<parameter>state</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcdef>int <function>sd_pid_notifyf</function></funcdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>pid_t <parameter>pid</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>int <parameter>unset_environment</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const char *<parameter>format</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <funcdef>int <function>sd_pid_notify_with_fds</function></funcdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>pid_t <parameter>pid</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>int <parameter>unset_environment</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const char *<parameter>state</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>const int *<parameter>fds</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <paramdef>unsigned <parameter>n_fds</parameter></paramdef>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcprototype>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </funcsynopsis>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync </refsynopsisdiv>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <para><function>sd_notify()</function> may be called by a service
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync to notify the service manager about state changes. It can be used
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync to send arbitrary information, encoded in an
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync environment-block-like string. Most importantly it can be used for
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync start-up completion notification.</para>
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <para>If the <parameter>unset_environment</parameter> parameter is
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync non-zero, <function>sd_notify()</function> will unset the
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <varname>$NOTIFY_SOCKET</varname> environment variable before
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync returning (regardless of whether the function call itself
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync succeeded or not). Further calls to
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync <function>sd_notify()</function> will then fail, but the variable
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync is no longer inherited by child processes.</para>
<citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>. File
to the service manager on messages that do not expect them (i.e.
<programlisting>sd_pid_notify_with_fds(0, 0, "FDSTORE=1\nFDNAME=foobar", &fd, 1);</programlisting>
<citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,