Page MenuHomeFreeBSD

timerfd: Namespace pollution adjustments
ClosedPublic

Authored by jfree on Aug 30 2023, 4:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 19, 6:50 AM
Unknown Object (File)
Wed, May 15, 8:55 AM
Unknown Object (File)
Thu, May 9, 10:15 PM
Unknown Object (File)
Thu, May 9, 9:23 AM
Unknown Object (File)
Thu, May 9, 5:05 AM
Unknown Object (File)
Wed, May 1, 9:51 PM
Unknown Object (File)
Wed, May 1, 4:10 PM
Unknown Object (File)
Tue, Apr 30, 6:36 AM
Subscribers

Details

Summary
Do not pollute userspace with <sys/proc.h>, instead declare struct thread
when _KERNEL is defined.

Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional
namespace pollution that mimics Linux. g/musl libcs include <time.h> in
their <sys/timerfd.h>, exposing clock gettime, settime functions and
CLOCK_ macro constants. Ports like Chromium expect this namespace
pollution and fail without it.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jfree requested review of this revision.Aug 30 2023, 4:41 AM
jfree created this revision.
This revision is now accepted and ready to land.Aug 30 2023, 4:53 AM

Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional namespace pollution that mimics Linux.

This should be explained by a comment IMO.

jfree edited the summary of this revision. (Show Details)

Add comment explaining intentional namespace pollution.

This revision now requires review to proceed.Sep 1 2023, 6:50 PM
markj added inline comments.
sys/sys/timerfd.h
34
This revision is now accepted and ready to land.Sep 1 2023, 8:20 PM

Reword comment to say the namespace instead of just namespace.

This revision now requires review to proceed.Sep 3 2023, 3:45 AM
jbeich added inline comments.
sys/sys/timerfd.h
34
  • Also <sys/_clock_id.h> for CLOCK_MONOTONIC as specified by timerfd(2) manpage
  • musl (Alpine), bionic (Android) and epoll-shim (previous behavior) have the same namespace pollution

Commit message (same as SUMMARY here?) should also reference bug 273373. I'm waiting for MFC to stable/14 before removing workarounds in 6 affected ports.

$ rg --sort-files -F -- '-D__BSD_VISIBLE -D__XSI_VISIBLE'
[...]
x11/mako/Makefile
43:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE

x11/swayimg/Makefile
84:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE

x11/sxmo-wayout/Makefile
36:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE

x11/wmenu/Makefile
35:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE

x11/xdg-desktop-portal-hyprland/Makefile
56:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE

x11/xdg-desktop-portal-wlr/Makefile
53:CFLAGS+=     -D__BSD_VISIBLE -D__XSI_VISIBLE
This revision was not accepted when it landed; it landed in state Needs Review.Sep 5 2023, 10:26 PM
Closed by commit rGfb5daae920ba: timerfd: Namespace pollution adjustments (authored by jfree, committed by imp). · Explain Why
This revision was automatically updated to reflect the committed changes.