From 2f98d8bdc7a9615d7d473cd808e7482c62bd9e41 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 10 Aug 2006 14:16:24 +0000 Subject: [PATCH] revert erroneous checkin --- winsup/cygwin/fhandler.cc | 18 ++++++++++++++++-- winsup/cygwin/fhandler_socket.cc | 5 ++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index ae5edcb62..00e987587 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -31,7 +31,6 @@ details. */ #include #include #include "ntdll.h" -#include "mmap_helper.h" static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */ @@ -224,8 +223,10 @@ fhandler_base::raw_read (void *ptr, size_t& ulen) HANDLE h = NULL; /* grumble */ int prio = 0; /* ditto */ + int try_noreserve = 1; DWORD len = ulen; +retry: ulen = (size_t) -1; if (read_state) { @@ -234,7 +235,7 @@ fhandler_base::raw_read (void *ptr, size_t& ulen) SetThreadPriority (h, THREAD_PRIORITY_TIME_CRITICAL); signal_read_state (1); } - BOOL res = mmReadFile (get_handle (), ptr, len, (DWORD *) &ulen, 0); + BOOL res = ReadFile (get_handle (), ptr, len, (DWORD *) &ulen, 0); if (read_state) { signal_read_state (1); @@ -260,6 +261,19 @@ fhandler_base::raw_read (void *ptr, size_t& ulen) bytes_read = 0; break; } + if (try_noreserve) + { + try_noreserve = 0; + switch (mmap_is_attached_or_noreserve (ptr, len)) + { + case MMAP_NORESERVE_COMMITED: + goto retry; + case MMAP_RAISE_SIGBUS: + raise(SIGBUS); + case MMAP_NONE: + break; + } + } /*FALLTHRU*/ case ERROR_INVALID_FUNCTION: case ERROR_INVALID_PARAMETER: diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 5feb9a69c..0fecdaaac 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -38,7 +38,6 @@ #include #include "cygtls.h" #include "cygwin/in6.h" -#include "mmap_helper.h" #define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) #define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) @@ -1164,8 +1163,8 @@ fhandler_socket::recv_internal (WSABUF *wsabuf, DWORD wsacnt, DWORD flags, while (!(res = wait_for_events (evt_mask | FD_CLOSE)) || saw_shutdown_read ()) { - res = mmWSARecvFrom (get_socket (), wsabuf, wsacnt, &ret, - &flags, from, fromlen, NULL, NULL); + res = WSARecvFrom (get_socket (), wsabuf, wsacnt, &ret, + &flags, from, fromlen, NULL, NULL); if (!res || WSAGetLastError () != WSAEWOULDBLOCK) break; } -- 2.43.5