Lines Matching refs:pid
150 get_pathname(pid_t pid) in get_pathname() argument
159 name[3] = pid; in get_pathname()
166 pid, strerror(errno)); in get_pathname()
169 fprintf(stderr, "pid %d exited\n", pid); in get_pathname()
173 fprintf(stderr, "No cached pathname for process %d\n", pid); in get_pathname()
176 printf(TRACE "pid %d path %s\n", pid, pathname); in get_pathname()
180 wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo) in wait_info() argument
185 printf(TRACE "pid %d wait %s", pid, in wait_info()
218 trace_sc(int pid) in trace_sc() argument
224 if (ptrace(PT_TO_SCE, pid, (caddr_t)1, 0) < 0) { in trace_sc()
226 ptrace(PT_KILL, pid, NULL, 0); in trace_sc()
230 if (waitpid(pid, &status, 0) == -1) { in trace_sc()
235 wait_info(pid, status, NULL); in trace_sc()
241 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) { in trace_sc()
243 ptrace(PT_KILL, pid, NULL, 0); in trace_sc()
246 wait_info(pid, status, &lwpinfo); in trace_sc()
249 if (ptrace(PT_TO_SCX, pid, (caddr_t)1, 0) < 0) { in trace_sc()
251 ptrace(PT_KILL, pid, NULL, 0); in trace_sc()
255 if (waitpid(pid, &status, 0) == -1) { in trace_sc()
260 wait_info(pid, status, NULL); in trace_sc()
266 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) { in trace_sc()
268 ptrace(PT_KILL, pid, NULL, 0); in trace_sc()
271 wait_info(pid, status, &lwpinfo); in trace_sc()
278 if (ptrace(PT_SC_REMOTE, pid, (caddr_t)&pscr, in trace_sc()
281 ptrace(PT_KILL, pid, NULL, 0); in trace_sc()
286 if (waitpid(pid, &status, 0) == -1) { in trace_sc()
293 get_pathname(pid); in trace_sc()
303 trace_cont(int pid) in trace_cont() argument
308 if (ptrace(PT_CONTINUE, pid, (caddr_t)1, 0) < 0) { in trace_cont()
310 ptrace(PT_KILL, pid, NULL, 0); in trace_cont()
314 if (waitpid(pid, &status, 0) == -1) { in trace_cont()
319 wait_info(pid, status, NULL); in trace_cont()
325 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) { in trace_cont()
327 ptrace(PT_KILL, pid, NULL, 0); in trace_cont()
330 wait_info(pid, status, &lwpinfo); in trace_cont()
334 get_pathname(pid); in trace_cont()
346 trace(pid_t pid) in trace() argument
349 return (trace_syscalls ? trace_sc(pid) : trace_cont(pid)); in trace()
358 pid_t pid, pid1; in main() local
385 if ((pid = fork()) < 0) { in main()
389 else if (pid == 0) { in main()
405 if (waitpid(pid, &status, 0) == -1) { in main()
412 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, in main()
415 ptrace(PT_KILL, pid, NULL, 0); in main()
418 wait_info(pid, status, &lwpinfo); in main()
420 if (ptrace(PT_FOLLOW_FORK, pid, 0, 1) < 0) { in main()
422 ptrace(PT_KILL, pid, NULL, 0); in main()
426 while ((pid1 = trace(pid)) >= 0) { in main()
453 ptrace(PT_CONTINUE, pid, (caddr_t)1, 0); in main()