tech-kern archive

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

Re: mknod(2) and POSIX



On 18.06.2019 14:30, Jason Thorpe wrote:
> 
> 
>> On Jun 18, 2019, at 2:25 PM, Jason Thorpe <thorpej%me.com@localhost> wrote:
>>
>>> On Jun 18, 2019, at 2:01 PM, Greg Troxel <gdt%lexort.com@localhost> wrote:
>>>
>>> I realize mkfifo is preferred in our world, and POSIX says it is
>>> preferred.  But I believe we have a failure to follow POSIX.
>>>
>>> Other opinions?
>>
>> Seems you are correct.
> 
> Sorry!  Hit "send" prematurely.
> 
> mknod(2) for the FIFO case should allow users under the same circumstances that mkfifo(2) does.
> 
> -- thorpej
> 

This is sometimes mentioned and discussed. Linux allows FIFO (mkfifo)
and socket (S_IFSOCK) in mknod(2) calls. I landed into this for the last
time in valgrind.

NetBSD is not the only BSD that does not allow this "portable" usage,
but on the other hand Linux, FreeBSD, Solaris, Darwin support it.

From the talks that happen from time to time people (including me) find
it bizarre to create FIFO or sockets with mknod(2). There is also an
option to create.. regular files and directories with mknod(2).

POSIX initially excluded mknod(2) from the specification and specified
mkfifo(2), mkdir(2).. today it creates various file types with mknod(2).

Implementing it on the kernel side is better as I need it for software
that bypasses libc and it's not nice to reimplement special cases in 3rd
party software.

I wrote a patch to add support for it, but untested as currently the
kernel build is broken:

http://netbsd.org/~kamil/patch-00128-posix-mknod.txt

Independently, I have removed unused variable retval.

If this patch is fine and once the kernel will be unbroken, I can land
it, document and add ATF tests.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index