-static void
-set_up_signal(int flags)
-{
- struct sigaction sa;
-
- memset(&sa, 0, sizeof sa);
- sa.sa_handler = sigalrm_handler;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = flags;
- xsigaction(SIGALRM, &sa, NULL);
-}
-
-static void
-set_up_timer(void)
-{
- static timer_t timer_id; /* "static" to avoid apparent memory leak. */
- struct itimerspec itimer;
-
- if (!CACHE_TIME) {
- return;
- }
-
- if (timer_create(monotonic_clock.id, NULL, &timer_id)) {
- VLOG_FATAL("timer_create failed (%s)", ovs_strerror(errno));
- }
-
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_nsec = TIME_UPDATE_INTERVAL * 1000 * 1000;
- itimer.it_value = itimer.it_interval;
-
- if (timer_settime(timer_id, 0, &itimer, NULL)) {
- VLOG_FATAL("timer_settime failed (%s)", ovs_strerror(errno));
- }
-}
-
-/* Set up the interval timer, to ensure that time advances even without calling
- * time_refresh().
- *
- * A child created with fork() does not inherit the parent's interval timer, so
- * this function needs to be called from the child after fork(). */
-void
-time_postfork(void)
-{
- assert_single_threaded();
- time_init();
- set_up_timer();
-}
-
-/* Forces a refresh of the current time from the kernel. It is not usually
- * necessary to call this function, since the time will be refreshed
- * automatically at least every TIME_UPDATE_INTERVAL milliseconds. If
- * CACHE_TIME is false, we will always refresh the current time so this
- * function has no effect. */
-void
-time_refresh(void)
-{
- monotonic_clock.tick = wall_clock.tick = true;
-}
-