-
Notifications
You must be signed in to change notification settings - Fork 167
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
Using libgnu, on Haiku? #1251
Comments
Rustix and Rust are capable of linking to native C libraries and consuming them through their C ABIs. This is normal for rustix on platforms where the lowest-level platform interface is a C library with a C ABI. I imagine rustix could do this on Haiku using libgnu as well. That said, I myself am not familiar with Haiku or libgnu, so any help anyone could provide on how to use these interfaces would be appreciated! |
From what I can tell, headers/gnu/sys/xattr.h is the first revision of the Linux-compatible xattr C header, as a thin C veneer, over its native "multidimensional" C++ xattr API. That API's symbols are exported from "libgnu", and are not part of the kernel-level system call interface, or Haiku's equivalent of the UNIX C Library ("libroot"), but is still an integral part of the OS, provided for compatibility with third-party software. (There's also a "libbsd", which does what it says on the tin, and provides supplementary symbols, derived from OpenBSD code). Doing some more digging, it appears that https://github.com/haiku/haiku/blob/master/headers/compatibility/gnu/sys/xattr.h is where it was moved to, but the original patch is probably the most elegant way of understanding the implementation, as well as the interface, it seems... The native API has a FourCC type, associated with attribute names, which gets concatenated together, with "user.haiku", and the "friendly name"/"user-defined name", to make the Linux-style xattr names, that get consumed by things like libarchive, and the Haiku port of BSDTAR. For compatibility with the "xattr" library, it would probably make sense to pass through the Linux-style API, exposed by libgnu, although exposing the native C++ APIs (which can probably be deduced, from the aforementioned header file) could be useful, for some more advanced/granular use cases. |
FWIW, it looks like https://github.com/haiku/haiku/tree/master/src/libs/gnu also has some scheduler-affinity stuff, and they also expose Linux-compatible pthreads, and maths APIs, but for my usecase, I mostly only need xattr support. |
Looks like rust-libc might already link against libgnu, if my understanding of rust-lang/libc@2bc73cc#diff-cabddc4ae5f30cea1808e5bbd02a3ae8e801193e998a6e5788fa54884ed61404 is correct. |
As part of Stebalien/xattr#63, I observed that Haiku implements a "Linux-compatible" xattr interface, as a wrapper, around its native BeOS-derived C++ APIs.
However, from what I understand, these functions are exported from its "libgnu" compatibility library, rather than as part of its "libroot" library, or any kind of kernel system call interface, so I assume that anything that uses Rustix, like that xattr library will not function, for fetching extended attributes, on this platform?
Sadly, as I'm largely unfamiliar with Rust, and interoperability with native libraries, I assume that either Rustix, or the xattr library would somehow have to link to the native libraries, and consume them, through the C ABI, and foreign function interface bindings, which I assume this project would be unwilling to support?
Any thoughts?
The text was updated successfully, but these errors were encountered: