Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/proc.h
Show First 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
struct thread0_storage { | struct thread0_storage { | ||||
struct thread t0st_thread; | struct thread t0st_thread; | ||||
uint64_t t0st_sched[10]; | uint64_t t0st_sched[10]; | ||||
}; | }; | ||||
struct mtx *thread_lock_block(struct thread *); | struct mtx *thread_lock_block(struct thread *); | ||||
void thread_lock_unblock(struct thread *, struct mtx *); | void thread_lock_block_wait(struct thread *); | ||||
void thread_lock_set(struct thread *, struct mtx *); | void thread_lock_set(struct thread *, struct mtx *); | ||||
void thread_lock_unblock(struct thread *, struct mtx *); | |||||
#define THREAD_LOCK_ASSERT(td, type) \ | #define THREAD_LOCK_ASSERT(td, type) \ | ||||
mtx_assert((td)->td_lock, (type)) | |||||
#define THREAD_LOCK_BLOCKED_ASSERT(td, type) \ | |||||
do { \ | do { \ | ||||
struct mtx *__m = (td)->td_lock; \ | struct mtx *__m = (td)->td_lock; \ | ||||
if (__m != &blocked_lock) \ | if (__m != &blocked_lock) \ | ||||
mtx_assert(__m, (type)); \ | mtx_assert(__m, (type)); \ | ||||
} while (0) | } while (0) | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
#define THREAD_LOCKPTR_ASSERT(td, lock) \ | #define THREAD_LOCKPTR_ASSERT(td, lock) \ | ||||
do { \ | do { \ | ||||
struct mtx *__m = (td)->td_lock; \ | struct mtx *__m; \ | ||||
KASSERT((__m == &blocked_lock || __m == (lock)), \ | __m = (td)->td_lock; \ | ||||
KASSERT(__m == (lock), \ | |||||
("Thread %p lock %p does not match %p", td, __m, (lock))); \ | ("Thread %p lock %p does not match %p", td, __m, (lock))); \ | ||||
} while (0) | } while (0) | ||||
#define THREAD_LOCKPTR_BLOCKED_ASSERT(td, lock) \ | |||||
do { \ | |||||
struct mtx *__m; \ | |||||
__m = (td)->td_lock; \ | |||||
KASSERT(__m == (lock) || __m == &blocked_lock, \ | |||||
("Thread %p lock %p does not match %p", td, __m, (lock))); \ | |||||
} while (0) | |||||
#define TD_LOCKS_INC(td) ((td)->td_locks++) | #define TD_LOCKS_INC(td) ((td)->td_locks++) | ||||
#define TD_LOCKS_DEC(td) do { \ | #define TD_LOCKS_DEC(td) do { \ | ||||
KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0, \ | KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0, \ | ||||
("thread %p owns no locks", (td))); \ | ("thread %p owns no locks", (td))); \ | ||||
(td)->td_locks--; \ | (td)->td_locks--; \ | ||||
} while (0) | } while (0) | ||||
#else | #else | ||||
#define THREAD_LOCKPTR_ASSERT(td, lock) | #define THREAD_LOCKPTR_ASSERT(td, lock) | ||||
#define THREAD_LOCKPTR_BLOCKED_ASSERT(td, lock) | |||||
#define TD_LOCKS_INC(td) | #define TD_LOCKS_INC(td) | ||||
#define TD_LOCKS_DEC(td) | #define TD_LOCKS_DEC(td) | ||||
#endif | #endif | ||||
/* | /* | ||||
* Flags kept in td_flags: | * Flags kept in td_flags: | ||||
* To change these you MUST have the scheduler lock. | * To change these you MUST have the scheduler lock. | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
#define TD_AWAITING_INTR(td) ((td)->td_inhibitors & TDI_IWAIT) | #define TD_AWAITING_INTR(td) ((td)->td_inhibitors & TDI_IWAIT) | ||||
#define TD_IS_RUNNING(td) ((td)->td_state == TDS_RUNNING) | #define TD_IS_RUNNING(td) ((td)->td_state == TDS_RUNNING) | ||||
#define TD_ON_RUNQ(td) ((td)->td_state == TDS_RUNQ) | #define TD_ON_RUNQ(td) ((td)->td_state == TDS_RUNQ) | ||||
#define TD_CAN_RUN(td) ((td)->td_state == TDS_CAN_RUN) | #define TD_CAN_RUN(td) ((td)->td_state == TDS_CAN_RUN) | ||||
#define TD_IS_INHIBITED(td) ((td)->td_state == TDS_INHIBITED) | #define TD_IS_INHIBITED(td) ((td)->td_state == TDS_INHIBITED) | ||||
#define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED) | #define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED) | ||||
#define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD) | #define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD) | ||||
#define TD_CAN_ABORT(td) (TD_ON_SLEEPQ((td)) && \ | |||||
((td)->td_flags & TDF_SINTR) != 0) | |||||
#define KTDSTATE(td) \ | #define KTDSTATE(td) \ | ||||
(((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \ | (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \ | ||||
((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \ | ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \ | ||||
((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \ | ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \ | ||||
((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \ | ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \ | ||||
((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding") | ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding") | ||||
#define TD_SET_INHIB(td, inhib) do { \ | #define TD_SET_INHIB(td, inhib) do { \ | ||||
▲ Show 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | |||||
void pstats_fork(struct pstats *src, struct pstats *dst); | void pstats_fork(struct pstats *src, struct pstats *dst); | ||||
void pstats_free(struct pstats *ps); | void pstats_free(struct pstats *ps); | ||||
void proc_clear_orphan(struct proc *p); | void proc_clear_orphan(struct proc *p); | ||||
void reaper_abandon_children(struct proc *p, bool exiting); | void reaper_abandon_children(struct proc *p, bool exiting); | ||||
int securelevel_ge(struct ucred *cr, int level); | int securelevel_ge(struct ucred *cr, int level); | ||||
int securelevel_gt(struct ucred *cr, int level); | int securelevel_gt(struct ucred *cr, int level); | ||||
void sess_hold(struct session *); | void sess_hold(struct session *); | ||||
void sess_release(struct session *); | void sess_release(struct session *); | ||||
int setrunnable(struct thread *); | int setrunnable(struct thread *, int); | ||||
void setsugid(struct proc *p); | void setsugid(struct proc *p); | ||||
int should_yield(void); | int should_yield(void); | ||||
int sigonstack(size_t sp); | int sigonstack(size_t sp); | ||||
void stopevent(struct proc *, u_int, u_int); | void stopevent(struct proc *, u_int, u_int); | ||||
struct thread *tdfind(lwpid_t, pid_t); | struct thread *tdfind(lwpid_t, pid_t); | ||||
void threadinit(void); | void threadinit(void); | ||||
void tidhash_add(struct thread *); | void tidhash_add(struct thread *); | ||||
void tidhash_remove(struct thread *); | void tidhash_remove(struct thread *); | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |