[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 040/108] linux-user: Split out mlock, mlockall, m
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 040/108] linux-user: Split out mlock, mlockall, munlock, munlockall |
Date: |
Sat, 9 Jun 2018 17:01:12 -1000 |
All targets define all of these; remove the ifdefs.
Merge target_to_host_mlockall_arg into its only caller.
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 62 ++++++++++++++++++++++----------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7504ad74b5..f79aebe869 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7144,21 +7144,6 @@ static inline abi_long target_to_host_sigevent(struct
sigevent *host_sevp,
return 0;
}
-#if defined(TARGET_NR_mlockall)
-static inline int target_to_host_mlockall_arg(int arg)
-{
- int result = 0;
-
- if (arg & TARGET_MLOCKALL_MCL_CURRENT) {
- result |= MCL_CURRENT;
- }
- if (arg & TARGET_MLOCKALL_MCL_FUTURE) {
- result |= MCL_FUTURE;
- }
- return result;
-}
-#endif
-
static inline abi_long host_to_target_stat64(void *cpu_env,
abi_ulong target_addr,
struct stat *host_st)
@@ -8392,6 +8377,23 @@ IMPL(mknodat)
return ret;
}
+IMPL(mlock)
+{
+ return get_errno(mlock(g2h(arg1), arg2));
+}
+
+IMPL(mlockall)
+{
+ int host_flags = 0;
+ if (arg1 & TARGET_MLOCKALL_MCL_CURRENT) {
+ host_flags |= MCL_CURRENT;
+ }
+ if (arg1 & TARGET_MLOCKALL_MCL_FUTURE) {
+ host_flags |= MCL_FUTURE;
+ }
+ return get_errno(mlockall(host_flags));
+}
+
#ifdef TARGET_NR_mmap
IMPL(mmap)
{
@@ -8497,6 +8499,16 @@ IMPL(msync)
return get_errno(msync(g2h(arg1), arg2, arg3));
}
+IMPL(munlock)
+{
+ return get_errno(munlock(g2h(arg1), arg2));
+}
+
+IMPL(munlockall)
+{
+ return get_errno(munlockall());
+}
+
IMPL(munmap)
{
return get_errno(target_munmap(arg1, arg2));
@@ -9734,22 +9746,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num,
abi_long arg1,
void *p;
switch(num) {
-#ifdef TARGET_NR_mlock
- case TARGET_NR_mlock:
- return get_errno(mlock(g2h(arg1), arg2));
-#endif
-#ifdef TARGET_NR_munlock
- case TARGET_NR_munlock:
- return get_errno(munlock(g2h(arg1), arg2));
-#endif
-#ifdef TARGET_NR_mlockall
- case TARGET_NR_mlockall:
- return get_errno(mlockall(target_to_host_mlockall_arg(arg1)));
-#endif
-#ifdef TARGET_NR_munlockall
- case TARGET_NR_munlockall:
- return get_errno(munlockall());
-#endif
case TARGET_NR_truncate:
if (!(p = lock_user_string(arg1)))
return -TARGET_EFAULT;
@@ -12762,6 +12758,8 @@ static impl_fn *syscall_table(unsigned num)
SYSCALL(mknod);
#endif
SYSCALL(mknodat);
+ SYSCALL(mlock);
+ SYSCALL(mlockall);
#ifdef TARGET_NR_mmap
SYSCALL(mmap);
#endif
@@ -12772,6 +12770,8 @@ static impl_fn *syscall_table(unsigned num)
SYSCALL(mprotect);
SYSCALL(mremap);
SYSCALL(msync);
+ SYSCALL(munlock);
+ SYSCALL(munlockall);
SYSCALL(munmap);
#ifdef CONFIG_OPEN_BY_HANDLE
SYSCALL(name_to_handle_at);
--
2.17.1
- [Qemu-devel] [PATCH v2 030/108] linux-user: Split out rt_sigprocmask, sgetmask, sigprocmask, ssetmask, (continued)
- [Qemu-devel] [PATCH v2 030/108] linux-user: Split out rt_sigprocmask, sgetmask, sigprocmask, ssetmask, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 031/108] linux-user: Split out rt_sigpending, rt_sigsuspend, sigpending, sigsuspend, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 032/108] linux-user: Split out rt_sigqueueinfo, rt_sigtimedwait, rt_tgsigqueueinfo, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 033/108] linux-user: Split out rt_sigreturn, sethostname, setrlimit, sigreturn, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 036/108] linux-user: Split out symlink, symlinkat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 035/108] linux-user: Split out select, pselect6, newselect, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 034/108] linux-user: Split out getrlimit, getrusage, gettimeofday, settimeofday, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 037/108] linux-user: Split out readlink, readlinkat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 038/108] linux-user: Split out mmap, mmap2, reboot, swapon, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 039/108] linux-user: Split out mprotect, mremap, msync, munmap, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 040/108] linux-user: Split out mlock, mlockall, munlock, munlockall,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 041/108] linux-user: Split out fchmod, fchmodat, ftruncate, truncate, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 042/108] linux-user: Split out fstatfs, fstatfs64, statfs, statfs64, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 043/108] linux-user: Split out getpriority, setpriority, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 044/108] linux-user: Split out socketcall, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 045/108] linux-user: Split out accept, accept4, bind, connect, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 046/108] linux-user: Split out 7 syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 047/108] linux-user: Split out recvmmsg, send, sendmmsg, sendmsg, sendto, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 048/108] linux-user: Split out getrandom, shutdown, setsockopt, socket, socketpair, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 049/108] linux-user: Fix stub gettid, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 050/108] linux-user: Split out getitimer, setitimer, syslog, Richard Henderson, 2018/06/09
- Prev by Date:
[Qemu-devel] [PATCH v2 039/108] linux-user: Split out mprotect, mremap, msync, munmap
- Next by Date:
[Qemu-devel] [PATCH v2 041/108] linux-user: Split out fchmod, fchmodat, ftruncate, truncate
- Previous by thread:
[Qemu-devel] [PATCH v2 039/108] linux-user: Split out mprotect, mremap, msync, munmap
- Next by thread:
[Qemu-devel] [PATCH v2 041/108] linux-user: Split out fchmod, fchmodat, ftruncate, truncate
- Index(es):