| 1657 | } |
| 1658 | |
| 1659 | struct thread * |
| 1660 | tdfind(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 | |
| 1693 | void |
| 1694 | tidhash_add(struct thread *td) |
no test coverage detected