Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / basis / Net / Socket / GenericSock.c
1 #include "platform.h"
2
3 C_Errno_t(C_Int_t)
4 Socket_GenericSock_socket (C_Int_t domain, C_Int_t type, C_Int_t protocol) {
5 int out;
6
7 MLton_initSockets ();
8 out = socket (domain, type, protocol);
9 if (out == -1) MLton_fixSocketErrno ();
10
11 return out;
12 }
13
14 C_Errno_t(C_Int_t)
15 Socket_GenericSock_socketPair (C_Int_t domain, C_Int_t type, C_Int_t protocol, Array(C_Int_t) sv) {
16 int out;
17
18 MLton_initSockets ();
19 out = socketpair (domain, type, protocol, (int*)sv);
20 if (out == -1) MLton_fixSocketErrno ();
21
22 return out;
23 }