diff options
author | Ian Gudger <igudger@google.com> | 2018-12-17 17:52:05 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-17 17:53:22 -0800 |
commit | 12c7430a01ad2b484987dd8ee24b6f2907e7366d (patch) | |
tree | 832c72f40867827b53bd357708c7cbdd3e6f6842 /test/syscalls | |
parent | b62591e6a813ec19a1fd74943584c4fead81f670 (diff) |
Fix recv blocking for connectionless Unix sockets.
Connectionless Unix sockets (DGRAM Unix sockets created with the socket system
call) inherently only have a read queue. They do not establish bidirectional
connections, instead, the connect system call only sets a default send
location. Writes give the data to the other endpoint which has its own read
queue.
To simplify the code, connectionless Unix sockets still get read and write
queues, but the write queue is a dummy and never waited on. The read queue is
the connectionless endpoint's queue. This change fixes a bug where the dummy
queue was incorrectly set as the read queue and the endpoint's queue was
incorrectly set as the write queue. This meant that read notifications went
to the dummy queue and were black holed.
PiperOrigin-RevId: 225921042
Change-Id: I8d9059def787a2c3c305185b92d05093fbd2be2a
Diffstat (limited to 'test/syscalls')
-rw-r--r-- | test/syscalls/linux/socket_unix_blocking_local.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/syscalls/linux/socket_unix_blocking_local.cc b/test/syscalls/linux/socket_unix_blocking_local.cc index f79e04b33..3c2105cc7 100644 --- a/test/syscalls/linux/socket_unix_blocking_local.cc +++ b/test/syscalls/linux/socket_unix_blocking_local.cc @@ -33,14 +33,12 @@ std::vector<SocketPairKind> GetSocketPairs() { ApplyVec<SocketPairKind>( FilesystemBoundUnixDomainSocketPair, AllBitwiseCombinations( - // FIXME: Add SOCK_DGRAM once blocking is fixed. - List<int>{SOCK_STREAM, SOCK_SEQPACKET}, + List<int>{SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM}, List<int>{0, SOCK_CLOEXEC})), ApplyVec<SocketPairKind>( AbstractBoundUnixDomainSocketPair, AllBitwiseCombinations( - // FIXME: Add SOCK_DGRAM once blocking is fixed. - List<int>{SOCK_STREAM, SOCK_SEQPACKET}, + List<int>{SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM}, List<int>{0, SOCK_CLOEXEC}))); } |