|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH 4/5] lib/vfscore: Register `ftruncate` to syscall_shim
Registers `ftruncate` 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 | 11 +++++------
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 3986676..6580573 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -31,4 +31,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
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
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 57413d6..158386b 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -33,6 +33,8 @@ fhold
fdrop
fget
ftruncate
+uk_syscall_e_ftruncate
+uk_syscall_r_ftruncate
stat
chmod
fchmod
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index b5b7e40..2600dd2 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1724,7 +1724,7 @@ UK_TRACEPOINT(trace_vfs_ftruncate, "%d 0x%x", int, off_t);
UK_TRACEPOINT(trace_vfs_ftruncate_ret, "");
UK_TRACEPOINT(trace_vfs_ftruncate_err, "%d", int);
-int ftruncate(int fd, off_t length)
+UK_SYSCALL_R_DEFINE(int, ftruncate, int, fd, off_t, length)
{
trace_vfs_ftruncate(fd, length);
struct vfscore_file *fp;
@@ -1732,20 +1732,19 @@ int ftruncate(int fd, off_t length)
error = fget(fd, &fp);
if (error)
- goto out_errno;
+ goto out_error;
error = sys_ftruncate(fp, length);
fdrop(fp);
if (error)
- goto out_errno;
+ goto out_error;
trace_vfs_ftruncate_ret();
return 0;
- out_errno:
- errno = error;
+ out_error:
trace_vfs_ftruncate_err(error);
- return -1;
+ return -error;
}
LFS64(ftruncate);
--
2.17.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |