NetBSD-Users archive

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

Re: procfs difference between NetBSD and Linux



simonb%NetBSD.org@localhost (Simon Burge) writes:

>Jaromir wrote:

>> > On 3/06/21 9:58 am, Mark Davies wrote:
>> > > done - https://bugzilla.samba.org/show_bug.cgi?id=14727
>> >
>> > And looks like they are throwing it back as a kernel bug
>> >
>> > https://bugzilla.samba.org/show_bug.cgi?id=14727#c3
>>
>> O_CREAT really shouldn't cause the open to fail if the file already
>> exists regardless of filesystem, so they are right.

>I agree with Jaromir here.  From the link in the samba bug, the SUSv3
>open() page entry for the O_CREAT flag starts with:

>    O_CREAT
>        If the file exists, this flag has no effect except as noted
>        under O_EXCL below.



What happens:

namei() return EEXIST when it works on a CREATE operation and
crosses a mountpoint.

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.

For namei() that's crossing a mountpoint -> EEXIST.



Home | Main Index | Thread Index | Old Index