mknod function makes a special file with name filename.
The mode specifies the mode of the file, and may include the various
special file bits, such as
S_IFCHR (for a character special file)
S_IFBLK (for a block special file). See Testing File Type.
The dev argument specifies which device the special file refers to.
Its exact interpretation depends on the kind of special file being created.
The return value is
0 on success and
-1 on error. In addition
to the usual file name errors (see File Name Errors), the
errno error conditions are defined for this function:
- The calling process is not privileged. Only the superuser can create
- The directory or file system that would contain the new file is full
and cannot be extended.
- The directory containing the new file can't be modified because it's on
a read-only file system.
- There is already a file named filename. If you want to replace
this file, you must remove the old file explicitly first.