-
Notifications
You must be signed in to change notification settings - Fork 201
Description
From my brief experimentation with Wayland, it has seemed like the Wayland server expects that when you send a message with a file descriptor parameter, it expects the message and the fd to be sent together in a single sendmsg call. The network library presently does not have any explicit support for doing this.
Currently, in my own code I have a copy of NullSocketAddress, which is internally defined in the network package but not exported.
data NullSocketAddress = NullSocketAddress
instance SocketAddress NullSocketAddress where
sizeOfSocketAddress _ = 0
peekSocketAddress _ = return NullSocketAddress
pokeSocketAddress _ _ = return ()So then I can use sendBufMsg the way the network package does internally...
Network.Socket.Address.sendBufMsg socket NullSocketAddress datas controls mempty... where datas contains the wayland message and controls contains the file descriptor.
Proposal one (nearly no effort): It would be nice if the network library simply exported the NullSocketAddress type so that I could use it instead of duplicating it.
Proposal two (slightly more work): Some explicit support for sending data and file descriptors in a single call?
sendWithFds :: Socket -> [ByteString] -> [Fd] -> IO ()