Lines Matching refs:td
392 #define THREAD_LOCK_ASSERT(td, type) \ argument
393 mtx_assert((td)->td_lock, (type))
395 #define THREAD_LOCK_BLOCKED_ASSERT(td, type) \ argument
397 struct mtx *__m = (td)->td_lock; \
403 #define THREAD_LOCKPTR_ASSERT(td, lock) \ argument
406 __m = (td)->td_lock; \
408 ("Thread %p lock %p does not match %p", td, __m, (lock))); \
411 #define THREAD_LOCKPTR_BLOCKED_ASSERT(td, lock) \ argument
414 __m = (td)->td_lock; \
416 ("Thread %p lock %p does not match %p", td, __m, (lock))); \
419 #define TD_LOCKS_INC(td) ((td)->td_locks++) argument
420 #define TD_LOCKS_DEC(td) do { \ argument
421 KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0, \
422 ("thread %p owns no locks", (td))); \
423 (td)->td_locks--; \
426 #define THREAD_LOCKPTR_ASSERT(td, lock) argument
427 #define THREAD_LOCKPTR_BLOCKED_ASSERT(td, lock) argument
429 #define TD_LOCKS_INC(td) argument
430 #define TD_LOCKS_DEC(td) argument
537 #define TD_IS_SLEEPING(td) ((td)->td_inhibitors & TDI_SLEEPING) argument
538 #define TD_ON_SLEEPQ(td) ((td)->td_wchan != NULL) argument
539 #define TD_IS_SUSPENDED(td) ((td)->td_inhibitors & TDI_SUSPENDED) argument
540 #define TD_IS_SWAPPED(td) ((td)->td_inhibitors & TDI_SWAPPED) argument
541 #define TD_ON_LOCK(td) ((td)->td_inhibitors & TDI_LOCK) argument
542 #define TD_AWAITING_INTR(td) ((td)->td_inhibitors & TDI_IWAIT) argument
543 #define TD_IS_RUNNING(td) ((td)->td_state == TDS_RUNNING) argument
544 #define TD_ON_RUNQ(td) ((td)->td_state == TDS_RUNQ) argument
545 #define TD_CAN_RUN(td) ((td)->td_state == TDS_CAN_RUN) argument
546 #define TD_IS_INHIBITED(td) ((td)->td_state == TDS_INHIBITED) argument
547 #define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED) argument
548 #define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD) argument
550 #define TD_CAN_ABORT(td) (TD_ON_SLEEPQ((td)) && \ argument
551 ((td)->td_flags & TDF_SINTR) != 0)
553 #define KTDSTATE(td) \ argument
554 (((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" : \
555 ((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" : \
556 ((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" : \
557 ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \
558 ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding")
560 #define TD_SET_INHIB(td, inhib) do { \ argument
561 (td)->td_state = TDS_INHIBITED; \
562 (td)->td_inhibitors |= (inhib); \
565 #define TD_CLR_INHIB(td, inhib) do { \ argument
566 if (((td)->td_inhibitors & (inhib)) && \
567 (((td)->td_inhibitors &= ~(inhib)) == 0)) \
568 (td)->td_state = TDS_CAN_RUN; \
571 #define TD_SET_SLEEPING(td) TD_SET_INHIB((td), TDI_SLEEPING) argument
572 #define TD_SET_SWAPPED(td) TD_SET_INHIB((td), TDI_SWAPPED) argument
573 #define TD_SET_LOCK(td) TD_SET_INHIB((td), TDI_LOCK) argument
574 #define TD_SET_SUSPENDED(td) TD_SET_INHIB((td), TDI_SUSPENDED) argument
575 #define TD_SET_IWAIT(td) TD_SET_INHIB((td), TDI_IWAIT) argument
576 #define TD_SET_EXITING(td) TD_SET_INHIB((td), TDI_EXITING) argument
578 #define TD_CLR_SLEEPING(td) TD_CLR_INHIB((td), TDI_SLEEPING) argument
579 #define TD_CLR_SWAPPED(td) TD_CLR_INHIB((td), TDI_SWAPPED) argument
580 #define TD_CLR_LOCK(td) TD_CLR_INHIB((td), TDI_LOCK) argument
581 #define TD_CLR_SUSPENDED(td) TD_CLR_INHIB((td), TDI_SUSPENDED) argument
582 #define TD_CLR_IWAIT(td) TD_CLR_INHIB((td), TDI_IWAIT) argument
584 #define TD_SET_RUNNING(td) (td)->td_state = TDS_RUNNING argument
585 #define TD_SET_RUNQ(td) (td)->td_state = TDS_RUNQ argument
586 #define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN argument
588 #define TD_SBDRY_INTR(td) \ argument
589 (((td)->td_flags & (TDF_SEINTR | TDF_SERESTART)) != 0)
590 #define TD_SBDRY_ERRNO(td) \ argument
591 (((td)->td_flags & TDF_SEINTR) != 0 ? EINTR : ERESTART)
875 #define FOREACH_THREAD_IN_PROC(p, td) \ argument
876 TAILQ_FOREACH((td), &(p)->p_threads, td_plist)
978 #define thread_safetoswapout(td) ((td)->td_flags & TDF_CANSWAP) argument
1087 int maybe_preempt(struct thread *td);
1090 int p_candebug(struct thread *td, struct proc *p);
1091 int p_cansee(struct thread *td, struct proc *p);
1092 int p_cansched(struct thread *td, struct proc *p);
1093 int p_cansignal(struct thread *td, struct proc *p, int signum);
1094 int p_canwait(struct thread *td, struct proc *p);
1098 int proc_getargv(struct thread *td, struct proc *p, struct sbuf *sb);
1099 int proc_getauxv(struct thread *td, struct proc *p, struct sbuf *sb);
1100 int proc_getenvv(struct thread *td, struct proc *p, struct sbuf *sb);
1103 void proc_linkup0(struct proc *p, struct thread *td);
1104 void proc_linkup(struct proc *p, struct thread *td);
1106 void proc_reap(struct thread *td, struct proc *p, int *status, int options);
1139 void cpu_copy_thread(struct thread *td, struct thread *td0);
1141 int cpu_fetch_syscall_args(struct thread *td);
1144 int cpu_procctl(struct thread *td, int idtype, id_t id, int com,
1158 int thread_check_susp(struct thread *td, bool sleep);
1160 void thread_cow_get(struct thread *newtd, struct thread *td);
1161 void thread_cow_free(struct thread *td);
1162 void thread_cow_update(struct thread *td);
1163 int thread_create(struct thread *td, struct rtprio *rtp,
1166 void thread_free(struct thread *td);
1167 void thread_link(struct thread *td, struct proc *p);
1170 void thread_stash(struct thread *td);
1178 void thread_suspend_one(struct thread *td);
1179 void thread_unlink(struct thread *td);
1189 struct thread *td; in curthread_pflags_set() local
1192 td = curthread; in curthread_pflags_set()
1193 save = ~flags | (td->td_pflags & flags); in curthread_pflags_set()
1194 td->td_pflags |= flags; in curthread_pflags_set()
1208 struct thread *td; in curthread_pflags2_set() local
1211 td = curthread; in curthread_pflags2_set()
1212 save = ~flags | (td->td_pflags2 & flags); in curthread_pflags2_set()
1213 td->td_pflags2 |= flags; in curthread_pflags2_set()
1225 kstack_contains(struct thread *td, vm_offset_t va, size_t len) in kstack_contains() argument
1227 return (va >= td->td_kstack && va + len >= va && in kstack_contains()
1228 va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); in kstack_contains()
1232 td_get_sched(struct thread *td) in td_get_sched() argument
1235 return ((struct td_sched *)&td[1]); in td_get_sched()
1240 td_softdep_cleanup(struct thread *td) in td_softdep_cleanup() argument
1243 if (td->td_su != NULL && softdep_ast_cleanup != NULL) in td_softdep_cleanup()
1244 softdep_ast_cleanup(td); in td_softdep_cleanup()