Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 24 May 2024 17:03:59 +0000
From: Rafael Ávila de Espíndola <>
Subject: ioctl signature

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, ...);


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.