The unreliability of AF_UNIX datagram sockets
Mon May 17 13:02:13 GMT 2021
On 5/17/2021 6:26 AM, Corinna Vinschen wrote:
> On May 13 10:30, Ken Brown wrote:
>> While working on sendmsg, I thought of another useful thing that the mqueue
>> code could provide: an internal _mq_send function that returns EPIPE if no
>> one has the mqueue open for reading. This plays the role of the
>> STATUS_PIPE_IS_CLOSED macro in the pipe implementation.
> I don't see how to do that. The code is written in a way not requiring
> to keep track of stuff at runtime. All shared info is part of the mmap
> so far. We don't know if any other mqd_t descriptor is open at the time,
> it's not even a descriptor in the usual sense, just a pointer to a private
> malloc'ed area. Keeping track of open descriptors requires another
> shared mem region at runtime.
OK, then I think I can handle this in the AF_UNIX shared memory. Each socket
can keep track of its own number of open (socket) descriptors, and then it can
send a shutdown message to its peer when the last one is about to close. The
sendmsg code will have to be tweaked to repeatedly check for shutdown messages.
More information about the Cygwin-developers