• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>Reentrant Syscalls - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Syscalls.html#Syscalls" title="Syscalls">
9<link rel="prev" href="Stubs.html#Stubs" title="Stubs">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<meta http-equiv="Content-Style-Type" content="text/css">
12<style type="text/css"><!--
13  pre.display { font-family:inherit }
14  pre.format  { font-family:inherit }
15  pre.smalldisplay { font-family:inherit; font-size:smaller }
16  pre.smallformat  { font-family:inherit; font-size:smaller }
17  pre.smallexample { font-size:smaller }
18  pre.smalllisp    { font-size:smaller }
19  span.sc    { font-variant:small-caps }
20  span.roman { font-family:serif; font-weight:normal; } 
21  span.sansserif { font-family:sans-serif; font-weight:normal; } 
22--></style>
23<link rel="stylesheet" type="text/css" href="../cs.css">
24</head>
25<body>
26<div class="node">
27<a name="Reentrant-Syscalls"></a>
28<p>
29Previous:&nbsp;<a rel="previous" accesskey="p" href="Stubs.html#Stubs">Stubs</a>,
30Up:&nbsp;<a rel="up" accesskey="u" href="Syscalls.html#Syscalls">Syscalls</a>
31<hr>
32</div>
33
34<h3 class="section">12.2 Reentrant covers for OS subroutines</h3>
35
36<p>Since the system subroutines are used by other library routines that
37require reentrancy, <samp><span class="file">libc.a</span></samp> provides cover routines (for example,
38the reentrant version of <code>fork</code> is <code>_fork_r</code>).  These cover
39routines are consistent with the other reentrant subroutines in this
40library, and achieve reentrancy by using a reserved global data block
41(see <a href="Reentrancy.html#Reentrancy">Reentrancy</a>).
42
43<!-- FIXME!!! The following ignored text specifies how this section ought -->
44<!-- to work;  however, both standalone info and Emacs info mode fail when -->
45<!-- confronted with nodes beginning `_' as of 24may93.  Restore when Info -->
46<!-- readers fixed! -->
47     <dl>
48<dt><code>_open_r</code><a name="index-g_t_005fopen_005fr-485"></a><dd>A reentrant version of <code>open</code>.  It takes a pointer
49to the global data block, which holds <code>errno</code>.
50
51     <pre class="example">          int _open_r(void *<var>reent</var>,
52              const char *<var>file</var>, int <var>flags</var>, int <var>mode</var>);
53</pre>
54     <br><dt><code>_close_r</code><a name="index-g_t_005fclose_005fr-486"></a><dd>A reentrant version of <code>close</code>.  It takes a pointer to the global
55data block, which holds <code>errno</code>.
56
57     <pre class="example">          int _close_r(void *<var>reent</var>, int <var>fd</var>);
58</pre>
59     <br><dt><code>_lseek_r</code><a name="index-g_t_005flseek_005fr-487"></a><dd>A reentrant version of <code>lseek</code>.  It takes a pointer to the global
60data block, which holds <code>errno</code>.
61
62     <pre class="example">          off_t _lseek_r(void *<var>reent</var>,
63              int <var>fd</var>, off_t <var>pos</var>, int <var>whence</var>);
64</pre>
65     <br><dt><code>_read_r</code><a name="index-g_t_005fread_005fr-488"></a><dd>A reentrant version of <code>read</code>.  It takes a pointer to the global
66data block, which holds <code>errno</code>.
67
68     <pre class="example">          long _read_r(void *<var>reent</var>,
69              int <var>fd</var>, void *<var>buf</var>, size_t <var>cnt</var>);
70</pre>
71     <br><dt><code>_write_r</code><a name="index-g_t_005fwrite_005fr-489"></a><dd>A reentrant version of <code>write</code>.  It takes a pointer to the global
72data block, which holds <code>errno</code>.
73
74     <pre class="example">          long _write_r(void *<var>reent</var>,
75              int <var>fd</var>, const void *<var>buf</var>, size_t <var>cnt</var>);
76</pre>
77     <br><dt><code>_fork_r</code><a name="index-g_t_005ffork_005fr-490"></a><dd>A reentrant version of <code>fork</code>.  It takes a pointer to the global
78data block, which holds <code>errno</code>.
79
80     <pre class="example">          int _fork_r(void *<var>reent</var>);
81</pre>
82     <br><dt><code>_wait_r</code><a name="index-g_t_005fwait_005fr-491"></a><dd>A reentrant version of <code>wait</code>.  It takes a pointer to the global
83data block, which holds <code>errno</code>.
84
85     <pre class="example">          int _wait_r(void *<var>reent</var>, int *<var>status</var>);
86</pre>
87     <br><dt><code>_stat_r</code><a name="index-g_t_005fstat_005fr-492"></a><dd>A reentrant version of <code>stat</code>.  It takes a pointer to the global
88data block, which holds <code>errno</code>.
89
90     <pre class="example">          int _stat_r(void *<var>reent</var>,
91              const char *<var>file</var>, struct stat *<var>pstat</var>);
92</pre>
93     <br><dt><code>_fstat_r</code><a name="index-g_t_005ffstat_005fr-493"></a><dd>A reentrant version of <code>fstat</code>.  It takes a pointer to the global
94data block, which holds <code>errno</code>.
95
96     <pre class="example">          int _fstat_r(void *<var>reent</var>,
97              int <var>fd</var>, struct stat *<var>pstat</var>);
98</pre>
99     <br><dt><code>_link_r</code><a name="index-g_t_005flink_005fr-494"></a><dd>A reentrant version of <code>link</code>.  It takes a pointer to the global
100data block, which holds <code>errno</code>.
101
102     <pre class="example">          int _link_r(void *<var>reent</var>,
103              const char *<var>old</var>, const char *<var>new</var>);
104</pre>
105     <br><dt><code>_unlink_r</code><a name="index-g_t_005funlink_005fr-495"></a><dd>A reentrant version of <code>unlink</code>.  It takes a pointer to the global
106data block, which holds <code>errno</code>.
107
108     <pre class="example">          int _unlink_r(void *<var>reent</var>, const char *<var>file</var>);
109</pre>
110     <br><dt><code>_sbrk_r</code><a name="index-g_t_005fsbrk_005fr-496"></a><dd>A reentrant version of <code>sbrk</code>.  It takes a pointer to the global
111data block, which holds <code>errno</code>.
112
113     <pre class="example">          char *_sbrk_r(void *<var>reent</var>, size_t <var>incr</var>);
114</pre>
115     </dl>
116
117   </body></html>
118
119