Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/sys_procdesc.c
| Show First 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | if (pd == NULL) | ||||
| return; | return; | ||||
| PROCDESC_LOCK(pd); | PROCDESC_LOCK(pd); | ||||
| KNOTE_LOCKED(&pd->pd_selinfo.si_note, NOTE_PDSIGCHLD); | KNOTE_LOCKED(&pd->pd_selinfo.si_note, NOTE_PDSIGCHLD); | ||||
| PROCDESC_UNLOCK(pd); | PROCDESC_UNLOCK(pd); | ||||
| wakeup(&p->p_procdesc); | wakeup(&p->p_procdesc); | ||||
| } | } | ||||
| void | |||||
| procdesc_fork(struct proc *p, pid_t child_pid) | |||||
| { | |||||
| struct procdesc *pd; | |||||
| PROC_LOCK(p); | |||||
| pd = p->p_procdesc; | |||||
| if (pd != NULL) { | |||||
| PROCDESC_LOCK(pd); | |||||
| pd->pd_last_child = child_pid; | |||||
| KNOTE_LOCKED(&pd->pd_selinfo.si_note, NOTE_FORK); | |||||
| PROCDESC_UNLOCK(pd); | |||||
| } | |||||
| PROC_UNLOCK(p); | |||||
| } | |||||
| /* | /* | ||||
| * When a process descriptor is reaped, perhaps as a result of close(), release | * When a process descriptor is reaped, perhaps as a result of close(), release | ||||
| * the process's reference on the process descriptor. | * the process's reference on the process descriptor. | ||||
| */ | */ | ||||
| void | void | ||||
| procdesc_reap(struct proc *p) | procdesc_reap(struct proc *p) | ||||
| { | { | ||||
| struct procdesc *pd; | struct procdesc *pd; | ||||
| ▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | if (kn->kn_sfflags & event) | ||||
| kn->kn_fflags |= event; | kn->kn_fflags |= event; | ||||
| /* Process is gone, so flag the event as finished. */ | /* Process is gone, so flag the event as finished. */ | ||||
| if ((event & NOTE_EXIT) != 0) { | if ((event & NOTE_EXIT) != 0) { | ||||
| kn->kn_flags |= EV_EOF | EV_ONESHOT; | kn->kn_flags |= EV_EOF | EV_ONESHOT; | ||||
| if (kn->kn_fflags & NOTE_EXIT) | if (kn->kn_fflags & NOTE_EXIT) | ||||
| kn->kn_data = pd->pd_xstat; | kn->kn_data = pd->pd_xstat; | ||||
| if (kn->kn_fflags == 0) | if (kn->kn_fflags == 0) | ||||
| kn->kn_flags |= EV_DROP; | kn->kn_flags |= EV_DROP; | ||||
markj: Probably you want to `kn->kn_flags &= ~NOTE_FORK` here? | |||||
Done Inline ActionsHm, no. I will explicitly mention that exit code is returned. kib: Hm, no. I will explicitly mention that exit code is returned. | |||||
Done Inline Actions(I meant kn->kn_fflags above of course.) markj: (I meant `kn->kn_fflags` above of course.) | |||||
Done Inline ActionsI do want (need) to see NOTE_FORK in this situation. kib: I do want (need) to see NOTE_FORK in this situation. | |||||
| return (1); | return (1); | ||||
| } | } | ||||
| if ((kn->kn_fflags & NOTE_FORK) != 0) | |||||
| kn->kn_data = pd->pd_last_child; | |||||
| return (kn->kn_fflags != 0); | return (kn->kn_fflags != 0); | ||||
| } | } | ||||
| static const struct filterops procdesc_kqops = { | static const struct filterops procdesc_kqops = { | ||||
| .f_isfd = 1, | .f_isfd = 1, | ||||
| .f_detach = procdesc_kqops_detach, | .f_detach = procdesc_kqops_detach, | ||||
| .f_event = procdesc_kqops_event, | .f_event = procdesc_kqops_event, | ||||
| ▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines | |||||
Probably you want to kn->kn_flags &= ~NOTE_FORK here?