[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 5/5] lib/vfscore: Register `truncate` to syscall_shim
Registers `truncate` system call to syscall_shim library. Signed-off-by: Constantin Raducanu <raducanu.costi@xxxxxxxxx> --- lib/vfscore/Makefile.uk | 3 ++- lib/vfscore/exportsyms.uk | 2 ++ lib/vfscore/main.c | 16 +++++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk index 6580573..662a2c8 100644 --- a/lib/vfscore/Makefile.uk +++ b/lib/vfscore/Makefile.uk @@ -32,4 +32,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2 -UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2 \ No newline at end of file +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2 +UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2 \ No newline at end of file diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk index 158386b..2805b73 100644 --- a/lib/vfscore/exportsyms.uk +++ b/lib/vfscore/exportsyms.uk @@ -72,6 +72,8 @@ uk_syscall_e_readv uk_syscall_r_readv writev truncate +uk_syscall_e_truncate +uk_syscall_r_truncate mknod preadv ioctl diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c index 2600dd2..1bcafe0 100644 --- a/lib/vfscore/main.c +++ b/lib/vfscore/main.c @@ -1694,7 +1694,7 @@ UK_TRACEPOINT(trace_vfs_truncate, "\"%s\" 0x%x", const char*, off_t); UK_TRACEPOINT(trace_vfs_truncate_ret, ""); UK_TRACEPOINT(trace_vfs_truncate_err, "%d", int); -int truncate(const char *pathname, off_t length) +UK_SYSCALL_R_DEFINE(int, truncate, const char*, pathname, off_t, length) { trace_vfs_truncate(pathname, length); struct task *t = main_task; @@ -1703,19 +1703,21 @@ int truncate(const char *pathname, off_t length) error = ENOENT; if (pathname == NULL) - goto out_errno; + goto out_error; + if ((error = task_conv(t, pathname, VWRITE, path)) != 0) - goto out_errno; + goto out_error; error = sys_truncate(path, length); if (error) - goto out_errno; + goto out_error; + trace_vfs_truncate_ret(); return 0; - out_errno: - errno = error; + + out_error: trace_vfs_truncate_err(error); - return -1; + return -error; } LFS64(truncate); -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |