summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-event.c12
-rw-r--r--src/udev/udev-rules.c6
-rw-r--r--src/udev/udev.h4
-rw-r--r--src/udev/udevadm-settle.c12
-rw-r--r--src/udev/udevd.c16
5 files changed, 25 insertions, 25 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 2b9fdf6748..11540f7bc1 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -48,7 +48,7 @@ struct udev_event *udev_event_new(struct udev_device *dev)
event->udev = udev;
udev_list_init(udev, &event->run_list, false);
event->fd_signal = -1;
- event->birth_usec = now_usec();
+ event->birth_usec = now(CLOCK_MONOTONIC);
event->timeout_usec = 30 * 1000 * 1000;
return event;
}
@@ -466,9 +466,9 @@ static void spawn_read(struct udev_event *event,
int i;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec) {
log_error("timeout '%s'\n", cmd);
goto out;
@@ -554,9 +554,9 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid)
int fdcount;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec)
timeout = 1000;
else
@@ -860,7 +860,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0)
udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db));
else if (udev_device_get_usec_initialized(event->dev) == 0)
- udev_device_set_usec_initialized(event->dev, now_usec());
+ udev_device_set_usec_initialized(event->dev, now(CLOCK_MONOTONIC));
/* (re)write database file */
udev_device_update_db(dev);
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 6f64bf6055..494ca7b689 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -47,7 +47,7 @@ struct uid_gid {
struct udev_rules {
struct udev *udev;
char **dirs;
- unsigned long long *dirs_ts_usec;
+ usec_t *dirs_ts_usec;
int resolve_names;
/* every key in the rules file becomes a token */
@@ -1691,7 +1691,7 @@ bool udev_rules_check_timestamp(struct udev_rules *rules)
if (stat(rules->dirs[i], &stats) < 0)
continue;
- if (rules->dirs_ts_usec[i] == ts_usec(&stats.st_mtim))
+ if (rules->dirs_ts_usec[i] == timespec_load(&stats.st_mtim))
continue;
/* first check */
@@ -1701,7 +1701,7 @@ bool udev_rules_check_timestamp(struct udev_rules *rules)
}
/* update timestamp */
- rules->dirs_ts_usec[i] = ts_usec(&stats.st_mtim);
+ rules->dirs_ts_usec[i] = timespec_load(&stats.st_mtim);
}
out:
return changed;
diff --git a/src/udev/udev.h b/src/udev/udev.h
index b0bd4d1961..a1dc3ee617 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -41,8 +41,8 @@ struct udev_event {
gid_t gid;
struct udev_list run_list;
int exec_delay;
- unsigned long long birth_usec;
- unsigned long long timeout_usec;
+ usec_t birth_usec;
+ usec_t timeout_usec;
int fd_signal;
unsigned int builtin_run;
unsigned int builtin_ret;
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index e70b351eb9..c4fc4ee4e5 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -47,9 +47,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{}
};
- unsigned long long start_usec = now_usec();
- unsigned long long start = 0;
- unsigned long long end = 0;
+ usec_t start_usec = now(CLOCK_MONOTONIC);
+ usec_t start = 0;
+ usec_t end = 0;
int quiet = 0;
const char *exists = NULL;
unsigned int timeout = 120;
@@ -123,7 +123,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
start = 0;
end = 0;
}
- log_debug("start=%llu end=%llu current=%llu\n", start, end, kernel_seq);
+ log_debug("start=%llu end=%llu current=%llu\n", (unsigned long long)start, (unsigned long long)end, kernel_seq);
} else {
if (end > 0) {
log_error("seq-end needs seq-start parameter, ignoring\n");
@@ -199,9 +199,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
}
if (timeout > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - start_usec;
+ age_usec = now(CLOCK_MONOTONIC) - start_usec;
if (age_usec / (1000 * 1000) >= timeout) {
struct udev_list_entry *list_entry;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 9bbc8ec8ad..b69f3f87de 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -122,7 +122,7 @@ struct worker {
struct udev_monitor *monitor;
enum worker_state state;
struct event *event;
- unsigned long long event_start_usec;
+ usec_t event_start_usec;
};
/* passed from worker to main process */
@@ -378,7 +378,7 @@ out:
worker->monitor = worker_monitor;
worker->pid = pid;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
worker->event = event;
event->state = EVENT_RUNNING;
udev_list_node_append(&worker->node, &worker_list);
@@ -409,7 +409,7 @@ static void event_run(struct event *event)
worker_ref(worker);
worker->event = event;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
event->state = EVENT_RUNNING;
return;
}
@@ -1374,7 +1374,7 @@ int main(int argc, char *argv[])
udev_list_node_init(&worker_list);
for (;;) {
- static unsigned long long last_usec;
+ static usec_t last_usec;
struct epoll_event ev[8];
int fdcount;
int timeout;
@@ -1445,7 +1445,7 @@ int main(int argc, char *argv[])
if (worker->state != WORKER_RUNNING)
continue;
- if ((now_usec() - worker->event_start_usec) > 30 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > 30 * 1000 * 1000) {
log_error("worker [%u] %s timeout; kill it\n", worker->pid,
worker->event ? worker->event->devpath : "<idle>");
kill(worker->pid, SIGKILL);
@@ -1479,13 +1479,13 @@ int main(int argc, char *argv[])
}
/* check for changed config, every 3 seconds at most */
- if ((now_usec() - last_usec) > 3 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - last_usec) > 3 * 1000 * 1000) {
if (udev_rules_check_timestamp(rules))
reload = true;
if (udev_builtin_validate(udev))
reload = true;
- last_usec = now_usec();
+ last_usec = now(CLOCK_MONOTONIC);
}
/* reload requested, HUP signal received, rules changed, builtin changed */
@@ -1505,7 +1505,7 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL) {
- udev_device_set_usec_initialized(dev, now_usec());
+ udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC));
if (event_queue_insert(dev) < 0)
udev_device_unref(dev);
}