[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: differece between mkfifo and mknod ... p
From: |
Peng Yu |
Subject: |
Re: differece between mkfifo and mknod ... p |
Date: |
Wed, 24 Mar 2021 21:12:46 -0500 |
On Wed, Mar 24, 2021 at 4:52 PM Bob Proulx <bob@proulx.com> wrote:
>
> Peng Yu wrote:
> > It seems that both `mkfifo` and `mknod ... p` can create a fifo. What
> > is the difference between them? Thanks.
>
> The mknod utility existed "for a decade" in Unix (don't quote me on
> that vague time statement) before mkfifo existed. The mknod utility
> existed in Unix v7 as a thin wrapper around the mknod(2) system call.
>
> man 2 mknod
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
>
> Named pipes are special files and special files are created with
> mknod. At least that was true until mkfifo came along. mkfifo was
> standardized by POSIX while the mknod utility seems too OS specific
> and never made it into the standards as far as I know.
>
> Therefore "mkfifo" should be used for standards compliance and "mknod"
> should continue to exist for backwards compatibility.
In that case, should a warning message be printed to persuade people
not to use it? Otherwise, people will continue to use it.
By discouraging people from using it for a long period (say 10 years),
its support can be dropped eventually which will reduce future
maintenance costs of this duplicate code.
--
Regards,
Peng