Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 2010 18:23:42 -0700
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        Eitan Adler <eitanadlerlist@gmail.com>
Cc:        standards@freebsd.org
Subject:   Re: Non-POSIX compliant portions of FreeBSD
Message-ID:  <n2g7d6fde3d1004221823p3383a8fei34fae27b00434859@mail.gmail.com>
In-Reply-To: <j2v7d6fde3d1004182016t48f443b4lf3e89992655e69de@mail.gmail.com>
References:  <w2u7d6fde3d1004072200i6b1df9f5w780609c3265e400b@mail.gmail.com> <m2wa0777e081004180548gdaf43413sd0311456379c9d31@mail.gmail.com> <j2v7d6fde3d1004182016t48f443b4lf3e89992655e69de@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 18, 2010 at 8:16 PM, Garrett Cooper <yanefbsd@gmail.com> wrote:
> On Sun, Apr 18, 2010 at 5:48 AM, Eitan Adler <eitanadlerlist@gmail.com> w=
rote:
>>> =A0 =A0I'll keep on providing a full list of items where we aren't POSI=
X
>>> compliant, but it'd be interesting to get a response about whether or
>>> not the items I submit are known or not, and whether or not they were
>>> conscious design decisions and/or items which need to be fixed.
>>> Thanks,
>>> -Garrett
>>
>> Can you make this into a wiki page along with the comments you receive?
>
> =A0 =A0Sure. Here's the page for starters:
> http://wiki.freebsd.org/FreeBSD_and_Standards

    Continuing on the fun... ioctl (by manpage alone) isn't even close
to being POSIX standard. Here are the differences I spotted at least
[in the ERRORS section]:

FreeBSD:

     The ioctl() system call will fail if:

     [EBADF]            The d argument is not a valid descriptor.

     [ENOTTY]           The d argument is not associated with a character s=
pe-
                        cial device.

     [ENOTTY]           The specified request does not apply to the kind of
                        object that the descriptor d references.

     [EINVAL]           The request or argp argument is not valid.

     [EFAULT]           The argp argument points outside the process's allo=
-
                        cated address space.

POSIX:

[EBADF]
    The fildes argument is not a valid open file descriptor.
[EINTR]
    A signal was caught during the ioctl() operation.
[EINVAL]
    The STREAM or multiplexer referenced by fildes is linked (directly
or indirectly) downstream from a multiplexer.

If an underlying device driver detects an error, then ioctl() shall fail if=
:

[EINVAL]
    The request or arg argument is not valid for this device.
[EIO]
    Some physical I/O error has occurred.
[ENOTTY]
    The fildes argument is not associated with a STREAMS device that
accepts control functions.
[ENXIO]
    The request and arg arguments are valid for this device driver,
but the service requested cannot be performed on this particular
sub-device.
[ENODEV]
    The fildes argument refers to a valid STREAMS device, but the
corresponding device driver does not support the ioctl() function.

If a STREAM is connected downstream from a multiplexer, any ioctl()
command except I_UNLINK and I_PUNLINK shall set errno to [EINVAL].

    1. EINTR and EIO aren't implemented in FreeBSD.
    2. The tort in EBADF for the POSIX definition suggests that the
file descriptor state is important -- it looks like the wording is
potentially a bit too well defined in the POSIX version as I could
open a file descriptor, close it, then attempt to run an ioctl(2) on
the device file descriptor, which should fail in the same way as the
FreeBSD wording suggests.
    3. It looks like ENODEV, ENOTTY, and ENXIO in the POSIX case are
bundled together in some of the possible states for the ENOTTY error
case on FreeBSD.

    At least it functions unlike the Linux copy in some cases though :].
Cheers,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?n2g7d6fde3d1004221823p3383a8fei34fae27b00434859>