[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

close() behavior when there are multiple fds for a socket

From: Ben Pfaff
Subject: close() behavior when there are multiple fds for a socket
Date: Thu, 14 Oct 2021 16:03:32 -0700

I guess this isn't the best place to ask this question, but I think there
are knowledgeable people here. I don't know the right place, so I'd
welcome being redirected to a better one.

The POSIX spec for close() is here:

This specification has a lot of cases that explicitly apply only to the
last close of an object, either using that language or by saying that
something happens when "all file descriptors associated with" an
object are closed. But it doesn't say that for sockets. Instead, it
just says, "If fildes refers to a socket, close() shall cause the
socket to be destroyed," which implies that closing any file
descriptor for a socket destroys the socket. I think that must be
wrong, because I don't think that's the behavior on the systems
I've used.

Do I misunderstand the spec? Or the behavior on real systems?
(Should I submit a request for clarification to the spec maintainers?)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]