sys_mknod [fs/namei.c]
Creates device special files (normal file, device special file, domain socket, or named pipe). The newly created node will be owned by the effective user ID of the process. If the directory containing the node has the set-group-ID bit set, or if the filesystem is mounted with BSD group semantics, the new node will inherit the group ownership from its parent directory; otherwise it will be owned by the effective group ID of the process. Arguments
eax | 14
ebx | Pointer to a null-terminated string that specifies the pathname.
ecx | This argument specifies both the permissions to use and the type of node to be created. It should be a combination (using bitwise-or) of one of the file types listed below and the permissions for the new node. File types:
`S_IFREG` | `A normal file (which will be created empty).`
`S_IFCHR` | `Character special file.`
`S_IFBLK` | `Block special file.`
`S_IFIFO` | `FIFO (named pipe).`
`S_IFSOCK` | `Unix domain socket.`
Permission bits. All the file permission bits are set to the bits of ecx except for those set in the file-mode creation mask of the process. (See sys_umask). Available permissions are:
`S_ISUID - set user ID on execution S_ISGID - set group ID on execution S_ISVTX - on directories, restricted deletion flag S_IRWXU - owner has read, write and execute permission S_IRUSR - owner has read permission S_IWUSR - owner has write permission S_IXUSR - owner has execute permission S_IRWXG - group has read, write and execute permission S_IRGRP - group has read permission S_IWGRP - group has write permission S_IXGRP - group has execute permission S_IRWXO - others have read, write and execute permission S_IROTH - others have read permission S_IWOTH - others have write permission S_IXOTH - others have execute permission`
edx | This argument is used only if file type is S_IFCHR or S_IFBLK in which case it specifies the major and minor numbers of the newly created device special file. Otherwise it's ignored.
Return values If the system call succeeds the return value is 0. If the system call fails the return value is one of the following errno values:
`-EACCES` | `The parent directory does not allow write permission to the process, or one of the directories in the path prefix did not allow search permission`
`-EEXIST` | `Path pointed by ebx already exists.`
`-EFAULT` | `Path pointed by ebx points outside your accessible address space.`
`-EINVAL` | `ecx requested creation of something other than a normal file, device special file, FIFO or socket.`
`-ELOOP` | `Too many symbolic links were encountered in resolving the path pointed by ebx.`
`-ENAMETOOLONG` | `Path pointed by ebx was too long.`
`-ENOENT` | `A directory component in the path pointed by ebx does not exist or is a dangling symbolic link.`
`-ENOMEM` | `Insufficient kernel memory was available.`
`-ENOSPC` | `The device containing the path pointed by ebx has no room for the new node.`
`-ENOTDIR` | `A component used as a directory in the path pointed by ebx is not, in fact, a directory.`
`-EPERM` | `ecx requested creation of something other than a regular file, FIFO (named pipe), or Unix domain socket, and the caller is not privileged (does not have the CAP_MKNOD capability); also returned if the filesystem containing the path pointed by ebx does not support the type of node requested.`
`-EROFS` | `Path pointed by ebx refers to a file on a read-only filesystem.`
Remarks n/a Compatibility n/a