source: trunk/minix/man/man2/mknod.2@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 3.2 KB
Line 
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)mknod.2 6.4 (Berkeley) 5/23/86
6.\"
7.TH MKNOD 2 "May 23, 1986"
8.UC 4
9.SH NAME
10mknod, mkfifo \- make a special file
11.SH SYNOPSIS
12.nf
13.ft B
14#include <sys/types.h>
15#include <unistd.h>
16#include <sys/stat.h>
17
18int mknod(const char *\fIpath\fP, mode_t \fImode\fP, dev_t \fIdev\fP)
19int mkfifo(const char *\fIpath\fP, mode_t \fImode\fP)
20.fi
21.ft R
22.SH DESCRIPTION
23.B Mknod
24creates a new file
25whose name is
26.I path.
27The mode of the new file
28(including special file bits)
29is initialized from
30.IR mode ,
31as defined in
32.IR <sys/stat.h> .
33(The protection part of the mode
34is modified by the process's mode mask (see
35.BR umask (2))).
36The first block pointer of the i-node
37is initialized from
38.I dev
39and is used to specify which device the special file
40refers to.
41.PP
42If mode indicates a block or character special file,
43.I dev
44is the device number of a character or block I/O device.
45The low eight bits of the device number hold the minor device number
46that selects a device among the devices governed by the same driver.
47The driver is selected by the major device number, the next eight bits
48of the device number.
49.PP
50If
51.I mode
52does not indicate a block special or character special device,
53.I dev
54is ignored.
55(For example, when creating a ``fifo'' special file.)
56.PP
57.B Mknod
58may be invoked only by the super-user,
59unless it is being used to create a fifo.
60.PP
61The call
62.BI "mkfifo(" path ", " mode ")"
63is equivalent to
64.PP
65.RS
66.BI "mknod(" path ", (" mode " & 0777) | S_IFIFO, 0)"
67.RE
68.SH "RETURN VALUE
69Upon successful completion a value of 0 is returned.
70Otherwise, a value of \-1 is returned and \fBerrno\fP
71is set to indicate the error.
72.SH ERRORS
73.B Mknod
74will fail and the file mode will be unchanged if:
75.TP 15
76[ENOTDIR]
77A component of the path prefix is not a directory.
78.TP 15
79[ENAMETOOLONG]
80The path name exceeds PATH_MAX characters.
81.TP 15
82[ENOENT]
83A component of the path prefix does not exist.
84.TP 15
85[EACCES]
86Search permission is denied for a component of the path prefix.
87.TP 15
88[ELOOP]
89Too many symbolic links were encountered in translating the pathname.
90(Minix-vmd)
91.TP 15
92[EPERM]
93The process's effective user ID is not super-user.
94.TP 15
95[EIO]
96An I/O error occurred while making the directory entry or allocating the inode.
97.TP 15
98[ENOSPC]
99The directory in which the entry for the new node is being placed
100cannot be extended because there is no space left on the file
101system containing the directory.
102.TP 15
103[ENOSPC]
104There are no free inodes on the file system on which the
105node is being created.
106.ig
107.TP 15
108[EDQUOT]
109The directory in which the entry for the new node
110is being placed cannot be extended because the
111user's quota of disk blocks on the file system
112containing the directory has been exhausted.
113.TP 15
114[EDQUOT]
115The user's quota of inodes on the file system on
116which the node is being created has been exhausted.
117..
118.TP 15
119[EROFS]
120The named file resides on a read-only file system.
121.TP 15
122[EEXIST]
123The named file exists.
124.TP 15
125[EFAULT]
126.I Path
127points outside the process's allocated address space.
128.SH "SEE ALSO"
129.BR chmod (2),
130.BR stat (2),
131.BR umask (2).
Note: See TracBrowser for help on using the repository browser.