MCPcopy Create free account
hub / github.com/F-Stack/f-stack / filt_proc

Function filt_proc

freebsd/kern/kern_event.c:490–519  ·  view source on GitHub ↗

XXX - move to kern_proc.c? */

Source from the content-addressed store, hash-verified

488
489/* XXX - move to kern_proc.c? */
490static int
491filt_proc(struct knote *kn, long hint)
492{
493 struct proc *p;
494 u_int event;
495
496 p = kn->kn_ptr.p_proc;
497 if (p == NULL) /* already activated, from attach filter */
498 return (0);
499
500 /* Mask off extra data. */
501 event = (u_int)hint & NOTE_PCTRLMASK;
502
503 /* If the user is interested in this event, record it. */
504 if (kn->kn_sfflags & event)
505 kn->kn_fflags |= event;
506
507 /* Process is gone, so flag the event as finished. */
508 if (event == NOTE_EXIT) {
509 kn->kn_flags |= EV_EOF | EV_ONESHOT;
510 kn->kn_ptr.p_proc = NULL;
511 if (kn->kn_fflags & NOTE_EXIT)
512 kn->kn_data = KW_EXITCODE(p->p_xexit, p->p_xsig);
513 if (kn->kn_fflags == 0)
514 kn->kn_flags |= EV_DROP;
515 return (1);
516 }
517
518 return (kn->kn_fflags != 0);
519}
520
521/*
522 * Called when the process forked. It mostly does the same as the

Callers 1

filt_procattachFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected