diff options
| author | Warner Losh <imp@FreeBSD.org> | 2024-05-31 14:44:55 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2024-05-31 14:44:55 +0000 |
| commit | 676041c41ba587285bb934aa2fca290ea7208038 (patch) | |
| tree | 479c205403dec0fa8b3bee6a80a33acb255aa54c | |
| parent | aca928a50a42f00f344df934005b09dbcb4e2f77 (diff) | |
WPA: Allow CLOCK_BOOTTIME and CLOCK_MONOTONIC to #define the same
Historically, these have been differnet values, and only one was defined
or they were defined as different values. Now that they are about to be
the same value, add #ifdef to cope.
Sponsored by: Netflix
Reviewed by: olce, val_packett.cool, adrian
Differential Revision: https://reviews.freebsd.org/D45418
| -rw-r--r-- | contrib/wpa/src/utils/os_unix.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/wpa/src/utils/os_unix.c b/contrib/wpa/src/utils/os_unix.c index 315c973f3228..a856179fb3b1 100644 --- a/contrib/wpa/src/utils/os_unix.c +++ b/contrib/wpa/src/utils/os_unix.c @@ -72,7 +72,6 @@ int os_get_time(struct os_time *t) return res; } - int os_get_reltime(struct os_reltime *t) { #ifndef __MACH__ @@ -97,16 +96,22 @@ int os_get_reltime(struct os_reltime *t) return 0; } switch (clock_id) { -#ifdef CLOCK_BOOTTIME +#if defined(CLOCK_BOOTTIME) case CLOCK_BOOTTIME: clock_id = CLOCK_MONOTONIC; break; #endif -#ifdef CLOCK_MONOTONIC +#if defined(CLOCK_MONOTONIC) +/* + * FreeBSD has both BOOTTIME and MONOTONIC defined to the same value, since they + * mean the same thing. FreeBSD 14.1 and ealier don't, so need this case. + */ +#if !(defined(CLOCK_BOOTTIME) && CLOCK_BOOTTIME == CLOCK_MONOTONIC) case CLOCK_MONOTONIC: clock_id = CLOCK_REALTIME; break; #endif +#endif case CLOCK_REALTIME: return -1; } |
