sysupdated: port to notify_recv()
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "errno-util.h"
|
||||
#include "event-source.h"
|
||||
#include "event-util.h"
|
||||
#include "fd-util.h"
|
||||
@@ -172,6 +173,30 @@ int event_add_child_pidref(
|
||||
return sd_event_add_child(e, s, pid->pid, options, callback, userdata);
|
||||
}
|
||||
|
||||
int event_source_get_child_pidref(sd_event_source *s, PidRef *ret) {
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
assert(ret);
|
||||
|
||||
pid_t pid;
|
||||
r = sd_event_source_get_child_pid(s, &pid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
int pidfd = sd_event_source_get_child_pidfd(s);
|
||||
if (pidfd < 0)
|
||||
return pidfd;
|
||||
|
||||
/* Note, we don't actually duplicate the fd here, i.e. we do not pass ownership of this PidRef to the caller */
|
||||
*ret = (PidRef) {
|
||||
.pid = pid,
|
||||
.fd = pidfd,
|
||||
};
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
dual_timestamp* event_dual_timestamp_now(sd_event *e, dual_timestamp *ts) {
|
||||
assert(e);
|
||||
assert(ts);
|
||||
|
||||
@@ -37,6 +37,8 @@ int event_add_time_change(sd_event *e, sd_event_source **ret, sd_event_io_handle
|
||||
|
||||
int event_add_child_pidref(sd_event *e, sd_event_source **s, const PidRef *pid, int options, sd_event_child_handler_t callback, void *userdata);
|
||||
|
||||
int event_source_get_child_pidref(sd_event_source *s, PidRef *ret);
|
||||
|
||||
dual_timestamp* event_dual_timestamp_now(sd_event *e, dual_timestamp *ts);
|
||||
|
||||
void event_source_unref_many(sd_event_source **array, size_t n);
|
||||
|
||||
Reference in New Issue
Block a user