[PATCH] handle EPROTOTYPE for socket invocations with SOCK_* flags
Pino Toscano
toscano.pino@tiscali.it
Wed Feb 6 19:48:00 GMT 2013
Hi,
since glibc 2.16, Hurd's bits/socket.h provides SOCK_CLOEXEC and
SOCK_NONBLOCK (which accept4 handles), but __ASSUME_SOCK_CLOEXEC is not
defined since socket and socketpair do not handle them, yet.
The snippets of fallback code that handle failures of invocation of
socket with SOCK_CLOEXEC or SOCK_NONBLOCK seem to not correctly disable
have_sock_cloexec/__have_sock_cloexec if errno is EPROTOTYPE, as
returned when the socket type (like "SOCK_STREAM | SOCK_CLOEXEC" for
socket with no handling of flags) is unknown.
The attached patch handles EPROTOTYPE as if it was EINVAL, disabling
have_sock_cloexec/__have_sock_cloexec if socket does not handle SOCK_*
flags.
(OTOH, it seems that there are few Linux archs -- like mips*, arm, hppa,
m68k -- which don't have __ASSUME_SOCK_CLOEXEC enabled in their
kernel-features.h at all: does it mean the Linux kernel really returns
EINVAL for unknown values as socket types?)
Thanks,
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_sock_cloexec.diff
Type: text/x-patch
Size: 3311 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130206/4d3e19b0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130206/4d3e19b0/attachment.sig>
More information about the Libc-alpha
mailing list