Re: [PATCH 2/5] Add fchmodat4(), a new syscall
flat view
From: Palmer Dabbelt <hidden>
Date: 2019-05-31 23:36:47
Also in:
linux-arch, linux-fsdevel, lkml
On Fri, 31 May 2019 12:51:00 PDT (-0700), Arnd Bergmann wrote:
On Fri, May 31, 2019 at 9:23 PM Palmer Dabbelt [off-list ref] wrote:quoted
man 3p says that fchmodat() takes a flags argument, but the Linux syscall does not. There doesn't appear to be a good userspace workaround for this issue but the implementation in the kernel is pretty straight-forward. The specific use case where the missing flags came up was WRT a fuse filesystem implemenation, but the functionality is pretty generic so I'm assuming there would be other use cases. Signed-off-by: Palmer Dabbelt <redacted> --- fs/open.c | 21 +++++++++++++++++++-- include/linux/syscalls.h | 5 +++++ 2 files changed, 24 insertions(+), 2 deletions(-)diff --git a/fs/open.c b/fs/open.c index a00350018a47..cfad7684e8d3 100644 --- a/fs/open.c +++ b/fs/open.c@@ -568,11 +568,17 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode) return ksys_fchmod(fd, mode); } -int do_fchmodat(int dfd, const char __user *filename, umode_t mode) +int do_fchmodat4(int dfd, const char __user *filename, umode_t mode, int flags)...quoted
+ +int do_fchmodat(int dfd, const char __user *filename, umode_t mode) +{ + return do_fchmodat4(dfd, filename, mode, 0); +} +There is only one external caller of do_fchmodat(), so just change that to pass the extra argument here, and keep a single do_fchmodat() function used by the sys_fchmod(), sys_fchmod4(), sys_chmod() and ksys_chmod().
OK, I'll roll that up into a v2.