Commit 6acb29dc authored by Mart Lubbers's avatar Mart Lubbers

Add unix sockets

parent 7e0b4bcb
Pipeline #21344 failed with stage
in 2 minutes and 43 seconds
......@@ -6,6 +6,7 @@
int main(void)
{
printf("AF_INET :== %lu\n", AF_INET);
printf("AF_UNIX :== %lu\n", AF_UNIX);
printf("AF_INET6 :== %lu\n", AF_INET6);
printf("AF_IPX :== %lu\n", AF_IPX);
printf("AF_APPLETALK :== %lu\n", AF_APPLETALK);
......
definition module System.Socket.Unix
from StdOverloaded import class toString
from System.Socket import class SocketAddress
:: SaUnix =
{ sun_path :: !FilePath
}
instance SocketAddress SaUnix
instance toString SaUnix
implementation module System.Socket.Unix
import StdEnv
import Data.Error
import System.Socket
import System._Pointer
instance SocketAddress SaUnix where
sa_serialize sa p w
#! p = writeInt2 p 0 (sa_domain sa)
#! p = writeCharArray (p+2) (packString sa.sun_path)
= (p, forceEvalPointer p w)
sa_deserialize p
= Ok {sun_path=derefString (p+2)}
sa_length _ = 110
sa_domain _ = AF_UNIX
sa_null = {sin_path="/"}
instance toString SaInet where toString s = s.sun_path
......@@ -7,6 +7,7 @@ from System.Socket import :: SocketType, class SocketAddress
:: *Socket a
AF_INET :== 2
AF_UNIX :== 1
AF_INET6 :== 10
AF_IPX :== 4
AF_APPLETALK :== 5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment