Use the uname syscall instead of calling the uname command #4274
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opam uses the
uname
syscall to get hold of theos
,arch
and in some casesos-version
variables in Unix environments.On POSIX-compliant systems, the
uname
syscall is available which theuname
command directly maps (for instance, in GNU coreutils: https://github.com/coreutils/coreutils/blob/master/src/uname.c)The idea behind this PR is to get all these variables without having to call an external command and instead of the
uname
syscall.This PR also fixes the value of
os-version
on FreeBSD, where it was previously gotten usinguname -U
(FreeBSD-only feature). However the value returned is rather odd for a version number:whereas the POSIX-compliant
uname -r
seems much more reasonable: