diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2002-04-30 15:00:48 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2002-04-30 15:00:48 +0000 |
commit | c98047f62764eab650f7495e50d0e1d63d53ac88 (patch) | |
tree | 3f26e1884beacb4fe6042fe60ca2bd7e093c5f79 /otherlibs/win32unix/unixsupport.c | |
parent | 044ac150e8b5763047b77757e9144a920fb49a42 (diff) |
Meilleure distinction handle/socket. Ajout lockf. Revu rename.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4765 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/unixsupport.c')
-rw-r--r-- | otherlibs/win32unix/unixsupport.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c index 9f3ae3189..97a9a3674 100644 --- a/otherlibs/win32unix/unixsupport.c +++ b/otherlibs/win32unix/unixsupport.c @@ -22,7 +22,6 @@ #include "unixsupport.h" #include "cst2constr.h" #include <errno.h> -#include <winsock.h> /* Heap-allocation of Windows file handles */ @@ -49,9 +48,27 @@ static struct custom_operations win_handle_ops = { value win_alloc_handle(HANDLE h) { - value res = - alloc_custom(&win_handle_ops, sizeof(HANDLE), 0, 1); + value res = alloc_custom(&win_handle_ops, sizeof(struct filedescr), 0, 1); Handle_val(res) = h; + Descr_kind_val(res) = KIND_HANDLE; + return res; +} + +value win_alloc_socket(SOCKET s) +{ + value res = alloc_custom(&win_handle_ops, sizeof(struct filedescr), 0, 1); + Socket_val(res) = s; + Descr_kind_val(res) = KIND_SOCKET; + return res; +} + +value win_alloc_handle_or_socket(HANDLE h) +{ + value res = win_alloc_handle(h); + int opt; + int optlen = sizeof(opt); + if (getsockopt((SOCKET) h, SOL_SOCKET, SO_TYPE, (char *)&opt, &optlen) == 0) + Descr_kind_val(res) = KIND_SOCKET; return res; } |