|
AquilaOS documentation
How it works, and its code
|
A thread. More...
#include <thread.h>
Data Fields | |
| tid_t | tid |
| the thread's ID, in its process | |
| state_t | state |
| its state | |
| struct proc * | owner |
| its process | |
| const char * | name |
| A kernel thread's (process 0's): its name, and what it runs. | |
| void(*) | kentry (void *arg) |
| void * | karg |
| uintptr_t | stack |
| its user stack | |
| uintptr_t | stack_base |
| size_t | stack_size |
| struct list_node | run_link |
| it's on the ready list (sched.c) while it's ready to run, or on the wait queue it sleeps on (waitq); run_link.list says which | |
| struct waitq * | waitq |
| int | syscall_nr |
| the system call it's in (the last one it made), to restart it | |
| int | restarting |
| whether the call is a restart (a stop interrupted it, and no handler ran); restart_until is the deadline it had, which a call that sleeps until a deadline (nanosleep, poll, select) keeps | |
| uint64_t | restart_until |
| void * | exit_value |
| what the thread exited with (thread_exit()), for thread_join() | |
| int | sig_oldmask_set |
| in sigsuspend() or pselect(): the signal mask they replaced, which the handler's frame keeps (sigreturn() restores it), or which is restored on the way out | |
| sigset_t | sig_oldmask |
| uint64_t | sleep_until |
| when it waits with a deadline (sched_wait()): the deadline, in arch_rtime_ns() time | |
| uintptr_t | fault_addr |
| the address of its last fault, the si_addr of the signal it raised | |
| struct list_node | timer_link |
| it's on the timer's list while it waits with a deadline | |
| struct file * | files [THREAD_FILES_HELD] |
| int | files_held |
| void * | arch |
| the architecture's own data: its registers, its kernel stack | |
| int | spawned |
| whether it has run yet | |
| int | urgent |
| it runs before the others once woken, as soon as the interrupt that woke it returns (sched_thread_wake()): the network's thread | |
| struct poll_reg * | poll_regs |
| in select() or poll(): what it waits for (poll_register()), and where it sleeps meanwhile | |
| struct waitq | poll_wait |
| int | killed |
| it was killed (proc_threads_end()) while it ran on another CPU: it frees itself there, when that CPU next enters the kernel; its owner is NULL if its process goes too (sched_thread_killed()) | |
| void* thread::arch |
the architecture's own data: its registers, its kernel stack
Definition at line 84 of file thread.h.
Referenced by aarch64_fpsimd_current(), aarch64_fpsimd_drop(), aarch64_fpsimd_restore(), aarch64_fpsimd_trap(), aarch64_return_to_user(), arch_exec_start(), arch_kthread_create(), arch_proc_fork(), arch_proc_init(), arch_syscall_return(), arch_thread_create(), arch_thread_kill(), arch_thread_spawn(), arch_thread_switch(), kthread_create(), and x86_return_to_user().
| void* thread::exit_value |
what the thread exited with (thread_exit()), for thread_join()
Definition at line 58 of file thread.h.
Referenced by sys_thread_join().
| uintptr_t thread::fault_addr |
| struct file* thread::files[THREAD_FILES_HELD] |
Definition at line 80 of file thread.h.
Referenced by file_hold(), and thread_files_release().
| int thread::files_held |
Definition at line 81 of file thread.h.
Referenced by file_hold(), and thread_files_release().
| void* thread::karg |
Definition at line 36 of file thread.h.
Referenced by kthread_create().
| void(*) thread::kentry(void *arg) |
Definition at line 35 of file thread.h.
Referenced by kthread_create().
| int thread::killed |
it was killed (proc_threads_end()) while it ran on another CPU: it frees itself there, when that CPU next enters the kernel; its owner is NULL if its process goes too (sched_thread_killed())
Definition at line 101 of file thread.h.
Referenced by proc_threads_end().
| const char* thread::name |
A kernel thread's (process 0's): its name, and what it runs.
Definition at line 34 of file thread.h.
Referenced by kthread_create(), and procfs_proc_status().
| struct proc* thread::owner |
its process
Definition at line 31 of file thread.h.
Referenced by aarch64_return_to_user(), arch_thread_spawn(), arch_thread_switch(), proc_execve(), proc_fork(), proc_threads_end(), sched_thread_killed(), signal_interrupts(), sys_thread_exit(), sys_thread_join(), thread_create(), thread_new(), and x86_return_to_user().
| struct poll_reg* thread::poll_regs |
in select() or poll(): what it waits for (poll_register()), and where it sleeps meanwhile
Definition at line 95 of file thread.h.
Referenced by poll_register(), and poll_unregister().
| int thread::restarting |
whether the call is a restart (a stop interrupted it, and no handler ran); restart_until is the deadline it had, which a call that sleeps until a deadline (nanosleep, poll, select) keeps
Definition at line 54 of file thread.h.
Referenced by aarch64_return_to_user(), and x86_return_to_user().
| struct list_node thread::run_link |
it's on the ready list (sched.c) while it's ready to run, or on the wait queue it sleeps on (waitq); run_link.list says which
Definition at line 45 of file thread.h.
Referenced by proc_threads_end(), procfs_proc_status(), sched_thread_ready(), sched_thread_wake(), schedule(), thread_wakeup(), and waitq_wakeup_nopoll().
| sigset_t thread::sig_oldmask |
Definition at line 64 of file thread.h.
Referenced by aarch64_return_to_user(), deliver(), deliver(), sys_sigsuspend(), and x86_return_to_user().
| int thread::sig_oldmask_set |
in sigsuspend() or pselect(): the signal mask they replaced, which the handler's frame keeps (sigreturn() restores it), or which is restored on the way out
Definition at line 63 of file thread.h.
Referenced by aarch64_return_to_user(), deliver(), deliver(), sys_sigsuspend(), and x86_return_to_user().
| uint64_t thread::sleep_until |
when it waits with a deadline (sched_wait()): the deadline, in arch_rtime_ns() time
Definition at line 68 of file thread.h.
Referenced by sched_timer_tick().
| int thread::spawned |
whether it has run yet
Definition at line 87 of file thread.h.
Referenced by arch_syscall_return(), kthread_create(), proc_execve(), proc_fork(), and sched_thread_spawn().
| uintptr_t thread::stack |
its user stack
Definition at line 39 of file thread.h.
Referenced by sys_thread_create(), and thread_create().
| uintptr_t thread::stack_base |
Definition at line 40 of file thread.h.
Referenced by binfmt_fmt_load().
| size_t thread::stack_size |
Definition at line 41 of file thread.h.
Referenced by binfmt_fmt_load().
| state_t thread::state |
its state
Definition at line 28 of file thread.h.
Referenced by kthread_create(), proc_threads_end(), procfs_proc_status(), signal_to(), sys_thread_exit(), sys_thread_join(), and thread_kill().
| int thread::syscall_nr |
the system call it's in (the last one it made), to restart it
Definition at line 49 of file thread.h.
Referenced by x86_return_to_user().
| tid_t thread::tid |
the thread's ID, in its process
Definition at line 25 of file thread.h.
Referenced by procfs_proc_status(), sys_thread_create(), sys_thread_join(), and thread_new().
| struct list_node thread::timer_link |
it's on the timer's list while it waits with a deadline
Definition at line 75 of file thread.h.
Referenced by procfs_proc_status(), sched_timer_cancel(), and sched_timer_tick().
| int thread::urgent |
it runs before the others once woken, as soon as the interrupt that woke it returns (sched_thread_wake()): the network's thread
Definition at line 91 of file thread.h.
Referenced by netif_register(), and sched_thread_wake().
| struct waitq* thread::waitq |
Definition at line 46 of file thread.h.
Referenced by proc_threads_end(), procfs_proc_status(), signal_to(), thread_wakeup(), and waitq_wakeup_nopoll().