@@ -22,7 +22,7 @@ import Data.ByteString (ByteString)
2222import Data.ByteString.Unsafe (unsafeUseAsCStringLen )
2323import qualified Data.ByteString as B
2424
25- import System.Socket (SocketAddress )
25+ import System.Socket (SocketAddress , Family ( .. ) )
2626import System.Socket.Family.Unix.Internal (Unix )
2727
2828#include "hs_socket.h"
@@ -31,16 +31,19 @@ import System.Socket.Family.Unix.Internal (Unix)
3131#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
3232#endif
3333
34- -- | A Unix socket address
35- data instance SocketAddress Unix
36- -- | Address is connected to a filesystem pathname. When used to bind
37- -- a socket file with this name is created in the file system.
38- = SocketAddressUnixPath ByteString
39- -- | Address is in abstract namespace which is a Linux-specific feature
40- -- that allows us to bind a UNIX domain socket to a name without that
41- -- name being created in the file system.
42- | SocketAddressUnixAbstract ByteString
43- deriving (Eq , Show )
34+ instance Family Unix where
35+ familyNumber _ = (# const AF_UNIX )
36+
37+ -- | A Unix socket address
38+ data SocketAddress Unix
39+ -- | Address is connected to a filesystem pathname. When used to bind
40+ -- a socket file with this name is created in the file system.
41+ = SocketAddressUnixPath ByteString
42+ -- | Address is in abstract namespace which is a Linux-specific feature
43+ -- that allows us to bind a UNIX domain socket to a name without that
44+ -- name being created in the file system.
45+ | SocketAddressUnixAbstract ByteString
46+ deriving (Eq , Show )
4447
4548-- | The maximal length of a address path.
4649-- SUSv3 doesn’t specify the size of the sun_path field. Early BSD
@@ -97,3 +100,4 @@ instance Storable (SocketAddress Unix) where
97100 where
98101 sun_family = (# ptr struct sockaddr_un, sun_family)
99102 sun_path = (# ptr struct sockaddr_un, sun_path)
103+
0 commit comments