Implement mlock2 syscall decoding
* mem.c: Include "xlat/mlock_flags.h". (SYS_FUNC(mlock2)): New function. * xlat/mlock_flags.in: New file. * xlat/mlockall_flags.in: Add MCL_ONFAULT, add default values. * linux/dummy.h (mlock2): Remove. * tests/mlock2.c: New file. * tests/mlock2.test: New test. * tests/Makefile.am (check_PROGRAMS): Add mlock2. (TESTS): Add mlock2.test. * tests/.gitignore Add mlock2.
This commit is contained in:
parent
2aec1e67df
commit
0d0a50aa25
@ -37,7 +37,6 @@
|
||||
#define sys_kcmp printargs
|
||||
#define sys_kexec_file_load printargs
|
||||
#define sys_lookup_dcookie printargs
|
||||
#define sys_mlock2 printargs
|
||||
#define sys_name_to_handle_at printargs
|
||||
#define sys_open_by_handle_at printargs
|
||||
#define sys_sysfs printargs
|
||||
|
11
mem.c
11
mem.c
@ -247,6 +247,17 @@ SYS_FUNC(msync)
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
||||
#include "xlat/mlock_flags.h"
|
||||
|
||||
SYS_FUNC(mlock2)
|
||||
{
|
||||
printaddr(tcp->u_arg[0]);
|
||||
tprintf(", %lu, ", tcp->u_arg[1]);
|
||||
printflags(mlock_flags, tcp->u_arg[2], "MLOCK_???");
|
||||
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
||||
SYS_FUNC(mincore)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
|
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -20,6 +20,7 @@ ipc_sem
|
||||
ipc_shm
|
||||
membarrier
|
||||
memfd_create
|
||||
mlock2
|
||||
mmap
|
||||
mmap64
|
||||
mmsg
|
||||
|
@ -33,6 +33,7 @@ check_PROGRAMS = \
|
||||
ipc_shm \
|
||||
membarrier \
|
||||
memfd_create \
|
||||
mlock2 \
|
||||
mmap \
|
||||
mmap64 \
|
||||
mmsg \
|
||||
@ -148,6 +149,7 @@ TESTS = \
|
||||
sysinfo.test \
|
||||
membarrier.test \
|
||||
memfd_create.test \
|
||||
mlock2.test \
|
||||
mmap.test \
|
||||
mmap64.test \
|
||||
mmsg.test \
|
||||
|
25
tests/mlock2.c
Normal file
25
tests/mlock2.c
Normal file
@ -0,0 +1,25 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#ifdef __NR_mlock2
|
||||
if (syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) != -1)
|
||||
return 77;
|
||||
printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe) = -1 %s\n",
|
||||
errno == ENOSYS ?
|
||||
"ENOSYS (Function not implemented)" :
|
||||
"EINVAL (Invalid argument)");
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
#else
|
||||
return 77;
|
||||
#endif
|
||||
}
|
13
tests/mlock2.test
Executable file
13
tests/mlock2.test
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check mlock2 syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
|
||||
run_prog > /dev/null
|
||||
OUT="$LOG.out"
|
||||
run_strace -e mlock2 $args > "$OUT"
|
||||
match_diff "$OUT" "$LOG"
|
||||
rm -f "$OUT"
|
||||
|
||||
exit 0
|
1
xlat/mlock_flags.in
Normal file
1
xlat/mlock_flags.in
Normal file
@ -0,0 +1 @@
|
||||
MLOCK_ONFAULT 1
|
@ -1,2 +1,3 @@
|
||||
MCL_CURRENT
|
||||
MCL_FUTURE
|
||||
MCL_CURRENT 1
|
||||
MCL_FUTURE 2
|
||||
MCL_ONFAULT 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user