Debian Codegraph @

src/shared/daemon-util.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "sd-daemon.h" /* IWYU pragma: export */
5
6 #include "shared-forward.h"
7
8 #define NOTIFY_READY_MESSAGE "READY=1\n" "STATUS=Processing requests..."
9 #define NOTIFY_STOPPING_MESSAGE "STOPPING=1\n" "STATUS=Shutting down..."
10
11 static inline const char* notify_start(const char *start, const char *stop) {
12 if (start)
13 (void) sd_notify(false, start);
14
15 return stop;
16 }
17
18 /* This is intended to be used with _cleanup_ attribute. */
19 static inline void notify_on_cleanup(const char **p) {
20 if (*p)
21 (void) sd_notify(false, *p);
22 }
23
24 int notify_remove_fd_warn(const char *name);
25 int notify_remove_fd_warnf(const char *format, ...) _printf_(1, 2);
26 int close_and_notify_warn(int fd, const char *name);
27 int notify_push_fd(int fd, const char *name);
28 int notify_push_fdf(int fd, const char *format, ...) _printf_(2, 3);
29
30 bool fdstore_detected(void);
31
32 int notify_reloading_full(const char *status);
33 static inline int notify_reloading(void) {
34 return notify_reloading_full("Reloading configuration...");
35 }