From 3dabc672182decad3e93e389ee5c3e6044ed0e98 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 7 Apr 2014 11:14:38 -0400 Subject: [PATCH] add new renameat2 syscall --- include/syscalls-x86_64.h | 3 ++- syscalls/rename.c | 29 +++++++++++++++++++++++++++++ syscalls/syscalls.h | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/include/syscalls-x86_64.h b/include/syscalls-x86_64.h index 0a3d6bf..e09df43 100644 --- a/include/syscalls-x86_64.h +++ b/include/syscalls-x86_64.h @@ -1,6 +1,6 @@ #pragma once -/* Syscalls from arch/x86/syscalls/syscall_64.tbl as of 3.8rc1 */ +/* Syscalls from arch/x86/syscalls/syscall_64.tbl as of 3.15rc1 */ #include "sanitise.h" #include "syscall.h" @@ -323,4 +323,5 @@ struct syscalltable syscalls_x86_64[] = { { .entry = &syscall_finit_module }, { .entry = &syscall_sched_setattr }, { .entry = &syscall_sched_getattr }, + { .entry = &syscall_renameat2 }, }; diff --git a/syscalls/rename.c b/syscalls/rename.c index 4307e6d..d2fa7bc 100644 --- a/syscalls/rename.c +++ b/syscalls/rename.c @@ -32,3 +32,32 @@ struct syscallentry syscall_renameat = { .flags = NEED_ALARM, .group = GROUP_VFS, }; + +/* + * SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, + int, newdfd, const char __user *, newname, unsigned int, flags) + */ + +#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ +#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ + +struct syscallentry syscall_renameat2 = { + .name = "renameat2", + .num_args = 5, + .arg1name = "olddfd", + .arg1type = ARG_FD, + .arg2name = "oldname", + .arg2type = ARG_ADDRESS, + .arg3name = "newdfd", + .arg3type = ARG_FD, + .arg4name = "newname", + .arg4type = ARG_ADDRESS, + .arg5name = "flags", + .arg5type = ARG_LIST, + .arg5list = { + .num = 2, + .values = { RENAME_NOREPLACE, RENAME_EXCHANGE }, + }, + .flags = NEED_ALARM, + .group = GROUP_VFS, +}; diff --git a/syscalls/syscalls.h b/syscalls/syscalls.h index 09b6a69..da86590 100644 --- a/syscalls/syscalls.h +++ b/syscalls/syscalls.h @@ -368,3 +368,4 @@ extern struct syscallentry syscall_arm_fadvise64_64; extern struct syscallentry syscall_sh_cacheflush; extern struct syscallentry syscall_sched_setattr; extern struct syscallentry syscall_sched_getattr; +extern struct syscallentry syscall_renameat2; -- 2.11.4.GIT