Skip to content

Update use of libc::timespec to prepare for future libc version#91

Merged
alexcrichton merged 1 commit intoalexcrichton:mainfrom
wesleywiser:musl-1.2
Dec 7, 2022
Merged

Update use of libc::timespec to prepare for future libc version#91
alexcrichton merged 1 commit intoalexcrichton:mainfrom
wesleywiser:musl-1.2

Conversation

@wesleywiser
Copy link
Copy Markdown
Contributor

In a future release of the libc crate, libc::timespec will contain private padding fields on *-linux-musl targets and so the struct will no longer be able to be created using the literal initialization syntax.

Update struct literal use of libc::timespec to initialize to zero first and then manually update the appropriate fields. Also updates a raw syscall to use the libc function instead as on musl 1.2, it correctly handles libc::timespec values which, in musl 1.2, are always 16 bytes in length regardless of platform.

See also rust-lang/libc#2088

In a future release of the `libc` crate, `libc::timespec` will contain
private padding fields on `*-linux-musl` targets and so the struct will
no longer be able to be created using the literal initialization syntax.

Update struct literal use of `libc::timespec` to initialize to zero
first and then manually update the appropriate fields. Also updates a
raw syscall to use the libc function instead as on musl 1.2, it
correctly handles `libc::timespec` values which, in musl 1.2, are
always 16 bytes in length regardless of platform.
@alexcrichton alexcrichton merged commit bcce691 into alexcrichton:main Dec 7, 2022
@alexcrichton
Copy link
Copy Markdown
Owner

Thanks!

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.

2 participants