+ Finished units

This commit is contained in:
michael 2004-10-22 20:45:36 +00:00
parent 24520c7cc8
commit cd861f2efc
6 changed files with 1350 additions and 87 deletions

View File

@ -4111,7 +4111,7 @@ socket. If so it returns <var>True</var>.
<!-- function Visibility: default -->
<element name="WEXITSTATUS">
<short>Extract the exit status from the <link id="FpWaitPID"/> result.</short>
<short>Extract the exit status from the <link id="#rtl.baseunix.FpWaitPID">fpWaitPID</link> result.</short>
<descr>
<var>WEXITSTATUS</var> can be used to extract the exit status from
<var>Status</var>, the result of the <link id="FpWaitPID"/> call.

153
docs/dynlibs.xml Normal file
View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="ISO8859-1"?>
<!--
$Id$
This file is part of the FPC documentation.
Copyright (C) 1997, by Michael Van Canneyt
The FPC documentation is free text; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The FPC Documentation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the FPC documentation; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<fpdoc-descriptions>
<package name="rtl">
<module name="dynlibs">
<short>Cross-platform support for dynamically loadable libraries</short>
<descr>
<p>
The <file>Dynlibs</file> unit provides support for dynamically loading
shared libraries. It is available only on those platforms that support
shared libraries. The functionality available here may only be a part of
the functionality available on each separate platform, in the interest of
portability.
</p>
<p>
On unix platforms, using this unit will cause the program to be linked to
the C library, as most shared libraries are implemented in C and the
dynamical linker too.
</p>
</descr>
<!-- alias type Visibility: default -->
<element name="TLibHandle">
<short>Library handle type</short>
<descr>
<var>TLibHandle</var> should be considered an opaque type. It is defined
differently on various platforms. The definition shown here depends on the
platform for which the documentation was generated.
</descr>
<seealso>
<link id="LoadLibrary"/>
<link id="UnloadLibrary"/>
</seealso>
</element>
<!-- constant Visibility: default -->
<element name="NilHandle">
<short>Correctly typed Nil handle - returned on error by <link id="LoadLibrary"/></short>
</element>
<!-- function Visibility: default -->
<element name="LoadLibrary">
<short>Load a dynamic library and return a handle to it.</short>
<descr>
<p>
<var>LoadLibrary</var> loads a dynamic library in file <var>Name</var>
and returns a handle to it. If the library cannot be loaded,
<link id="NilHandle"/> is returned.
</p>
<p>
No assumptions should be made about the location of the loaded library if a
relative pathname is specified. The behaviour is dependent on the platform.
Therefore it is best to specify an absolute pathname if possible.
</p>
</descr>
<errors>
On error, <link id="NilHandle"/> is returned.
</errors>
<seealso>
<link id="UnloadLibrary"/>
<link id="GetProcedureAddress"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="GetProcedureAddress">
<short>Get the address of a procedure or symbol in a dynamic library.</short>
<descr>
<p>
<var>GetProcedureAddress</var> returns a pointer to the location in memory
of the symbol <var>ProcName</var> in the dynamically loaded library
specified by it's handle <var>lib</var>. If the symbol cannot be found or
the handle is invalid, <var>Nil</var> is returned.
</p>
<p>
On Windows, only an exported procedure or
function can be searched this way. On Unix platforms the location of any
exported symbol can be retrieved this way.
</p>
</descr>
<errors>
If the symbol cannot be found, <var>Nil</var> is returned.
</errors>
<seealso>
<link id="LoadLibrary"/>
<link id="UnLoadLibrary"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="UnloadLibrary">
<short>Unload a previously loaded library</short>
<descr>
<var>UnloadLibrary</var> unloads a previously loaded library (specified by
the handle <var>lib</var>). The call returns <var>True</var> if succesful,
<var>False</var> otherwisa.
</descr>
<errors>
On error, <var>False</var> is returned.
</errors>
<seealso>
<link id="LoadLibrary"/>
<link id="GetProcedureAddress"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="FreeLibrary">
<short>For compatibility with Delphi/Windows: Unload a library</short>
<descr>
<var>FreeLibrary</var> provides the same functionality as <link
id="UnloadLibrary"/>, and is provided for compatibility with Delphi.
</descr>
<seealso>
<link id="UnloadLibrary"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="GetProcAddress">
<short>For compatibility with Delphi/Windows: Get the address of a procedure</short>
<descr>
<var>GetProcAddress</var> provides the same functionality as <link
id="GetProcedureAddress"/>, and is provided for compatibility with Delphi.
</descr>
<seealso>
<link id="GetProcedureAddress"/>
</seealso>
</element>
</module> <!-- dynlibs -->
</package>
</fpdoc-descriptions>

