summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/syscall/memcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/syscall/memcntl.c')
-rw-r--r--usr/src/uts/common/syscall/memcntl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr/src/uts/common/syscall/memcntl.c b/usr/src/uts/common/syscall/memcntl.c
index 1ab3a8b65e..5d77e354e8 100644
--- a/usr/src/uts/common/syscall/memcntl.c
+++ b/usr/src/uts/common/syscall/memcntl.c
@@ -21,14 +21,13 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2015 Joyent, Inc.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/bitmap.h>
#include <sys/sysmacros.h>
@@ -116,13 +115,17 @@ memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask)
* MS_SYNC used to be defined to be zero but is now non-zero.
* For binary compatibility we still accept zero
* (the absence of MS_ASYNC) to mean the same thing.
+ * Binary compatibility is not an issue for MS_INVALCURPROC.
*/
iarg = (uintptr_t)arg;
if ((iarg & ~MS_INVALIDATE) == 0)
iarg |= MS_SYNC;
- if (((iarg & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) != 0) ||
- ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC))) {
+ if (((iarg &
+ ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE|MS_INVALCURPROC)) != 0) ||
+ ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC)) ||
+ ((iarg & (MS_INVALIDATE|MS_INVALCURPROC)) ==
+ (MS_INVALIDATE|MS_INVALCURPROC))) {
error = set_errno(EINVAL);
} else {
error = as_ctl(as, addr, len, cmd, attr, iarg, NULL, 0);
@@ -348,7 +351,8 @@ memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask)
}
return (error);
case MC_ADVISE:
- if ((uintptr_t)arg == MADV_FREE) {
+ if ((uintptr_t)arg == MADV_FREE ||
+ (uintptr_t)arg == MADV_PURGE) {
len &= PAGEMASK;
}
switch ((uintptr_t)arg) {
@@ -384,6 +388,10 @@ memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask)
return (error);
}
break;
+ case MC_INHERIT_ZERO:
+ if (arg != 0 || attr != NULL || mask != 0)
+ return (set_errno(EINVAL));
+ break;
default:
return (set_errno(EINVAL));
}