<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title><style type="text/css">
<!--
.style1 {font-size: 18px;font-weight: bold;font-family: Georgia, "Times New Roman", Times, serif;}
.style2 {font-size: 14px}
a{color:#0000cc;text-decoration:none}
a:visited{color:#0000cc;text-decoration:none}
-->
</style></head>
<body style="margin:0px 0px 0px 0px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#cccccc"><span class="style1" style="margin-left:5px">sys_mknod <span class="style2">[fs/namei.c] </span></span></td>
</tr>
<tr>
<td><p style="margin-left:22px;margin-top:0px"><br />
Creates device special files (normal file, device special file, domain socket, or named pipe).<br />
<br />
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. </p>
<p style="margin-left:10px"><strong>Arguments</strong></p>
<table width="100%" border="0" style="margin-left:20px; margin-right:20px">
<tr>
<td width="6%" valign="top"><em>eax</em></td>
<td width="94%">14</td>
</tr>
<tr>
<td valign="top"><em>ebx</em></td>
<td>Pointer to a null-terminated string that specifies the pathname.</td>
</tr>
<tr>
<td valign="top"><em>ecx</em></td>
<td>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.<br />
File types:
<table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333">
<tr>
<td><table width="100%" border="0">
<tr>
<td width="12%"><code>S_IFREG</code></td>
<td width="88%"><code>A normal file (which will be created empty).</code></td>
</tr>
<tr>
<td><code>S_IFCHR</code></td>
<td><code>Character special file.</code></td>
</tr>
<tr>
<td><code>S_IFBLK</code></td>
<td><code> Block special file.</code></td>
</tr>
<tr>
<td><code>S_IFIFO </code></td>
<td><code>FIFO (named pipe).</code></td>
</tr>
<tr>
<td><code>S_IFSOCK</code></td>
<td><code>Unix domain socket.</code></td>
</tr>
</table></td>
</tr>
</table>
Permission bits. All the file permission bits are set to the bits of <em>ecx</em> except for those set in the file-mode creation mask of the process. (See <a href="60.html">sys_umask</a>). Available permissions are:
<table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333">
<tr>
<td><p><code>S_ISUID - set user ID on execution<br>
S_ISGID - set group ID on execution<br>
S_ISVTX - on directories, restricted deletion flag<br>
S_IRWXU - owner has read, write and execute permission <br />
S_IRUSR - owner has read permission <br />
S_IWUSR - owner has write permission <br />
S_IXUSR - owner has execute permission <br />
S_IRWXG - group has read, write and execute permission <br />
S_IRGRP - group has read permission <br />
S_IWGRP - group has write permission <br />
S_IXGRP - group has execute permission <br />
S_IRWXO - others have read, write and execute permission <br />
S_IROTH - others have read permission <br />
S_IWOTH - others have write permission <br />
S_IXOTH - others have execute permission</code></p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><em>edx</em></td>
<td>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. </td>
</tr>
</table>
<p style="margin-left:10px" ><strong>Return values</strong></p>
<p style="margin-left:22px;margin-right:10px" >If the system call succeeds the return value is 0.<br />
If the system call fails the return value is one of the following <em>errno</em> values:</p>
<table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333;margin-left:22px;margin-right:22px">
<tr>
<td><table width="100%" border="0">
<tr>
<td width="10%" valign="top"><code>-EACCES </code></td>
<td width="90%"><code>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</code></td>
</tr>
<tr>
<td valign="top"><code>-EEXIST </code></td>
<td><code>Path pointed by <em>ebx</em> already exists. </code></td>
</tr>
<tr>
<td valign="top"><code>-EFAULT </code></td>
<td><code>Path pointed by <em>ebx </em>points outside your accessible address space. </code></td>
</tr>
<tr>
<td valign="top"><code>-EINVAL </code></td>
<td><code><em>ecx</em> requested creation of something other than a normal file, device special file, FIFO or socket. </code></td>
</tr>
<tr>
<td valign="top"><code>-ELOOP </code></td>
<td><code>Too many symbolic links were encountered in resolving the path pointed by<em> ebx.</em></code></td>
</tr>
<tr>
<td valign="top"><code>-ENAMETOOLONG </code></td>
<td><code>Path pointed by <em>ebx</em> was too long. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOENT</code></td>
<td><code>A directory component in the path pointed by<em> ebx </em>does not exist or is a dangling symbolic link. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOMEM </code></td>
<td><code>Insufficient kernel memory was available. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOSPC </code></td>
<td><code>The device containing the path pointed by<em> ebx</em> has no room for the new node. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOTDIR </code></td>
<td><code>A component used as a directory in the path pointed by<em> ebx </em>is not, in fact, a directory.</code></td>
</tr>
<tr>
<td valign="top"><code>-EPERM</code></td>
<td><code><em>ecx</em> 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<em> ebx</em> does not support the type of node requested. </code></td>
</tr>
<tr>
<td valign="top"><code>-EROFS </code></td>
<td><code>Path pointed by <em>ebx</em> refers to a file on a read-only filesystem. </code></td>
</tr>
</table></td>
</tr>
</table>
<p style="margin-left:10px"><strong>Remarks</strong></p>
<p style="margin-left:22px">n/a</p>
<p style="margin-left:10px"><strong>Compatibility</strong></p>
<p style="margin-left:22px">n/a</p></td>
</tr>
</table></body></html>