237
docs/linux.xml Normal file
View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="ISO8859-1"?>
<!--
$Id$
This file is part of the FPC documentation.
Copyright (C) 1997, by Michael Van Canneyt
The FPC documentation is free text; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The FPC Documentation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the FPC documentation; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<fpdoc-descriptions>
<package name="rtl">
<module name="Linux">
<short>Linux-specific operating system calls.</short>
<descr>
<p>
The <file>linux</file> unit contains linux specific operating system calls.
</p>
<p>
The platform independent functionality of the FPC 1.0.X version of the
<file>linux</file> unit has been split out over the
<link id="#rtl.unix">unix</link>, <link id="#rtl.baseunix">baseunix</link> and
<link id="#rtl.unixutil">unixutil</link> units.
</p>
<p>
The X86-specific parts have been moved to the <link id="#rtl.x86">X86</link>
unit.
</p>
<p>
People wanting to use the old version (FPC 1.0.X and before) of the
<file>linux</file> can use the <link id="#rtl.oldlinux">oldlinux</link> unit
instead.
</p>
</descr>
<!-- record type Visibility: default -->
<element name="TSysinfo">
<short>Record with system information, used by the <link id="SysInfo"/> call.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.uptime">
<short>Number of seconds since boot.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.loads">
<short>1, 5 and 15 minute load averages.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.totalram">
<short>total amount of main memory.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.freeram">
<short>amount of free memory.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.sharedram">
<short>amount of shared memory.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.bufferram">
<short>amount of memory used by buffers.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.totalswap">
<short>total amount of swapspace.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.freeswap">
<short>amount of free swapspace.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.procs">
<short>number of current processes.</short>
</element>
<!-- variable Visibility: default -->
<element name="TSysinfo.s">
<short>?</short>
</element>
<!-- pointer type Visibility: default -->
<element name="PSysInfo">
<short>Pointer to <link id="TSysInfo"/> record.</short>
</element>
<!-- function Visibility: default -->
<element name="Sysinfo">
<short>Return kernel system information</short>
<descr>
<p>
<var>SysInfo</var> returns system information in <var>Info</var>. Returned information
in <var>Info</var> includes:
</p>
<dl>
<dt>uptime</dt><dd>Number of seconds since boot.</dd>
<dt>loads</dt><dd>1, 5 and 15 minute load averages.</dd>
<dt>totalram</dt><dd>total amount of main memory.</dd>
<dt>freeram</dt><dd>amount of free memory.</dd>
<dt>sharedram</dt><dd>amount of shared memory.</dd>
<dt>bufferram</dt><dd>amount of memory used by buffers.</dd>
<dt>totalswap</dt><dd>total amount of swapspace.</dd>
<dt>freeswap</dt><dd>amount of free swapspace.</dd>
<dt>procs</dt><dd>number of current processes.</dd>
</dl>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="#rtl.baseunix.fpUname"/>
</seealso>
<example file="linuxex/ex64"/>
</element>
<!-- constant Visibility: default -->
<element name="CSIGNAL">
<short><link id="Clone"/> option: Signal mask to be sent at exit</short>
</element>
<!-- constant Visibility: default -->
<element name="CLONE_VM">
<short><link id="Clone"/> option: VM shared between processes</short>
</element>
<!-- constant Visibility: default -->
<element name="CLONE_FS">
<short><link id="Clone"/> option: fs info shared between processes</short>
</element>
<!-- constant Visibility: default -->
<element name="CLONE_FILES">
<short><link id="Clone"/> option: open files shared between processes</short>
</element>
<!-- constant Visibility: default -->
<element name="CLONE_SIGHAND">
<short><link id="Clone"/> option: signal handlers shared between processes</short>
</element>
<!-- constant Visibility: default -->
<element name="CLONE_PID">
<short><link id="Clone"/> option: PID shared between processes</short>
</element>
<!-- function type Visibility: default -->
<element name="TCloneFunc">
<short>Clone function prototype.</short>
</element>
<!-- function Visibility: default -->
<element name="Clone">
<short>Clone current process (create new thread)</short>
<descr>
<p>
<var>Clone</var>
creates a child process which is a copy of the parent process, just
like <link id="#rtl.baseunix.FpFork">FpFork</link> does. In difference with <var>Fork</var>, however, the child
process shares some parts of it's execution context with its parent, so it
is suitable for the implementation of threads: many instances of a program
that share the same memory.
</p>
<p>
When the child process is created, it starts executing the function
<var>Func</var>, and passes it <var>Args</var>. The return value of <var>Func</var> is
either the explicit return value of the function, or the exit code of
the child process.
</p>
<p>
The <var>sp</var> pointer points to the memory reserved as stack space for the
child process. This address should be the top of the memory block to be used
as stack.
</p>
<p>
The <var>Flags</var> determine the behaviour of the <var>Clone</var> call. The low
byte of the Flags contains the number of the signal that will be sent to
the parent when the child dies.
This may be bitwise OR'ed with the following constants:
</p>
<dl>
<dt>CLONE_VM</dt>
<dd> Parent and child share the same memory space, including
memory (un)mapped with subsequent <var>mmap</var> calls.</dd>
<dt>CLONE_FS</dt>
<dd> Parent and child have the same view of the filesystem;
the <var>chroot</var>, <var>chdir</var> and <var>umask</var> calls affect both processes.</dd>
<dt>CLONE_FILES</dt>
<dd> the file descriptor table of parent and child is shared.</dd>
<dt>CLONE_SIGHAND</dt>
<dd> the parent and child share the same table of signal
handlers. The signal masks are different, though.</dd>
<dt>CLONE_PID</dt>
<dd> PArent and child have the same process ID.</dd>
</dl>
<p>
Clone returns the process ID in the parent process, and -1 if an error
occurred.
</p>
</descr>
<errors>
<p>
On error, -1 is returned to the parent, and no child is created.
</p>
<dl>
<dt>sys_eagain</dt><dd>Too many processes are running.</dd>
<dt>sys_enomem</dt><dd>Not enough memory to create child process.</dd>
</dl>
</errors>
<seealso>
<link id="#rtl.baseunix.FpFork"/>
</seealso>
<example file="linuxex/ex71"/>
</element>
</module> <!-- Linux -->
</package>
</fpdoc-descriptions>

