Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-12-04 03:03:15 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-12-04 03:03:15 +0400
commit447354e13ccb83e0baeaaf6158f52b9033fba117 (patch)
treeebd168a9d9fb5028c2349a15f9992e28d105839e
parentb9aa81491f62f6053bb648f20143ba9e68051622 (diff)
* mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Drop
outdated comment. Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag. (munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Call NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/mmap.cc18
2 files changed, 9 insertions, 16 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a66c13a6c..99b56d0ad 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-03 Corinna Vinschen <vinschen@redhat.com>
+
+ * mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Drop
+ outdated comment. Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag.
+ (munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE. Call
+ NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
+
2011-12-03 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout, remove extra space after function name from debugging
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index afbeb7a3a..97f0dad6f 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -1346,14 +1346,6 @@ mlock (const void *addr, size_t len)
{
int ret = -1;
- /* Instead of using VirtualLock, which does not guarantee that the pages
- aren't swapped out when the process is inactive, we're using
- ZwLockVirtualMemory with the LOCK_VM_IN_RAM flag to do what mlock on
- POSIX systems does. On NT, this requires SeLockMemoryPrivilege,
- which is given only to SYSTEM by default. */
-
- push_thread_privilege (SE_LOCK_MEMORY_PRIVILEGE, true);
-
/* Align address and length values to page size. */
size_t pagesize = getpagesize ();
PVOID base = (PVOID) rounddown((uintptr_t) addr, pagesize);
@@ -1362,7 +1354,7 @@ mlock (const void *addr, size_t len)
do
{
status = NtLockVirtualMemory (NtCurrentProcess (), &base, &size,
- LOCK_VM_IN_RAM);
+ LOCK_VM_IN_WSL);
if (status == STATUS_WORKING_SET_QUOTA)
{
/* The working set is too small, try to increase it so that the
@@ -1402,8 +1394,6 @@ mlock (const void *addr, size_t len)
}
while (status == STATUS_WORKING_SET_QUOTA);
- pop_thread_privilege ();
-
return ret;
}
@@ -1412,21 +1402,17 @@ munlock (const void *addr, size_t len)
{
int ret = -1;
- push_thread_privilege (SE_LOCK_MEMORY_PRIVILEGE, true);
-
/* Align address and length values to page size. */
size_t pagesize = getpagesize ();
PVOID base = (PVOID) rounddown((uintptr_t) addr, pagesize);
ULONG size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len, pagesize);
NTSTATUS status = NtUnlockVirtualMemory (NtCurrentProcess (), &base, &size,
- LOCK_VM_IN_RAM);
+ LOCK_VM_IN_WSL);
if (!NT_SUCCESS (status))
__seterrno_from_nt_status (status);
else
ret = 0;
- pop_thread_privilege ();
-
return ret;
}