Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Apr 2003 18:30:28 -0400 (EDT)
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        standards@freebsd.org
Subject:   Non-compliant FreeBSD behavior?
Message-ID:  <200304112230.h3BMUS1G068705@khavrinen.lcs.mit.edu>
In-Reply-To: <20030411.134416.71552075.imp@bsdimp.com>
References:  <20030411.134416.71552075.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Fri, 11 Apr 2003 13:44:16 -0600 (MDT), "M. Warner Losh" <imp@bsdimp.com> said:

> something subtle I'm missing?  What do the standards have to say about
> this?

The standards do not say anything about FIONBIO or ioctl() in general[1].

As far as O_NONBLOCK goes:

# The I/O mode of a socket is described by the O_NONBLOCK file status
# flag which pertains to the open file description for the socket. This
# flag is initially off when a socket is created, but may be set and
# cleared by the use of the F_SETFL command of the fcntl( ) function.
# When the O_NONBLOCK flag is set, functions that would normally block
# until they are complete shall either return immediately with an error,
# or shall complete asynchronously to the execution of the calling
# process. Data transfer operations (the read( ), write( ), send( ), and
# recv( ) functions) shall complete immediately, transfer only as much
# as is available, and then return without blocking, or return an error
# indicating that no transfer could be made without blocking.  The
# connect( ) function initiates a connection and shall return without
# blocking when O_NONBLOCK is set; it shall return the error
# [EINPROGRESS] to indicate that the connection was initiated
# successfully, but that it has not yet completed.

In addition to this definition, O_NONBLOCK is also defined for SEWERS
endpoints, POSIX message queues, opening fifos and special files, and
reading from and writing to pipes and fifos.  FreeBSD's network stack
does not mention O_NONBLOCK anywhere, but the fcntl() implementation
automatically turns fcntl(fd, F_SETFL, O_NONBLOCK) operations into
ioctl(fd, FIONBIO, &one) operations.  soo_ioctl() should then be
called indirectly to set the SS_NBIO status flag on the socket itself.
At the moment I can't seem to find where connect() actually blocks.

-GAWollman

[1] Actually, ioctl() is defined, as a SEWERS-specific function, which
might as well be completely undefined considering how little of SEWERS
is actually defined in the standard.



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