Page MenuHomeFreeBSD

kqueue: Add NOTE_REAP
ClosedPublic

Authored by des on Fri, Jul 17, 8:10 PM.
Tags
None
Referenced Files
F164483253: D58313.id182768.diff
Sat, Aug 1, 7:56 AM
F164460575: D58313.id182433.diff
Sat, Aug 1, 5:12 AM
Unknown Object (File)
Fri, Jul 31, 7:36 PM
Unknown Object (File)
Fri, Jul 31, 10:38 AM
Unknown Object (File)
Fri, Jul 31, 6:40 AM
Unknown Object (File)
Fri, Jul 31, 5:49 AM
Unknown Object (File)
Thu, Jul 30, 5:41 PM
Unknown Object (File)
Thu, Jul 30, 5:54 AM

Details

Summary

Add a NOTE_REAP event for EVFILTER_PROC which provides a notification
when the process is reaped.

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des held this revision as a draft.
des published this revision for review.Tue, Jul 21, 7:51 PM
des added reviewers: kib, markj.

taking out of draft since I don't get notifications for replies to drafts

des added a subscriber: kevans.

I just tested this patch again for the first time since February and to my surprise, it now seems to work. Perhaps some of the work @kevans and @kib have done in this area since then fixed whatever issue was preventing it from working. Please review...

sys/kern/kern_event.c
2249

Why move this out of the flux segment?

sys/kern/kern_event.c
2249

We set the KN_SCAN bit before entering flux, we should clear it after leaving flux. I suppose it makes no difference in practice since in both cases kq is locked throughout, but this seemed cleaner to me.

des edited the summary of this revision. (Show Details)

remove unnecessary change

des marked an inline comment as done.Wed, Jul 22, 10:36 AM
kib added inline comments.
lib/libsys/kqueue.2
547

I think some explanation what 'reaped' means is useful.

sys/kern/kern_event.c
448
This revision is now accepted and ready to land.Wed, Jul 22, 11:48 PM
lib/libsys/kqueue.2
547

Why? It's established terminology. I prefer “collected” but “reaped” is what it's been called for 40 or 50 years, cf. procctl(2), waitpid(2) etc.

sys/kern/kern_event.c
448

Better to do a sweep later.

markj added inline comments.
lib/libsys/kqueue.2
547

You might at least refer to wait(2), e.g., "The process has been reaped by a call to the wait(2) family of functions."

des marked 2 inline comments as done.Thu, Jul 23, 4:36 PM
This revision now requires review to proceed.Thu, Jul 23, 5:46 PM
kib added inline comments.
sys/kern/kern_event.c
473

I think that EVFILT_PROC and EVFILT_PROCDESC need a separate PCTRLMASKs, I will handle this afterward.

This revision is now accepted and ready to land.Thu, Jul 23, 10:49 PM
des planned changes to this revision.Fri, Jul 24, 1:33 PM

I just noticed that NOTE_REAP aliases NOTE_SIGNAL. Testing a fix.

markj added inline comments.
sys/sys/event.h
212–215
This revision is now accepted and ready to land.Fri, Jul 24, 7:51 PM
This revision was automatically updated to reflect the committed changes.