summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-07-29 12:23:31 +0200
committerKay Sievers <kay@vrfy.org>2014-07-29 13:20:20 +0200
commit3a43da2832dc5360a638d043f469a6dcbe025582 (patch)
treee3b60e840bb087c1af7f458676e3ab6bf04ea49e /src/libsystemd
parentcf347234ae78630dd4aad8907f027965e7fb9040 (diff)
time-util: add and use USEC/NSEC_INFINIY
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-util.c2
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel-benchmark.c2
-rw-r--r--src/libsystemd/sd-event/sd-event.c12
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c2
5 files changed, 10 insertions, 10 deletions
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 6441c5b162..d41e53753f 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1265,7 +1265,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_message_append(m, "v", "t", (usec_t) -1);
+ r = sd_bus_message_append(m, "v", "t", USEC_INFINITY);
} else if (endswith(eq, "%")) {
double percent;
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 28fc19e2cf..0fadd1699e 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -2646,7 +2646,7 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) {
struct pollfd p[2] = {};
int r, e, n;
struct timespec ts;
- usec_t m = (usec_t) -1;
+ usec_t m = USEC_INFINITY;
assert(bus);
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
index 90257d4f3c..cd88e67c9e 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel-benchmark.c
@@ -47,7 +47,7 @@ static void server(sd_bus *b, size_t *result) {
assert_se(r >= 0);
if (r == 0)
- assert_se(sd_bus_wait(b, (usec_t) -1) >= 0);
+ assert_se(sd_bus_wait(b, USEC_INFINITY) >= 0);
if (!m)
continue;
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index b285017376..bf6f01cfad 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -407,9 +407,9 @@ _public_ int sd_event_new(sd_event** ret) {
e->n_ref = 1;
e->signal_fd = e->watchdog_fd = e->epoll_fd = e->realtime.fd = e->boottime.fd = e->monotonic.fd = e->realtime_alarm.fd = e->boottime_alarm.fd = -1;
- e->realtime.next = e->boottime.next = e->monotonic.next = e->realtime_alarm.next = e->boottime_alarm.next = (usec_t) -1;
+ e->realtime.next = e->boottime.next = e->monotonic.next = e->realtime_alarm.next = e->boottime_alarm.next = USEC_INFINITY;
e->original_pid = getpid();
- e->perturb = (usec_t) -1;
+ e->perturb = USEC_INFINITY;
assert_se(sigemptyset(&e->sigset) == 0);
@@ -796,7 +796,7 @@ static void initialize_perturb(sd_event *e) {
bit. Here, we calculate a perturbation usec offset from the
boot ID. */
- if (_likely_(e->perturb != (usec_t) -1))
+ if (_likely_(e->perturb != USEC_INFINITY))
return;
if (sd_id128_get_boot(&bootid) >= 0)
@@ -1751,7 +1751,7 @@ static int event_arm_timer(
if (d->fd < 0)
return 0;
- if (d->next == (usec_t) -1)
+ if (d->next == USEC_INFINITY)
return 0;
/* disarm */
@@ -1759,7 +1759,7 @@ static int event_arm_timer(
if (r < 0)
return r;
- d->next = (usec_t) -1;
+ d->next = USEC_INFINITY;
return 0;
}
@@ -1827,7 +1827,7 @@ static int flush_timer(sd_event *e, int fd, uint32_t events, usec_t *next) {
return -EIO;
if (next)
- *next = (usec_t) -1;
+ *next = USEC_INFINITY;
return 0;
}
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index b91d08012a..c19bad1bc9 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -473,7 +473,7 @@ static usec_t calc_elapse(uint64_t usec) {
static int rtnl_poll(sd_rtnl *rtnl, bool need_more, uint64_t timeout_usec) {
struct pollfd p[1] = {};
struct timespec ts;
- usec_t m = (usec_t) -1;
+ usec_t m = USEC_INFINITY;
int r, e;
assert(rtnl);