Lines Matching refs:phdl

75 	struct proc_handle *phdl;  in proc_init()  local
79 if ((phdl = malloc(sizeof(*phdl))) == NULL) in proc_init()
82 memset(phdl, 0, sizeof(*phdl)); in proc_init()
83 phdl->public.pid = pid; in proc_init()
84 phdl->flags = flags; in proc_init()
85 phdl->status = status; in proc_init()
86 phdl->procstat = procstat_open_sysctl(); in proc_init()
87 if (phdl->procstat == NULL) in proc_init()
91 if ((kp = procstat_getprocs(phdl->procstat, KERN_PROC_PID, pid, in proc_init()
94 error = procstat_getpathname(phdl->procstat, kp, phdl->execpath, in proc_init()
95 sizeof(phdl->execpath)); in proc_init()
96 procstat_freeprocs(phdl->procstat, kp); in proc_init()
101 if ((fd = open(phdl->execpath, O_RDONLY)) < 0) { in proc_init()
108 phdl->model = PR_MODEL_LP64; in proc_init()
111 phdl->model = PR_MODEL_ILP32; in proc_init()
121 *pphdl = phdl; in proc_init()
128 struct proc_handle *phdl; in proc_attach() local
140 error = proc_init(pid, flags, PS_RUN, &phdl); in proc_attach()
145 if (ptrace(PT_ATTACH, proc_getpid(phdl), 0, 0) != 0) { in proc_attach()
162 phdl->status = PS_STOP; in proc_attach()
165 proc_continue(phdl); in proc_attach()
169 if (error != 0 && phdl != NULL) { in proc_attach()
170 proc_free(phdl); in proc_attach()
171 phdl = NULL; in proc_attach()
173 *pphdl = phdl; in proc_attach()
181 struct proc_handle *phdl; in proc_create() local
189 phdl = NULL; in proc_create()
224 error = proc_init(pid, 0, PS_IDLE, &phdl); in proc_create()
226 phdl->status = PS_STOP; in proc_create()
229 if (error != 0 && phdl != NULL) { in proc_create()
230 proc_free(phdl); in proc_create()
231 phdl = NULL; in proc_create()
234 *pphdl = phdl; in proc_create()
239 proc_free(struct proc_handle *phdl) in proc_free() argument
244 for (i = 0; i < phdl->nmappings; i++) { in proc_free()
245 file = phdl->mappings[i].file; in proc_free()
258 if (phdl->maparrsz > 0) in proc_free()
259 free(phdl->mappings); in proc_free()
260 if (phdl->procstat != NULL) in proc_free()
261 procstat_close(phdl->procstat); in proc_free()
262 if (phdl->rdap != NULL) in proc_free()
263 rd_delete(phdl->rdap); in proc_free()
264 free(phdl); in proc_free()