mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Remove getpid and fork system calls
The getpid and fork system calls were stubbed out previously, this commit removes them and adds process_koid as a getpid replacement.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
SYSCALL(0x00, object_noop, void)
|
||||
SYSCALL(0x01, object_wait, j6_handle_t, j6_signal_t, j6_signal_t *)
|
||||
|
||||
SYSCALL(0x10, process_koid, j6_koid_t *)
|
||||
SYSCALL(0x11, process_exit, int64_t)
|
||||
SYSCALL(0x12, process_fork, uint32_t*)
|
||||
SYSCALL(0x13, process_getpid, uint32_t*)
|
||||
SYSCALL(0x14, process_log, const char *)
|
||||
SYSCALL(0x15, process_pause, void)
|
||||
SYSCALL(0x16, process_sleep, uint64_t)
|
||||
SYSCALL(0x12, process_log, const char *)
|
||||
SYSCALL(0x13, process_pause, void)
|
||||
SYSCALL(0x14, process_sleep, uint64_t)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "j6/errors.h"
|
||||
#include "j6/types.h"
|
||||
|
||||
#include "objects/process.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
@@ -21,43 +23,20 @@ process_exit(int64_t status)
|
||||
return j6_err_unexpected;
|
||||
}
|
||||
|
||||
/*
|
||||
j6_status_t
|
||||
process_fork(pid_t *pid)
|
||||
process_koid(j6_koid_t *koid)
|
||||
{
|
||||
if (pid == nullptr) {
|
||||
if (koid == nullptr) {
|
||||
return j6_err_invalid_arg;
|
||||
}
|
||||
|
||||
auto &s = scheduler::get();
|
||||
auto *p = s.current();
|
||||
pid_t ppid = p->pid;
|
||||
|
||||
log::debug(logs::syscall, "Process %d calling fork(%016llx)", ppid, pid);
|
||||
|
||||
*pid = p->fork();
|
||||
|
||||
p = s.current();
|
||||
log::debug(logs::syscall, "Process %d's fork: returning %d from process %d", ppid, *pid, p->pid);
|
||||
TCB *tcb = scheduler::get().current();
|
||||
process &p = thread::from_tcb(tcb)->parent();
|
||||
|
||||
*koid = p.koid();
|
||||
return j6_status_ok;
|
||||
}
|
||||
|
||||
j6_status_t
|
||||
process_getpid(pid_t *pid)
|
||||
{
|
||||
if (pid == nullptr) {
|
||||
return j6_err_invalid_arg;
|
||||
}
|
||||
|
||||
auto &s = scheduler::get();
|
||||
auto *p = s.current();
|
||||
|
||||
*pid = p->pid;
|
||||
return j6_status_ok;
|
||||
}
|
||||
*/
|
||||
|
||||
j6_status_t
|
||||
process_log(const char *message)
|
||||
{
|
||||
@@ -72,9 +51,6 @@ process_log(const char *message)
|
||||
return j6_status_ok;
|
||||
}
|
||||
|
||||
j6_status_t process_fork(uint32_t *pid) { *pid = 5; return process_log("CALLED FORK"); }
|
||||
j6_status_t process_getpid(uint32_t *pid) { *pid = 0; return process_log("CALLED GETPID"); }
|
||||
|
||||
j6_status_t
|
||||
process_pause()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user