The mknod() function attempts to create a filesystem node named by the pathname to which the argument path points. GNU and POSIX specifications for this function vary in the following areas.
Node type is specified in the mode argument (using the bitwise OR) from the symb olic constants S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO.
GNU specifies that:
a node type specified as zero behaves as S_IFREG.
for the node types S_IFCHR and S_IFBLK, dev specifies the major and minor numbers of the newly created device special file.
POSIX specifies that:
S_IFDIR may additionally be used to create a directory file.
S_IFIFO is the only portable use of mknod().
if mode is not S_IFIFO or dev is not 0, the behavior of mknod() is unspecified.
Permissions are specified in the mode argument.
GNU specifies that:
permissions are modified by the process umask in the usual way: the permissions of the created node are (mode & ~umask).
POSIX specifies that:
the mode argument specifies node permissions (using the bitwise OR) from the following symbolic constants: S_ISUID set user ID on execution S_ISGID set group ID on execution S_IRWXU read, write or execute (search) by owner S_IRUSR read by owner S_IWUSR write by owner S_IXUSR execute (search) by owner S_IRWXG read, write or execute (search) by group S_IRGRP read by group S_IWGRP write by group S_IXGRP execute (search) by group S_IRWXO read, write or execute (search) by others S_IROTH read by others S_IWOTH write by others S_IXOTH execute (search) by others S_ISVTX on directories, restricted deletion flag
owner, group, and other permission bits of mode are modified by the file mode creation mask of the process. The mknod() function clears each bit whose corresponding bit in the file mode creation mask of the process is set.
upon successful completion, mknod() marks for update the st_atime, st_ctime and st_mtime fields of the file. Also, the st_ctime and st_mtime fields of the directory that contains the new entry are marked for update.
GNU specifies the following error conditions that are not reflected in POSIX:
EFAULT pathname points outside your accessible address space
ENOMEM insufficient kernel memory was available
POSIX specifies the following error conditions that are not reflected in GNU:
EIO an I/O error occurred while accessing the file system