From 4054d76151678edc7c6b77ebdebb9a32d1dc11c9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 14 Apr 2023 17:48:47 +0200 Subject: sd-daemon: add sd_pid_notifyf_with_fds() I guess it was only a question of time until we need to add the final frontier of notification functions: one that combines the features of all the others: 1. specifiying a source PID 2. taking a list of fds to send along 3. accepting a format string for the status string Hence, let's add it. --- man/sd_notify.xml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'man/sd_notify.xml') diff --git a/man/sd_notify.xml b/man/sd_notify.xml index f93542e329..b82d145860 100644 --- a/man/sd_notify.xml +++ b/man/sd_notify.xml @@ -22,6 +22,7 @@ sd_pid_notify sd_pid_notifyf sd_pid_notify_with_fds + sd_pid_notifyf_with_fds sd_notify_barrier Notify service manager about start-up completion and other service status changes @@ -67,6 +68,16 @@ unsigned n_fds + + int sd_pid_notifyf_with_fds + pid_t pid + int unset_environment + const int *fds + size_t n_fds + const char *format + + + int sd_notify_barrier int unset_environment @@ -326,12 +337,12 @@ able to properly attribute the message to the unit, and thus will ignore it, even if NotifyAccess= is set for it. - Hence, to eliminate all race conditions involving lookup of the client's unit and attribution of notifications - to units correctly, sd_notify_barrier() may be used. This call acts as a synchronization point - and ensures all notifications sent before this call have been picked up by the service manager when it returns - successfully. Use of sd_notify_barrier() is needed for clients which are not invoked by the - service manager, otherwise this synchronization mechanism is unnecessary for attribution of notifications to the - unit. + Hence, to eliminate all race conditions involving lookup of the client's unit and attribution of + notifications to units correctly, sd_notify_barrier() may be used. This call acts as + a synchronization point and ensures all notifications sent before this call have been picked up by the + service manager when it returns successfully. Use of sd_notify_barrier() is needed + for clients which are not invoked by the service manager, otherwise this synchronization mechanism is + unnecessary for attribution of notifications to the unit. sd_notifyf() is similar to sd_notify() but takes a printf()-like format string plus arguments. @@ -352,6 +363,11 @@ that file descriptors sent to the service manager on a message without FDSTORE=1 are immediately closed on reception. + sd_pid_notifyf_with_fds() is a combination of + sd_pid_notify_with_fds() and sd_notifyf(), i.e. it accepts both + a PID and a set of file descriptors as input, and processes a format string to generate the state + string. + sd_notify_barrier() allows the caller to synchronize against reception of previously sent notification messages and uses the BARRIER=1 command. It takes a relative timeout value in microseconds which is passed to -- cgit v1.2.1