FreeBSD kernel kern code
|
#include "opt_witness.h"
#include "opt_kdtrace.h"
#include "opt_hwpmc_hooks.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/rangelock.h>
#include <sys/resourcevar.h>
#include <sys/sdt.h>
#include <sys/smp.h>
#include <sys/sched.h>
#include <sys/sleepqueue.h>
#include <sys/selinfo.h>
#include <sys/turnstile.h>
#include <sys/ktr.h>
#include <sys/rwlock.h>
#include <sys/umtx.h>
#include <sys/cpuset.h>
#include <security/audit/audit.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/uma.h>
#include <sys/eventhandler.h>
Go to the source code of this file.
Macros | |
#define | TID_BUFFER_SIZE 1024 |
#define | RUN_THRESH 16 |
Functions | |
__FBSDID ("$BSDSUniX$") | |
SDT_PROVIDER_DECLARE (proc) | |
SDT_PROBE_DEFINE (proc,,, lwp__exit) | |
TAILQ_HEAD (thread) | |
static void | tid_free (lwpid_t tid) |
static int | thread_ctor (void *mem, int size, void *arg, int flags) |
static void | thread_dtor (void *mem, int size, void *arg) |
static int | thread_init (void *mem, int size, int flags) |
static void | thread_fini (void *mem, int size) |
void | proc_linkup0 (struct proc *p, struct thread *td) |
void | proc_linkup (struct proc *p, struct thread *td) |
void | threadinit (void) |
void | thread_zombie (struct thread *td) |
void | thread_stash (struct thread *td) |
void | thread_reap (void) |
struct thread * | thread_alloc (int pages) |
int | thread_alloc_stack (struct thread *td, int pages) |
void | thread_free (struct thread *td) |
void | thread_exit (void) |
void | thread_wait (struct proc *p) |
void | thread_link (struct thread *td, struct proc *p) |
void | thread_unthread (struct thread *td) |
void | thread_unlink (struct thread *td) |
static int | calc_remaining (struct proc *p, int mode) |
int | thread_single (int mode) |
int | thread_suspend_check (int return_instead) |
void | thread_suspend_switch (struct thread *td) |
void | thread_suspend_one (struct thread *td) |
int | thread_unsuspend_one (struct thread *td) |
void | thread_unsuspend (struct proc *p) |
void | thread_single_end (void) |
struct thread * | thread_find (struct proc *p, lwpid_t tid) |
struct thread * | tdfind (lwpid_t tid, pid_t pid) |
void | tidhash_add (struct thread *td) |
void | tidhash_remove (struct thread *td) |
Variables | |
static uma_zone_t | thread_zone |
#define RUN_THRESH 16 |
Referenced by tdfind().
#define TID_BUFFER_SIZE 1024 |
Referenced by tid_free().
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 585 of file kern_thread.c.
References panic().
Referenced by thread_single().
void proc_linkup | ( | struct proc * | p, |
struct thread * | td | ||
) |
Definition at line 252 of file kern_thread.c.
References ksiginfo_alloc(), sigqueue_init(), and thread_link().
Referenced by fork1(), and proc_linkup0().
void proc_linkup0 | ( | struct proc * | p, |
struct thread * | td | ||
) |
Definition at line 245 of file kern_thread.c.
References proc_linkup().
SDT_PROBE_DEFINE | ( | proc | , |
lwp__exit | |||
) |
SDT_PROVIDER_DECLARE | ( | proc | ) |
TAILQ_HEAD | ( | thread | ) |
Definition at line 74 of file kern_thread.c.
struct thread* tdfind | ( | lwpid_t | tid, |
pid_t | pid | ||
) |
Definition at line 1006 of file kern_thread.c.
References RUN_THRESH.
Referenced by cpuset_which(), get_cputime(), kern_ptrace(), sigev_findtd(), sys_rtprio_thread(), sys_thr_kill(), sys_thr_kill2(), sys_thr_set_name(), sys_thr_wake(), and umtxq_sleep_pi().
struct thread* thread_alloc | ( | int | pages | ) |
Definition at line 342 of file kern_thread.c.
References thread_reap(), and thread_zone.
Referenced by create_thread(), fork1(), and kthread_add().
int thread_alloc_stack | ( | struct thread * | td, |
int | pages | ||
) |
Definition at line 359 of file kern_thread.c.
Referenced by fork1().
|
static |
Definition at line 132 of file kern_thread.c.
References umtx_thread_alloc().
Referenced by init_dtrace(), proc0_init(), and threadinit().
|
static |
Definition at line 161 of file kern_thread.c.
References panic(), and tid_free().
Referenced by init_dtrace(), and threadinit().
void thread_exit | ( | void | ) |
Definition at line 397 of file kern_thread.c.
References cpu_ticks, Giant, panic(), rucollect(), ruxagg(), sched_exit_thread(), sched_throw(), thread_unlink(), thread_unsuspend_one(), ticks, umtx_thread_exit(), and witness_thread_exit().
Referenced by exit1(), kthread_exit(), sys_thr_exit(), and thread_suspend_check().
struct thread* thread_find | ( | struct proc * | p, |
lwpid_t | tid | ||
) |
Definition at line 992 of file kern_thread.c.
|
static |
Definition at line 223 of file kern_thread.c.
References rlqentry_free(), seltdfini(), sleepq_free(), turnstile_free(), and umtx_thread_fini().
Referenced by threadinit().
void thread_free | ( | struct thread * | td | ) |
Definition at line 374 of file kern_thread.c.
References cpuset_rel(), and thread_zone.
Referenced by create_thread(), proc_fini(), and thread_reap().
|
static |
Definition at line 201 of file kern_thread.c.
References sleepq_alloc(), turnstile_alloc(), and umtx_thread_init().
Referenced by proc0_init(), and threadinit().
void thread_link | ( | struct thread * | td, |
struct proc * | p | ||
) |
Definition at line 535 of file kern_thread.c.
References callout_init(), and sigqueue_init().
Referenced by create_thread(), kthread_add(), and proc_linkup().
void thread_reap | ( | void | ) |
Definition at line 314 of file kern_thread.c.
References crfree(), and thread_free().
Referenced by thread_alloc(), and thread_wait().
int thread_single | ( | int | mode | ) |
Definition at line 616 of file kern_thread.c.
References calc_remaining(), Giant, sleepq_abort(), thread_suspend_switch(), thread_unsuspend_one(), and thread_unthread().
Referenced by exit1(), fork_norfproc(), kern_execve(), and sigexit().
void thread_single_end | ( | void | ) |
Definition at line 958 of file kern_thread.c.
References thread_unsuspend_one().
Referenced by fork_norfproc(), and kern_execve().
void thread_stash | ( | struct thread * | td | ) |
Definition at line 304 of file kern_thread.c.
References thread_zombie().
Referenced by fork_exit(), and mi_switch().
int thread_suspend_check | ( | int | return_instead | ) |
Definition at line 767 of file kern_thread.c.
References Giant, mi_switch(), tdsigcleanup(), thread_exit(), thread_stopped(), thread_suspend_one(), thread_unsuspend_one(), and tidhash_remove().
Referenced by ast(), exit1(), kern_sigsuspend(), and sleepq_catch_signals().
void thread_suspend_one | ( | struct thread * | td | ) |
Definition at line 893 of file kern_thread.c.
References sched_sleep().
Referenced by sig_suspend_threads(), and thread_suspend_check().
void thread_suspend_switch | ( | struct thread * | td | ) |
Definition at line 864 of file kern_thread.c.
References mi_switch(), sched_sleep(), and thread_stopped().
Referenced by issignal(), ptracestop(), and thread_single().
void thread_unlink | ( | struct thread * | td | ) |
Definition at line 573 of file kern_thread.c.
Referenced by thread_exit().
void thread_unsuspend | ( | struct proc * | p | ) |
Definition at line 923 of file kern_thread.c.
References thread_unsuspend_one().
Referenced by kern_ptrace(), and tdsendsignal().
int thread_unsuspend_one | ( | struct thread * | td | ) |
Definition at line 907 of file kern_thread.c.
References setrunnable().
Referenced by thread_exit(), thread_single(), thread_single_end(), thread_suspend_check(), and thread_unsuspend().
void thread_unthread | ( | struct thread * | td | ) |
Definition at line 560 of file kern_thread.c.
Referenced by thread_single().
void thread_wait | ( | struct proc * | p | ) |
Definition at line 508 of file kern_thread.c.
References cpuset_rel(), crfree(), Giant, sched_relinquish(), and thread_reap().
Referenced by proc_reap().
void thread_zombie | ( | struct thread * | td | ) |
Definition at line 293 of file kern_thread.c.
Referenced by thread_stash().
void threadinit | ( | void | ) |
Definition at line 270 of file kern_thread.c.
References hashinit(), maxproc, mtx_init(), new_unrhdr(), sched_sizeof_thread(), thread_ctor(), thread_dtor(), thread_fini(), thread_init(), and thread_zone.
Referenced by proc0_init().
|
static |
Definition at line 112 of file kern_thread.c.
References free_unr(), and TID_BUFFER_SIZE.
Referenced by thread_dtor().
void tidhash_add | ( | struct thread * | td | ) |
Definition at line 1043 of file kern_thread.c.
Referenced by create_thread(), do_fork(), and kthread_add().
void tidhash_remove | ( | struct thread * | td | ) |
Definition at line 1051 of file kern_thread.c.
Referenced by exit1(), and thread_suspend_check().
|
static |
Definition at line 72 of file kern_thread.c.
Referenced by thread_alloc(), thread_free(), and threadinit().