Skip to content

Conversation

@vadorovsky
Copy link
Contributor

Description

ioctl implementation in glibc takes unsigned long int[0]. The musl implementation takes int[1]. That causes incompatibility, since the libc::ioctl wrapper expects c_int on musl targets.

Given that ioctl is just a regular syscall handled by the Linux kernel, use libc::syscall directly, so we don't have to deal with the integer types.

[0] https://elixir.bootlin.com/glibc/glibc-2.41.9000/source/misc/sys/ioctl.h#L42
[1] https://elixir.bootlin.com/musl/v1.2.5/source/include/stropts.h#L133

Checklist

  • I have tested my changes locally
  • I have updated documentation if needed
  • I have added comments for complex logic
  • My changes generate no new warnings

`ioctl` implementation in glibc takes `unsigned long int`[0]. The musl
implementation takes `int`[1]. That causes incompatibility, since the
`libc::ioctl` wrapper expects `c_int` on musl targets.

Given that `ioctl` is just a regular syscall handled by the Linux
kernel, use `libc::syscall` directly, so we don't have to deal with
the integer types.

[0] https://elixir.bootlin.com/glibc/glibc-2.41.9000/source/misc/sys/ioctl.h#L42
[1] https://elixir.bootlin.com/musl/v1.2.5/source/include/stropts.h#L133
@FreddyFunk
Copy link
Collaborator

Works nicely, thanks!

@FreddyFunk FreddyFunk merged commit 95f0f5c into cosmic-utils:main Dec 22, 2025
8 checks passed
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