-
Notifications
You must be signed in to change notification settings - Fork 1
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
Consolidate RawPOSIX constants #30
Comments
If we do this, then the system you build on will have those constants
loaded. So, for example, you might not be able to build parts of the
codebase on a Mac (as I have been doing).
I would recommend at least considering other approaches.
…On Mon, Nov 11, 2024 at 3:12 PM Nicholas Renner ***@***.***> wrote:
Currently RawPOSIX uses a mix of libc imported constants, old rustposix
constants, and now has a separate file for vmmap constants. Lets use the
libc constants to be more portable, and just define them by importing,
something like this:
let PROT_READ = libc::PROT_READ;
—
Reply to this email directly, view it on GitHub
<#30>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGROD7D4P6CZR4QSR4UTBT2AEFTPAVCNFSM6AAAAABRSRQROKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2TAMRZGY4TSMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I'm pretty agnostic as to how we handle this as long as it's consistent. You think it's better to define them ourselves? I know @Yaxuan-w started transitioning to using the libc constants, were there some issues that led to that decision? |
So, having the build system define them is making so that these (silently) change when the build system changes them (or doesn't have them defined, which occurred sometimes on my Mac). If you put references in the code to where you got them from, and define them in your code, you'll need to update these as Linux adds them, but the code will build and work everywhere. To me, the latter design is better --- so long as you always take care to note where you got the constants from... |
That makes sense to me. @Yaxuan-w did you need to use the libc constants when you were switching to RawPOSIX or was it just to match the syscalls we were importing? If its the latter lets go with our own defined constants like what we had in RustPOSIX, just documented better. |
ok that makes sense to me |
@ChinmayShringi here are the constants from RustPOSIX: https://github.com/Lind-Project/safeposix-rust/blob/develop/src/safeposix/syscalls/fs_constants.rs You should be able to copy these but its definitely worth doing a thorough review on all of these for correctness. |
Currently RawPOSIX uses a mix of libc imported constants, old rustposix constants, and now has a separate file for vmmap constants. Lets use the libc constants to be more portable, and just define them by importing, something like this:
The text was updated successfully, but these errors were encountered: