Closed
Bug 21750
Opened 25 years ago
Closed 25 years ago
The fcntl() calls on an accepted socket can be omitted on some Unix flavors.
Categories
(NSPR :: NSPR, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: wtc, Assigned: wtc)
Details
Attachments
(1 file)
3.86 KB,
text/plain
|
Details |
In ptio.c, pt_SetMethods, we make two fcntl() calls
to set a socket (TCP or UDP) nonblocking. For an
accepted socket returned by an accept() call, these
two fcntl() calls can be omitted on some Unix flavors
(e.g., Solaris) because the O_NONBLOCK flag is
inherited from the listening socket.
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•25 years ago
|
||
Our Sun and IBM contacts confirmed that a newly
accepted socket inherits the O_NONBLOCK flag of
the listening socket on Solaris and AIX.
Our HP contact pointed out that while a newly
accepted socket does not inherit the O_NONBLOCK
flag of the listening socket, it does inherit
the SS_NBIO socket state flag, which is set by
ioctl() FIOSNBIO (see the socket(7) man page on
HP-UX). If we want the newly accepted socket to
inherit nonblocking mode, we need to use the
ioctl() FIOSNBIO method. (There are three methods
for putting a socket into nonblocking mode on HP-UX:
fcntl() O_NONBLOCK, fcntl() O_NDELAY, and ioctl()
FIOSNBIO.)
Assignee | ||
Comment 2•25 years ago
|
||
Assignee | ||
Comment 3•25 years ago
|
||
I ran my test on AIX, HP-UX, IRIX, Linux, OSF1, and Solaris.
The results are:
- Inherited: AIX, HP-UX, IRIX, and Solaris.
- Not inherited: Linux and OSF1.
On the platforms where non-blocking mode is
inherited by accepted sockets, we define the
macro _PR_ACCEPT_INHERIT_NONBLOCK.
I added a new argument 'isAcceptedSocket' to
pt_SetMethods() so that we can tell if the
osfd is an accepted socket.
I checked in my fix to NSPRPUB_RELEASE_4_0_BRANCH.
/cvsroot/mozilla/nsprpub/pr/include/md/_aix.h, revision 3.7.18.1
/cvsroot/mozilla/nsprpub/pr/include/md/_hpux.h, revision 3.6.18.1
/cvsroot/mozilla/nsprpub/pr/include/md/_irix.h, revision 3.7.4.1
/cvsroot/mozilla/nsprpub/pr/include/md/_solaris.h, revision 3.10.4.1
/cvsroot/mozilla/nsprpub/pr/src/pthreads/ptio.c, revision 3.42.4.3
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 4•25 years ago
|
||
On OpenVMS, the tcpip code is NOT part of the O/S, and there are several
different tcpip implementations that are available. Since we never know which
tcpip code we are going to running on, we have no choice but to err on the side
of caution. I would therefore suggest that for OpenVMS you keep doing the fcntl
calls to be safe.
Colin.
You need to log in
before you can comment on or make changes to this bug.
Description
•