add directory Ref-docs
This commit is contained in:
91
Ref-docs/syscalls/syscalls_10.html
Normal file
91
Ref-docs/syscalls/syscalls_10.html
Normal file
@@ -0,0 +1,91 @@
|
||||
<html><!-- This HTML file has been created by texi2html 1.29
|
||||
from syscalls.texi on 4 June 1994 -->
|
||||
|
||||
<TITLE>Syscall specifications of Linux - creat</TITLE>
|
||||
<P>Go to the <A HREF="syscalls_9.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_9.html">previous</A>, <A HREF="syscalls_11.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_11.html">next</A> section.<P>
|
||||
<H2><A NAME="SEC10" HREF="syscalls_toc.html#SEC10" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC10">creat and open</A></H2>
|
||||
<P>
|
||||
<H3>SYNOPSIS</H3>
|
||||
<P>
|
||||
<CODE>int open(const char *<VAR>path</VAR>, int <VAR>flags</VAR>);</CODE>
|
||||
<P>
|
||||
<CODE>int open(const char *<VAR>path</VAR>, int <VAR>flags</VAR>, mode_t
|
||||
<VAR>mode</VAR>);</CODE>
|
||||
<P>
|
||||
<CODE>int creat(const char *<VAR>path</VAR>, mode_t <VAR>mode</VAR>);</CODE>
|
||||
<P>
|
||||
<H3>PARAMETERS</H3>
|
||||
<P>
|
||||
<VAR>path</VAR>: [in] the path of the new file to create.
|
||||
<P>
|
||||
<VAR>mode</VAR>: [in] the new permission mask of the file. It is masked by
|
||||
the <CODE>umask</CODE> value: <CODE>(mode & ~umask)</CODE>.
|
||||
<P>
|
||||
<VAR>flags</VAR>: [in] flags (see description).
|
||||
<P>
|
||||
<H3>DESCRIPTION</H3>
|
||||
<P>
|
||||
<VAR>open</VAR> opens an file. The <VAR>flags</VAR> parameter must be one of the
|
||||
following:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>O_RDONLY</CODE>
|
||||
<DD>the file is opened for reading.
|
||||
<P>
|
||||
<DT><CODE>O_WRONLY</CODE>
|
||||
<DD>the file is opened for writing.
|
||||
<P>
|
||||
<DT><CODE>O_RDWR</CODE>
|
||||
<DD>the file is opened for both reading and writing.
|
||||
</DL>
|
||||
<P>
|
||||
The following values may be or'ed together and with one of the preceding
|
||||
values:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>O_CREAT</CODE>
|
||||
<DD>create the file if it does not exist.
|
||||
<P>
|
||||
<DT><CODE>O_EXCL</CODE>
|
||||
<DD>used with <CODE>O_CREAT</CODE>, if the file exists, the call fails. The test
|
||||
for existence and the creation if the file does not exists is atomic
|
||||
operation according to POSIX.1.
|
||||
<P>
|
||||
<DT><CODE>O_NOCTTY</CODE>
|
||||
<DD>the file will not become the controly tty of the task even if the file
|
||||
is a tty and the task does not have a controling terminal.
|
||||
<P>
|
||||
<DT><CODE>O_TRUNC</CODE>
|
||||
<DD>if the file already exists, truncate its lenght to 0.
|
||||
<P>
|
||||
<DT><CODE>O_APPEND</CODE>
|
||||
<DD>the file is opened for appending. The file pointer is always at the end
|
||||
of the file.
|
||||
<P>
|
||||
<DT><CODE>O_NONBLOCK or O_NDELAY</CODE>
|
||||
<DD>the calls manipulating the file never block.
|
||||
<P>
|
||||
<DT><CODE>O_SYNC</CODE>
|
||||
<DD>the file buffers are always synchronized with the on disk file. The
|
||||
write calls block until the data is completely written on disk. This is
|
||||
not POSIX.1.
|
||||
</DL>
|
||||
|
||||
<CODE>create</CODE> creates a new file. The new file is open for writing
|
||||
only. If a file with the same path already existed, then it is trucated.
|
||||
<P>
|
||||
<H3>RETURN VALUE</H3>
|
||||
<P>
|
||||
On success, a file descriptor for the file is returned. This file
|
||||
descriptor is the lowest numbered unused descriptor. On error, those
|
||||
calls return -1, and errno is set to one of the following values.
|
||||
<P>
|
||||
<UL>
|
||||
<LI><CODE>EISDIR</CODE>: the last component of the path is a directory.
|
||||
<LI><CODE>ETXTBSY</CODE>: tried to create an already used executable.
|
||||
<LI><CODE>EFAULT</CODE>, <CODE>EACCESS</CODE>, <CODE>ENAMETOOLONG</CODE>, <CODE>ENOENT</CODE>,
|
||||
<CODE>ENOTDIR</CODE>, <CODE>EMFILE</CODE>, <CODE>ENFILE</CODE>, <CODE>ENOMEM</CODE>,
|
||||
<CODE>EROFS</CODE>, <CODE>ELOOP</CODE>, <CODE>EEXIST</CODE> or <CODE>ENOSPC</CODE>.
|
||||
</UL>
|
||||
<P>
|
||||
<P>Go to the <A HREF="syscalls_9.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_9.html">previous</A>, <A HREF="syscalls_11.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_11.html">next</A> section.<P>
|
||||
Reference in New Issue
Block a user