From: "Rafael Ávila de Espíndola" <rafael@espindo.la>
To: musl@lists.openwall.com
Subject: [musl] ioctl signature
Date: Fri, 24 May 2024 17:03:59 +0000 [thread overview]
Message-ID: <87v833cfb4.fsf@espindo.la> (raw)
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
next reply other threads:[~2024-05-24 17:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 17:03 Rafael Ávila de Espíndola [this message]
2024-05-24 17:10 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v833cfb4.fsf@espindo.la \
--to=rafael@espindo.la \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).