-
Notifications
You must be signed in to change notification settings - Fork 91
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
Update struct layout for aarch64 linux to match value on device #165
Conversation
The struct layout for aarch64 linux does not match that on AWS graviton2 nodes, missing several entries. This commit updates the layout to match the `stat` structure obtained from the device: ``` pahole -C stat /usr/lib/debug/lib64/libc.so.6.debug struct stat { __dev_t st_dev; /* 0 8 */ __ino_t st_ino; /* 8 8 */ __mode_t st_mode; /* 16 4 */ __nlink_t st_nlink; /* 20 4 */ __uid_t st_uid; /* 24 4 */ __gid_t st_gid; /* 28 4 */ __dev_t st_rdev; /* 32 8 */ __dev_t __pad1; /* 40 8 */ __off_t st_size; /* 48 8 */ __blksize_t st_blksize; /* 56 4 */ int __pad2; /* 60 4 */ /* --- cacheline 1 boundary (64 bytes) --- */ __blkcnt_t st_blocks; /* 64 8 */ struct timespec st_atim; /* 72 16 */ struct timespec st_mtim; /* 88 16 */ struct timespec st_ctim; /* 104 16 */ int __glibc_reserved[2]; /* 120 8 */ /* size: 128, cachelines: 2, members: 16 */ }; ``` This commit also updates the unit test for FileStat to include a test to verify `nlink` values - this was failing prior to this update.
Thanks again! This is the layout for glibc, I assume. Do we need to verify that any other libc are different, like musl? |
@headius Thanks for the quick merge! You are correct, this is the layout for /usr/include/aarch64-linux-musl/bits/stat.h:
Diff: struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
+ unsigned long __pad;
- __dev_t __pad1;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
+ unsigned __unused[2];
- int __glibc_reserved[2];
}; |
Thanks for the extra footwork! Those diffs seem like no problem. |
@shanjiantao Thank you! |
I will be pushing out a round of JNR releases today or tomorrow. |
The struct layout for aarch64 linux does not match that on AWS graviton2 nodes,
missing several entries.
This commit updates the layout to match the
stat
structure obtained from thedevice:
This commit also updates the unit test for FileStat to include a test to
verify
nlink
values - this was failing prior to this update.Relates: #164