Problems with the (new) implementation of AF_UNIX datagram sockets
Ken Brown
kbrown@cornell.edu
Wed Apr 14 16:15:54 GMT 2021
Hi Corinna,
This is a follow-up to
https://cygwin.com/pipermail/cygwin/2021-April/248284.html
I don't know if you've been following that thread, but two serious problems with
datagram sockets (on the topic/af_unix branch) have shown up.
1. Writing will block until a connection to the peer's pipe can be made. In
particular, if there are two consecutive writes with the same peer, the second
one will block until the peer reads the first message. This happens because the
peer's pipe is not available for the second connection until the peer
disconnects the first connection. This is currently done in recvmsg, and I
don't see a straightforward way to do it anywhere else.
2. There's no way for select to test whether a datagram socket is ready for
writing. That's because we can't know whether a connection to a hypothetical
peer's pipe will be possible. According to Stevens, the issue *should* be
whether there's space in the socket's send buffer. But our sockets don't have a
send buffer until they connect to a pipe.
I think the solution to both problems is for Cygwin to maintain a send buffer
for datagram sockets. Does that seem right, or do you have another idea?
I haven't yet thought much about how to implement a send buffer, but I wanted to
check with you before investing time in it. And if you agree that this is the
way to go, I'd appreciate any implementation suggestions you might have.
Thanks.
Ken
More information about the Cygwin-developers
mailing list