diff options
author | Anoop C S <anoopcs@redhat.com> | 2019-09-27 11:19:37 +0530 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2019-10-08 08:38:32 +0000 |
commit | 5084a69de14f24e9d804998580eefcba773fdd5a (patch) | |
tree | b916c4c98de899dbf47e16c87c46e780ea558e5d /source3/modules/vfs_default.c | |
parent | c9d302f20b066267a8fd2d7ce4dc171161c9c40c (diff) | |
download | samba-5084a69de14f24e9d804998580eefcba773fdd5a.tar.gz |
s3: VFS: Add SMB_VFS_FCNTL
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_default.c')
-rw-r--r-- | source3/modules/vfs_default.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 738be3bf2d6..9bf8005bcd7 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2615,6 +2615,51 @@ static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, return 0; } +static int vfswrap_fcntl(vfs_handle_struct *handle, files_struct *fsp, int cmd, + va_list cmd_arg) +{ + void *argp; + va_list dup_cmd_arg; + int result; + int val; + + START_PROFILE(syscall_fcntl); + + va_copy(dup_cmd_arg, cmd_arg); + + switch(cmd) { + case F_SETLK: + case F_SETLKW: + case F_GETLK: +#if defined(HAVE_OFD_LOCKS) + case F_OFD_SETLK: + case F_OFD_SETLKW: + case F_OFD_GETLK: +#endif +#if defined(HAVE_F_OWNER_EX) + case F_GETOWN_EX: + case F_SETOWN_EX: +#endif +#if defined(HAVE_RW_HINTS) + case F_GET_RW_HINT: + case F_SET_RW_HINT: + case F_GET_FILE_RW_HINT: + case F_SET_FILE_RW_HINT: +#endif + argp = va_arg(dup_cmd_arg, void *); + result = sys_fcntl_ptr(fsp->fh->fd, cmd, argp); + break; + default: + val = va_arg(dup_cmd_arg, int); + result = sys_fcntl_int(fsp->fh->fd, cmd, val); + } + + va_end(dup_cmd_arg); + + END_PROFILE(syscall_fcntl); + return result; +} + static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { bool result; @@ -3506,6 +3551,7 @@ static struct vfs_fn_pointers vfs_default_fns = { .fallocate_fn = vfswrap_fallocate, .lock_fn = vfswrap_lock, .kernel_flock_fn = vfswrap_kernel_flock, + .fcntl_fn = vfswrap_fcntl, .linux_setlease_fn = vfswrap_linux_setlease, .getlock_fn = vfswrap_getlock, .symlinkat_fn = vfswrap_symlinkat, |