mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
kernel: close syscall
This commit is contained in:
@@ -4,13 +4,15 @@ extern syscall_mmap
|
|||||||
extern syscall_openat
|
extern syscall_openat
|
||||||
extern syscall_read
|
extern syscall_read
|
||||||
extern syscall_seek
|
extern syscall_seek
|
||||||
|
extern syscall_close
|
||||||
syscalltab:
|
syscalltab:
|
||||||
dq syscall_print
|
dq syscall_print
|
||||||
dq syscall_mmap
|
dq syscall_mmap
|
||||||
dq syscall_openat
|
dq syscall_openat
|
||||||
dq syscall_read
|
dq syscall_read
|
||||||
dq syscall_seek
|
dq syscall_seek
|
||||||
syscallcount equ 5
|
dq syscall_close
|
||||||
|
syscallcount equ 6
|
||||||
section .text
|
section .text
|
||||||
global arch_syscall_entry
|
global arch_syscall_entry
|
||||||
; on entry:
|
; on entry:
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#include <kernel/syscalls.h>
|
||||||
|
#include <kernel/file.h>
|
||||||
|
|
||||||
|
syscallret_t syscall_close(context_t *context, int fd) {
|
||||||
|
syscallret_t ret = {
|
||||||
|
.ret = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
ret.errno = fd_close(fd);
|
||||||
|
ret.ret = 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
@@ -113,10 +113,10 @@ index 0000000..e5b087a
|
|||||||
+
|
+
|
||||||
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..b92f59e
|
index 0000000..0f88fe5
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||||
@@ -0,0 +1,151 @@
|
@@ -0,0 +1,152 @@
|
||||||
+#include <bits/ensure.h>
|
+#include <bits/ensure.h>
|
||||||
+#include <mlibc/debug.hpp>
|
+#include <mlibc/debug.hpp>
|
||||||
+#include <mlibc/all-sysdeps.hpp>
|
+#include <mlibc/all-sysdeps.hpp>
|
||||||
@@ -244,7 +244,8 @@ index 0000000..b92f59e
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ int sys_close(int fd) {
|
+ int sys_close(int fd) {
|
||||||
+ return ENOSYS;
|
+ long r;
|
||||||
|
+ return syscall(SYSCALL_CLOSE, &r, fd);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, off_t offset, void **window) {
|
+ int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, off_t offset, void **window) {
|
||||||
@@ -287,10 +288,10 @@ index 0000000..990eca0
|
|||||||
+#endif
|
+#endif
|
||||||
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..1947f70
|
index 0000000..bb2e40d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||||
@@ -0,0 +1,28 @@
|
@@ -0,0 +1,29 @@
|
||||||
+#ifndef _SYSCALL_H_INCLUDE
|
+#ifndef _SYSCALL_H_INCLUDE
|
||||||
+#define _SYSCALL_H_INCLUDE
|
+#define _SYSCALL_H_INCLUDE
|
||||||
+
|
+
|
||||||
@@ -299,6 +300,7 @@ index 0000000..1947f70
|
|||||||
+#define SYSCALL_OPENAT 2
|
+#define SYSCALL_OPENAT 2
|
||||||
+#define SYSCALL_READ 3
|
+#define SYSCALL_READ 3
|
||||||
+#define SYSCALL_SEEK 4
|
+#define SYSCALL_SEEK 4
|
||||||
|
+#define SYSCALL_CLOSE 5
|
||||||
+
|
+
|
||||||
+#include <stddef.h>
|
+#include <stddef.h>
|
||||||
+#include <stdint.h>
|
+#include <stdint.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user