toolchain/share/doc/gdb/open.html

136 lines
5.4 KiB
HTML
Raw Permalink Normal View History

2024-01-10 05:24:32 +00:00
<html lang="en">
<head>
<title>open - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="List-of-Supported-Calls.html#List-of-Supported-Calls" title="List of Supported Calls">
<link rel="next" href="close.html#close" title="close">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="open"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="close.html#close">close</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="List-of-Supported-Calls.html#List-of-Supported-Calls">List of Supported Calls</a>
<hr>
</div>
<h5 class="unnumberedsubsubsec">open</h5>
<p><a name="index-open_002c-file_002di_002fo-system-call-3604"></a>
<dl>
<dt>Synopsis:<dd>
<pre class="smallexample"> int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
</pre>
<br><dt>Request:<dd>&lsquo;<samp><span class="samp">Fopen,</span><var>pathptr</var><span class="samp">/</span><var>len</var><span class="samp">,</span><var>flags</var><span class="samp">,</span><var>mode</var></samp>&rsquo;
<p class="noindent"><var>flags</var> is the bitwise <code>OR</code> of the following values:
<dl>
<dt><code>O_CREAT</code><dd>If the file does not exist it will be created. The host
rules apply as far as file ownership and time stamps
are concerned.
<br><dt><code>O_EXCL</code><dd>When used with <code>O_CREAT</code>, if the file already exists it is
an error and open() fails.
<br><dt><code>O_TRUNC</code><dd>If the file already exists and the open mode allows
writing (<code>O_RDWR</code> or <code>O_WRONLY</code> is given) it will be
truncated to zero length.
<br><dt><code>O_APPEND</code><dd>The file is opened in append mode.
<br><dt><code>O_RDONLY</code><dd>The file is opened for reading only.
<br><dt><code>O_WRONLY</code><dd>The file is opened for writing only.
<br><dt><code>O_RDWR</code><dd>The file is opened for reading and writing.
</dl>
<p class="noindent">Other bits are silently ignored.
<p class="noindent"><var>mode</var> is the bitwise <code>OR</code> of the following values:
<dl>
<dt><code>S_IRUSR</code><dd>User has read permission.
<br><dt><code>S_IWUSR</code><dd>User has write permission.
<br><dt><code>S_IRGRP</code><dd>Group has read permission.
<br><dt><code>S_IWGRP</code><dd>Group has write permission.
<br><dt><code>S_IROTH</code><dd>Others have read permission.
<br><dt><code>S_IWOTH</code><dd>Others have write permission.
</dl>
<p class="noindent">Other bits are silently ignored.
<br><dt>Return value:<dd><code>open</code> returns the new file descriptor or -1 if an error
occurred.
<br><dt>Errors:<dd>
<dl>
<dt><code>EEXIST</code><dd><var>pathname</var> already exists and <code>O_CREAT</code> and <code>O_EXCL</code> were used.
<br><dt><code>EISDIR</code><dd><var>pathname</var> refers to a directory.
<br><dt><code>EACCES</code><dd>The requested access is not allowed.
<br><dt><code>ENAMETOOLONG</code><dd><var>pathname</var> was too long.
<br><dt><code>ENOENT</code><dd>A directory component in <var>pathname</var> does not exist.
<br><dt><code>ENODEV</code><dd><var>pathname</var> refers to a device, pipe, named pipe or socket.
<br><dt><code>EROFS</code><dd><var>pathname</var> refers to a file on a read-only filesystem and
write access was requested.
<br><dt><code>EFAULT</code><dd><var>pathname</var> is an invalid pointer value.
<br><dt><code>ENOSPC</code><dd>No space on device to create the file.
<br><dt><code>EMFILE</code><dd>The process already has the maximum number of files open.
<br><dt><code>ENFILE</code><dd>The limit on the total number of files open on the system
has been reached.
<br><dt><code>EINTR</code><dd>The call was interrupted by the user.
</dl>
</dl>
</body></html>