Weston stuff: fractional HiDPI, FreeBSD, Rust

Simon McVittie smcv at collabora.com
Fri Jan 19 12:16:47 UTC 2018


On Thu, 18 Jan 2018 at 18:25:02 +0000, Daniel Stone wrote:
> I do have another suggestion though: can you please change the platform
> checks (#ifdef __linux__ and #ifdef FreeBSD) to instead be feature
> checks? For example, CLOCK_MONOTONIC_RAW is behind a Linux ifdef and
> CLOCK_MONOTONIC_FAST is behind a FreeBSD ifdef. There's no reason
> either platform couldn't start providing the other's clocks.

Based on my experience with dbus, feature checks are desirable in general,
but I'd recommend leaving a comment

#ifdef CLOCK_MONOTONIC_RAW
  /* Used on Linux >= x.y and possibly elsewhere */
  ... code ...
#endif

or even an #error-based pseudo-assertion like this:

#ifdef CLOCK_MONOTONIC_RAW
  /* Used on Linux >= x.y and possibly elsewhere */
  ... code ...
#elif defined(__linux__)
# error Not having CLOCK_MONOTONIC_RAW on Linux is a regression
#endif

to indicate which features are expected to be present on which platforms.
Before I did the necessary archaeology in 2013, dbus supported 5 different
ways to do AF_UNIX credentials-passing, one of which (*BSD-compatible
LOCAL_CREDS) turned out to have been redundant with other mechanisms on
all known platforms, and had regressed in 2009 such that it didn't actually
work. https://bugs.freedesktop.org/show_bug.cgi?id=60340

(Admittedly, credentials-passing and other murky corners of AF_UNIX are
perhaps the place where feature-checks are least useful, because they
have very little standardization, with each specific mechanism tending
to be unique to one or two platforms anyway.)

    smcv


More information about the wayland-devel mailing list