Lines Matching defs:pid

152 get_pathname(pid_t pid)
161 name[3] = pid;
168 pid, strerror(errno));
171 fprintf(stderr, "pid %d exited\n", pid);
175 fprintf(stderr, "No cached pathname for process %d\n", pid);
178 printf(TRACE "pid %d path %s\n", pid, pathname);
182 wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo)
187 printf(TRACE "pid %d wait %s", pid,
216 trace_sc(int pid)
221 if (ptrace(PT_TO_SCE, pid, (caddr_t)1, 0) < 0) {
223 ptrace(PT_KILL, pid, NULL, 0);
227 if (waitpid(pid, &status, 0) == -1) {
232 wait_info(pid, status, NULL);
238 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) {
240 ptrace(PT_KILL, pid, NULL, 0);
243 wait_info(pid, status, &lwpinfo);
246 if (ptrace(PT_TO_SCX, pid, (caddr_t)1, 0) < 0) {
248 ptrace(PT_KILL, pid, NULL, 0);
252 if (waitpid(pid, &status, 0) == -1) {
257 wait_info(pid, status, NULL);
263 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) {
265 ptrace(PT_KILL, pid, NULL, 0);
268 wait_info(pid, status, &lwpinfo);
272 get_pathname(pid);
282 trace_cont(int pid)
287 if (ptrace(PT_CONTINUE, pid, (caddr_t)1, 0) < 0) {
289 ptrace(PT_KILL, pid, NULL, 0);
293 if (waitpid(pid, &status, 0) == -1) {
298 wait_info(pid, status, NULL);
304 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo, sizeof(lwpinfo)) < 0) {
306 ptrace(PT_KILL, pid, NULL, 0);
309 wait_info(pid, status, &lwpinfo);
313 get_pathname(pid);
327 trace(pid_t pid)
330 return (trace_syscalls ? trace_sc(pid) : trace_cont(pid));
339 pid_t pid, pid1;
361 if ((pid = fork()) < 0) {
365 else if (pid == 0) {
381 if (waitpid(pid, &status, 0) == -1) {
388 if (ptrace(PT_LWPINFO, pid, (caddr_t)&lwpinfo,
391 ptrace(PT_KILL, pid, NULL, 0);
394 wait_info(pid, status, &lwpinfo);
396 if (ptrace(PT_FOLLOW_FORK, pid, 0, 1) < 0) {
398 ptrace(PT_KILL, pid, NULL, 0);
402 while ((pid1 = trace(pid)) >= 0) {
404 printf(TRACE "attached to pid %d\n", pid1);
412 printf(TRACE "nested loop, pid %d status %s\n",
429 ptrace(PT_CONTINUE, pid, (caddr_t)1, 0);