Skip to content

linux_like: remove non-sched_priority fields from sched_param for musl #3395

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

Closed
wants to merge 1 commit into from
Closed

linux_like: remove non-sched_priority fields from sched_param for musl #3395

wants to merge 1 commit into from

Conversation

nekopsykose
Copy link
Contributor

for musl, these names were removed in 827aa8fbcac89a63c6efb986871663861500cd13 (back to reserved space).
bminor/musl@827aa8f

since musl doesn't actually touch/implement these options, they shouldn't be exposed.


discovered in haileys/bark#4 . afaict, ohos is also musl-1.2 base, so we can drop that too. i can't speak for emscripten, maybe it's similar?

however, merely dropping the cfg like this changes the representation of the struct. afaict we want to match the representation to musl, so we have to keep the padding like musl does. in that case, the definition is:

struct sched_param {
	int sched_priority;
	int __reserved1;
#if _REDIR_TIME64
	long __reserved2[4];
#else
	struct {
		time_t __reserved1;
		long __reserved2;
	} __reserved2[2];
#endif
	int __reserved3;
};

i don't know how to map this back to rust

for musl, these names were removed in 827aa8fbcac89a63c6efb986871663861500cd13
(back to reserved space).
bminor/musl@827aa8f

since musl doesn't actually touch/implement these options, they
shouldn't be exposed.
@rustbot
Copy link
Collaborator

rustbot commented Oct 19, 2023

r? @JohnTitor

(rustbot has picked a reviewer for you, use r? to override)

@nekopsykose
Copy link
Contributor Author

ah, i see #1588 touched on this and left a fixme in libc-test..

@nekopsykose
Copy link
Contributor Author

it /should/ be correct to add the correct amount of type padding. for the #if, the documentation is in bminor/musl@1febd21 . what that means for us is we just assume it is true (new binaries).

that makes the struct

int sched_priority
int
long [4]
int

i can't find a reference on how to add 'invisible' padding (without adding a named type that has to be used). also seemingly these arent #[repr(C)], so i don't know how much this matters or not..

someone that knows more than me would have to elaborate on this, but would be nice to fix the definition, and if the fields are removed for all 3 we can drop the fixme from libc-test too i think

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

Successfully merging this pull request may close these issues.

3 participants