Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Nov 1998 17:25:33 -0600
From:      Jacques Vidrine <n@nectar.com>
To:        Peter.Mutsaers@mail.ing.nl
Cc:        hackers@FreeBSD.ORG
Subject:   Re: kern/8629: accept (2) errno uses incorrect code 
Message-ID:  <199811182325.RAA11250@spawn.nectar.com>
In-Reply-To: <000BCF69.C21023@mail.ing.nl> 
References:  <000BCF69.C21023@mail.ing.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----

[sending to -hackers to solicit comments regarding PR 8629]

On 17 November 1998 at 11:03, Peter.Mutsaers@mail.ing.nl wrote:

[regarding operating systems which return EOPNOTSUPP from accept
 when called with a socket _not_ of type SOCK_STREAM]

> Solaris 2.6 and Digital UNIX 4.0 do. I tested my program on them
> 
> Output from a small program doing an accept on socket 69/udp (tftp), using
> perror to show the errno value:
[summary from Peter's experience and mine:

	Returns EINVAL			Returns EOPNOTSUPP
	4.4 BSD Lite2
	FreeBSD
	NetBSD
	OpenBSD
	AIX 3.2.5
	AIX 4.1
	HP-UX 10.20
	HP-UX 10.30
	Linux 2.1.128
					AIX 4.2
					Solaris 2.6
					Digital UNIX 4.0
]
	
> Actually I should look it up in the POSIX spec but I don't have one at hand.

Yes, if POSIX has something to say about it, then that has to be
definitive.

> However the number of Unices doing it like the original manpage, and the fact
> that AIX 4.1 --> 4.2 
> modified it to comply, convinces me that really it should return EOPNOTSUPP.

I'm far from convinced.  See above.  Additionally, the BSD and
Linux accept() code is ``correct'' in that checking the type
of the socket (and therefore returning EOPNOTSUPP) would be an
additional, redundant check.   Checking whether or not the 
socket is in a ``listening state'' is sufficient.

So far it seems as if BSD implementations return EINVAL, while System
V implementations return EOPNOTSUPP. The Linux implementation is
homegrown, but returns EINVAL in this situation for the same reasons
the BSD code does.  Since the sockets interface is defined by BSD, I
expect that BSD is correct, and that the System V vendors got it
wrong.  I can't blame them, though, since BSD has had the manual page
wrong forever.

Jacques Vidrine / n@nectar.com / nectar@FreeBSD.org

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNlNXbTeRhT8JRySpAQGwrAQAsqrOv4AY6FcphYZIA92g4GjnZtUzHoH9
DEdsWjc2hiN6vj9GvPmlbpfUObk/htLeS7ncBGSZouGkpjx/2Rpv0JjjTh35u1bI
VtrEpkQVfcOgc0TWUu52WKeOcb8WExwZ+KPsoYzEIdU6Wz6FEP0c+iT6ri5v+d+w
VWCoYVyqdig=
=kcSM
-----END PGP SIGNATURE-----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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