tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: In-kernel process exit hooks?



On Wed, 6 Jan 2016, Taylor R Campbell wrote:

Another possibility would be to change filemon(4) to do fd_getfile
each it needs to use the file descriptor.  This makes it a little more
brittle (fails if you close the descriptor), but would sidestep the
problem.

Hmmm, perhaps. Failure would not be a problem, since we would just revert to the initial "output file unspecified" conditions.

I think I like this approach.  :)  I'll give it a try.

Another possibility would be to use fd_getfile2/closef, which holds a
reference only on the file, instead of fd_getfile/fd_putfile, which
holds a reference on the file and on the descriptor.  Releasing the
reference to the file may not a problem, even though releasing the
reference to the descriptor is a problem as you found.

Would this prevent the file descriptor from being closed behind our backs?


+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+


Home | Main Index | Thread Index | Old Index