You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1499 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I look at socket function in win32 unix library and propose make some
changes in it
otherlibs/win32unix/accept.c - function setsocketopt erase status of
last accept call, WSAGetLastError must be called before it.
function set_nonblock and clear_nonblock, not implement in current
version, but I read MSDN, and fount what win32 socket support
nonblocking mode. I propose include these function in library.
win32 version of select, raise error if call it with empty lists of
files descr, but linux version handle this situation. I propose emulate
behaviour of linux version. If select catch empty lists of fd, it call
win32 function Sleep, for emulate time-out.
otherlibs/win32unix/accept.c - function setsocketopt erase status of
last accept call, WSAGetLastError must be called before it.
function set_nonblock and clear_nonblock, not implement in current
version, but I read MSDN, and fount what win32 socket support
nonblocking mode. I propose include these function in library.
win32 version of select, raise error if call it with empty lists of
files descr, but linux version handle this situation. I propose emulate
behaviour of linux version. If select catch empty lists of fd, it call
win32 function Sleep, for emulate time-out.
These changes are well taken. I'll apply them. Thanks for the patch,
Original bug ID: 1499
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hello,
I look at socket function in win32 unix library and propose make some
changes in it
otherlibs/win32unix/accept.c - function setsocketopt erase status of
last accept call, WSAGetLastError must be called before it.
function set_nonblock and clear_nonblock, not implement in current
version, but I read MSDN, and fount what win32 socket support
nonblocking mode. I propose include these function in library.
win32 version of select, raise error if call it with empty lists of
files descr, but linux version handle this situation. I propose emulate
behaviour of linux version. If select catch empty lists of fd, it call
win32 function Sleep, for emulate time-out.
--
Artem Prisyznuk
tema@sit.kiev.ua
diff -ru ocaml-3.06/otherlibs/win32unix/accept.c G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/accept.c
--- ocaml-3.06/otherlibs/win32unix/accept.c Fri Jun 7 09:49:42 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/accept.c Thu Dec 12 11:13:08 2002
@@ -29,6 +29,7 @@
int oldvalue, oldvaluelen, newvalue, retcode;
union sock_addr_union addr;
socklen_param_type addr_len;
int err_code = 0;
oldvaluelen = sizeof(oldvalue);
retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
@@ -43,13 +44,15 @@
enter_blocking_section();
snew = accept(sconn, &addr.s_gen, &addr_len);
leave_blocking_section();
if( snew == INVALID_SOCKET )
err_code = WSAGetLastError ();
if (retcode == 0) {
/* Restore initial mode */
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
(char *) &oldvalue, oldvaluelen);
}
if (snew == INVALID_SOCKET) {
uerror("accept", Nothing);
}
Begin_roots2 (fd, adr)
diff -ru ocaml-3.06/otherlibs/win32unix/connect.c G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/connect.c
--- ocaml-3.06/otherlibs/win32unix/connect.c Fri Jun 7 09:49:42 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/connect.c Thu Dec 12 11:13:08 2002
@@ -36,3 +36,35 @@
}
return Val_unit;
}
+CAMLprim value unix_set_nonblock(socket)
+{
+}
+CAMLprim value unix_clear_nonblock(socket)
+{
+}
diff -ru ocaml-3.06/otherlibs/win32unix/errmsg.c G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/errmsg.c
--- ocaml-3.06/otherlibs/win32unix/errmsg.c Fri Dec 7 13:40:44 2001
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/errmsg.c Thu Dec 12 11:13:08 2002
@@ -37,6 +37,8 @@
sizeof(buffer),
NULL))
return copy_string(buffer);
}
diff -ru ocaml-3.06/otherlibs/win32unix/select.c G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/select.c
--- ocaml-3.06/otherlibs/win32unix/select.c Tue Apr 30 15:00:48 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/select.c Thu Dec 12 16:27:04 2002
@@ -57,31 +57,43 @@
Begin_roots3 (readfds, writefds, exceptfds)
Begin_roots3 (read_list, write_list, except_list)
tm = Double_val(timeout);
if ( ! (readfds == Val_int(0) && writefds == Val_int(0) &&
} else {
}
res = alloc_small(3, 0);
Field(res, 0) = read_list;
Field(res, 1) = write_list;
Field(res, 2) = except_list;
End_roots();
End_roots();
return res;
diff -ru ocaml-3.06/otherlibs/win32unix/unix.ml G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/unix.ml
--- ocaml-3.06/otherlibs/win32unix/unix.ml Fri Jul 12 09:47:54 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/unix.ml Thu Dec 12 11:13:08 2002
@@ -306,8 +306,13 @@
external dup : file_descr -> file_descr = "unix_dup"
external dup2 : file_descr -> file_descr -> unit = "unix_dup2"
+external set_nonblock : file_descr -> unit = "unix_set_nonblock"
+external clear_nonblock : file_descr -> unit = "unix_clear_nonblock"
+(*
let set_nonblock fd = ()
let clear_nonblock fd = ()
+*)
external set_close_on_exec : file_descr -> unit = "win_set_close_on_exec"
external clear_close_on_exec : file_descr -> unit = "win_clear_close_on_exec"
diff -ru ocaml-3.06/otherlibs/win32unix/unixsupport.c G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/unixsupport.c
--- ocaml-3.06/otherlibs/win32unix/unixsupport.c Fri Jun 7 09:49:42 2002
+++ G:\cygwin\home\tema\ocaml\ocaml-3.06/otherlibs/win32unix/unixsupport.c Thu Dec 12 11:13:08 2002
@@ -76,6 +76,8 @@
/* Mapping of Windows error codes to POSIX error codes */
struct error_entry { unsigned long win_code; int range; int posix_code; };
+#define EWOULDBLOCK -WSAEWOULDBLOCK
+#define EINPROGRESS -WSAEINPROGRESS
static struct error_entry win_error_table[] = {
{ ERROR_INVALID_FUNCTION, 0, EINVAL},
@@ -142,6 +144,8 @@
#ifdef WSAENFILE
{ WSAENFILE, 0, ENFILE },
#endif
{ WSAENOTEMPTY, 0, ENOTEMPTY },
{ 0, -1, 0 }
};
@@ -164,8 +168,6 @@
/* Windows socket errors */
-#define EWOULDBLOCK -WSAEWOULDBLOCK
-#define EINPROGRESS -WSAEINPROGRESS
#define EALREADY -WSAEALREADY
#define ENOTSOCK -WSAENOTSOCK
#define EDESTADDRREQ -WSAEDESTADDRREQ
The text was updated successfully, but these errors were encountered: