Lines Matching refs:sp
33 static void clock_state_release_timerfd(ClockState *sp) { in clock_state_release_timerfd() argument
34 sp->timerfd_event_source = sd_event_source_unref(sp->timerfd_event_source); in clock_state_release_timerfd()
35 sp->timerfd_fd = safe_close(sp->timerfd_fd); in clock_state_release_timerfd()
38 static void clock_state_release(ClockState *sp) { in clock_state_release() argument
39 clock_state_release_timerfd(sp); in clock_state_release()
40 sp->inotify_event_source = sd_event_source_unref(sp->inotify_event_source); in clock_state_release()
41 sp->inotify_fd = safe_close(sp->inotify_fd); in clock_state_release()
44 static int clock_state_update(ClockState *sp, sd_event *event);
46 static int update_notify_run_systemd_timesync(ClockState *sp) { in update_notify_run_systemd_timesync() argument
47 …sp->run_systemd_timesync_wd = inotify_add_watch(sp->inotify_fd, "/run/systemd/timesync", IN_CREATE… in update_notify_run_systemd_timesync()
48 return sp->run_systemd_timesync_wd; in update_notify_run_systemd_timesync()
55 ClockState *sp = userdata; in timerfd_handler() local
57 return clock_state_update(sp, sd_event_source_get_event(s)); in timerfd_handler()
60 static void process_inotify_event(sd_event *event, ClockState *sp, struct inotify_event *e) { in process_inotify_event() argument
61 if (e->wd == sp->run_systemd_wd) { in process_inotify_event()
63 if (sp->run_systemd_timesync_wd < 0) in process_inotify_event()
64 update_notify_run_systemd_timesync(sp); in process_inotify_event()
65 } else if (e->wd == sp->run_systemd_timesync_wd) { in process_inotify_event()
68 (void) inotify_rm_watch(sp->inotify_fd, sp->run_systemd_timesync_wd); in process_inotify_event()
69 sp->run_systemd_timesync_wd = -1; in process_inotify_event()
72 clock_state_update(sp, event); in process_inotify_event()
81 ClockState *sp = userdata; in inotify_handler() local
93 process_inotify_event(event, sp, e); in inotify_handler()
99 ClockState *sp, in clock_state_update() argument
106 clock_state_release_timerfd(sp); in clock_state_update()
137 sp->timerfd_fd = r; in clock_state_update()
144 sp->adjtime_state = r; in clock_state_update()
150 log_info("adjtime state %d status %x time %s", sp->adjtime_state, tx.status, in clock_state_update()
153 sp->has_watchfile = access("/run/systemd/timesync/synchronized", F_OK) >= 0; in clock_state_update()
154 if (sp->has_watchfile) in clock_state_update()
157 else if (sp->adjtime_state == TIME_ERROR) { in clock_state_update()
160 r = sd_event_add_io(event, &sp->timerfd_event_source, sp->timerfd_fd, in clock_state_update()
161 EPOLLIN, timerfd_handler, sp); in clock_state_update()