Registers `close` system call to syscall_shim library.
Signed-off-by: Constantin Raducanu <raducanu.costi@xxxxxxxxx>
---
lib/vfscore/Makefile.uk | 1 +
lib/vfscore/exportsyms.uk | 2 ++
lib/vfscore/main.c | 9 ++++-----
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index a3391e6..631f351 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -29,3 +29,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += write-3 writev-3
UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 223bb72..cb01f33 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -18,6 +18,8 @@ write
uk_syscall_e_write
uk_syscall_r_write
close
+uk_syscall_e_close
+uk_syscall_r_close
read
uk_syscall_e_read
uk_syscall_r_read
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 846e2ef..e970df1 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -207,22 +207,21 @@ int fdclose(int fd)
return error;
}
-int close(int fd)
+UK_SYSCALL_R_DEFINE(int, close, int, fd)
{
int error;
trace_vfs_close(fd);
error = fdclose(fd);
if (error)
- goto out_errno;
+ goto out_error;
trace_vfs_close_ret();
return 0;
- out_errno:
+ out_error:
trace_vfs_close_err(error);
- errno = error;
- return -1;
+ return -error;
}
UK_TRACEPOINT(trace_vfs_mknod, "\"%s\" 0%0o 0x%x", const char*, mode_t, dev_t);