I understand why it's useful to have access to another process' opened files.
I was wondering more why the Plan9 behavior would be useful - why you would want opening /proc/self/fd/<n> to give you a reference to the same file description instead of giving you a new file description. I assume opening /proc/<other-pid>/fd/<n> doesn't share file descriptions with the other process in Plan9 either, but maybe I'm assuming that wrongly as well.
Comments
I understand why it's useful to have access to another process' opened files.
I was wondering more why the Plan9 behavior would be useful - why you would want opening /proc/self/fd/<n> to give you a reference to the same file description instead of giving you a new file description. I assume opening /proc/<other-pid>/fd/<n> doesn't share file descriptions with the other process in Plan9 either, but maybe I'm assuming that wrongly as well.
If opening the other process' entry shares the description, that means you're messing with its read/write pointer.
I know, which is why I'm hoping that's not the case.
But then, if that's not the case for /proc/<other>/fd/<n>, why would it be for /proc/self/fd/<n> ? Where does this expectation come from?