mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] ioctl signature
@ 2024-05-24 17:03 Rafael Ávila de Espíndola
  2024-05-24 17:10 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Ávila de Espíndola @ 2024-05-24 17:03 UTC (permalink / raw)
  To: musl

The signature of ioctl in musl is

int ioctl (int, int, ...);

In glibc it is

int ioctl(int fd, unsigned long request, ...);

The requests are always 32 bits, and the most significant bit is used to
indicated that this ioctl is a read operation. This means that some
constants are negative numbers if using an int. I have noticed this
because rust's interface to libc matches the system libc implementation,
and in alpine I got an error for a literal out of range for
0xc0104801. I don't know if a C compiler would produce a warning, but
that seems somewhat reasonable.

Should the declaration be changed to use an unsigned request?:

int ioctl (int, unsigned int, ...);

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-24 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 17:03 [musl] ioctl signature Rafael Ávila de Espíndola
2024-05-24 17:10 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).