NetBSD-Users archive

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

Re: procfs difference between NetBSD and Linux



rhialto%falu.nl@localhost (Rhialto) writes:

>On Thu 03 Jun 2021 at 09:12:52 -0000, Michael van Elst wrote:
>> What happens:
>>=20
>> namei() return EEXIST when it works on a CREATE operation and
>> crosses a mountpoint.
>>=20
>> procfs cheats in that the directory nodes like /proc/$pid/fd are
>> served by procfs and have a v_mount pointing to /proc. But the
>> file descriptors /proc/$pid/fd/$fd are magic aliases and you get
>> the real vnode of that open file which belongs to a different
>> mount, e.g. /dev/pts for a pty or a ffs filesystem for a regular file.
>>=20
>> For namei() that's crossing a mountpoint -> EEXIST.

>I guess the question for the short term is: will it work as intended
>when the O_CREAT flag is omitted from the call (since it is redundant
>in this case anyway)?


I guess so. But AFAIK Samba has refactored the code so that O_CREAT
is always used when writing a file. You'd need to add a hack that
detects the procfs writes to strip O_CREAT for only that case.




Home | Main Index | Thread Index | Old Index