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-1335 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 #if !defined(__STDC_FORMAT_MACROS) 28 #define __STDC_FORMAT_MACROS 29 #endif // !defined(__STDC_FORMAT_MACROS) 30 #include <systemd/sd-daemon.h> 31 /** INTERVAL in seconds followed by printf style status */ 32 #define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \ 33 sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000) 34 35 #else 36 #define sd_notify(X, Y) 37 #define sd_notifyf(E, F, ...) 38 #define service_manager_extend_timeout(I, FMTSTR, ...) 39 #endif 40 41 #endif /* MY_SERVICE_MANAGER_INCLUDED */ 42