From c45adacee49edf02ebc439183afbdfeacef4db1b Mon Sep 17 00:00:00 2001
From: Antonio Huete Jimenez <tuxillo@quantumachine.net>
Date: Sat, 24 Jul 2010 21:32:42 +0200
Subject: [PATCH] sys - Properly not support mlockall/munlockall.

---
 sys/emulation/linux/i386/linux_syscall.h |    2 --
 sys/emulation/linux/i386/linux_sysent.c  |    4 ++--
 sys/emulation/linux/i386/syscalls.master |    4 ++--
 sys/kern/init_sysent.c                   |    4 ++--
 sys/kern/syscalls.c                      |    4 ++--
 sys/kern/syscalls.master                 |    4 ++--
 sys/sys/syscall.h                        |    2 --
 sys/sys/syscall.mk                       |    2 --
 sys/sys/sysproto.h                       |   14 --------------
 sys/sys/sysunion.h                       |    2 --
 sys/vm/vm_mmap.c                         |   25 -------------------------
 11 files changed, 10 insertions(+), 57 deletions(-)

diff --git a/sys/emulation/linux/i386/linux_syscall.h b/sys/emulation/linux/i386/linux_syscall.h
index 94e8019..3ddee33 100644
--- a/sys/emulation/linux/i386/linux_syscall.h
+++ b/sys/emulation/linux/i386/linux_syscall.h
@@ -144,8 +144,6 @@
 #define	LINUX_SYS_linux_sysctl	149
 #define	LINUX_SYS_mlock	150
 #define	LINUX_SYS_munlock	151
-#define	LINUX_SYS_mlockall	152
-#define	LINUX_SYS_munlockall	153
 #define	LINUX_SYS_sched_setparam	154
 #define	LINUX_SYS_sched_getparam	155
 #define	LINUX_SYS_linux_sched_setscheduler	156