View File

@ -2125,7 +2125,7 @@ Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno
</dl>
</errors>
<seealso>
<link id="FpStat"/>
<link id="#rtl.baseunix.FpStat"/>
<link id="FpLStat"/>
</seealso>
<example file="linuxex/ex91"/>
@ -2255,8 +2255,8 @@ with <link id="PClose"/>. The result is the same, but <var>PClose</var> returns
exit status of the command <var>Prog</var>.
</descr>
<errors>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function. Errors are essentially those of the Execve, Dup and AssignPipe commands.
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
Errors are essentially those of the Execve, Dup and AssignPipe commands.
</errors>
<seealso>
<link id="AssignPipe"/>
@ -2299,8 +2299,7 @@ error.
</descr>
<errors>
<p>
In case of error (return value -1) <var>LinuxError</var> is used to report
errors:
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
</p>
<dl>
<dt>sys_emfile</dt>
@ -2354,234 +2353,506 @@ None.
<!-- function Visibility: default -->
<element name="FExpand">
<short></short>
<short>Expand filename to fully qualified path</short>
<descr>
<var>FExpand</var> expands <var>Path</var> to a full path, starting from root,
eliminating directory references such as . and .. from the result.
</descr>
<errors>
None
</errors>
<seealso>
</seealso>
<example file="linuxex/ex45"/>
</element>
<!-- function Visibility: default -->
<element name="FSearch">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="FSearch">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="FSearch">
<short></short>
<short>Search for file in search path.</short>
<descr>
<p>
<var>FSearch</var> searches in <var>DirList</var>, a colon separated list of directories,
for a file named <var>Path</var>. It then returns a path to the found file.
</p>
<p>
The <var>CurrentDirStrategy</var> determines how the current directory is treated
when searching:
</p>
<dl>
<dt>NoCurrentDirectory</dt><dd><printshort id="TFSearchOption.NoCurrentDirectory"/></dd>
<dt>CurrentDirectoryFirst</dt><dd><printshort id="TFSearchOption.CurrentDirectoryFirst"/></dd>
<dt>CurrentDirectoryLast</dt><dd><printshort id="TFSearchOption.CurrentDirectoryLast"/></dd>
</dl>
<p>
It is mainly provided to mimic DOS search path behaviour. Default behaviour
is to search the current directory first.
</p>
</descr>
<errors>
An empty string if no such file was found.
</errors>
<seealso>
<link id="FExpand"/>
<link id="#rtl.unixutil.FNMatch"/>
</seealso>
<example file="linuxex/ex46"/>
</element>
<!-- function Visibility: default -->
<element name="Glob">
<short></short>
<short>Find filenames matching a wildcard pattern</short>
<descr>
<p
>Glob returns a pointer to a glob structure which contains all filenames which
exist and match the pattern in <var>Path</var>.
The pattern can contain wildcard characters, which have their
usual meaning.
</p>
</descr>
<errors>
<p>
Returns nil on error, and extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
</p>
<dl>
<dt>sys_enomem</dt><dd> No memory on heap for glob structure.</dd>
<dt>others</dt><dd> As returned by the opendir call, and sys_readdir.</dd>
</dl>
</errors>
<seealso>
<link id="GlobFree"/>
</seealso>
<example file="linuxex/ex49"/>
</element>
<!-- procedure Visibility: default -->
<element name="Globfree">
<short></short>
<short>Free result of <link id="Glob"/> call</short>
<descr>
<p>
Releases the memory, occupied by a pglob structure. <var>P</var> is set to nil.
</p>
<p>
For an example, see <link id="Glob"/>.
</p>
</descr>
<errors>
None
</errors>
<seealso>
<link id="Glob"/>
</seealso>
</element>
<!-- procedure Visibility: default -->
<element name="SigRaise">
<short></short>
<short>Raise a signal (send to current process)</short>
<descr>
<var>SigRaise</var> sends a <var>Sig</var> signal to the current process.
</descr>
<errors>
None.
</errors>
<seealso>
<link id="#rtl.baseunix.FpKill"/>
<link id="#rtl.baseunix.FpGetPid"/>
</seealso>
<example file="linuxex/ex65"/>
</element>
<!-- function Visibility: default -->
<element name="FpMMap">
<short></short>
<short>Create memory map of a file</short>
<descr>
<p>
<var>FpMMap</var> maps or unmaps files or devices into memory. The different
arguments determine what and how the file is mapped:
</p>
<dl>
<dt>adr</dt>
<dd> Address where to mmap the device. This address is a hint,
and may not be followed.</dd>
<dt>len</dt><dd> Size (in bytes) of area to be mapped.</dd>
<dt>prot</dt>
<dd>
<p> Protection of mapped memory. This is a OR-ed combination of the
following constants:</p>
<dl>
<dt>PROT_EXEC</dt><dd> The memory can be executed.</dd>
<dt>PROT_READ</dt><dd> The memory can be read.</dd>
<dt>PROT_WRITE</dt><dd> The memory can be written.</dd>
<dt>PROT_NONE</dt><dd> The memory can not be accessed.</dd>
</dl>
</dd>
<dt>flags</dt><dd><p>Contains some options for the mmap call. It is an OR-ed
combination of the following constants:</p>
<dl>
<dt>MAP_FIXED</dt>
<dd> Do not map at another address than the given address. If the
address cannot be used, <var>MMap</var> will fail.</dd>
<dt>MAP_SHARED</dt>
<dd> Share this map with other processes that map this object.</dd>
<dt>MAP_PRIVATE</dt>
<dd> Create a private map with copy-on-write semantics.</dd>
<dt>MAP_ANONYMOUS</dt>
<dd> <var>fd</var> does not have to be a file descriptor.</dd>
</dl>
<p>
One of the options <var>MAP_SHARED</var> and <var>MAP_PRIVATE</var> must be present,
but not both at the same time.
</p>
</dd>
<dt>fd</dt><dd> File descriptor from which to map.</dd>
<dt>off</dt><dd> Offset to be used in file descriptor <var>fd</var>.</dd>
</dl>
<p>
The function returns a pointer to the mapped memory, or a -1 in case of en
error.
</p>
</descr>
<errors>
<p>
On error, -1 is returned and extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
</p>
<dl>
<dt>Sys_EBADF</dt>
<dd> <var>fd</var> is not a valid file descriptor and
<var>MAP_ANONYMOUS</var> was not specified.</dd>
<dt>Sys_EACCES</dt>
<dd><var>MAP_PRIVATE</var> was specified, but <var>fd</var> is not open for
reading. Or <var>MAP_SHARED</var> was asked and <var>PROT_WRITE</var> is set, fd
is not open for writing</dd>
<dt>Sys_EINVAL</dt>
<dd> One of the record fields <var>Start</var>, <var>length</var> or
<var>offset</var> is invalid.</dd>
<dt>Sys_ETXTBUSY</dt>
<dd><var>MAP_DENYWRITE</var> was set but the object specified
by fd is open for writing.</dd>
<dt>Sys_EAGAIN</dt>
<dd><var>fd</var> is locked, or too much memory is locked.</dd>
<dt>Sys_ENOMEM</dt>
<dd> Not enough memory for this operation.</dd>
</dl>
</errors>
<seealso>
<link id="FpMUnMap"/>
</seealso>
<example file="linuxex/ex66"/>
</element>
<!-- function Visibility: default -->
<element name="Fpmunmap">
<short></short>
<short>Unmap previously mapped memory block</short>
<descr>
<p>
<var>FpMUnMap</var> unmaps the memory block of size <var>Len</var>, pointed to by
<var>Adr</var>, which was previously allocated with <link id="FpMMap"/>.
</p>
<p>
The function returns <var>True</var> if successful, <var>False</var> otherwise.
</p>
<p>
For an example, see <link id="FpMMap"/>.
</p>
</descr>
<errors>
In case of error the function returns a nonzero value,
extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
See <link id="FpMMap"/> for possible error values.
</errors>
<seealso>
<link id="FpMMap"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpgettimeofday">
<short></short>
<short>Return kernel time of day in GMT</short>
<descr>
<p>
<var>FpGetTimeOfDay</var> returns the number of seconds since 00:00, January 1
1970, GMT in a <var>timeval</var> record. This time NOT corrected any way,
not taking into account timezones, daylight savings time and so on.
</p>
<p>
It is simply a wrapper to the kernel system call. To get the local time,
<link id="GetTime"/>.
</p>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="GetTime"/>
<link id="GetDateTime"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpNice">
<short></short>
<short>Set process priority</short>
<descr>
<p>
<var>Nice</var> adds <var>-N</var> to the priority of the running process. The lower the
priority numerically, the less the process is favored.
Only the superuser can specify a negative <var>N</var>, i.e. increase the rate at
which the process is run.
</p>
<p>
If the function is succesful, zero is returned. On error, a nonzero value is returned.
</p>
</descr>
<errors>
<p>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link> function.
</p>
<dl>
<dt>sys_eperm</dt><dd> A non-superuser tried to specify a negative <var>N</var>, i.e.
do a priority increase.</dd>
</dl>
</errors>
<seealso>
<link id="FpGetPriority"/>
<link id="FpSetPriority"/>
</seealso>
<example file="linuxex/ex15"/>
</element>
<!-- function Visibility: default -->
<element name="fpGetPriority">
<short></short>
<short>Return process priority</short>
<descr>
<p>
GetPriority returns the priority with which a process is running.
Which process(es) is determined by the <var>Which</var> and <var>Who</var> variables.
<var>Which</var> can be one of the pre-defined <var>Prio_Process</var>,
<var>Prio_PGrp</var>, <var>Prio_User</var>, in which case <var>Who</var> is the process ID, Process group ID or
User ID, respectively.
</p>
<p>
For an example, see <link id="FpNice"/>.
</p>
</descr>
<errors>
<p>
Error information is returned solely by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function: a priority can be a positive or negative value.
</p>
<dl>
<dt>sys_esrch</dt>
<dd> No process found using <var>which</var> and <var>who</var>. </dd>
<dt>sys_einval</dt>
<dd> <var>Which</var> was not one of <var>Prio_Process</var>,
<var>Prio_Grp</var> or <var>Prio_User</var>.</dd>
</dl>
</errors>
<seealso>
<link id="FpSetPriority"/>
<link id="FpNice"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpSetPriority">
<short></short>
<short>Set process priority</short>
<descr>
<p>
<var>fpSetPriority</var> sets the priority with which a process is running.
Which process(es) is determined by the <var>Which</var> and <var>Who</var> variables.
<var>Which</var> can be one of the pre-defined constants:
</p>
<dl>
<dt>Prio_Process</dt><dd><var>Who</var> is interpreted as process ID</dd>
<dt>Prio_PGrp</dt><dd><var>Who</var> is interpreted as process group ID</dd>
<dt>Prio_User</dt><dd><var>Who</var> is interpreted as user ID</dd>
</dl>
<p>
<var>Prio</var> is a value in the range -20 to 20.
</p>
<p>
For an example, see <link id="FpNice"/>.
</p>
<p>
The function returns zero on success, -1 on failure
</p>
</descr>
<errors>
<p>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function.
</p>
<dl>
<dt>sys_esrch</dt>
<dd>No process found using <var>which</var> and <var>who</var>.</dd>
<dt>sys_einval</dt>
<dd> <var>Which</var> was not one of <var>Prio_Process</var>,
<var>Prio_Grp</var> or <var>Prio_User</var>.</dd>
<dt>sys_eperm</dt>
<dd>A process was found, but neither its effective or real
user ID match the effective user ID of the caller.</dd>
<dt>sys_eacces</dt>
<dd>A non-superuser tried to a priority increase.</dd>
</dl>
</errors>
<seealso>
<link id="FpGetPriority"/>
<link id="FpNice"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpLstat">
<short></short>
<short>Return information about symbolic link. Do not follow the link</short>
<descr>
<var>FpLstat</var> gets information about the link specified in <var>Path</var>
(or <var>FileName</var>, and stores it in <var>Info</var>, which points to a
record of type <var>TStat</var>. Contrary to <link
id="#rtl.baseunix.FpFStat">FpFstat</link>, it stores
information about the link, not about the file the link points to.
The function returns zero if the call was succesful, a nonzero return value
indicates failure.
failed.
</descr>
<errors>
<p>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function.
</p>
<dl>
<dt>sys_enoent</dt><dd> <var>Path</var> does not exist.</dd>
</dl>
</errors>
<seealso>
<link id="#rtl.baseunix.FpFStat"/>
<link id="StatFS"/>
</seealso>
<example file="linuxex/ex29"/>
</element>
<!-- function Visibility: default -->
<element name="fpLstat">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpSymlink">
<short></short>
<short>Create a symbolic link</short>
<descr>
<p>
<var>SymLink</var> makes <var>NewName</var> point to the file in
<var>OldName</var>, which doesn't necessarily exist. The two files
DO NOT have the same inode number. This is known as a 'soft' link.
</p>
<p>The permissions of the link are irrelevant, as they are not used when
following the link. Ownership of the file is only checked in case of removal
or renaming of the link.
</p>
<p>
The function returns zero if the call was succesful, a nonzero value if the call
failed.
</p>
</descr>
<errors>
<p>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function.
</p>
<dl>
<dt>sys_eperm</dt>
<dd>The filesystem containing oldpath and newpath does not
support linking files.</dd>
<dt>sys_eaccess</dt>
<dd>Write access for the directory containing <var>Newpath</var>
is disallowed, or one of the directories in <var>OldPath</var> or
<var>NewPath</var> has no search (=execute) permission.</dd>
<dt>sys_enoent</dt>
<dd>A directory entry in <var>OldPath</var> or <var>NewPath</var> does
not exist or is a symbolic link pointing to a non-existent directory.</dd>
<dt>sys_enotdir</dt>
<dd>A directory entry in <var>OldPath</var> or <var>NewPath</var> is
nor a directory.</dd>
<dt>sys_enomem</dt><dd>Insufficient kernel memory.</dd>
<dt>sys_erofs</dt><dd>The files are on a read-only filesystem.</dd>
<dt>sys_eexist</dt><dd><var>NewPath</var> already exists.</dd>
<dt>sys_eloop</dt>
<dd> <var>OldPath</var> or <var>NewPath</var> has a reference to a circular
symbolic link, i.e. a symbolic link, whose expansion points to itself.
</dd>
<dt>sys_enospc</dt>
<dd>The device containing <var>NewPath</var> has no room for another entry.</dd>
</dl>
</errors>
<seealso>
<link id="#rtl.baseunix.FpLink"/>
<link id="#rtl.baseunix.FpUnLink"/>
<link id="FpReadLink"/>
</seealso>
<example file="linuxex/ex22"/>
</element>
<!-- function Visibility: default -->
<element name="fpReadLink">
<short></short>
<short>Read destination of symbolic link</short>
<descr>
<p>
<var>FpReadLink</var> returns the file the symbolic link <var>name</var> is pointing
to. The first form of this function accepts a buffer <var>linkname</var> of
length <var>maxlen</var> where the filename will be stored. It returns the
actual number of characters stored in the buffer.
</p>
<p>
The second form of the function returns simply the name of the file.
</p>
</descr>
<errors>
<p>
On error, the first form of the function returns -1; the second one returns
an empty string.
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function.
</p>
<dl>
<dt>SYS_ENOTDIR</dt>
<dd>A part of the path in <var>Name</var> is not a directory.</dd>
<dt>SYS_EINVAL</dt>
<dd>maxlen is not positive, or the file is not a symbolic link.</dd>
<dt>SYS_ENAMETOOLONG</dt>
<dd>A pathname, or a component of a pathname, was too long.</dd>
<dt>SYS_ENOENT</dt>
<dd>the link <var>name</var> does not exist.</dd>
<dt>SYS_EACCES</dt>
<dd>No permission to search a directory in the path</dd>
<dt>SYS_ELOOP</dt>
<dd>Too many symbolic links were encountered in translating the pathname.</dd>
<dt>SYS_EIO</dt>
<dd>An I/O error occurred while reading from the file system.</dd>
<dt>SYS_EFAULT</dt>
<dd>The buffer is not part of the the process's memory space.</dd>
<dt>SYS_ENOMEM</dt>
<dd>Not enough kernel memory was available.</dd>
</dl>
</errors>
<seealso>
<link id="FpSymLink"/>
</seealso>
<example file="linuxex/ex62"/>
</element>
<!-- function Visibility: default -->
<element name="PClose">
<short></short>
<short>Close file opened with <link id="POpen"/></short>
<descr>
<p>
<var>PClose</var> closes a file opened with <link id="POpen"/>.
It waits for the command to complete, and then returns the exit status of the command.
</p>
<p>
For an example, see <link id="POpen"/>
</p>
</descr>
<errors>
Extended error information is returned by the <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
function.
</errors>
<seealso>
<link id="POpen"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="PClose">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="StatFS">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="fpReadLink">
<short></short>
<descr>
</descr>
<errors>
</errors>
<seealso>
</seealso>
</element>
</module> <!-- Unix -->
</package>

290
docs/unixutil.xml Normal file
View File

@ -0,0 +1,290 @@
<?xml version="1.0" encoding="ISO8859-1"?>
<fpdoc-descriptions>
<package name="rtl">
<!--
====================================================================
unixutil
====================================================================
-->
<module name="unixutil">
<short>Unix utility routines.</short>
<descr>
<p>
The <file>UnixUtil</file> unit contains some of the routines that were
present in the old <file>Linux</file> unit, but which do not really belong
in the <link id="#rtl.unix">unix</link> or <link id="#rtl.baseunix">baseunix</link>
units.
</p>
<p>
Most of the functions described here have cross-platform counterparts in the
<link id="#rtl.sysutils">SysUtils</link> unit. It is therefore recommended
to use that unit.
</p>
</descr>
<!-- variable Visibility: default -->
<element name="tzseconds">
<short>Seconds west of GMT</short>
</element>
<element name="ComStr">
<short>Command-line string type.</short>
</element>
<element name="PathStr">
<short>Filename full path string type.</short>
</element>
<element name="DirStr">
<short>Filename directory part string type.</short>
</element>
<element name="NameStr">
<short>Filename name part string type.</short>
</element>
<element name="ExtStr">
<short>Filename extension part string type.</short>
</element>
<!-- function Visibility: default -->
<element name="Dirname">
<short>Extract directory part from filename</short>
<descr>
<p>
Returns the directory part of <var>Path</var>.
The directory is the part of <var>Path</var> before the last slash,
or empty if there is no slash.
The last character of the result is not a slash, unless the directory is the
root directory.
</p>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="BaseName"/>
<link id="#rtl.unix.FExpand"/>
</seealso>
<example file="linuxex/ex47"/>
</element>
<!-- function Visibility: default -->
<element name="StringToPPChar">
<short>Split string in list of null-terminated strings</short>
<descr>
<p>
<var>StringToPPChar</var> splits the string <var>S</var> in words, replacing any
whitespace with zero characters. It returns a pointer to an array of pchars
that point to the first letters of the words in <var>S</var>. This array is terminated
by a <var>Nil</var> pointer.
</p>
<p>
The function does <em> not</em> add a zero character to the end of the string
unless it ends on whitespace.
</p>
<p>
The function reserves memory on the heap to store the array of <var>PChar</var>;
The caller is responsible for freeing this memory.
</p>
<p>
This function can be called to create arguments for the various <var>Exec</var>
calls.
</p>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="ArrayStringToPPchar"/>
<link id="#rtl.unix.CreateShellArgV"/>
<link id="#rtl.baseunix.FpExecve"/>
<link id="#rtl.unix.Execv"/>
</seealso>
<example file="linuxex/ex70"/>
</element>
<!-- function Visibility: default -->
<element name="ArrayStringToPPchar">
<short>Concert an array of string to an array of null-terminated strings</short>
<descr>
<p>
<var>ArrayStringToPPchar</var> creates an array of null-terminated strings
that point to strings which are the same as the strings in the array
<var>S</var>. The function returns a pointer to this array. The array and
the strings it contains must be disposed of after being used, because it
they are allocated on the heap.
</p>
<p>
The <var>ReserveEntries</var> parameter tells <var>ArrayStringToPPchar</var>
to allocate room at the end of the array for another <var>ReserveEntries</var>
entries.
</p>
</descr>
<errors>
If not enough memory is available, an error may occur.
</errors>
<seealso>
<link id="StringToPPChar"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="Basename">
<short>Return basename of a file</short>
<descr>
<p>
Returns the filename part of <var>Path</var>, stripping off <var>Suf</var> if it
exists.
The filename part is the whole name if <var>Path</var> contains no slash,
or the part of <var>Path</var> after the last slash.
The last character of the result is not a slash, unless the directory is the
root directory.
</p>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="DirName"/>
<link id="#rtl.unix.FExpand"/>
</seealso>
<example file="linuxex/ex48"/>
</element>
<!-- function Visibility: default -->
<element name="FNMatch">
<short>Check whether filename matches wildcard specification</short>
<descr>
<p>
<var>FNMatch</var> returns <var>True</var> if the filename in <var>Name</var>
matches the wildcard pattern in <var>Pattern</var>, <var>False</var> otherwise.
</p>
<p>
<var>Pattern</var> can contain the wildcards <var>*</var> (match zero or more
arbitrary characters) or <var>?</var> (match a single character).
</p>
</descr>
<errors>
None.
</errors>
<seealso>
<link id="#rtl.unix.FSearch"/>
<link id="#rtl.unix.FExpand"/>
</seealso>
<example file="linuxex/ex69"/>
</element>
<!-- function Visibility: default -->
<element name="GetFS">
<short>Return file selector</short>
<descr>
<var>GetFS</var> returns the file selector that the kernel provided for your
file. In principle you don' need this file selector. Only for some calls
it is needed, such as the <link id="#rtl.baseunix.fpSelect"/> call or so.
</descr>
<errors>
In case the file was not opened, then -1 is returned.
</errors>
<seealso>
<link id="#rtl.baseunix.fpSelect"/>
</seealso>
<example file="linuxex/ex34"/>
</element>
<!-- procedure Visibility: default -->
<element name="FSplit">
<short>Split filename into path, name and extension</short>
<descr>
<var>FSplit</var> splits a full file name into 3 parts : A <var>Path</var>, a
<var>Name</var> and an extension (in <var>ext</var>).
The extension is taken to be all letters after the last dot (.).
</descr>
<errors>
None.
</errors>
<seealso>
<link id="#rtl.unix.FSearch"/>
</seealso>
<example file="linuxex/ex67"/>
</element>
<!-- function Visibility: default -->
<element name="LocalToEpoch">
<short>Convert local time to epoch (unix) time</short>
<descr>
Converts the Local time to epoch time (=Number of seconds since 00:00:00 , January 1,
1970 ).
</descr>
<errors>
None
</errors>
<seealso>
<link id="#rtl.unix.GetEpochTime"/>
<link id="EpochToLocal"/>
<link id="#rtl.unix.GetTime"/>
<link id="#rtl.unix.GetDate"/>
</seealso>
<example file="linuxex/ex4"/>
</element>
<!-- procedure Visibility: default -->
<element name="EpochToLocal">
<short>Convert epoch time to local time</short>
<descr>
<p>
Converts the epoch time (=Number of seconds since 00:00:00 , January 1,
1970, corrected for your time zone ) to local date and time.
</p>
<p>
This function takes into account the timzeone settings of your system.
</p>
</descr>
<errors>
None
</errors>
<seealso>
<link id="#rtl.unix.GetEpochTime"/>
<link id="LocalToEpoch"/>
<link id="#rtl.unix.GetTime"/>
<link id="#rtl.unix.GetDate"/>
</seealso>
<example file="linuxex/ex3"/>
</element>
<!-- procedure Visibility: default -->
<element name="JulianToGregorian">
<short>Converts a julian date to a gregorian date</short>
<descr>
<var>JulianToGregorian</var> takes a julian day and converts it to a
gregorian date. (Start of the Julian Date count is from 0 at 12 noon 1 JAN -4712
(4713 BC),)
</descr>
<errors>
None.
</errors>
<seealso>
<link id="GregorianToJulian"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="GregorianToJulian">
<short>Converts a gregorian date to a julian date</short>
<descr>
<var>GregorianToJulian</var> takes a gregorian date and converts it to a
Julian day.
</descr>
<errors>
None.
</errors>
<seealso>
<link id="JulianToGregorian"/>
</seealso>
</element>
</module> <!-- unixutil -->
</package>
</fpdoc-descriptions>

312
docs/x86.xml Normal file
View File

@ -0,0 +1,312 @@
<?xml version="1.0" encoding="ISO8859-1"?>
<fpdoc-descriptions>
<!--
$Id$
This file is part of the FPC documentation.
Copyright (C) 1997, by Michael Van Canneyt
The FPC documentation is free text; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The FPC Documentation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the FPC documentation; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<package name="rtl">
<module name="x86">
<short>Intel X86 specific routines for unix platforms.</short>
<!-- \FPCexampledir{crtex} -->
<descr>
<p>
The <file>x86</file> unit contains some of the routines that were present in
the 1.0.X Linux unit, and which were Intel (PC) architecture specific.
</p>
<p>
These calls have been preserved for compatibility, but should be considered
deprecated: they are not portable and may not even work on future linux
versions.
</p>
</descr>
<element name="ReadPort">
<short>Read data from a PC port</short>
<descr>
<p>
<var>ReadPort</var> reads one Byte, Word or Longint from port <var>Port</var> into
<var>Value</var>.
</p>
<p>
Note that you need permission to read a port. This permission can be set by
the root user with the <link id="FpIOPerm"/> call.
</p>
</descr>
<errors>
In case of an error (not enough permissions read this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="ReadPortB"/>
<link id="ReadPortW"/>
<link id="ReadPortL"/>
<link id="WritePort"/>,
<link id="WritePortB"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
</seealso>
</element>
<element name="ReadPortB">
<short>Read bytes from a PC port</short>
<descr>
<p>
The procedural form of <var>ReadPortB</var> reads <var>Count</var> bytes from port
<var>Port</var> and stores them in <var>Buf</var>. There must be enough memory
allocated at <var>Buf</var> to store <var>Count</var> bytes.
</p>
<p>
The functional form of <var>ReadPortB</var> reads 1 byte from port <var>B</var>
and returns the byte that was read.
</p>
<p>
Note that you need permission to read a port. This permission can be set by
the root user with the <link id="FpIOPerm"/> call.
</p>
</descr>
<errors>
In case of an error (not enough permissions read this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="ReadPort"/>
<link id="ReadPortW"/>
<link id="ReadPortL"/>
<link id="WritePort"/>,
<link id="WritePortB"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
</seealso>
</element>
<element name="ReadPortL">
<short>Read longints from a PC port </short>
<descr>
<p>
The procedural form of <var>ReadPortL</var> reads <var>Count</var> longints from port
<var>Port</var> and stores them in <var>Buf</var>. There must be enough memory
allocated at <var>Buf</var> to store <var>Count</var> Longints.
</p>
<p>
The functional form of <var>ReadPortL</var> reads 1 longint from port <var>B</var>
and returns the longint that was read.
</p>
<p>
Note that you need permission to read a port. This permission can be set by
the root user with the <link id="FpIOPerm"/> call.
</p>
</descr>
<errors>
In case of an error (not enough permissions read this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="ReadPort"/>
<link id="ReadPortW"/>
<link id="ReadPortB"/>
<link id="WritePort"/>,
<link id="WritePortB"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
</seealso>
</element>
<element name="ReadPortW">
<short>Read Words from a PC port</short>
<descr>
<p>
The procedural form of <var>ReadPortW</var> reads <var>Count</var> words from port
<var>Port</var> and stores them in <var>Buf</var>. There must be enough memory
allocated at <var>Buf</var> to store <var>Count</var> words.
</p>
<p>
The functional form of <var>ReadPortW</var> reads 1 word from port <var>B</var>
and returns the word that was read.
</p>
<p>
Note that you need permission to read a port. This permission can be set by
the root user with the <link id="FpIOPerm"/> call.
</p>
</descr>
<errors>
In case of an error (not enough permissions read this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="ReadPort"/>
<link id="ReadPortB"/>
<link id="ReadPortL"/>
<link id="WritePort"/>,
<link id="WritePortB"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
</seealso>
</element>
<element name="WritePort">
<short>Write data to PC port</short>
<descr>
<p>
<var>WritePort</var> writes <var>Value</var> -- 1 byte, Word or longint --
to port <var>Port</var>.
</p>
<remark>
You need permission to write to a port. This permission can be set with root
permission with the <link id="FpIOPerm"/> call.
</remark>
</descr>
<errors>
In case of an error (not enough permissions to write to this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="WritePortB"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
<link id="ReadPortB"/>
<link id="ReadPortL"/>
<link id="ReadPortW"/>
</seealso>
</element>
<element name="WritePortB">
<short>Write byte to PC port</short>
<descr>
<p>
The first form of <var>WritePortB</var> writes 1 byte to port <var>Port</var>.
The second form writes <var>Count</var> bytes from <var>Buf</var> to port <var>Port</var>.
</p>
<remark>
You need permission to write to a port. This permission can be set with root
permission with the <link id="FpIOPerm"/> call.
</remark>
</descr>
<errors>
In case of an error (not enough permissions to write to this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="WritePort"/>
<link id="WritePortL"/>
<link id="WritePortW"/>
<link id="ReadPortB"/>
<link id="ReadPortL"/>
<link id="ReadPortW"/>
</seealso>
</element>
<element name="WritePortL">
<short>Write longint to PC port.</short>
<descr>
<p>
The first form of <var>WritePortB</var> writes 1 byte to port <var>Port</var>.
The second form writes <var>Count</var> bytes from <var>Buf</var> to port <var>Port</var>.
</p>
<remark>
You need permission to write to a port. This permission can be set with root
permission with the <link id="FpIOPerm"/> call.
</remark>
</descr>
<errors>
In case of an error (not enough permissions to write to this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="WritePort"/>
<link id="WritePortB"/>
<link id="WritePortW"/>
<link id="ReadPortB"/>
<link id="ReadPortL"/>
<link id="ReadPortW"/>
</seealso>
</element>
<element name="WritePortW">
<short>Write Word to PC port</short>
<descr>
<p>
The first form of <var>WritePortB</var> writes 1 byte to port <var>Port</var>.
The second form writes <var>Count</var> bytes from <var>Buf</var> to port <var>Port</var>.
</p>
<remark>
You need permission to write to a port. This permission can be set with root
permission with the <link id="FpIOPerm"/> call.
</remark>
</descr>
<errors>
In case of an error (not enough permissions to write to this port), runtime 216
(<em> Access Violation</em>) will occur.
</errors>
<seealso>
<link id="FpIOPerm"/>
<link id="WritePort"/>
<link id="WritePortL"/>
<link id="WritePortB"/>
<link id="ReadPortB"/>
<link id="ReadPortL"/>
<link id="ReadPortW"/>
</seealso>
</element>
<element name="FpIOperm">
<short>Set permission on IO ports</short>
<descr>
<p>
<var>FpIOperm</var>
sets permissions on <var>Num</var> ports starting with port <var>From</var> to
<var>Value</var>. The function returns zero if the call was successfull,
a nonzero value otherwise.
</p>
<p>
Note:
</p>
<ul>
<li> This works ONLY as root.</li>
<li> Only the first <var>0x03ff</var> ports can be set.</li>
<li> When doing a <link id="#rtl.baseunix.FpFork">FpFork</link>, the permissions are reset.
When doing a <link id="#rtl.baseunix.FpExecve">FpExecVE</link> they are kept.</li>
</ul>
</descr>
<errors>
Extended error information can be retrieved with <link id="#rtl.baseunix.fpGetErrno">FpGetErrno</link>
</errors>
</element>
<element name="FpIoPL">
<short>Set I/O privilege level</short>
<descr>
<var>FpIoPL</var> sets the I/O privilige level. It is intended for
completeness only, one should normally not use it.
</descr>
</element>
</module>
</package>
</fpdoc-descriptions>