For each new pipe process, add its process descriptor into the kqueue with the EVFILT_PROCDESC filter and NOTE_EXIT event. When the pipe process exits, the main kqueue loop will catch this, logging exit errors and cleaning up the pipe process' filed node.
Details
- Reviewers
markj - Commits
- rGd2d180fb7736: syslogd: Watch for dead pipe processes
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Add boolean reload parameter to close_filed(). When set to true, remove kevents that reference the filed.
Remove reload parameter in close_filed(). Move kqueue deletion into closelogfiles() instead.
usr.sbin/syslogd/syslogd.c | ||
---|---|---|
2504 | What's the point of deleting the kevent if we're about to close the fd anyway? Does that simplify cleanup somehow? |
usr.sbin/syslogd/syslogd.c | ||
---|---|---|
2504 |
If we're reloading, it is possible that piped processes are still alive. In init(), this closelogfiles() is called and all fileds are freed. If we don't remove the piped process' kevent from the kqueue, then EVFILT_PROCDESC will be triggered upon the procdesc closure in close_filed(). Back in main(), the EVFILT_PROCDESC will attempt to call close_filed() again with an invalid, freed filed (stored in its udata). |