diff --git a/sys/emulation/linux/i386/linux_sysent.c b/sys/emulation/linux/i386/linux_sysent.c
index 06ffaf7..da014c8 100644
--- a/sys/emulation/linux/i386/linux_sysent.c
+++ b/sys/emulation/linux/i386/linux_sysent.c
@@ -170,8 +170,8 @@ struct sysent linux_sysent[] = {
 	{ AS(linux_sysctl_args), (sy_call_t *)sys_linux_sysctl },	/* 149 = linux_sysctl */
 	{ AS(mlock_args), (sy_call_t *)sys_mlock },	/* 150 = mlock */
 	{ AS(munlock_args), (sy_call_t *)sys_munlock },	/* 151 = munlock */
-	{ AS(mlockall_args), (sy_call_t *)sys_mlockall },	/* 152 = mlockall */
-	{ 0, (sy_call_t *)sys_munlockall },		/* 153 = munlockall */
+	{ 0, (sy_call_t *)sys_nosys },			/* 152 = mlockall */
+	{ 0, (sy_call_t *)sys_nosys },			/* 153 = munlockall */
 	{ AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam },	/* 154 = sched_setparam */
 	{ AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam },	/* 155 = sched_getparam */
 	{ AS(linux_sched_setscheduler_args), (sy_call_t *)sys_linux_sched_setscheduler },	/* 156 = linux_sched_setscheduler */
diff --git a/sys/emulation/linux/i386/syscalls.master b/sys/emulation/linux/i386/syscalls.master
index 31c8d0d..32d4d9a 100644
--- a/sys/emulation/linux/i386/syscalls.master
+++ b/sys/emulation/linux/i386/syscalls.master
@@ -237,8 +237,8 @@
 149	STD	LINUX	{ int linux_sysctl(struct l___sysctl_args *args); }
 150	NOPROTO	BSD	{ int mlock(const void *addr, size_t len); }
 151	NOPROTO	BSD	{ int munlock(const void *addr, size_t len); }
-152	NOPROTO	BSD	{ int mlockall(int how); }
-153	NOPROTO	BSD	{ int munlockall(void); }
+152	UNIMPL	BSD	mlockall
+153	UNIMPL	BSD	munlockall
 154	NOPROTO	POSIX	{ int sched_setparam(pid_t pid, \
 				const struct sched_param *param); }
 155	NOPROTO	POSIX	{ int sched_getparam(pid_t pid, \
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index f186de1..7c2d9f3 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -357,8 +357,8 @@ struct sysent sysent[] = {
 	{ 0, (sy_call_t *)sys_yield },			/* 321 = yield */
 	{ 0, (sy_call_t *)sys_nosys },			/* 322 = thr_sleep */
 	{ 0, (sy_call_t *)sys_nosys },			/* 323 = thr_wakeup */
-	{ AS(mlockall_args), (sy_call_t *)sys_mlockall },	/* 324 = mlockall */
-	{ 0, (sy_call_t *)sys_munlockall },		/* 325 = munlockall */
+	{ 0, (sy_call_t *)sys_nosys },			/* 324 = mlockall */
+	{ 0, (sy_call_t *)sys_nosys },			/* 325 = munlockall */
 	{ AS(__getcwd_args), (sy_call_t *)sys___getcwd },	/* 326 = __getcwd */
 	{ AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam },	/* 327 = sched_setparam */
 	{ AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam },	/* 328 = sched_getparam */
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index 42d6c83..9848c74 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -331,8 +331,8 @@ const char *syscallnames[] = {
 	"yield",			/* 321 = yield */
 	"#322",			/* 322 = thr_sleep */
 	"#323",			/* 323 = thr_wakeup */
-	"mlockall",			/* 324 = mlockall */
-	"munlockall",			/* 325 = munlockall */
+	"#324",			/* 324 = mlockall */
+	"#325",			/* 325 = munlockall */
 	"__getcwd",			/* 326 = __getcwd */
 	"sched_setparam",			/* 327 = sched_setparam */
 	"sched_getparam",			/* 328 = sched_getparam */
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 591bcef..5c3a96f 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -470,8 +470,8 @@
 321     STD     BSD     { int yield(void); }
 322	UNIMPL	BSD	thr_sleep
 323	UNIMPL	BSD	thr_wakeup
-324     STD     BSD     { int mlockall(int how); }
-325     STD     BSD     { int munlockall(void); }
+324     UNIMPL	BSD     mlockall
+325     UNIMPL	BSD     munlockall
 326     STD     BSD     { int __getcwd(u_char *buf, u_int buflen); }
 
 327     STD     POSIX   { int sched_setparam (pid_t pid, const struct sched_param *param); }
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index b121f6e..5430342 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -246,8 +246,6 @@
 #define	SYS_aio_write	319
 #define	SYS_lio_listio	320
 #define	SYS_yield	321
-#define	SYS_mlockall	324
-#define	SYS_munlockall	325
 #define	SYS___getcwd	326
 #define	SYS_sched_setparam	327
 #define	SYS_sched_getparam	328
diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk
index 4103f66..dd66c55 100644
--- a/sys/sys/syscall.mk
+++ b/sys/sys/syscall.mk
@@ -187,8 +187,6 @@ MIASM =  \
 	aio_write.o \
 	lio_listio.o \
 	yield.o \
-	mlockall.o \
-	munlockall.o \
 	__getcwd.o \
 	sched_setparam.o \
 	sched_getparam.o \
diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h
index 6b365af..3e937ba 100644
--- a/sys/sys/sysproto.h
+++ b/sys/sys/sysproto.h
@@ -1387,18 +1387,6 @@ struct	yield_args {
 #endif
 	register_t dummy;
 };
-struct	mlockall_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	int	how;	char how_[PAD_(int)];
-};
-struct	munlockall_args {
-#ifdef _KERNEL
-	struct sysmsg sysmsg;
-#endif
-	register_t dummy;
-};
 struct	__getcwd_args {
 #ifdef _KERNEL
 	struct sysmsg sysmsg;
@@ -2795,8 +2783,6 @@ int	sys_aio_read (struct aio_read_args *);
 int	sys_aio_write (struct aio_write_args *);
 int	sys_lio_listio (struct lio_listio_args *);
 int	sys_yield (struct yield_args *);
-int	sys_mlockall (struct mlockall_args *);
-int	sys_munlockall (struct munlockall_args *);
 int	sys___getcwd (struct __getcwd_args *);
 int	sys_sched_setparam (struct sched_setparam_args *);
 int	sys_sched_getparam (struct sched_getparam_args *);
diff --git a/sys/sys/sysunion.h b/sys/sys/sysunion.h
index 374ee3c..8c3255c 100644
--- a/sys/sys/sysunion.h
+++ b/sys/sys/sysunion.h
@@ -294,8 +294,6 @@ union sysunion {
 	struct	aio_write_args aio_write;
 	struct	lio_listio_args lio_listio;
 	struct	yield_args yield;
-	struct	mlockall_args mlockall;
-	struct	munlockall_args munlockall;
 	struct	__getcwd_args __getcwd;
 	struct	sched_setparam_args sched_setparam;
 	struct	sched_getparam_args sched_getparam;
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index a5beeb2..72e3574 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1025,31 +1025,6 @@ sys_mlock(struct mlock_args *uap)
 	return (error == KERN_SUCCESS ? 0 : ENOMEM);
 }
 
-/*
- * mlockall_args(int how)
- *
- * Dummy routine, doesn't actually do anything.
- *
- * No requirements
- */
-int
-sys_mlockall(struct mlockall_args *uap)
-{
-	return (ENOSYS);
-}
-
-/*
- * munlockall_args(void)
- *
- * Dummy routine, doesn't actually do anything.
- *
- * No requirements
- */
-int
-sys_munlockall(struct munlockall_args *uap)
-{
-	return (ENOSYS);
-}
 
 /*
  * munlock system call handler
-- 
1.7.0.5

