mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
Waitpid seems to be working
This commit is contained in:
@@ -30,9 +30,9 @@ extern "C" {
|
||||
|
||||
#define SYSCALL_EXECVE_ID 50
|
||||
#define SYSCALL_FORK_ID 51
|
||||
#define SYSCALL_WAITPID_ID 52
|
||||
#define SYSCALL_SBRK_ID 100
|
||||
|
||||
|
||||
#define SYSCALL_PRINT_MEM 1000
|
||||
#define SYSCALL_PRINT_TASKS 1001
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
uint64_t _do_syscall(uint64_t id_rdi, uint64_t a1_rsi, uint64_t a2_rdx, uint64_t a3_rcx) {
|
||||
register uint64_t res asm("rax");
|
||||
@@ -92,6 +93,11 @@ int _unlink(char *name) {
|
||||
}
|
||||
|
||||
int _wait(int *status) {
|
||||
return waitpid(-1, &status, 0);
|
||||
}
|
||||
|
||||
pid_t waitpid(pid_t pid, int *status, int options) {
|
||||
return _do_syscall(SYSCALL_WAITPID_ID, (uint64_t) pid, (uint64_t) status, (uint64_t) options);
|
||||
}
|
||||
|
||||
int _write(int file, char *ptr, int len) {
|
||||
|
||||
Reference in New Issue
Block a user