gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r310 - GNUnet/src/util/win


From: durner
Subject: [GNUnet-SVN] r310 - GNUnet/src/util/win
Date: Fri, 25 Feb 2005 12:00:55 -0800 (PST)

Author: durner
Date: 2005-02-25 12:00:54 -0800 (Fri, 25 Feb 2005)
New Revision: 310

Modified:
   GNUnet/src/util/win/winproc.c
Log:
Fix mmap

Modified: GNUnet/src/util/win/winproc.c
===================================================================
--- GNUnet/src/util/win/winproc.c       2005-02-25 11:39:10 UTC (rev 309)
+++ GNUnet/src/util/win/winproc.c       2005-02-25 20:00:54 UTC (rev 310)
@@ -1794,11 +1794,10 @@
  * map files into memory
  * @author Cygwin team
  * @author Nils Durner
- * @todo [WIN] Needs testing
  */
 void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
                 unsigned long long off) {
-  DWORD protect, high, low;
+  DWORD protect, high, low, access_param;
   HANDLE h, hFile;
   SECURITY_ATTRIBUTES sec_none;
   void *base;
@@ -1809,12 +1808,15 @@
   {
     case PROT_WRITE:
       protect = PAGE_READWRITE;
+      access_param = FILE_MAP_WRITE;
       break;
     case PROT_READ:
       protect = PAGE_READONLY;
+      access_param = FILE_MAP_READ;
       break;
     default:
       protect = PAGE_WRITECOPY;
+      access_param = FILE_MAP_COPY;
       break;
   }
   
@@ -1839,9 +1841,9 @@
   /* If a non-zero start is given, try mapping using the given address first.
      If it fails and flags is not MAP_FIXED, try again with NULL address. */
   if (start)
-    base = MapViewOfFileEx(h, access, high, low, len, start);
+    base = MapViewOfFileEx(h, access_param, high, low, len, start);
   if (!base && !(flags & MAP_FIXED))
-    base = MapViewOfFileEx(h, access, high, low, len, NULL);
+    base = MapViewOfFileEx(h, access_param, high, low, len, NULL);
   
   if (!base || ((flags & MAP_FIXED) && base != start))
   {
@@ -1861,7 +1863,6 @@
  * Unmap files from memory
  * @author Cygwin team
  * @author Nils Durner
- * @todo [WIN] Needs testing
  */
 int _win_munmap(void *start, size_t length)
 {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]