Lines Matching defs:pd
124 struct procdesc *pd;
135 pd = fp->f_data;
137 if (pd->pd_proc != NULL) {
138 *p = pd->pd_proc;
155 struct procdesc *pd;
160 pd = fp_procdesc->f_data;
161 return (pd->pd_pid);
211 struct procdesc *pd;
213 pd = malloc(sizeof(*pd), M_PROCDESC, M_WAITOK | M_ZERO);
214 pd->pd_proc = p;
215 pd->pd_pid = p->p_pid;
216 p->p_procdesc = pd;
217 pd->pd_flags = 0;
219 pd->pd_flags |= PDF_DAEMON;
220 PROCDESC_LOCK_INIT(pd);
221 knlist_init_mtx(&pd->pd_selinfo.si_note, &pd->pd_lock);
227 refcount_init(&pd->pd_refcount, 2);
257 procdesc_free(struct procdesc *pd)
266 if (refcount_release(&pd->pd_refcount)) {
267 KASSERT(pd->pd_proc == NULL,
269 KASSERT((pd->pd_flags & PDF_CLOSED),
272 knlist_destroy(&pd->pd_selinfo.si_note);
273 PROCDESC_LOCK_DESTROY(pd);
274 free(pd, M_PROCDESC);
286 struct procdesc *pd;
292 pd = p->p_procdesc;
294 PROCDESC_LOCK(pd);
295 KASSERT((pd->pd_flags & PDF_CLOSED) == 0 || p->p_pptr == p->p_reaper,
298 pd->pd_flags |= PDF_EXITED;
299 pd->pd_xstat = KW_EXITCODE(p->p_xexit, p->p_xsig);
307 if (pd->pd_flags & PDF_CLOSED) {
308 PROCDESC_UNLOCK(pd);
309 pd->pd_proc = NULL;
311 procdesc_free(pd);
314 if (pd->pd_flags & PDF_SELECTED) {
315 pd->pd_flags &= ~PDF_SELECTED;
316 selwakeup(&pd->pd_selinfo);
318 KNOTE_LOCKED(&pd->pd_selinfo.si_note, NOTE_EXIT);
319 PROCDESC_UNLOCK(pd);
330 struct procdesc *pd;
335 pd = p->p_procdesc;
336 pd->pd_proc = NULL;
338 procdesc_free(pd);
350 struct procdesc *pd;
355 pd = fp->f_data;
360 PROCDESC_LOCK(pd);
361 pd->pd_flags |= PDF_CLOSED;
362 PROCDESC_UNLOCK(pd);
363 p = pd->pd_proc;
389 pd->pd_proc = NULL;
391 procdesc_free(pd);
406 if ((pd->pd_flags & PDF_DAEMON) == 0)
416 procdesc_free(pd);
424 struct procdesc *pd;
428 pd = fp->f_data;
429 PROCDESC_LOCK(pd);
430 if (pd->pd_flags & PDF_EXITED)
433 selrecord(td, &pd->pd_selinfo);
434 pd->pd_flags |= PDF_SELECTED;
436 PROCDESC_UNLOCK(pd);
443 struct procdesc *pd;
445 pd = kn->kn_fp->f_data;
446 knlist_remove(&pd->pd_selinfo.si_note, kn, 0);
452 struct procdesc *pd;
455 pd = kn->kn_fp->f_data;
461 event = pd->pd_flags & PDF_EXITED ? NOTE_EXIT : 0;
475 kn->kn_data = pd->pd_xstat;
493 struct procdesc *pd;
495 pd = fp->f_data;
500 knlist_add(&pd->pd_selinfo.si_note, kn, 0);
510 struct procdesc *pd;
519 pd = fp->f_data;
521 if (pd->pd_proc != NULL) {
522 PROC_LOCK(pd->pd_proc);
523 AUDIT_ARG_PROCESS(pd->pd_proc);
526 pstart = pd->pd_proc->p_stats->p_start;
533 if (pd->pd_proc->p_state != PRS_ZOMBIE)
537 sb->st_uid = pd->pd_proc->p_ucred->cr_ruid;
538 sb->st_gid = pd->pd_proc->p_ucred->cr_rgid;
539 PROC_UNLOCK(pd->pd_proc);