|
AquilaOS documentation
How it works, and its code
|
Kernel threads. More...
#include <core/system.h>#include <core/arch.h>#include <core/panic.h>#include <core/string.h>#include <mm/vm.h>#include <sys/kthread.h>#include <sys/proc.h>#include <sys/sched.h>#include <ds/queue.h>Go to the source code of this file.
Functions | |
| static int | kproc_init (void) |
| Makes process 0, the kernel threads' process, the first time a kernel thread is made. | |
| static void | kthread_start (void) |
| Runs a kernel thread's function: every kernel thread starts here, on its own stack (arch_kthread_create()). | |
| int | kthread_create (const char *name, void(*fn)(void *), void *arg, struct thread **ref) |
| Makes a kernel thread, and makes it ready to run. | |
Variables | |
| struct proc * | kproc |
Kernel threads.
Kernel threads are the threads of process 0, "[kernel]", as on the BSDs. They run kernel functions on their kernel stacks, in the kernel's address space, and are scheduled like any other thread. Process 0 has no parent, has its own session and process group, and takes no signals.
Definition in file kthread.c.
|
static |
Makes process 0, the kernel threads' process, the first time a kernel thread is made.
Returns 0, or -ENOMEM.
Definition at line 27 of file kthread.c.
References kmalloc(), kproc, kproc_init(), kvm_space, M_ZERO, proc::name, panic, proc::pid, vm_space::pmap, procs, proc::running, session_new(), SIG_DFL, SIG_MAX, proc::sigaction, and proc::vm_space.
Referenced by kproc_init(), and kthread_create().
| int kthread_create | ( | const char * | name, |
| void(* | fn )(void *), | ||
| void * | arg, | ||
| struct thread ** | ref ) |
Makes a kernel thread, and makes it ready to run.
| name | the thread's name, as ps shows it ("[net]") |
| fn | the function it runs, which must never return |
| arg | the argument fn is called with |
| ref | if not NULL, set to the new thread |
Definition at line 71 of file kthread.c.
References thread::arch, arch_kthread_create(), thread::karg, thread::kentry, kfree(), kproc, kproc_init(), kthread_create(), kthread_start(), thread::name, NULL, RUNNABLE, sched_thread_ready(), thread::spawned, thread::state, thread_new(), and proc::threads.
Referenced by kthread_create(), and netif_register().
|
static |
Runs a kernel thread's function: every kernel thread starts here, on its own stack (arch_kthread_create()).
The function must not return.
Definition at line 56 of file kthread.c.
References curthread, kthread_start(), and panic.
Referenced by kthread_create(), and kthread_start().
| struct proc* kproc |
Definition at line 23 of file kthread.c.
Referenced by kproc_init(), kthread_create(), signal_interrupts(), signal_send(), and signal_to().