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
Absorb platform detection hacks from jnr projects #260
Comments
I can add the code from jnr/jnr-enxio#39 myself in some neat way it's just the code that checks if FreeBSD is version > 12 right? if (Platform.getNativePlatform().getOS() == Platform.OS.FREEBSD) {
FreeBSD freeBSD = (Platform.FreeBSD) Platform.getNativePlatform();
int version = freeBSD.getVersion();
if (version >= 12) {
// do FreeBSD 12+ stuff
} else {
// do legacy stuff
}
} @headius Point me to the other hacks you're mentioning and I'll see if I can incorporate them in an elegant way as well. I won't be able to test any BSD code myself (never had any experience using a BSD) so I will have to assume the code I will bring in is correct. |
I poked around jnr-posix and found the following:
Additionally, jnr-constants has some suspiciously similar macros and platform lookup logic here: https://github.com/jnr/jnr-constants/blob/1d006ac75cdbab78491f22796f3e84e5be918b71/src/main/java/jnr/constants/PlatformConstants.java I looked over jnr-unixsocket and did not see anything that looked like platform detection. |
I should mention that some of the Linux platform detection logic is to differentiate glibc from e.g. musl, which I think is appropriate to leave in jnr-posix. |
Ok the version numbering hack has been added in #270 |
In jnr/jnr-enxio#39 we see the latest hack to detect platform, in this case detecting FreeBSD 12. A similar hack was done to jnr-posix, which contains many other such hacks to detect libc version on Linux and specific levels of *BSD. These platform-detection tricks are needed by nearly all consumers of jnr-ffi, so we should combine them and formalize the Platform API to be uniform for all jnr-ffi consumers.
The text was updated successfully, but these errors were encountered: