Add sched_yield(2)

This commit is contained in:
Mark
2020-07-28 14:52:31 +03:00
parent da48c168ea
commit ee85365bbc
3 changed files with 7 additions and 4 deletions
+1
View File
@@ -73,6 +73,7 @@ void *syscall_table[256] = {
// Process control
[SYSCALL_NRX_SIGENTRY] = sys_sigentry,
[SYSCALL_NR_EXECVE] = sys_execve,
[SYSCALL_NR_YIELD] = sys_yield,
[SYSCALL_NR_GETPID] = sys_getpid,
[SYSCALL_NR_CLONE] = sys_clone,
[SYSCALL_NR_KILL] = sys_kill,
+2
View File
@@ -19,6 +19,8 @@ int sys_setgid(gid_t gid);
int sys_sigaltstack(const struct user_stack *ss, struct user_stack *old_ss);
void sys_yield(void);
int sys_waitpid(pid_t pid, int *status, int flags);
pid_t sys_getpgid(pid_t pid);
int sys_setpgid(pid_t pid, pid_t pgrp);
+4 -4
View File
@@ -85,7 +85,6 @@ void proc_add_entry(struct process *proc) {
proc_ensure_dir();
kdebug("BEGIN ADD ENTRY %d\n", proc->pid);
snprintf(name, sizeof(name), "%d", proc->pid);
_assert(sysfs_add_dir(g_sysfs_proc_dir, name, &proc->fs_entry) == 0);
@@ -95,15 +94,12 @@ void proc_add_entry(struct process *proc) {
proc, sysfs_proc_parent, NULL) == 0);
_assert(sysfs_add_config_endpoint(proc->fs_entry, "ioctx", SYSFS_MODE_DEFAULT, 64,
proc, sysfs_proc_ioctx, NULL) == 0);
kdebug("END ADD ENTRY %d\n", proc->pid);
}
void proc_del_entry(struct process *proc) {
_assert(proc && !(proc->flags & THREAD_KERNEL));
_assert(proc->pid > 0);
kdebug("BEGIN DEL ENTRY %d\n", proc->pid);
sysfs_del_ent(proc->fs_entry);
kdebug("END DEL ENTRY %d\n", proc->pid);
}
void context_save_fpu(struct thread *new, struct thread *old) {
@@ -754,6 +750,10 @@ __attribute__((noreturn)) void sys_exit(int status) {
panic("This code shouldn't run\n");
}
void sys_yield(void) {
yield();
}
void sys_sigreturn(void) {
context_sigreturn();
}