mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
riscv: compat: syscall: Add compat_sys_call_table implementation
Implement compat sys_call_table and some system call functions: truncate64, ftruncate64, fallocate, pread64, pwrite64, sync_file_range, readahead, fadvise64_64 which need argument translation. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20220405071314.3225832-12-guoren@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
01abdfeac8
commit
59c10c52f5
13 changed files with 148 additions and 3 deletions
24
fs/open.c
24
fs/open.c
|
@ -224,6 +224,21 @@ SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
|
|||
}
|
||||
#endif /* BITS_PER_LONG == 32 */
|
||||
|
||||
#if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_TRUNCATE64)
|
||||
COMPAT_SYSCALL_DEFINE3(truncate64, const char __user *, pathname,
|
||||
compat_arg_u64_dual(length))
|
||||
{
|
||||
return ksys_truncate(pathname, compat_arg_u64_glue(length));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_FTRUNCATE64)
|
||||
COMPAT_SYSCALL_DEFINE3(ftruncate64, unsigned int, fd,
|
||||
compat_arg_u64_dual(length))
|
||||
{
|
||||
return ksys_ftruncate(fd, compat_arg_u64_glue(length));
|
||||
}
|
||||
#endif
|
||||
|
||||
int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
|
||||
{
|
||||
|
@ -339,6 +354,15 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
|
|||
return ksys_fallocate(fd, mode, offset, len);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_FALLOCATE)
|
||||
COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode, compat_arg_u64_dual(offset),
|
||||
compat_arg_u64_dual(len))
|
||||
{
|
||||
return ksys_fallocate(fd, mode, compat_arg_u64_glue(offset),
|
||||
compat_arg_u64_glue(len));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* access() needs to use the real uid/gid, not the effective uid/gid.
|
||||
* We do this by temporarily clearing all FS-related capabilities and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue