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.

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

brooks created this revision.Feb 23 2018, 9:47 PM

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

emaste accepted this revision.Feb 28 2018, 2:47 AM

Fine with me

This revision is now accepted and ready to land.Feb 28 2018, 2:47 AM
jhb added a comment.Feb 28 2018, 11:06 PM

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.

kib accepted this revision.Mar 1 2018, 11:55 AM
jhb accepted this revision.Mar 2 2018, 6:00 PM

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.