Lines Matching refs: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, &param));
144 thr_new_initthr(struct thread *td, void *thunk)
158 suword_lwpid(param->child_tid, td->td_tid)) ||
160 suword_lwpid(param->parent_tid, td->td_tid)))
167 cpu_set_upcall(td, param->start_func, param->arg, &stack);
169 return (cpu_set_user_tls(td, param->tls_base));
173 kern_thr_new(struct thread *td, struct thr_param *param)
185 return (thread_create(td, rtpp, thr_new_initthr, param));
189 thread_create(struct thread *td, struct rtprio *rtp,
196 p = td->td_proc;
203 if (priv_check(td, PRIV_SCHED_SETPOLICY) != 0)
226 /* Initialize our td */
231 cpu_copy_thread(newtd, td);
238 bcopy(&td->td_startcopy, &newtd->td_startcopy,
240 newtd->td_sa = td->td_sa;
241 newtd->td_proc = td->td_proc;
243 thread_cow_get(newtd, td);
256 thread_lock(td);
258 sched_fork_thread(td, newtd);
259 thread_unlock(td);
269 &td->td_vm_dom_policy);
277 if (!(td->td_pri_class == PRI_TIMESHARE &&
301 sys_thr_self(struct thread *td, struct thr_self_args *uap)
306 error = suword_lwpid(uap->id, (unsigned)td->td_tid);
313 sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
317 umtx_thread_exit(td);
322 kern_umtx_wake(td, uap->state, INT_MAX, 0);
325 return (kern_thr_exit(td));
329 kern_thr_exit(struct thread *td)
333 p = td->td_proc;
361 td->td_dbgflags |= TDB_EXIT;
363 ptracestop(td, SIGTRAP, NULL);
365 tidhash_remove(td);
377 tdsigcleanup(td);
380 AUDIT_SYSCALL_EXIT(0, td);
390 sys_thr_kill(struct thread *td, struct thr_kill_args *uap)
398 p = td->td_proc;
403 ksi.ksi_uid = td->td_ucred->cr_ruid;
411 if (ttd != td) {
437 sys_thr_kill2(struct thread *td, struct thr_kill2_args *uap)
450 ksi.ksi_pid = td->td_proc->p_pid;
451 ksi.ksi_uid = td->td_ucred->cr_ruid;
456 error = p_cansignal(td, p, uap->sig);
466 if (ttd != td) {
481 error = p_cansignal(td, p, uap->sig);
494 sys_thr_suspend(struct thread *td, struct thr_suspend_args *uap)
508 return (kern_thr_suspend(td, tsp));
512 kern_thr_suspend(struct thread *td, struct timespec *tsp)
514 struct proc *p = td->td_proc;
519 if (td->td_pflags & TDP_WAKEUP) {
520 td->td_pflags &= ~TDP_WAKEUP;
534 if (error == 0 && (td->td_flags & TDF_THRWAKEUP) == 0)
535 error = msleep((void *)td, &p->p_mtx,
538 if (td->td_flags & TDF_THRWAKEUP) {
539 thread_lock(td);
540 td->td_flags &= ~TDF_THRWAKEUP;
541 thread_unlock(td);
556 sys_thr_wake(struct thread *td, struct thr_wake_args *uap)
562 if (uap->id == td->td_tid) {
563 td->td_pflags |= TDP_WAKEUP;
567 p = td->td_proc;
580 sys_thr_set_name(struct thread *td, struct thr_set_name_args *uap)
598 p = td->td_proc;