1/*
2 Copyright (c) 2015 Daniel Black. All rights reserved.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
16*/
17
18
19#ifndef MY_SERVICE_MANAGER_INCLUDED
20#define MY_SERVICE_MANAGER_INCLUDED
21
22#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY)
23/*
24 sd-daemon.h may include inttypes.h. Explicitly request format macros before
25 the first inclusion of inttypes.h.
26*/
27#define __STDC_FORMAT_MACROS
28#include <systemd/sd-daemon.h>
29/** INTERVAL in seconds followed by printf style status */
30#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \
31 sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000)
32
33#else
34#define sd_notify(X, Y)
35#define sd_notifyf(E, F, ...)
36#define service_manager_extend_timeout(I, FMTSTR, ...)
37#endif
38
39#endif /* MY_SERVICE_MANAGER_INCLUDED */
40