summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix')
-rw-r--r--otherlibs/win32unix/accept.c6
-rw-r--r--otherlibs/win32unix/bind.c5
-rw-r--r--otherlibs/win32unix/connect.c5
-rw-r--r--otherlibs/win32unix/getpeername.c5
-rw-r--r--otherlibs/win32unix/listen.c6
-rw-r--r--otherlibs/win32unix/select.c5
-rw-r--r--otherlibs/win32unix/sendrecv.c20
-rw-r--r--otherlibs/win32unix/shutdown.c6
-rw-r--r--otherlibs/win32unix/socket.c5
9 files changed, 48 insertions, 15 deletions
diff --git a/otherlibs/win32unix/accept.c b/otherlibs/win32unix/accept.c
index e907a1d2b..ef2dd3400 100644
--- a/otherlibs/win32unix/accept.c
+++ b/otherlibs/win32unix/accept.c
@@ -46,8 +46,10 @@ CAMLprim value unix_accept(sock)
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
(char *) &oldvalue, oldvaluelen);
}
- if (snew == INVALID_SOCKET)
- unix_error(WSAGetLastError(), "accept", Nothing);
+ if (snew == INVALID_SOCKET) {
+ win32_maperr(WSAGetLastError());
+ uerror("accept", Nothing);
+ }
Begin_roots2 (fd, adr)
fd = win_alloc_handle((HANDLE) snew);
adr = alloc_sockaddr(&addr, addr_len);
diff --git a/otherlibs/win32unix/bind.c b/otherlibs/win32unix/bind.c
index b1b23f816..6434fac67 100644
--- a/otherlibs/win32unix/bind.c
+++ b/otherlibs/win32unix/bind.c
@@ -25,6 +25,9 @@ CAMLprim value unix_bind(socket, address)
get_sockaddr(address, &addr, &addr_len);
ret = bind((SOCKET) Handle_val(socket), &addr.s_gen, addr_len);
- if (ret == -1) unix_error(WSAGetLastError(), "bind", Nothing);
+ if (ret == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("bind", Nothing);
+ }
return Val_unit;
}
diff --git a/otherlibs/win32unix/connect.c b/otherlibs/win32unix/connect.c
index d921c0e84..a7fd2aeec 100644
--- a/otherlibs/win32unix/connect.c
+++ b/otherlibs/win32unix/connect.c
@@ -28,6 +28,9 @@ CAMLprim value unix_connect(socket, address)
enter_blocking_section();
retcode = connect(s, &addr.s_gen, addr_len);
leave_blocking_section();
- if (retcode == -1) unix_error(WSAGetLastError(), "connect", Nothing);
+ if (retcode == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("connect", Nothing);
+ }
return Val_unit;
}
diff --git a/otherlibs/win32unix/getpeername.c b/otherlibs/win32unix/getpeername.c
index 135b6d3fd..acc33f40b 100644
--- a/otherlibs/win32unix/getpeername.c
+++ b/otherlibs/win32unix/getpeername.c
@@ -26,6 +26,9 @@ CAMLprim value unix_getpeername(sock)
addr_len = sizeof(sock_addr);
retcode = getpeername((SOCKET) Handle_val(sock),
&addr.s_gen, &addr_len);
- if (retcode == -1) unix_error(WSAGetLastError(), "getpeername", Nothing);
+ if (retcode == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("getpeername", Nothing);
+ }
return alloc_sockaddr(&addr, addr_len);
}
diff --git a/otherlibs/win32unix/listen.c b/otherlibs/win32unix/listen.c
index 63b3f590c..8a8ece648 100644
--- a/otherlibs/win32unix/listen.c
+++ b/otherlibs/win32unix/listen.c
@@ -19,7 +19,9 @@
CAMLprim value unix_listen(sock, backlog)
value sock, backlog;
{
- if (listen((SOCKET) Handle_val(sock), Int_val(backlog)) == -1)
- unix_error(WSAGetLastError(), "listen", Nothing);
+ if (listen((SOCKET) Handle_val(sock), Int_val(backlog)) == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("listen", Nothing);
+ }
return Val_unit;
}
diff --git a/otherlibs/win32unix/select.c b/otherlibs/win32unix/select.c
index 599667dbb..474ed3163 100644
--- a/otherlibs/win32unix/select.c
+++ b/otherlibs/win32unix/select.c
@@ -71,7 +71,10 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
enter_blocking_section();
retcode = select(FD_SETSIZE, &read, &write, &except, tvp);
leave_blocking_section();
- if (retcode == -1) unix_error(WSAGetLastError(), "select", Nothing);
+ if (retcode == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("select", Nothing);
+ }
read_list = fdset_to_fdlist(readfds, &read);
write_list = fdset_to_fdlist(writefds, &write);
except_list = fdset_to_fdlist(exceptfds, &except);
diff --git a/otherlibs/win32unix/sendrecv.c b/otherlibs/win32unix/sendrecv.c
index d65bca590..f3f1b670c 100644
--- a/otherlibs/win32unix/sendrecv.c
+++ b/otherlibs/win32unix/sendrecv.c
@@ -35,7 +35,10 @@ CAMLprim value unix_recv(value sock, value buff, value ofs, value len, value fla
ret = recv((SOCKET) Handle_val(sock), iobuf, (int) numbytes,
convert_flag_list(flags, msg_flag_table));
leave_blocking_section();
- if (ret == -1) unix_error(WSAGetLastError(), "recv", Nothing);
+ if (ret == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("recv", Nothing);
+ }
memmove (&Byte(buff, Long_val(ofs)), iobuf, ret);
End_roots();
return Val_int(ret);
@@ -61,7 +64,10 @@ CAMLprim value unix_recvfrom(value sock, value buff, value ofs, value len, value
convert_flag_list(flags, msg_flag_table),
&addr.s_gen, &addr_len);
leave_blocking_section();
- if (ret == -1) unix_error(WSAGetLastError(), "recvfrom", Nothing);
+ if (ret == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("recvfrom", Nothing);
+ }
memmove (&Byte(buff, Long_val(ofs)), iobuf, ret);
adr = alloc_sockaddr(&addr, addr_len);
res = alloc_small(2, 0);
@@ -84,7 +90,10 @@ CAMLprim value unix_send(value sock, value buff, value ofs, value len, value fla
ret = send((SOCKET) Handle_val(sock), iobuf, (int) numbytes,
convert_flag_list(flags, msg_flag_table));
leave_blocking_section();
- if (ret == -1) unix_error(WSAGetLastError(), "send", Nothing);
+ if (ret == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("send", Nothing);
+ }
return Val_int(ret);
}
@@ -106,7 +115,10 @@ value unix_sendto_native(value sock, value buff, value ofs, value len, value fla
convert_flag_list(flags, msg_flag_table),
&addr.s_gen, addr_len);
leave_blocking_section();
- if (ret == -1) unix_error(WSAGetLastError(), "sendto", Nothing);
+ if (ret == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("sendto", Nothing);
+ }
return Val_int(ret);
}
diff --git a/otherlibs/win32unix/shutdown.c b/otherlibs/win32unix/shutdown.c
index bf1e8c911..25373464e 100644
--- a/otherlibs/win32unix/shutdown.c
+++ b/otherlibs/win32unix/shutdown.c
@@ -24,7 +24,9 @@ CAMLprim value unix_shutdown(sock, cmd)
value sock, cmd;
{
if (shutdown((SOCKET) Handle_val(sock),
- shutdown_command_table[Int_val(cmd)]) == -1)
- unix_error(WSAGetLastError(), "shutdown", Nothing);
+ shutdown_command_table[Int_val(cmd)]) == -1) {
+ win32_maperr(WSAGetLastError());
+ uerror("shutdown", Nothing);
+ }
return Val_unit;
}
diff --git a/otherlibs/win32unix/socket.c b/otherlibs/win32unix/socket.c
index c07d76881..9423f5585 100644
--- a/otherlibs/win32unix/socket.c
+++ b/otherlibs/win32unix/socket.c
@@ -48,6 +48,9 @@ CAMLprim value unix_socket(domain, type, proto)
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
(char *) &oldvalue, oldvaluelen);
}
- if (s == INVALID_SOCKET) unix_error(WSAGetLastError(), "socket", Nothing);
+ if (s == INVALID_SOCKET) {
+ win32_maperr(WSAGetLastError());
+ uerror("socket", Nothing);
+ }
return win_alloc_handle((HANDLE) s);
}