[Bug 273373] <sys/timerfd.h> fails to build in POSIX mode due to namespace pollution

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 28 Aug 2023 08:44:39 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273373

--- Comment #4 from Jan Beich <jbeich@FreeBSD.org> ---
Both attachment 244373 and review D41600?id=126574 are not self-sufficient:

$ cat a.c
#include <sys/timerfd.h>
int main() { timerfd_create(CLOCK_MONOTONIC, 0); return 0; }

$ cc a.c
a.c:2:29: error: use of undeclared identifier 'CLOCK_MONOTONIC'
int main() { timerfd_create(CLOCK_MONOTONIC, 0); return 0; }
                            ^
1 error generated.

as found via www/chromium

../../third_party/wayland/src/src/event-loop.c:318:28: error: use of undeclared
identifier 'CLOCK_MONOTONIC'
        timer_fd = timerfd_create(CLOCK_MONOTONIC,
                                  ^
../../third_party/wayland/src/src/event-loop.c:495:2: warning: call to
undeclared function 'clock_gettime'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]
        clock_gettime(CLOCK_MONOTONIC, &now);
        ^
../../third_party/wayland/src/src/event-loop.c:495:16: error: use of undeclared
identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &now);
                      ^
../../third_party/wayland/src/src/event-loop.c:620:3: warning: call to
undeclared function 'clock_gettime'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]
                clock_gettime(CLOCK_MONOTONIC, &deadline);
                ^
../../third_party/wayland/src/src/event-loop.c:620:17: error: use of undeclared
identifier 'CLOCK_MONOTONIC'
                clock_gettime(CLOCK_MONOTONIC, &deadline);
                              ^

Note, clock_gettime() is also affected due to namespace pollution in glibc/musl
where <sys/timerfd.h> includes <time.h>. On FreeBSD clock_gettime() was
provided via <sys/proc.h> -> <sys/time.h>.

-- 
You are receiving this mail because:
You are the assignee for the bug.