Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

nlink_t and blksize_t are defined incorrectly on for aarch64 linux #240

Closed
robbavey opened this issue Jun 1, 2021 · 0 comments · Fixed by #241
Closed

nlink_t and blksize_t are defined incorrectly on for aarch64 linux #240

robbavey opened this issue Jun 1, 2021 · 0 comments · Fixed by #241
Milestone

Comments

@robbavey
Copy link
Contributor

robbavey commented Jun 1, 2021

Looking at the values defined here and here in TypeAliases.java for the aarch64 platform, the type aliases for nlink_t and blksize_t do not match the value in the stat struct
https://github.com/jnr/jnr-ffi/blob/master/src/main/java/jnr/ffi/provider/jffi/platform/aarch64/linux/TypeAliases.java

https://github.com/jnr/jnr-ffi/blob/master/src/main/java/jnr/ffi/provider/jffi/platform/aarch64/linux/TypeAliases.java#L52:

m.put(TypeAlias.nlink_t, NativeType.ULONG);

vs

/usr/include/bits/stat.h:    __nlink_t st_nlink;		/* Link count.  */
/usr/include/bits/types.h:__STD_TYPE __NLINK_T_TYPE __nlink_t;	/* Type of file link counts.  */
/usr/include/bits/typesizes.h:#define __NLINK_T_TYPE		__U32_TYPE

And

https://github.com/jnr/jnr-ffi/blob/master/src/main/java/jnr/ffi/provider/jffi/platform/aarch64/linux/TypeAliases.java#L44

m.put(TypeAlias.blksize_t, NativeType.SLONG);

vs:

/usr/include/bits/stat.h:    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
/usr/include/bits/types.h:__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
/usr/include/bits/typesizes.h:#define __BLKSIZE_T_TYPE	__S32_TYPE

which manifests itself in File.stat running on jruby-9.2.17.0 presenting incorrect results on these nodes.

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

Successfully merging a pull request may close this issue.

2 participants