mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-07 05:10:36 +01:00
n-acd: use CLOCK_MONOTONIC timers on older kernels
The README states that a kernel >= 3.0 is enough, however CLOCK_BOOTTIME is only available since kernel 3.15. Fall back to CLOCK_MONOTONIC when CLOCK_BOOTTIME is not available. See: https://github.com/nettools/n-acd/pull/3 Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
This commit is contained in:
parent
8a01bdc2d1
commit
8c3023d471
1 changed files with 7 additions and 0 deletions
|
|
@ -264,6 +264,13 @@ _public_ int n_acd_new(NAcd **acdp) {
|
|||
}
|
||||
|
||||
acd->fd_timer = timerfd_create(CLOCK_BOOTTIME, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
if (acd->fd_timer < 0 && errno == EINVAL) {
|
||||
/*
|
||||
* Fall back to CLOCK_MONOTONIC when CLOCK_BOOTTIME is
|
||||
* not available (kernel < 3.15).
|
||||
*/
|
||||
acd->fd_timer = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
}
|
||||
if (acd->fd_timer < 0) {
|
||||
r = -n_acd_errno();
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue