* 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.
#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
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)) {
ipc_shm
membarrier
memfd_create
+mlock2
mmap
mmap64
mmsg
ipc_shm \
membarrier \
memfd_create \
+ mlock2 \
mmap \
mmap64 \
mmsg \
sysinfo.test \
membarrier.test \
memfd_create.test \
+ mlock2.test \
mmap.test \
mmap64.test \
mmsg.test \
--- /dev/null
+#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
+}
--- /dev/null
+#!/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
--- /dev/null
+MLOCK_ONFAULT 1
-MCL_CURRENT
-MCL_FUTURE
+MCL_CURRENT 1
+MCL_FUTURE 2
+MCL_ONFAULT 4