On Wed, Mar 24, 2021 at 4:52 PM Bob Proulx <b...@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