MidnightBSD 4.0 (FreeBSD 13-stable base) does not provide sys/timerfd.h or the timerfd_create(2) / timerfd_settime(2) / timerfd_gettime(2) syscalls. FreeBSD added these in 14.0.
Why this matters
Upstream software increasingly assumes timerfd is available on any non-Windows platform, because it is present on Linux and on FreeBSD >= 14. Ports that use it need MidnightBSD-specific patches that FreeBSD does not carry, which means the divergence is ours to maintain.
The first concrete case is KDE Plasma 6.6.6. plasma-workspace added libclock/alignedtimer.cpp, which uses timerfd unconditionally:
#include <sys/timerfd.h>
...
m_timerFd = timerfd_create(CLOCK_REALTIME, O_CLOEXEC | O_NONBLOCK);
...
const int flags = TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET;
timerfd_settime(m_timerFd, flags, ×pec, nullptr);
libclock is not optional (unconditional add_subdirectory(libclock)), and the digital clock applet links it, so x11/plasma6-plasma-workspace does not build without it. FreeBSD's port needs no patch here because their base provides the API.
Current workaround
x11/plasma6-plasma-workspace now carries an mports-local patch that guards the timerfd path with __has_include(<sys/timerfd.h>) and falls back to a single-shot QTimer re-armed against the wall clock.
The fallback is functional but not equivalent. TFD_TIMER_CANCEL_ON_SET makes the kernel cancel the timer when the realtime clock is stepped, so the application learns about a clock change immediately. The QTimer fallback only re-aligns on its next tick, so after a clock step (NTP correction, suspend/resume, manual change) the clock applet can display a stale time for up to one interval — a minute for the minute timer.
The patch also has to be carried forward across future Plasma releases, and any other port adopting timerfd will need the same treatment.
Request
Import timerfd(2) from FreeBSD 14 into the MidnightBSD base system:
sys/sys/timerfd.h
- the
timerfd_create / timerfd_settime / timerfd_gettime syscalls
TFD_TIMER_ABSTIME, TFD_TIMER_CANCEL_ON_SET, TFD_CLOEXEC, TFD_NONBLOCK
Once base provides it, the __has_include guard in the Plasma patch resolves to the native path automatically and the fallback becomes dead code, so the port needs no further change to benefit.
References
- FreeBSD implementation:
sys/kern/sys_timerfd.c, sys/sys/timerfd.h (added in 14.0)
- Affected port:
x11/plasma6-plasma-workspace (Plasma 6.6.6)
- Upstream source:
libclock/alignedtimer.cpp in plasma-workspace
MidnightBSD 4.0 (FreeBSD 13-stable base) does not provide
sys/timerfd.hor thetimerfd_create(2)/timerfd_settime(2)/timerfd_gettime(2)syscalls. FreeBSD added these in 14.0.Why this matters
Upstream software increasingly assumes timerfd is available on any non-Windows platform, because it is present on Linux and on FreeBSD >= 14. Ports that use it need MidnightBSD-specific patches that FreeBSD does not carry, which means the divergence is ours to maintain.
The first concrete case is KDE Plasma 6.6.6.
plasma-workspaceaddedlibclock/alignedtimer.cpp, which uses timerfd unconditionally:libclockis not optional (unconditionaladd_subdirectory(libclock)), and the digital clock applet links it, sox11/plasma6-plasma-workspacedoes not build without it. FreeBSD's port needs no patch here because their base provides the API.Current workaround
x11/plasma6-plasma-workspacenow carries an mports-local patch that guards the timerfd path with__has_include(<sys/timerfd.h>)and falls back to a single-shotQTimerre-armed against the wall clock.The fallback is functional but not equivalent.
TFD_TIMER_CANCEL_ON_SETmakes the kernel cancel the timer when the realtime clock is stepped, so the application learns about a clock change immediately. The QTimer fallback only re-aligns on its next tick, so after a clock step (NTP correction, suspend/resume, manual change) the clock applet can display a stale time for up to one interval — a minute for the minute timer.The patch also has to be carried forward across future Plasma releases, and any other port adopting timerfd will need the same treatment.
Request
Import timerfd(2) from FreeBSD 14 into the MidnightBSD base system:
sys/sys/timerfd.htimerfd_create/timerfd_settime/timerfd_gettimesyscallsTFD_TIMER_ABSTIME,TFD_TIMER_CANCEL_ON_SET,TFD_CLOEXEC,TFD_NONBLOCKOnce base provides it, the
__has_includeguard in the Plasma patch resolves to the native path automatically and the fallback becomes dead code, so the port needs no further change to benefit.References
sys/kern/sys_timerfd.c,sys/sys/timerfd.h(added in 14.0)x11/plasma6-plasma-workspace(Plasma 6.6.6)libclock/alignedtimer.cppin plasma-workspace