mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
sd_notify (systemd status notifications) support
sd_notify() is used to notify systemd of changes to the status of the process. This allows the systemd daemon to know when the process finished loading (and thus only start another program after Asterisk has finished loading). To use this, use a systemd unit with 'Type=notify' for Asterisk. This commit also adds the function ast_sd_notify(), a wrapper around sd_notify that does nothing if not built with systemd support. Also adds support for libsystemd detection in the configure script. Change-Id: Ied6a59dafd5ef331c5c7ae8f3ccd2dfc94be7811
This commit is contained in:
10
main/io.c
10
main/io.c
@@ -36,6 +36,9 @@ ASTERISK_REGISTER_FILE()
|
||||
|
||||
#include "asterisk/io.h"
|
||||
#include "asterisk/utils.h"
|
||||
#ifdef HAVE_SYSTEMD
|
||||
#include <systemd/sd-daemon.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_IO
|
||||
#define DEBUG DEBUG_M
|
||||
@@ -384,3 +387,10 @@ int ast_get_termcols(int fd)
|
||||
return cols;
|
||||
}
|
||||
|
||||
int ast_sd_notify(const char *state) {
|
||||
#ifdef HAVE_SYSTEMD
|
||||
return sd_notify(0, state);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user