mknod.2

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 2 代码 · 共 173 行

2
173
字号
.\" SCCSID: @(#)mknod.2	4.1	12/9/88.TH mknod 2.SH Namemknod \- make a directory or a special file .SH Syntax.nf#include <sys/types.h>#include <sys/stat.h>.PPint mknod(\fIpath, mode, dev\fP)char *\fIpath\fP;mode_t \fImode\fP;int \fIdev\fP;.fi.SH Description.NXR "mknod system call".NXAM "mknod system call" "mkdir command".NXR "file" "creating".NXR "directory" "creating".NXR "special file" "creating"The .PN mknodsystem call creates a new filewhose name is.I path.The mode of the new file(including special file bits)is initialized from.IR mode, where the value of .I modeis interpreted as follows:.PPS_IFMT-0170000  File type; one of the following:.RSS_IFIFO-0010000  FIFO special.brS_IFCHR-0020000  Character special.brS_IFDIR-0040000  Directory.brS_IFBLK-0060000  Block special.brS_IFREG-0100000      or 0000000  Ordinary file.RE.PPS_IRWXU-0007000 Execution mode; made from the following:.RSS_ISUID-0004000  Set user ID on execution.brS_ISGID-0002000  Set group ID on execution.brS_ISVTX-0001000  Save text image after execution.RE.PP        00777   Access permissions; made from the following:.RSS_IREAD-0000400  Read by owner.brS_IWRITE-0000200 Write by owner.br S_IEXEC-0000100  Execute (search on directory) by owner.brs_IRWXG-0000070  Read, write, execute (search) by group.brS_IRWXD-0000007  Read, write, execute (search) by others.RE.PPThe file's owner ID is set to the process's effectiveuser ID.  The file's group ID is set to the parent directory's  group ID..PPValues of \fImode\fP other than those in the preceeding listare undefined and should not be used.  The low-order nine bits of \fImode\fP are modifiedby the process's file mode creation mask:all bits set in the process's file mode creation maskare cleared.  For further information, see .MS umask 2 .If \fImode\fPindicates a block or character special file, .I devis a configuration dependent specification of acharacter or block I/O device.  If.I modedoes not indicate a block special or characterspecial device, .I devis ignored..PPFor file types other than FIFO special, only the superuser can invoke the.PN mknodsystem call. .SH Return ValuesThe.PN mknodsystem call returns a value of 0 upon successful completion.Otherwise, .PN mknodreturns a value of \-1, and sets \fIerrno\fPto indicate the error..SH DiagnosticsThe.PN mknodsystem call fails and the file mode is unchanged under the followingconditions:.TP 15[EPERM]The process's effective user ID is not superuser..TP 15[ENOTDIR]A component of the path prefix is not a directory..TP 15[ENOENT]A component of the path prefix does not exist..TP 15[EROFS]The named file resides on a read-only file system..TP 15[EEXIST]The named file exists..TP 15[EFAULT].I Pathpoints outside the process's allocated address space..TP 15[ELOOP]Too many symbolic links were encountered in translating the pathname..TP 15[ENAMETOOLONG]A component of a pathname exceeded 255 characters, or an entirepathname exceeded 1023 characters..TP 15[EACCES]Search permission is denied for a component of the path prefix..TP 15[EIO]An I/O error occurred while making the directory entry or allocatingthe inode..TP 15[ENOSPC]The directory in which the entry for the new node is being placedcannot be extended, because there is no space left on thefile system..TP 15[ENOSPC]There are no free inodes on the file system on whichthe node is being created..TP 15[EDQUOT]The directory in which the entry for the new node is beingplaced cannot be extended because the user's quota of diskblocks on the file system containing the directory has beenexhausted..TP 15[EDQUOT]The user's quota of inodes on the file system on which thenode is being created has been exhausted..TP 15[ESTALE]The file handle given in the argument is invalid.  Thefile referred to by that file handle no longer existsor has been revoked..TP[ETIMEDOUT]A connect request or remote file operation failedbecause the connected partydid not properly respond after a periodof time that is dependent on the communications protocol..SH See Alsomkdir(1), chmod(2), execve(2), stat(2), umask(2), fs(5)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?