mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Add syscall helpers
Added the syscalls/helpers.h file to templatize common kobject syscall operations. Also moved most syscall implementations to using process::current() and thread::current() instead of asking the scheduler.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "log.h"
|
||||
#include "objects/process.h"
|
||||
#include "objects/thread.h"
|
||||
#include "scheduler.h"
|
||||
|
||||
namespace syscalls {
|
||||
@@ -11,14 +10,10 @@ namespace syscalls {
|
||||
j6_status_t
|
||||
process_koid(j6_koid_t *koid)
|
||||
{
|
||||
if (koid == nullptr) {
|
||||
if (koid == nullptr)
|
||||
return j6_err_invalid_arg;
|
||||
}
|
||||
|
||||
TCB *tcb = scheduler::get().current();
|
||||
process &p = thread::from_tcb(tcb)->parent();
|
||||
|
||||
*koid = p.koid();
|
||||
*koid = process::current().koid();
|
||||
return j6_status_ok;
|
||||
}
|
||||
|
||||
@@ -26,8 +21,7 @@ j6_status_t
|
||||
process_exit(int64_t status)
|
||||
{
|
||||
auto &s = scheduler::get();
|
||||
TCB *tcb = s.current();
|
||||
process &p = thread::from_tcb(tcb)->parent();
|
||||
process &p = process::current();
|
||||
|
||||
log::debug(logs::syscall, "Process %llx exiting with code %d", p.koid(), status);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user