Skip to content

Conversation

@guoci
Copy link

@guoci guoci commented Feb 19, 2022

macro values may vary across OSes

macro values may vary across OS
@smacke
Copy link
Owner

smacke commented Mar 27, 2022

Hey, thanks for the PR! Could you provide some comments on which OSes deviate from the constants here? Originally this project is targeted primarily at Linux and I'm not aware of which other OSes support O_DIRECT; e.g. I don't see it in BSD.

Also, I'm not too fond of the idea of spinning up another process in a statically-scoped context, but it's been a while since I've used Java so maybe this sort of thing is standard practice? Either way I'd prefer a different approach that doesn't require spawning other processes, and that has the current constants available as a fallback in case something goes wrong.

@guoci
Copy link
Author

guoci commented Mar 28, 2022

My comment was not clear, I meant across Linux distros. The hardcoded macro value in Jaydio was triggering a bug. In that particular distro, it was for O_DIRECTORY instead of O_DIRECT.
I do not know of any way to obtain the values without gcc.
We could try to scan the system C headers with Java code, but that can get complicated, a macro symbol can be defined as another macro symbol, which must be resolved to get the value.

@smacke
Copy link
Owner

smacke commented Mar 28, 2022

Thanks for the extra context! Which distro had different constants from the hardcoded ones?

@fcyu
Copy link

fcyu commented Mar 30, 2022

It's Ubuntu 20.04.4 LTS (GNU/Linux 5.11.0-1028-aws aarch64). The CPU is Arm-based AWS Graviton2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants