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

sysdeps: Add WivOS #1235

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

sysdeps: Add WivOS #1235

wants to merge 23 commits into from

Conversation

StartForKiller
Copy link

Finally after some work, WivOS is fully working on upstream.

So here is the first big commit to upstream WivOS sysdep to mlibc.

Geertiebear and others added 23 commits August 1, 2022 20:24
In this sweep, I decided to extract all SIO* ioctl families into a
common abi-bit.
Currently, the only platform providing bits/syscall.h is Linux. Linux is
also the only platform whose users rely on unistd.h including
<bits/syscall.h>. Precedent set by other platforms is that the syscall
function is provided by the sysdep itself, and as such, this would not
be a useful change.

In conclusion, <bits/syscall.h> is provided on an as-wants basis,
depending on platform.
Here, it is enough (maybe even excessive) to check for the Linux option,
at least until the header is, for one reason or another, included in
mlibc.
relying on defined()/if{,n}def is prone to typos, and might go
undetected to a long time, due to possibly subtle differences
Excerpt from sys/socket.h:
	// Control message format:
	// The offsets marked with ^ are aligned to alignof(size_t).
	//
	// |---HEADER---|---DATA---|---PADDING---|---HEADER---|...
	// ^            ^                        ^
	// |---------CMSG_LEN------|
	// |---------------CMSG_SPACE------------|

By this definition, control message header and data should both be
aligned to (at least) alignof(size_t), however, previously, the
implementation of these macros in options/posix relied on
sizeof(struct cmsghdr) % sizeof(size_t) being zero. After the recent
change to socklen_t, this no longer held true, and DATA would be aligned
to a 12 byte boundary (on x86_64), and hence would move all data back a
bit. Code that relied on CMSG_ALIGN() to compute sizes of cmsg data
(notably, sysdeps/managarm) hence broke as a result.

The change in this commit fixes that misalignment.
@no92
Copy link
Member

no92 commented Jan 28, 2025

You need to rebase. Having old commits and merge commits is a no-no in a pull request.

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.

8 participants