No functional change intended.
Tracking these structures separately for each proc enables future work to
correctly emulate clone(2) in linux(4).
Differential D27037
Split out cwd/root/jail, cmask state from filedesc table cem on Nov 1 2020, 3:54 AM. Authored by Tags None Referenced Files
Details No functional change intended. Tracking these structures separately for each proc enables future work to This was inspired by D27016 / enables a better version of that change. fdcopy_remapped / fdescfree_remapped are only used by CloudABI-exclusive Corresponding lsof patch: https://reviews.freebsd.org/P456
Diff Detail
Event TimelineComment Actions struct pwddesc might be a better name, since it's essentially a wrapper for a struct pwd which allows multiple processes to share the same instance. I guess we can't "just" move the struct pwd reference directly into struct proc because struct pwd is updated using a copy-on-write scheme. OTOH, the motivation for that scheme seems to be to reduce filedesc lock contention, but in this diff we have a separate lock, so maybe some simplification is possible now. Comment Actions This will have to be tested against LTP and rfork flag which keeps sharing what's currently fdp. Also this introduces a problem: what should happen when you mix rfork and the new flag in existing processes?
Comment Actions Pwd and cmask, for whatever reason.
Yeah, it can’t just be CoW or there is no sharing. Comment Actions Sure.
What is the problem? The new flag cannot be accessed by rfork abi.
Comment Actions
Comment Actions This looks fine. However, there is a nasty little problem: someoen(tm) will have to patch lsof to handle the change. You can do it with a version bump to compile-time detect. It can be found here: https://github.com/lsof-org/lsof ; you can mail ler@ to get the patch submitted. Comment Actions
What we really need is to add a canonical interface for lsof to use Comment Actions As far as I know the kernel already exports all the necessay bits. However, making lsof use them is quite a task. Comment Actions Lsof appears to use libkvm on modern FreeBSD, but not libproc. So it needs the equivalent change to procstat_getfiles_kvm() and I think that's it.
|