-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Require 1003.1-2008 for libunix #10505
base: trunk
Are you sure you want to change the base?
Conversation
The selection of POSIX options was done by "what gets rid of all the |
I think that what wants to happen here is that we determine the range of POSIX macros required (basically what's above, adding |
Fair enough! (I might add the _POSIX_THREAD_SAFE_FUNCTIONS stuff in a later PR, it would avoid some weird bugs on weird platforms that we're currently subject to) |
Naively, I was expecting something like "we require POSIX 2003 and we use the POSIX feature macros The improvements compared with the existing code are 1- we can remove a bunch of It sounds like you want to require POSIX 2008 and a bunch of optional features, and fail configuration if they are not there. Isn't this going too far? Or am I missing something obvious? |
FYI, I suspect the various BSDs will happily fix their feature macros if it turns out they support a newer version of the APIs than they advertise. That won't help things in the short term of course. |
Ah, I had assumed that the point in saying that we require something is that we would not need to test for it in the code, thus removing no-longer-tested emulations. Obviously for Going through it for the emulations, rather than just the "not available" exceptions, requiring 1003.1-2001 + X/OPEN means:
These emulations would remain, but would be removed if we required 1003.1-2008 + X/OPEN:
The only emulation which requires an option in both is the fallback to |
Rather than going all-in on removing all the I don't particularly mind, this was just an experiment. I do find it slightly strange that it's possible to configure (in error) OCaml such that |
Please don't give up! I think this change goes in the right direction, but we need some collective thinking (before writing even more code) to agree on where to put the bar between "configure refuses to build OCaml" and "lots of functions may fail at run-time". I agree that |
Based on #10505 (comment), "requiring 1003.1-2001 + X/OPEN" and keeping some emulations in mmap.c and sleep.c sounds very reasonable to me. Again, I'm more concerned about removing configure tests (too many, not reliable enough) than about eradicating all emulation code. |
Sounds reasonable, except that I'd really like to get rid of the HAS_ macros, Windows ports permitting. Defining the HAS_ macros in terms of the POSIX checks just adds one level of indirection and makes the code much harder to read.
Yes, of course. |
One last thing: what about |
Don't worry, I wasn't 🙂 I meant that it's not a pressing thing to move forwards for me, so I wouldn't have minded if you had preferred it closed. How does this sound based on everything so far:
#ifdef CAML_INTERNALS
#define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE 600
#endif
|
Cross-referencing #11115 (comment) with a note that if |
b27b7a8
to
42d998b
Compare
Assume presence of fchmod, fchown, getcwd, getgroups, mktime, setitimer, nice, putenv, realpath, rewinddir, setsid and termios.h functions.
Continuing from #10397 (comment), a brief Sunday musing on the amount of code which we could drop by requiring Issue 7 for libunix. I've marked the PR as draft partly for discussion and partly because if we do adopt it, the
configure
checks are not yet correct. However, this does all pass precheck as it stands.The Unix library builds with either:
_POSIX_VERSION >= 200809L
,_XOPEN_VERSION >= 700
plus_POSIX_IPV6
and_POSIX_SPAWN
)._POSIX_VERSION >= 200112L
,_XOPEN_VERSION >= 600
plus_POSIX_IPV6
,_POSIX_SPAWN
,_POSIX_TIMERS
,and_POSIX_SYNCHRONIZED_IO
_POSIX_MAPPED_FILES | _POSIX_SHARED_MEMORY_OBJECTS | _POSIX_TYPED_MEMORY_OBJECTS
)We couldn't entirely go all-in on 1003-1.2008 because at least macOS and FreeBSD (or at least FreeBSD on the precheck workers) have everything needed, but only report 1003-1.2001.
The removal of emulation modes which are presumably not really being tested anywhere is quite tempting, as is the reduction in the number of tests needed in
configure
(POSIX clearly defines these feature probing macros, so it'd be nice, and quicker, to adopt them).References: Issue 6 (2004) and Issue 7 (2008). I have checked the definition and conformance level of each macro/function check which has been removed, and I believe all the changes are correct.