Skip to content
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

Expose mode from Luv.File.Stat.t as an integral or expose equality #134

Open
haesbaert opened this issue Oct 18, 2022 · 2 comments
Open
Labels

Comments

@haesbaert
Copy link
Contributor

mode is a Mode.numeric

There is no good way to get the file type, normally you would AND with S_IFMT and test for equality with all the S_* types.
Testing the bits with Mode.test is not enough since the bits are shared between different file types.

Currently the only way I found to figure the filetype was doing:

    let mode = (Obj.magic lst.mode : int) in

And then doing all the mask and comparison myself, see ocaml-multicore/eio#339

@aantron
Copy link
Owner

aantron commented Apr 7, 2023

This is indeed an awkward part of the API and will need to change. Historically, it became this way because S_IFMT was added later than the other bits. However, I see that this is no longer being used in eio_luv at the moment, so I think it can be delayed, after a maintenance release of Luv.

@aantron aantron removed this from the 0.5.12 milestone Apr 7, 2023
@haesbaert
Copy link
Contributor Author

Thank you for looking into this.
It's not a pressing matter for us as I ended up just grabing the stat directly through the Unix module.
There's also the future of luv/libuv being phased out in EIO in favor of eio_posix + some windows backend, not due to luv, more due to how libuv associates handles with loops which make it cumbersome to support in EIO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants