Lines Matching defs:td
103 thr_create_initthr(struct thread *td, void *thunk)
109 if (args->tid != NULL && suword_lwpid(args->tid, td->td_tid))
112 return (set_mcontext(td, &args->ctx.uc_mcontext));
116 sys_thr_create(struct thread *td, struct thr_create_args *uap)
125 return (thread_create(td, NULL, thr_create_initthr, &args));
129 sys_thr_new(struct thread *td, struct thr_new_args *uap)
140 return (kern_thr_new(td, ¶m));
144 thr_new_initthr(struct thread *td, void *thunk)
159 suword_lwpid(param->child_tid, td->td_tid)) ||
161 suword_lwpid(param->parent_tid, td->td_tid)))
168 error = cpu_set_upcall(td, param->start_func, param->arg, &stack);
172 return (cpu_set_user_tls(td, param->tls_base));
176 kern_thr_new(struct thread *td, struct thr_param *param)
188 return (thread_create(td, rtpp, thr_new_initthr, param));
192 thread_create(struct thread *td, struct rtprio *rtp,
199 p = td->td_proc;
206 if (priv_check(td, PRIV_SCHED_SETPOLICY) != 0)
229 /* Initialize our td */
236 bcopy(&td->td_startcopy, &newtd->td_startcopy,
238 newtd->td_proc = td->td_proc;
240 thread_cow_get(newtd, td);
242 cpu_copy_thread(newtd, td);
255 thread_lock(td);
257 sched_fork_thread(td, newtd);
258 thread_unlock(td);
275 if (rtp != NULL && !(td->td_pri_class == PRI_TIMESHARE &&
297 sys_thr_self(struct thread *td, struct thr_self_args *uap)
302 error = suword_lwpid(uap->id, (unsigned)td->td_tid);
309 sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
313 umtx_thread_exit(td);
318 (void)kern_umtx_wake(td, uap->state, INT_MAX, 0);
321 return (kern_thr_exit(td));
325 kern_thr_exit(struct thread *td)
329 p = td->td_proc;
357 p->p_sysent->sv_ontdexit(td);
359 td->td_dbgflags |= TDB_EXIT;
362 ptracestop(td, SIGTRAP, NULL);
365 tidhash_remove(td);
375 tdsigcleanup(td);
378 AUDIT_SYSCALL_EXIT(0, td);
388 sys_thr_kill(struct thread *td, struct thr_kill_args *uap)
396 p = td->td_proc;
401 ksi.ksi_uid = td->td_ucred->cr_ruid;
409 if (ttd != td) {
435 sys_thr_kill2(struct thread *td, struct thr_kill2_args *uap)
448 ksi.ksi_pid = td->td_proc->p_pid;
449 ksi.ksi_uid = td->td_ucred->cr_ruid;
454 error = p_cansignal(td, p, uap->sig);
464 if (ttd != td) {
479 error = p_cansignal(td, p, uap->sig);
492 sys_thr_suspend(struct thread *td, struct thr_suspend_args *uap)
506 return (kern_thr_suspend(td, tsp));
510 kern_thr_suspend(struct thread *td, struct timespec *tsp)
512 struct proc *p = td->td_proc;
517 if (td->td_pflags & TDP_WAKEUP) {
518 td->td_pflags &= ~TDP_WAKEUP;
532 if (error == 0 && (td->td_flags & TDF_THRWAKEUP) == 0)
533 error = msleep((void *)td, &p->p_mtx,
536 if (td->td_flags & TDF_THRWAKEUP) {
537 thread_lock(td);
538 td->td_flags &= ~TDF_THRWAKEUP;
539 thread_unlock(td);
554 sys_thr_wake(struct thread *td, struct thr_wake_args *uap)
560 if (uap->id == td->td_tid) {
561 td->td_pflags |= TDP_WAKEUP;
565 p = td->td_proc;
578 sys_thr_set_name(struct thread *td, struct thr_set_name_args *uap)
596 p = td->td_proc;