Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions php_systemd.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define PHP_SYSTEMD_EXTNAME "systemd"

PHP_FUNCTION(sd_journal_send);
PHP_FUNCTION(sd_notify);

extern zend_module_entry systemd_module_entry;
#define phpext_systemd_ptr &systemd_module_entry
Expand Down
16 changes: 16 additions & 0 deletions systemd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#endif
#include "php.h"
#include "php_systemd.h"
#include <systemd/sd-daemon.h>
#include <systemd/sd-journal.h>

zend_function_entry systemd_functions[] = {
PHP_FE(sd_journal_send, NULL)
PHP_FE(sd_notify, NULL)
{NULL, NULL, NULL} // Sentinel
};

Expand Down Expand Up @@ -63,3 +65,17 @@ PHP_FUNCTION(sd_journal_send)

RETURN_TRUE;
}

PHP_FUNCTION(sd_notify)
{
int unset_environment;
char *state;
int state_len;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls",
&unset_environment, &state, &state_len) != SUCCESS) {
RETURN_FALSE;
}

RETURN_LONG(sd_notify(unset_environment, state));
}