return 0;
}
+_public_ int sd_event_add_time_relative(
+ sd_event *e,
+ sd_event_source **ret,
+ clockid_t clock,
+ uint64_t usec,
+ uint64_t accuracy,
+ sd_event_time_handler_t callback,
+ void *userdata) {
+
+ usec_t t;
+ int r;
+
+ /* Same as sd_event_add_time() but operates relative to the event loop's current point in time, and
+ * checks for overflow. */
+
+ r = sd_event_now(e, clock, &t);
+ if (r < 0)
+ return r;
+
+ if (usec >= USEC_INFINITY - t)
+ return -EOVERFLOW;
+
+ return sd_event_add_time(e, ret, clock, t + usec, accuracy, callback, userdata);
+}
+
static int signal_exit_callback(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
assert(s);
return 0;
}
+_public_ int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec) {
+ usec_t t;
+ int r;
+
+ assert_return(s, -EINVAL);
+ assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM);
+
+ r = sd_event_now(s->event, event_source_type_to_clock(s->type), &t);
+ if (r < 0)
+ return r;
+
+ if (usec >= USEC_INFINITY - t)
+ return -EOVERFLOW;
+
+ return sd_event_source_set_time(s, t + usec);
+}
+
_public_ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
assert_return(s, -EINVAL);
assert_return(usec, -EINVAL);
static int process_child(sd_event *e) {
sd_event_source *s;
- Iterator i;
int r;
assert(e);
the callback still sees the process as a zombie.
*/
- HASHMAP_FOREACH(s, e->child_sources, i) {
+ HASHMAP_FOREACH(s, e->child_sources) {
assert(s->type == SOURCE_CHILD);
if (s->pending)
if (d->buffer.ev.mask & IN_Q_OVERFLOW) {
struct inode_data *inode_data;
- Iterator i;
/* The queue overran, let's pass this event to all event sources connected to this inotify
* object */
- HASHMAP_FOREACH(inode_data, d->inodes, i) {
+ HASHMAP_FOREACH(inode_data, d->inodes) {
sd_event_source *s;
LIST_FOREACH(inotify.by_inode_data, s, inode_data->event_sources) {
if (s->type != SOURCE_POST) {
sd_event_source *z;
- Iterator i;
/* If we execute a non-post source, let's mark all
* post sources as pending */
- SET_FOREACH(z, s->event->post_sources, i) {
+ SET_FOREACH(z, s->event->post_sources) {
if (z->enabled == SD_EVENT_OFF)
continue;