add directory Minix
This commit is contained in:
171
Minix/2.0.0/wwwman/man2/open.2.html
Normal file
171
Minix/2.0.0/wwwman/man2/open.2.html
Normal file
@@ -0,0 +1,171 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>open(2)</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>open(2)</H1>
|
||||
<HR>
|
||||
<PRE>
|
||||
|
||||
</PRE>
|
||||
<H2>NAME</H2><PRE>
|
||||
open - open a file for reading or writing, or create a new file
|
||||
|
||||
|
||||
</PRE>
|
||||
<H2>SYNOPSIS</H2><PRE>
|
||||
<STRONG>#include</STRONG> <STRONG><sys/types.h></STRONG>
|
||||
<STRONG>#include</STRONG> <STRONG><fcntl.h></STRONG>
|
||||
|
||||
<STRONG>int</STRONG> <STRONG>open(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>path</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>flags</EM> [<STRONG>,</STRONG> <STRONG>mode_t</STRONG> <EM>mode</EM>]<STRONG>)</STRONG>
|
||||
|
||||
|
||||
</PRE>
|
||||
<H2>DESCRIPTION</H2><PRE>
|
||||
<STRONG>Open</STRONG> opens the file <EM>path</EM> for reading and/or writing, as specified by the
|
||||
<EM>flags</EM> argument and returns a descriptor for that file. The <EM>flags</EM>
|
||||
argument may indicate the file is to be created if it does not already
|
||||
exist (by specifying the O_CREAT flag), in which case the file is created
|
||||
with mode <EM>mode</EM> as described in <STRONG><A HREF="../man2/chmod.2.html">chmod(2)</A></STRONG> and modified by the process'
|
||||
umask value (see <STRONG><A HREF="../man2/umask.2.html">umask(2)</A></STRONG>).
|
||||
|
||||
<EM>Path</EM> is the address of a string of ASCII characters representing a path
|
||||
name, terminated by a null character. The flags specified are formed by
|
||||
<EM>or</EM>'ing the following values
|
||||
|
||||
O_RDONLY open for reading only
|
||||
O_WRONLY open for writing only
|
||||
O_RDWR open for reading and writing
|
||||
O_NONBLOCK do not block on open
|
||||
O_APPEND append on each write
|
||||
O_CREAT create file if it does not exist
|
||||
O_TRUNC truncate size to 0
|
||||
O_EXCL error if create and file exists
|
||||
|
||||
Opening a file with O_APPEND set causes each write on the file to be
|
||||
appended to the end. If O_TRUNC is specified and the file exists, the
|
||||
file is truncated to zero length. If O_EXCL is set with O_CREAT, then if
|
||||
the file already exists, the open returns an error. This can be used to
|
||||
implement a simple exclusive access locking mechanism. If O_EXCL is set
|
||||
and the last component of the pathname is a symbolic link, the open will
|
||||
fail even if the symbolic link points to a non-existent name. If the
|
||||
O_NONBLOCK flag is specified and the open call would result in the
|
||||
process being blocked for some reason, the open returns immediately.
|
||||
|
||||
Upon successful completion a non-negative integer termed a file
|
||||
descriptor is returned. The file pointer used to mark the current
|
||||
position within the file is set to the beginning of the file.
|
||||
|
||||
The new descriptor is set to remain open across <STRONG>execve</STRONG> system calls; see
|
||||
<STRONG><A HREF="../man2/close.2.html">close(2)</A></STRONG>.
|
||||
|
||||
The system imposes a limit on the number of descriptors open
|
||||
simultaneously by one process.
|
||||
|
||||
|
||||
</PRE>
|
||||
<H2>ERRORS</H2><PRE>
|
||||
The named file is opened unless one or more of the following are true:
|
||||
|
||||
[ENOTDIR] A component of the path prefix is not a directory.
|
||||
|
||||
[ENAMETOOLONG] The path name exceeds PATH_MAX characters.
|
||||
|
||||
[ENOENT] O_CREAT is not set and the named file does not exist.
|
||||
|
||||
[ENOENT] A component of the path name that must exist does not
|
||||
exist.
|
||||
|
||||
[EACCES] Search permission is denied for a component of the path
|
||||
prefix.
|
||||
|
||||
[EACCES] The required permissions (for reading and/or writing) are
|
||||
denied for the named file.
|
||||
|
||||
[EACCES] O_CREAT is specified, the file does not exist, and the
|
||||
directory in which it is to be created does not permit
|
||||
writing.
|
||||
|
||||
[EACCES] A device to be opened for writing is physically write
|
||||
protected.
|
||||
|
||||
[ELOOP] Too many symbolic links were encountered in translating
|
||||
the pathname. (Minix-vmd)
|
||||
|
||||
[EISDIR] The named file is a directory, and the arguments specify
|
||||
it is to be opened for writing.
|
||||
|
||||
[EROFS] The named file resides on a read-only file system, and the
|
||||
file is to be modified.
|
||||
|
||||
[EMFILE] The system limit for open file descriptors per process has
|
||||
already been reached.
|
||||
|
||||
[ENFILE] The system file table is full.
|
||||
|
||||
[ENXIO] The named file is a character special or block special
|
||||
file, and the device associated with this special file
|
||||
does not exist.
|
||||
|
||||
[ENOSPC] O_CREAT is specified, the file does not exist, and the
|
||||
directory in which the entry for the new file is being
|
||||
placed cannot be extended because there is no space left
|
||||
on the file system containing the directory.
|
||||
|
||||
|
||||
|
||||
[ENOSPC] O_CREAT is specified, the file does not exist, and there
|
||||
are no free inodes on the file system on which the file is
|
||||
being created.
|
||||
|
||||
[EIO] An I/O error occurred while making the directory entry or
|
||||
allocating the inode for O_CREAT.
|
||||
|
||||
[EFAULT] <EM>Path</EM> points outside the process's allocated address space.
|
||||
|
||||
[EEXIST] O_CREAT and O_EXCL were specified and the file exists.
|
||||
|
||||
|
||||
</PRE>
|
||||
<H2>SEE ALSO</H2><PRE>
|
||||
<STRONG><A HREF="../man2/chmod.2.html">chmod(2)</A></STRONG>, <STRONG><A HREF="../man2/close.2.html">close(2)</A></STRONG>, <STRONG><A HREF="../man2/dup.2.html">dup(2)</A></STRONG>, <STRONG><A HREF="../man2/fcntl.2.html">fcntl(2)</A></STRONG>, <STRONG><A HREF="../man2/lseek.2.html">lseek(2)</A></STRONG>, <STRONG><A HREF="../man2/read.2.html">read(2)</A></STRONG>, <STRONG><A HREF="../man2/write.2.html">write(2)</A></STRONG>,
|
||||
<STRONG><A HREF="../man2/umask.2.html">umask(2)</A></STRONG>.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</PRE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user