Lines Matching refs:pid

67     rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
83 rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
96 rslt = ptrace(PT_READ_D, ph->pid, (caddr_t) aligned_addr, 0);
114 static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct reg *user) {
115 // we have already attached to all thread 'pid's, just use ptrace call
117 if (ptrace(PT_GETREGS, pid, (caddr_t) user, 0) < 0) {
118 print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
132 static bool ptrace_continue(pid_t pid, int signal) {
134 if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
135 print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
143 static bool ptrace_waitpid(pid_t pid) {
148 ret = waitpid(pid, &status, 0);
158 if (!ptrace_continue(pid, WSTOPSIG(status))) {
172 print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
185 // attach to a process/thread specified by "pid"
186 static bool ptrace_attach(pid_t pid) {
187 if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
188 print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
191 return ptrace_waitpid(pid);
324 freep = kinfo_getvmmap(ph->pid, &cnt);
326 print_debug("can't get vm map for pid\n", ph->pid);
412 // detach a given pid
413 static bool ptrace_detach(pid_t pid) {
414 if (pid && ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0) {
415 print_debug("ptrace(PTRACE_DETACH, ..) failed for %d\n", pid);
423 ptrace_detach(ph->pid);
435 struct ps_prochandle* Pgrab(pid_t pid) {
444 if (ptrace_attach(pid) != true) {
450 ph->pid = pid;
459 ptrace_detach(pid);