mknod is a function in the GNU C library, glibc, which makes special files, such as files which correspond to devices. It is included for compatibility with 4.4BSD. Its prototype is:
int mknod(const char *filename, int mode, int dev)
where filename is the name of the special file to create, mode specifies the mode of the file (possibly including special file bits, such as S_IFCHR or S_IFBLK for character or block files), and dev is an integer specifying which device the file refers to; its interpretation varies. mknod returns 0 on success, and returns -1 on error, as well as setting errno accordingly:
- EPERM - only the superuser can create special files. This process is not running as the superuser.
- ENOSPC - No space left in filesystem or directory for the new special file.
- EROFS - Read-only filesystem.
- EEXIST - File already exists -- old file must be unlinked first.
The mknod function happens unsurprisingly to form the base for the mknod program, which in the GNU system is part of GNU coreutils.
(Information mostly paraphrased from the GNU C Library Reference Manual, which is under the GNU Free Documentation License.)