@@ -126,6 +126,8 @@ getPeerEid _ = return (0, 0)
126126{-# Deprecated getPeerEid "Use getPeerCredential instead" #-}
127127
128128-- | Whether or not UNIX-domain sockets are available.
129+ -- 'AF_UNIX' is supported on Windows since 3.1.3.0.
130+ -- So, this variable is 'True` on all platforms.
129131--
130132-- Since 2.7.0.0.
131133isUnixDomainSocketAvailable :: Bool
@@ -139,8 +141,7 @@ instance SocketAddress NullSockAddr where
139141 pokeSocketAddress _ _ = return ()
140142
141143-- | Send a file descriptor over a UNIX-domain socket.
142- -- Use this function in the case where 'isUnixDomainSocketAvailable' is
143- -- 'True'.
144+ -- This function does not work on Windows.
144145sendFd :: Socket -> CInt -> IO ()
145146sendFd s outfd = void $ allocaBytes dummyBufSize $ \ buf -> do
146147 let cmsg = encodeCmsg $ Fd outfd
@@ -151,8 +152,7 @@ sendFd s outfd = void $ allocaBytes dummyBufSize $ \buf -> do
151152-- | Receive a file descriptor over a UNIX-domain socket. Note that the resulting
152153-- file descriptor may have to be put into non-blocking mode in order to be
153154-- used safely. See 'setNonBlockIfNeeded'.
154- -- Use this function in the case where 'isUnixDomainSocketAvailable' is
155- -- 'True'.
155+ -- This function does not work on Windows.
156156recvFd :: Socket -> IO CInt
157157recvFd s = allocaBytes dummyBufSize $ \ buf -> do
158158 (NullSockAddr , _, cmsgs, _) <- recvBufMsg s [(buf,dummyBufSize)] 32 mempty
@@ -163,9 +163,8 @@ recvFd s = allocaBytes dummyBufSize $ \buf -> do
163163 dummyBufSize = 16
164164
165165-- | Build a pair of connected socket objects.
166- -- For portability, use this function in the case
167- -- where 'isUnixDomainSocketAvailable' is 'True'
168- -- and specify 'AF_UNIX' to the first argument.
166+ -- On Windows, this function emulates socketpair() using
167+ -- 'AF_UNIX' and a temporary file will remain.
169168socketPair :: Family -- Family Name (usually AF_UNIX)
170169 -> SocketType -- Socket Type (usually Stream)
171170 -> ProtocolNumber -- Protocol Number
0 commit comments