FreeBSD kernel kern code
kern_thr.c File Reference
#include <sys/cdefs.h>
#include "opt_compat.h"
#include "opt_posix.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/posix4.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sched.h>
#include <sys/sysctl.h>
#include <sys/smp.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/signalvar.h>
#include <sys/ucontext.h>
#include <sys/thr.h>
#include <sys/rtprio.h>
#include <sys/umtx.h>
#include <sys/limits.h>
#include <machine/frame.h>
#include <security/audit/audit.h>
Include dependency graph for kern_thr.c:

Go to the source code of this file.

Macros

#define suword_lwpid   suword
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static SYSCTL_NODE (_kern, OID_AUTO, threads, CTLFLAG_RW, 0,"thread allocation")
 
 SYSCTL_INT (_kern_threads, OID_AUTO, max_threads_per_proc, CTLFLAG_RW,&max_threads_per_proc, 0,"Limit on threads per proc")
 
 SYSCTL_INT (_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD,&max_threads_hits, 0,"")
 
static int create_thread (struct thread *td, mcontext_t *ctx, void(*start_func)(void *), void *arg, char *stack_base, size_t stack_size, char *tls_base, long *child_tid, long *parent_tid, int flags, struct rtprio *rtp)
 
int sys_thr_create (struct thread *td, struct thr_create_args *uap)
 
int sys_thr_new (struct thread *td, struct thr_new_args *uap)
 
int kern_thr_new (struct thread *td, struct thr_param *param)
 
int sys_thr_self (struct thread *td, struct thr_self_args *uap)
 
int sys_thr_exit (struct thread *td, struct thr_exit_args *uap)
 
int sys_thr_kill (struct thread *td, struct thr_kill_args *uap)
 
int sys_thr_kill2 (struct thread *td, struct thr_kill2_args *uap)
 
int sys_thr_suspend (struct thread *td, struct thr_suspend_args *uap)
 
int kern_thr_suspend (struct thread *td, struct timespec *tsp)
 
int sys_thr_wake (struct thread *td, struct thr_wake_args *uap)
 
int sys_thr_set_name (struct thread *td, struct thr_set_name_args *uap)
 

Variables

static int max_threads_per_proc = 1500
 
static int max_threads_hits
 

Macro Definition Documentation

#define suword_lwpid   suword

Definition at line 87 of file kern_thr.c.

Referenced by create_thread(), sys_thr_exit(), and sys_thr_self().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static int create_thread ( struct thread *  td,
mcontext_t *  ctx,
void(*)(void *)  start_func,
void *  arg,
char *  stack_base,
size_t  stack_size,
char *  tls_base,
long *  child_tid,
long *  parent_tid,
int  flags,
struct rtprio *  rtp 
)
static

Definition at line 151 of file kern_thr.c.

References crfree(), crhold(), max_threads_hits, max_threads_per_proc, priv_check(), racct_add(), racct_sub(), rtp_to_pri(), sched_add(), sched_fork_thread(), sched_prio(), suword_lwpid, thread_alloc(), thread_free(), thread_link(), and tidhash_add().

Referenced by kern_thr_new(), and sys_thr_create().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_thr_new ( struct thread *  td,
struct thr_param *  param 
)

Definition at line 131 of file kern_thr.c.

References create_thread().

Referenced by sys_thr_new().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_thr_suspend ( struct thread *  td,
struct timespec *  tsp 
)

Definition at line 465 of file kern_thr.c.

References tvtohz().

Referenced by sys_thr_suspend().

Here is the call graph for this function:

Here is the caller graph for this function:

int sys_thr_create ( struct thread *  td,
struct thr_create_args *  uap 
)

Definition at line 101 of file kern_thr.c.

References create_thread().

Here is the call graph for this function:

int sys_thr_exit ( struct thread *  td,
struct thr_exit_args *  uap 
)

Definition at line 306 of file kern_thr.c.

References kern_umtx_wake(), racct_sub(), suword_lwpid, tdsigcleanup(), thread_exit(), and thread_stopped().

Here is the call graph for this function:

int sys_thr_kill ( struct thread *  td,
struct thr_kill_args *  uap 
)

Definition at line 343 of file kern_thr.c.

References tdfind(), and tdksignal().

Here is the call graph for this function:

int sys_thr_kill2 ( struct thread *  td,
struct thr_kill2_args *  uap 
)

Definition at line 390 of file kern_thr.c.

References p_cansignal(), pfind(), tdfind(), and tdksignal().

Here is the call graph for this function:

int sys_thr_new ( struct thread *  td,
struct thr_new_args *  uap 
)

Definition at line 116 of file kern_thr.c.

References kern_thr_new().

Here is the call graph for this function:

int sys_thr_self ( struct thread *  td,
struct thr_self_args *  uap 
)

Definition at line 294 of file kern_thr.c.

References suword_lwpid.

int sys_thr_set_name ( struct thread *  td,
struct thr_set_name_args *  uap 
)

Definition at line 533 of file kern_thr.c.

References name, and tdfind().

Here is the call graph for this function:

int sys_thr_suspend ( struct thread *  td,
struct thr_suspend_args *  uap 
)

Definition at line 447 of file kern_thr.c.

References kern_thr_suspend(), ts, and umtx_copyin_timeout().

Here is the call graph for this function:

int sys_thr_wake ( struct thread *  td,
struct thr_wake_args *  uap 
)

Definition at line 509 of file kern_thr.c.

References tdfind(), and wakeup().

Here is the call graph for this function:

SYSCTL_INT ( _kern_threads  ,
OID_AUTO  ,
max_threads_per_proc  ,
CTLFLAG_RW  ,
max_threads_per_proc,
,
"Limit on threads per proc"   
)
SYSCTL_INT ( _kern_threads  ,
OID_AUTO  ,
max_threads_hits  ,
CTLFLAG_RD  ,
max_threads_hits,
,
""   
)
static SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
threads  ,
CTLFLAG_RW  ,
,
"thread allocation"   
)
static

Variable Documentation

int max_threads_hits
static

Definition at line 68 of file kern_thr.c.

Referenced by create_thread().

int max_threads_per_proc = 1500
static

Definition at line 64 of file kern_thr.c.

Referenced by create_thread().