<refname>sd_pid_notify_with_fds</refname>
<refname>sd_pid_notifyf_with_fds</refname>
<refname>sd_notify_barrier</refname>
+ <refname>sd_pid_notify_barrier</refname>
<refpurpose>Notify service manager about start-up completion and other service status changes</refpurpose>
</refnamediv>
<paramdef>int <parameter>unset_environment</parameter></paramdef>
<paramdef>uint64_t <parameter>timeout</parameter></paramdef>
</funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_pid_notify_barrier</function></funcdef>
+ <paramdef>pid_t <parameter>pid</parameter></paramdef>
+ <paramdef>int <parameter>unset_environment</parameter></paramdef>
+ <paramdef>uint64_t <parameter>timeout</parameter></paramdef>
+ </funcprototype>
</funcsynopsis>
</refsynopsisdiv>
previously sent notification messages and uses the <varname>BARRIER=1</varname> command. It takes a
relative <varname>timeout</varname> value in microseconds which is passed to
<citerefentry><refentrytitle>ppoll</refentrytitle><manvolnum>2</manvolnum>
- </citerefentry>. A value of UINT64_MAX is interpreted as infinite timeout.
- </para>
+ </citerefentry>. A value of UINT64_MAX is interpreted as infinite timeout.</para>
+
+ <para><function>sd_pid_notify_barrier()</function> is just like <function>sd_notify_barrier()</function>,
+ but allows specifying the originating PID for the notification message.</para>
</refsect1>
<refsect1>
sd_event_source_set_memory_pressure_type;
sd_event_source_set_memory_pressure_period;
sd_event_trim_memory;
+ sd_pid_notify_barrier;
} LIBSYSTEMD_253;
return r;
}
-_public_ int sd_notify_barrier(int unset_environment, uint64_t timeout) {
+_public_ int sd_pid_notify_barrier(pid_t pid, int unset_environment, uint64_t timeout) {
_cleanup_close_pair_ int pipe_fd[2] = PIPE_EBADF;
int r;
if (pipe2(pipe_fd, O_CLOEXEC) < 0)
return -errno;
- r = sd_pid_notify_with_fds(0, unset_environment, "BARRIER=1", &pipe_fd[1], 1);
+ r = sd_pid_notify_with_fds(pid, unset_environment, "BARRIER=1", &pipe_fd[1], 1);
if (r <= 0)
return r;
return 1;
}
+_public_ int sd_notify_barrier(int unset_environment, uint64_t timeout) {
+ return sd_pid_notify_barrier(0, unset_environment, timeout);
+}
+
_public_ int sd_pid_notify(pid_t pid, int unset_environment, const char *state) {
return sd_pid_notify_with_fds(pid, unset_environment, state, NULL, 0);
}
arg_fds = fdset_free(arg_fds); /* Close before we execute anything */
if (!arg_no_block) {
- r = sd_notify_barrier(0, 5 * USEC_PER_SEC);
+ r = sd_pid_notify_barrier(source_pid, /* unset_environment= */ false, 5 * USEC_PER_SEC);
if (r < 0)
return log_error_errno(r, "Failed to invoke barrier: %m");
if (r == 0)
*/
int sd_notify_barrier(int unset_environment, uint64_t timeout);
+/*
+ Just like sd_notify_barrier() but also takes a PID to send the barrier message from.
+*/
+int sd_pid_notify_barrier(pid_t pid, int unset_environment, uint64_t timeout);
+
/*
Returns > 0 if the system was booted with systemd. Returns < 0 on
error. Returns 0 if the system was not booted with systemd. Note