From: Emmanuel Colbus <ecolbus@manux.info>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][4/11][MANUX] Kernel compatibility : ioctl(2)
Date: Tue, 15 Apr 2014 18:00:21 +0200 [thread overview]
Message-ID: <534D5795.8080100@manux.info> (raw)
In-Reply-To: <20140415160035.3135dda7@alan.etchedpixels.co.uk>
Le 15/04/2014 17:00, One Thousand Gnomes a écrit :
> On Tue, 15 Apr 2014 15:42:54 +0200
> Emmanuel Colbus <ecolbus@manux.info> wrote:
>
>> Continuing with syscalls, I would like to indicate you a modification
>> I've done with regards to ioctl's. The thing is, I have had the need for
>> ioctl's that return *file descriptors*, instead of standard return codes.
>
> You probably only think you have ;-)
>
> The return from an ioctl on 32bit is going to be an unsigned 32bit value,
> as is a Linux file handle. So if you do
>
> fd = ioctl(foo);
>
> then not only have you got an interface that isn't compliant with
> POSIX/SuS you also have no error reporting capability.
Wait, on 32 bits, no process can have 2^32 file handles, or even 2^31.
Thus, since the error code is a negative value, userspace will simply do :
fd = _sys_ioctl(foo);
if (fd < 0)
errno = -fd;
Which the libc is going to do for them anyways if they call ioctl()
directly.
>
> The expectation of ioctl is
>
> err = ioctl(fd, FDIOWIBBLE, &result);
>
> now if result is a pointer to where to store one or more file handles you
> are sorted.
Also feasible.
>
> If you are going to use SuS/POSIX naming I'd really suggest sticking to
> the expected behaviour in the standards.
I think this is an unproblematic extension, especially since these
ioctls are only supposed to be called by low-level software shipped with
the OS.
>
> Alan
>
Emmanuel
next prev parent reply other threads:[~2014-04-15 16:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 13:42 [RFC][4/11][MANUX] Kernel compatibility : ioctl(2) Emmanuel Colbus
2014-04-15 15:00 ` One Thousand Gnomes
2014-04-15 16:00 ` Emmanuel Colbus [this message]
2014-04-15 16:05 ` One Thousand Gnomes
2014-04-15 16:32 ` Emmanuel Colbus
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=534D5795.8080100@manux.info \
--to=ecolbus@manux.info \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox