mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: fork syscall
This commit is contained in:
@@ -133,10 +133,10 @@ index 0000000..e5b087a
|
||||
+
|
||||
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||
new file mode 100644
|
||||
index 0000000..dc6bd0e
|
||||
index 0000000..3961e7f
|
||||
--- /dev/null
|
||||
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
|
||||
@@ -0,0 +1,178 @@
|
||||
@@ -0,0 +1,185 @@
|
||||
+#include <bits/ensure.h>
|
||||
+#include <mlibc/debug.hpp>
|
||||
+#include <mlibc/all-sysdeps.hpp>
|
||||
@@ -200,6 +200,13 @@ index 0000000..dc6bd0e
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ int sys_fork(pid_t *pid) {
|
||||
+ long ret = 0;
|
||||
+ long error = syscall(SYSCALL_FORK, &ret);
|
||||
+ *pid = ret;
|
||||
+ return error;
|
||||
+ }
|
||||
+
|
||||
+ int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags, struct stat *statbuf) {
|
||||
+ long ret;
|
||||
+ switch (fsfdt) {
|
||||
@@ -334,10 +341,10 @@ index 0000000..990eca0
|
||||
+#endif
|
||||
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||
new file mode 100644
|
||||
index 0000000..fde482a
|
||||
index 0000000..16c462d
|
||||
--- /dev/null
|
||||
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
|
||||
@@ -0,0 +1,34 @@
|
||||
@@ -0,0 +1,35 @@
|
||||
+#ifndef _SYSCALL_H_INCLUDE
|
||||
+#define _SYSCALL_H_INCLUDE
|
||||
+
|
||||
@@ -352,6 +359,7 @@ index 0000000..fde482a
|
||||
+#define SYSCALL_GETPID 8
|
||||
+#define SYSCALL_FSTAT 9
|
||||
+#define SYSCALL_FSTATAT 10
|
||||
+#define SYSCALL_FORK 11
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <stdint.h>
|
||||
|
||||
Reference in New Issue
Block a user