Lines Matching refs:phdl
76 struct proc_handle *phdl; in proc_init() local
80 if ((phdl = malloc(sizeof(*phdl))) == NULL) in proc_init()
83 memset(phdl, 0, sizeof(*phdl)); in proc_init()
84 phdl->public.pid = pid; in proc_init()
85 phdl->flags = flags; in proc_init()
86 phdl->status = status; in proc_init()
87 phdl->procstat = procstat_open_sysctl(); in proc_init()
88 if (phdl->procstat == NULL) in proc_init()
92 if ((kp = procstat_getprocs(phdl->procstat, KERN_PROC_PID, pid, in proc_init()
95 error = procstat_getpathname(phdl->procstat, kp, phdl->execpath, in proc_init()
96 sizeof(phdl->execpath)); in proc_init()
97 procstat_freeprocs(phdl->procstat, kp); in proc_init()
102 if ((fd = open(phdl->execpath, O_RDONLY)) < 0) { in proc_init()
109 phdl->model = PR_MODEL_LP64; in proc_init()
112 phdl->model = PR_MODEL_ILP32; in proc_init()
122 *pphdl = phdl; in proc_init()
129 struct proc_handle *phdl; in proc_attach() local
141 error = proc_init(pid, flags, PS_RUN, &phdl); in proc_attach()
146 if (ptrace(PT_ATTACH, proc_getpid(phdl), 0, 0) != 0) { in proc_attach()
163 phdl->status = PS_STOP; in proc_attach()
166 proc_continue(phdl); in proc_attach()
170 if (error != 0 && phdl != NULL) { in proc_attach()
171 proc_free(phdl); in proc_attach()
172 phdl = NULL; in proc_attach()
174 *pphdl = phdl; in proc_attach()
182 struct proc_handle *phdl; in proc_create() local
190 phdl = NULL; in proc_create()
225 error = proc_init(pid, 0, PS_IDLE, &phdl); in proc_create()
227 phdl->status = PS_STOP; in proc_create()
230 if (error != 0 && phdl != NULL) { in proc_create()
231 proc_free(phdl); in proc_create()
232 phdl = NULL; in proc_create()
235 *pphdl = phdl; in proc_create()
240 proc_free(struct proc_handle *phdl) in proc_free() argument
245 for (i = 0; i < phdl->nmappings; i++) { in proc_free()
246 file = phdl->mappings[i].file; in proc_free()
259 if (phdl->maparrsz > 0) in proc_free()
260 free(phdl->mappings); in proc_free()
261 if (phdl->procstat != NULL) in proc_free()
262 procstat_close(phdl->procstat); in proc_free()
263 if (phdl->rdap != NULL) in proc_free()
264 rd_delete(phdl->rdap); in proc_free()
265 free(phdl); in proc_free()