Difference between mkfifo () and mknod ()
Usage is mkfifo()
standardized and portable. Using mknod()
as a whole, it is not transferable - it is part of POSIX (despite assertions to the contrary in an earlier version of this answer). The POSIX specification states what mkfifo()
should be preferred. Otherwise, there is no difference between the FIFO created mkfifo()
and the mknod()
.
Note that mknod()
it can be used to create other types of devices than just FIFOs. He can create special special and personal devices. Once upon a time very (very, very) long ago, mknod()
also used to create directories - a few days before the system call mkdir()
or rmdir()
. After creating the directory, you had to use twice link()
to create entries .
and ..
in the new directory. (And you have root privileges to use it, so the team mkdir
and rmdir
were SUID root.) Currently, file systems are much more reliable, because it is no longer part of the game.
Ref: Version 7 Unix - circa 1979
source to share