1
<?xml version="1.0" encoding="ISO8859-1"?>
4
$Id: linux.xml,v 1.1 2004/10/22 20:45:36 michael Exp $
5
This file is part of the FPC documentation.
6
Copyright (C) 1997, by Michael Van Canneyt
8
The FPC documentation is free text; you can redistribute it and/or
9
modify it under the terms of the GNU Library General Public License as
10
published by the Free Software Foundation; either version 2 of the
11
License, or (at your option) any later version.
13
The FPC Documentation is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Library General Public License for more details.
18
You should have received a copy of the GNU Library General Public
19
License along with the FPC documentation; see the file COPYING.LIB. If not,
20
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
Boston, MA 02111-1307, USA.
26
<short>Linux-specific operating system calls.</short>
29
The <file>linux</file> unit contains linux specific operating system calls.
32
The platform independent functionality of the FPC 1.0.X version of the
33
<file>linux</file> unit has been split out over the
34
<link id="#rtl.unix">unix</link>, <link id="#rtl.baseunix">baseunix</link> and
35
<link id="#rtl.unixutil">unixutil</link> units.
38
The X86-specific parts have been moved to the <link id="#rtl.x86">X86</link>
42
People wanting to use the old version (FPC 1.0.X and before) of the
43
<file>linux</file> can use the <link id="#rtl.oldlinux">oldlinux</link> unit
48
<!-- record type Visibility: default -->
49
<element name="TSysinfo">
50
<short>Record with system information, used by the <link id="SysInfo"/> call.</short>
53
<!-- variable Visibility: default -->
54
<element name="TSysinfo.uptime">
55
<short>Number of seconds since boot.</short>
58
<!-- variable Visibility: default -->
59
<element name="TSysinfo.loads">
60
<short>1, 5 and 15 minute load averages.</short>
63
<!-- variable Visibility: default -->
64
<element name="TSysinfo.totalram">
65
<short>total amount of main memory.</short>
68
<!-- variable Visibility: default -->
69
<element name="TSysinfo.freeram">
70
<short>amount of free memory.</short>
73
<!-- variable Visibility: default -->
74
<element name="TSysinfo.sharedram">
75
<short>amount of shared memory.</short>
78
<!-- variable Visibility: default -->
79
<element name="TSysinfo.bufferram">
80
<short>amount of memory used by buffers.</short>
83
<!-- variable Visibility: default -->
84
<element name="TSysinfo.totalswap">
85
<short>total amount of swapspace.</short>
88
<!-- variable Visibility: default -->
89
<element name="TSysinfo.freeswap">
90
<short>amount of free swapspace.</short>
93
<!-- variable Visibility: default -->
94
<element name="TSysinfo.procs">
95
<short>number of current processes.</short>
98
<!-- variable Visibility: default -->
99
<element name="TSysinfo.s">
103
<!-- pointer type Visibility: default -->
104
<element name="PSysInfo">
105
<short>Pointer to <link id="TSysInfo"/> record.</short>
108
<!-- function Visibility: default -->
109
<element name="Sysinfo">
110
<short>Return kernel system information</short>
113
<var>SysInfo</var> returns system information in <var>Info</var>. Returned information
114
in <var>Info</var> includes:
117
<dt>uptime</dt><dd>Number of seconds since boot.</dd>
118
<dt>loads</dt><dd>1, 5 and 15 minute load averages.</dd>
119
<dt>totalram</dt><dd>total amount of main memory.</dd>
120
<dt>freeram</dt><dd>amount of free memory.</dd>
121
<dt>sharedram</dt><dd>amount of shared memory.</dd>
122
<dt>bufferram</dt><dd>amount of memory used by buffers.</dd>
123
<dt>totalswap</dt><dd>total amount of swapspace.</dd>
124
<dt>freeswap</dt><dd>amount of free swapspace.</dd>
125
<dt>procs</dt><dd>number of current processes.</dd>
132
<link id="#rtl.baseunix.fpUname"/>
134
<example file="linuxex/ex64"/>
137
<!-- constant Visibility: default -->
138
<element name="CSIGNAL">
139
<short><link id="Clone"/> option: Signal mask to be sent at exit</short>
142
<!-- constant Visibility: default -->
143
<element name="CLONE_VM">
144
<short><link id="Clone"/> option: VM shared between processes</short>
147
<!-- constant Visibility: default -->
148
<element name="CLONE_FS">
149
<short><link id="Clone"/> option: fs info shared between processes</short>
152
<!-- constant Visibility: default -->
153
<element name="CLONE_FILES">
154
<short><link id="Clone"/> option: open files shared between processes</short>
157
<!-- constant Visibility: default -->
158
<element name="CLONE_SIGHAND">
159
<short><link id="Clone"/> option: signal handlers shared between processes</short>
162
<!-- constant Visibility: default -->
163
<element name="CLONE_PID">
164
<short><link id="Clone"/> option: PID shared between processes</short>
167
<!-- function type Visibility: default -->
168
<element name="TCloneFunc">
169
<short>Clone function prototype.</short>
172
<!-- function Visibility: default -->
173
<element name="Clone">
174
<short>Clone current process (create new thread)</short>
178
creates a child process which is a copy of the parent process, just
179
like <link id="#rtl.baseunix.FpFork">FpFork</link> does. In difference with <var>Fork</var>, however, the child
180
process shares some parts of it's execution context with its parent, so it
181
is suitable for the implementation of threads: many instances of a program
182
that share the same memory.
185
When the child process is created, it starts executing the function
186
<var>Func</var>, and passes it <var>Args</var>. The return value of <var>Func</var> is
187
either the explicit return value of the function, or the exit code of
191
The <var>sp</var> pointer points to the memory reserved as stack space for the
192
child process. This address should be the top of the memory block to be used
196
The <var>Flags</var> determine the behaviour of the <var>Clone</var> call. The low
197
byte of the Flags contains the number of the signal that will be sent to
198
the parent when the child dies.
199
This may be bitwise OR'ed with the following constants:
203
<dd> Parent and child share the same memory space, including
204
memory (un)mapped with subsequent <var>mmap</var> calls.</dd>
206
<dd> Parent and child have the same view of the filesystem;
207
the <var>chroot</var>, <var>chdir</var> and <var>umask</var> calls affect both processes.</dd>
209
<dd> the file descriptor table of parent and child is shared.</dd>
210
<dt>CLONE_SIGHAND</dt>
211
<dd> the parent and child share the same table of signal
212
handlers. The signal masks are different, though.</dd>
214
<dd> PArent and child have the same process ID.</dd>
217
Clone returns the process ID in the parent process, and -1 if an error
223
On error, -1 is returned to the parent, and no child is created.
226
<dt>sys_eagain</dt><dd>Too many processes are running.</dd>
227
<dt>sys_enomem</dt><dd>Not enough memory to create child process.</dd>
231
<link id="#rtl.baseunix.FpFork"/>
233
<example file="linuxex/ex71"/>
235
</module> <!-- Linux -->
237
</fpdoc-descriptions>