MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tdfind

Function tdfind

freebsd/kern/kern_thread.c:1659–1691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1657}
1658
1659struct thread *
1660tdfind(lwpid_t tid, pid_t pid)
1661{
1662 struct proc *p;
1663 struct thread *td;
1664
1665 td = curthread;
1666 if (td->td_tid == tid) {
1667 if (pid != -1 && td->td_proc->p_pid != pid)
1668 return (NULL);
1669 PROC_LOCK(td->td_proc);
1670 return (td);
1671 }
1672
1673 for (;;) {
1674 if (!tdfind_hash(tid, pid, &p, &td))
1675 return (NULL);
1676 PROC_LOCK(p);
1677 if (td->td_tid != tid) {
1678 PROC_UNLOCK(p);
1679 continue;
1680 }
1681 if (td->td_proc != p) {
1682 PROC_UNLOCK(p);
1683 continue;
1684 }
1685 if (p->p_state == PRS_NEW) {
1686 PROC_UNLOCK(p);
1687 return (NULL);
1688 }
1689 return (td);
1690 }
1691}
1692
1693void
1694tidhash_add(struct thread *td)

Callers 12

umtxq_sleep_piFunction · 0.85
sigev_findtdFunction · 0.85
pgetFunction · 0.85
sysctl_kern_proc_kstackFunction · 0.85
cpuset_whichFunction · 0.85
get_cputimeFunction · 0.85
kern_ptraceFunction · 0.85
sys_thr_killFunction · 0.85
sys_thr_kill2Function · 0.85
sys_thr_wakeFunction · 0.85
sys_thr_set_nameFunction · 0.85
sys_rtprio_threadFunction · 0.85

Calls 1

tdfind_hashFunction · 0.85

Tested by

no test coverage detected