implement mlockall()/munlockall() for LTP syscall
This commit is contained in:
@ -27,4 +27,10 @@
|
|||||||
#define MAP_STACK 0x00020000
|
#define MAP_STACK 0x00020000
|
||||||
#define MAP_HUGETLB 0x00040000
|
#define MAP_HUGETLB 0x00040000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* for mlockall()
|
||||||
|
*/
|
||||||
|
#define MCL_CURRENT 0x01
|
||||||
|
#define MCL_FUTURE 0x02
|
||||||
|
|
||||||
#endif /* HEADER_ARCH_MMAN_H */
|
#endif /* HEADER_ARCH_MMAN_H */
|
||||||
|
|||||||
@ -88,6 +88,8 @@ SYSCALL_HANDLED(147, sched_get_priority_min)
|
|||||||
SYSCALL_HANDLED(148, sched_rr_get_interval)
|
SYSCALL_HANDLED(148, sched_rr_get_interval)
|
||||||
SYSCALL_HANDLED(149, mlock)
|
SYSCALL_HANDLED(149, mlock)
|
||||||
SYSCALL_HANDLED(150, munlock)
|
SYSCALL_HANDLED(150, munlock)
|
||||||
|
SYSCALL_HANDLED(151, mlockall)
|
||||||
|
SYSCALL_HANDLED(152, munlockall)
|
||||||
SYSCALL_HANDLED(158, arch_prctl)
|
SYSCALL_HANDLED(158, arch_prctl)
|
||||||
SYSCALL_HANDLED(160, setrlimit)
|
SYSCALL_HANDLED(160, setrlimit)
|
||||||
SYSCALL_HANDLED(186, gettid)
|
SYSCALL_HANDLED(186, gettid)
|
||||||
|
|||||||
@ -5038,6 +5038,37 @@ out2:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(mlockall)
|
||||||
|
{
|
||||||
|
const int flags = ihk_mc_syscall_arg0(ctx);
|
||||||
|
struct process *proc = cpu_local_var(current);
|
||||||
|
uid_t euid = geteuid();
|
||||||
|
|
||||||
|
if (!flags || (flags & ~(MCL_CURRENT|MCL_FUTURE))) {
|
||||||
|
kprintf("mlockall(0x%x):invalid flags: EINVAL\n", flags);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!euid) {
|
||||||
|
kprintf("mlockall(0x%x):priv user: 0\n", flags);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proc->rlimit[MCK_RLIMIT_MEMLOCK].rlim_cur != 0) {
|
||||||
|
kprintf("mlockall(0x%x):limits exists: ENOMEM\n", flags);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
kprintf("mlockall(0x%x):no lock permitted: EPERM\n", flags);
|
||||||
|
return -EPERM;
|
||||||
|
} /* sys_mlockall() */
|
||||||
|
|
||||||
|
SYSCALL_DECLARE(munlockall)
|
||||||
|
{
|
||||||
|
kprintf("munlockall(): 0\n");
|
||||||
|
return 0;
|
||||||
|
} /* sys_munlockall() */
|
||||||
|
|
||||||
SYSCALL_DECLARE(remap_file_pages)
|
SYSCALL_DECLARE(remap_file_pages)
|
||||||
{
|
{
|
||||||
const uintptr_t start0 = ihk_mc_syscall_arg0(ctx);
|
const uintptr_t start0 = ihk_mc_syscall_arg0(ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user