mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 05:38:21 +00:00
proc: separate from sched
This commit is contained in:
@@ -26,7 +26,7 @@ syscallret_t syscall_chdir(context_t *, char *upath) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
vnode_t *ref = path[0] == '/' ? sched_getroot() : sched_getcwd();
|
||||
vnode_t *ref = path[0] == '/' ? proc_get_root() : proc_get_cwd();
|
||||
vnode_t *new = NULL;
|
||||
|
||||
ret.errno = vfs_lookup(&new, ref, path, NULL, 0);
|
||||
@@ -40,7 +40,7 @@ syscallret_t syscall_chdir(context_t *, char *upath) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sched_setcwd(new);
|
||||
proc_set_cwd(new);
|
||||
ret.ret = 0;
|
||||
|
||||
cleanup:
|
||||
@@ -69,7 +69,7 @@ syscallret_t syscall_fchdir(context_t *, int fd) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sched_setcwd(file->vnode);
|
||||
proc_set_cwd(file->vnode);
|
||||
ret.errno = 0;
|
||||
|
||||
cleanup:
|
||||
|
||||
@@ -31,7 +31,7 @@ syscallret_t syscall_chroot(context_t *, char *upath) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
vnode_t *ref = path[0] == '/' ? sched_getroot() : sched_getcwd();
|
||||
vnode_t *ref = path[0] == '/' ? proc_get_root() : proc_get_cwd();
|
||||
vnode_t *new = NULL;
|
||||
|
||||
ret.errno = vfs_lookup(&new, ref, path, NULL, 0);
|
||||
@@ -45,7 +45,7 @@ syscallret_t syscall_chroot(context_t *, char *upath) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sched_setroot(new);
|
||||
proc_set_root(new);
|
||||
ret.ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
||||
@@ -171,7 +171,7 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
|
||||
goto error;
|
||||
}
|
||||
|
||||
refnode = *path == '/' ? sched_getroot() : sched_getcwd();
|
||||
refnode = *path == '/' ? proc_get_root() : proc_get_cwd();
|
||||
|
||||
ret.errno = vfs_lookup(&node, refnode, path, NULL, 0);
|
||||
if (ret.errno)
|
||||
@@ -241,7 +241,7 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
|
||||
|
||||
if (interp) {
|
||||
vnode_t *interpnode = NULL;
|
||||
vnode_t *interprefnode = *interp == '/' ? sched_getroot() : sched_getcwd();
|
||||
vnode_t *interprefnode = *interp == '/' ? proc_get_root() : proc_get_cwd();
|
||||
ret.errno = vfs_lookup(&interpnode, interprefnode, interp, NULL, 0);
|
||||
if (ret.errno)
|
||||
goto error;
|
||||
@@ -273,7 +273,7 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
|
||||
|
||||
ret.ret = 0;
|
||||
|
||||
sched_stopotherthreads();
|
||||
proc_stop_other_threads();
|
||||
|
||||
// close O_CLOEXEC fds
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
#include <semaphore.h>
|
||||
|
||||
__attribute__((noreturn)) void syscall_exit(context_t *context, int status) {
|
||||
sched_terminateprogram(status << 8);
|
||||
proc_terminate(status << 8);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ syscallret_t syscall_fork(context_t *ctx) {
|
||||
};
|
||||
|
||||
proc_t *proc = current_thread()->proc;
|
||||
proc_t *nproc = sched_newproc();
|
||||
proc_t *nproc = proc_create();
|
||||
if (nproc == NULL) {
|
||||
ret.errno = ENOMEM;
|
||||
goto cleanup;
|
||||
@@ -45,8 +45,8 @@ syscallret_t syscall_fork(context_t *ctx) {
|
||||
|
||||
nproc->umask = current_thread()->proc->umask;
|
||||
nproc->cred = current_thread()->proc->cred;
|
||||
nproc->root = sched_getroot();
|
||||
nproc->cwd = sched_getcwd();
|
||||
nproc->root = proc_get_root();
|
||||
nproc->cwd = proc_get_cwd();
|
||||
nproc->threadlist = nthread;
|
||||
nthread->procnext = NULL;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ syscallret_t syscall_kill(context_t *context, int pid, int signal) {
|
||||
else if (pid < -1)
|
||||
effectivepid = -pid; // target specific process group
|
||||
|
||||
proc_t *target = sched_getprocfrompid(effectivepid);
|
||||
proc_t *target = proc_get_from_pid(effectivepid);
|
||||
if (target == NULL && pid != 0 && pid != -1) {
|
||||
ret.errno = ESRCH;
|
||||
return ret;
|
||||
@@ -39,7 +39,7 @@ syscallret_t syscall_kill(context_t *context, int pid, int signal) {
|
||||
|
||||
signal_signalproc(target, signal);
|
||||
} else if (pid == -1) {
|
||||
ret.errno = sched_signalall(signal, current_thread()->proc);
|
||||
ret.errno = proc_signal_all(signal, current_thread()->proc);
|
||||
} else {
|
||||
ret.errno = jobctl_signal(target, signal, current_thread()->proc);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ syscallret_t syscall_killthread(context_t *context, int pid, int tid, int signal
|
||||
}
|
||||
|
||||
proc_t *sender = current_thread()->proc;
|
||||
proc_t *target = sched_getprocfrompid(pid);
|
||||
proc_t *target = proc_get_from_pid(pid);
|
||||
if (target == NULL) {
|
||||
ret.errno = ESRCH;
|
||||
return ret;
|
||||
|
||||
@@ -70,8 +70,8 @@ syscallret_t syscall_mount(context_t *context, char *ubacking, char *umountpoint
|
||||
|
||||
vnode_t *backingrefnode = NULL;
|
||||
if (ubacking)
|
||||
backingrefnode = *backing == '/' ? sched_getroot() : sched_getcwd();
|
||||
vnode_t *mountpointrefnode = *mountpoint == '/' ? sched_getroot() : sched_getcwd();
|
||||
backingrefnode = *backing == '/' ? proc_get_root() : proc_get_cwd();
|
||||
vnode_t *mountpointrefnode = *mountpoint == '/' ? proc_get_root() : proc_get_cwd();
|
||||
vnode_t *backingnode = NULL;
|
||||
|
||||
if (ubacking) {
|
||||
|
||||
@@ -25,7 +25,7 @@ syscallret_t syscall_setpgid(context_t *, pid_t pid, pid_t pgid) {
|
||||
proc = currentproc;
|
||||
PROC_HOLD(proc);
|
||||
} else {
|
||||
proc = sched_getprocfrompid(pid);
|
||||
proc = proc_get_from_pid(pid);
|
||||
}
|
||||
|
||||
if (proc == NULL) {
|
||||
@@ -44,7 +44,7 @@ syscallret_t syscall_setpgid(context_t *, pid_t pid, pid_t pgid) {
|
||||
pgrp = currentproc;
|
||||
PROC_HOLD(pgrp);
|
||||
} else {
|
||||
pgrp = sched_getprocfrompid(pgid);
|
||||
pgrp = proc_get_from_pid(pgid);
|
||||
}
|
||||
|
||||
if (pgrp == NULL) {
|
||||
|
||||
@@ -9,7 +9,7 @@ __attribute__((noreturn)) void syscall_sigreturn(context_t *context) {
|
||||
int error = usercopy_fromuser(&sigframe, (void *)CTX_SP(context), sizeof(sigframe_t));
|
||||
if (error || ARCH_CONTEXT_ISUSER(&sigframe.context) == false) {
|
||||
printf("syscall_sigreturn: bad return stack or bad return information\n");
|
||||
sched_terminateprogram(SIGSEGV);
|
||||
proc_terminate(SIGSEGV);
|
||||
}
|
||||
|
||||
interrupt_set(false);
|
||||
|
||||
Reference in New Issue
Block a user