Lines Matching defs:pid

150 	pid_t pid;
152 pid = vfork();
153 if (pid == -1)
155 if (pid == 0) { /* Child */
162 if (waitpid(pid, NULL, 0) < 0)
165 new_proc(info, pid, 0);
172 start_tracing(struct trussinfo *info, pid_t pid)
178 ret = ptrace(PT_ATTACH, pid, NULL, 0);
184 if (waitpid(pid, NULL, 0) < 0)
187 new_proc(info, pid, 0);
204 detach_proc(pid_t pid)
212 kill(pid, SIGSTOP);
214 if (waitpid(pid, &status, 0) < 0)
221 if (ptrace(PT_CONTINUE, pid, (caddr_t)1, sig) < 0)
225 if (ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0)
228 kill(pid, SIGCONT);
236 find_abi(pid_t pid)
248 mib[3] = pid;
257 warnx("ABI %s for pid %ld is not supported", progt, (long)pid);
300 nlwps = ptrace(PT_GETNUMLWPS, p->pid, NULL, 0);
305 nlwps = ptrace(PT_GETLWPLIST, p->pid, (caddr_t)lwps, nlwps);
321 new_proc(struct trussinfo *info, pid_t pid, lwpid_t lwpid)
330 if (np->pid == pid)
331 errx(1, "Duplicate process for pid %ld", (long)pid);
335 if (ptrace(PT_FOLLOW_FORK, pid, NULL, 1) == -1)
336 err(1, "Unable to follow forks for pid %ld", (long)pid);
337 if (ptrace(PT_LWP_EVENTS, pid, NULL, 1) == -1)
338 err(1, "Unable to enable LWP events for pid %ld", (long)pid);
340 np->pid = pid;
341 np->abi = find_abi(pid);
369 detach_proc(p->pid);
375 find_proc(struct trussinfo *info, pid_t pid)
380 if (np->pid == pid)
388 * Change curthread member based on (pid, lwpid).
391 find_thread(struct trussinfo *info, pid_t pid, lwpid_t lwpid)
396 np = find_proc(info, pid);
413 find_exit_thread(struct trussinfo *info, pid_t pid)
417 p = find_proc(info, pid);
580 p->abi = find_abi(p->pid);
582 if (ptrace(PT_DETACH, p->pid, (caddr_t)1, 0) < 0)
600 len += fprintf(info->outfile, "%5d", t->proc->pid);
692 fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid,
719 fprintf(fp, " pid=%jd uid=%jd", (intmax_t)si->si_pid,