Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | .\" Copyright (c) 1980, 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)mknod.2 6.5 (Berkeley) 3/10/91 | |
33 | .\" | |
34 | .Dd March 10, 1991 | |
35 | .Dt MKNOD 2 | |
36 | .Os BSD 4 | |
37 | .Sh NAME | |
38 | .Nm mknod | |
39 | .Nd make a special file node | |
40 | .Sh SYNOPSIS | |
41 | .Fd #include <unistd.h> | |
42 | .Ft int | |
43 | .Fn mknod "const char *path" "mode_t mode" "dev_t dev" | |
44 | .Sh DESCRIPTION | |
45 | The device special file | |
46 | .Fa path | |
47 | is created with the major and minor | |
48 | device numbers extracted from | |
49 | .Fa mode. | |
50 | The access permissions of | |
51 | .Fa path | |
52 | are descendant from the | |
53 | .Xr umask 2 | |
54 | of the parent process. | |
55 | .Pp | |
56 | If | |
57 | .Fa mode | |
58 | indicates a block or character special file, | |
59 | .Fa dev | |
60 | is a configuration dependent specification of a character or block | |
61 | I/O device and the superblock of the device. If | |
62 | .Fa mode | |
63 | does not indicate a block special or character special device, | |
64 | .Fa dev | |
65 | is ignored. | |
66 | .Pp | |
67 | .Fn Mknod | |
68 | requires super-user privileges. | |
69 | .Sh RETURN VALUES | |
70 | Upon successful completion a value of 0 is returned. | |
71 | Otherwise, a value of -1 is returned and | |
72 | .Va errno | |
73 | is set to indicate the error. | |
74 | .Sh ERRORS | |
75 | .Fn Mknod | |
76 | will fail and the file will be not created if: | |
77 | .Bl -tag -width Er | |
78 | .It Bq Er ENOTDIR | |
79 | A component of the path prefix is not a directory. | |
80 | .It Bq Er EINVAL | |
81 | The pathname contains a character with the high-order bit set. | |
82 | .It Bq Er ENAMETOOLONG | |
83 | A component of a pathname exceeded 255 characters, | |
84 | or an entire path name exceeded 1023 characters. | |
85 | .It Bq Er ENOENT | |
86 | A component of the path prefix does not exist. | |
87 | .It Bq Er EACCES | |
88 | Search permission is denied for a component of the path prefix. | |
89 | .It Bq Er ELOOP | |
90 | Too many symbolic links were encountered in translating the pathname. | |
91 | .It Bq Er EPERM | |
92 | The process's effective user ID is not super-user. | |
93 | .It Bq Er EPERM | |
94 | The pathname contains a character with the high-order bit set. | |
95 | .It Bq Er EIO | |
96 | An I/O error occurred while making the directory entry or allocating the inode. | |
97 | .It Bq Er ENOSPC | |
98 | The directory in which the entry for the new node is being placed | |
99 | cannot be extended because there is no space left on the file | |
100 | system containing the directory. | |
101 | .It Bq Er ENOSPC | |
102 | There are no free inodes on the file system on which the | |
103 | node is being created. | |
104 | .It Bq Er EDQUOT | |
105 | The directory in which the entry for the new node | |
106 | is being placed cannot be extended because the | |
107 | user's quota of disk blocks on the file system | |
108 | containing the directory has been exhausted. | |
109 | .It Bq Er EDQUOT | |
110 | The user's quota of inodes on the file system on | |
111 | which the node is being created has been exhausted. | |
112 | .It Bq Er EROFS | |
113 | The named file resides on a read-only file system. | |
114 | .It Bq Er EEXIST | |
115 | The named file exists. | |
116 | .It Bq Er EFAULT | |
117 | .Fa Path | |
118 | points outside the process's allocated address space. | |
119 | .El | |
120 | .Sh SEE ALSO | |
121 | .Xr chmod 2 , | |
122 | .Xr stat 2 , | |
123 | .Xr umask 2 | |
124 | .Sh HISTORY | |
125 | A | |
126 | .Nm | |
326e0c26 GW |
127 | function call appeared in |
128 | .At v6 . |