Page MenuHomeFreeBSD

Don't declare union semun in userspace unless _WANT_SEMUN is defined.
ClosedPublic

Authored by brooks on Feb 23 2018, 9:47 PM.
Tags
None
Referenced Files
F81675399: D14492.diff
Fri, Apr 19, 6:38 PM
Unknown Object (File)
Dec 21 2023, 9:37 PM
Unknown Object (File)
Dec 20 2023, 4:30 AM
Unknown Object (File)
Nov 21 2023, 4:09 AM
Unknown Object (File)
Nov 21 2023, 4:09 AM
Unknown Object (File)
Nov 21 2023, 4:09 AM
Unknown Object (File)
Nov 21 2023, 3:37 AM
Unknown Object (File)
Nov 1 2023, 9:09 AM
Subscribers

Details

Summary

POSIX explicitly states that the application must declare union semun.
This makes no sense, but it is what it is.

In a ports exp-run a moderate number of ports fail due to a lack of
approprate autotools-like discovery mechanisms. These issues are
addresses in D14137 which will be committed before this change.

PR: 224300, 224443

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15236
Build 15300: arc lint + arc unit

Event Timeline

This depends on D14137 and is intended to be committed along with D14490 and D14491.

This revision is now accepted and ready to land.Feb 28 2018, 2:47 AM

I do wonder if it wouldn't be better to break with POSIX in this case and just expose it. Is there something in particular that motivates hiding it besides POSIX compliance?

In D14492#305171, @jhb wrote:

I do wonder if it wouldn't be better to break with POSIX in this case and just expose it. Is there something in particular that motivates hiding it besides POSIX compliance?

I ran into it when trying to run some NetBSD tests since NetBSD is compliant. As things stand we differ from Linux and NetBSD. MacOS put it under:

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)

The amount we break is minimal in the grand scheme of things and in several cases in ports we're actually breaking local patches to Linux code that we're presumably carrying because upstream doesn't want non-portable changes.

There's no major problem with the current situation but due to the C type system there's no way to write portable C code against this interface unless the target is standards compliant.

That works for me then. It might be helpful to note in the commit message that other OS's also hide it by default.

This revision was automatically updated to reflect the committed changes.