summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix')
-rw-r--r--otherlibs/win32unix/channels.c5
-rw-r--r--otherlibs/win32unix/unixsupport.c3
-rw-r--r--otherlibs/win32unix/unixsupport.h2
3 files changed, 8 insertions, 2 deletions
diff --git a/otherlibs/win32unix/channels.c b/otherlibs/win32unix/channels.c
index ed961910b..6e6b10139 100644
--- a/otherlibs/win32unix/channels.c
+++ b/otherlibs/win32unix/channels.c
@@ -82,7 +82,10 @@ CAMLprim value win_filedescr_of_channel(value vchan)
CAMLprim value win_handle_fd(value vfd)
{
int crt_fd = Int_val(vfd);
- value res = win_alloc_handle_or_socket((HANDLE) _get_osfhandle(crt_fd));
+ /* PR#4750: do not use the _or_socket variant as it can cause performance
+ degradation and this function is only used with the standard
+ handles 0, 1, 2, which are not sockets. */
+ value res = win_alloc_handle((HANDLE) _get_osfhandle(crt_fd));
CRT_fd_val(res) = crt_fd;
return res;
}
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c
index 24c4a9e45..6e32a39e7 100644
--- a/otherlibs/win32unix/unixsupport.c
+++ b/otherlibs/win32unix/unixsupport.c
@@ -65,6 +65,8 @@ value win_alloc_socket(SOCKET s)
return res;
}
+#if 0
+/* PR#4750: this function is no longer used */
value win_alloc_handle_or_socket(HANDLE h)
{
value res = win_alloc_handle(h);
@@ -74,6 +76,7 @@ value win_alloc_handle_or_socket(HANDLE h)
Descr_kind_val(res) = KIND_SOCKET;
return res;
}
+#endif
/* Mapping of Windows error codes to POSIX error codes */
diff --git a/otherlibs/win32unix/unixsupport.h b/otherlibs/win32unix/unixsupport.h
index 57f4caa68..bf71ac6dc 100644
--- a/otherlibs/win32unix/unixsupport.h
+++ b/otherlibs/win32unix/unixsupport.h
@@ -36,7 +36,7 @@ struct filedescr {
#define Descr_kind_val(v) (((struct filedescr *) Data_custom_val(v))->kind)
#define CRT_fd_val(v) (((struct filedescr *) Data_custom_val(v))->crt_fd)
-extern value win_alloc_handle_or_socket(HANDLE);
+/* extern value win_alloc_handle_or_socket(HANDLE); */
extern value win_alloc_handle(HANDLE);
extern value win_alloc_socket(SOCKET);
extern int win_CRT_fd_of_filedescr(value handle);