+ Added pause and alarm, now all examples use FPCExample

This commit is contained in:
michael 1999-11-14 20:01:04 +00:00
parent 7761b7ac35
commit b5560c1fbe

View File

@ -19,6 +19,8 @@
% Boston, MA 02111-1307, USA. % Boston, MA 02111-1307, USA.
% %
\chapter{The LINUX unit.} \chapter{The LINUX unit.}
\label{ch:linux}
\FPCexampledir{linuxex}
This chapter describes the LINUX unit for Free Pascal. The unit was written This chapter describes the LINUX unit for Free Pascal. The unit was written
by Micha\"el van Canneyt. It works only on the Linux operating system. by Micha\"el van Canneyt. It works only on the Linux operating system.
This chapter is divided in 2 sections: This chapter is divided in 2 sections:
@ -375,13 +377,14 @@ the \seep{FLock} call uses the following mode constants :
LOCK_UN = 8; LOCK_UN = 8;
LOCK_NB = 4; LOCK_NB = 4;
\end{verbatim} \end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Functions and procedures
\section{Functions and procedures} \section{Functions and procedures}
\begin{function}{Access} \begin{function}{Access}
\Declaration \Declaration
Function Access (Path : Pathstr; Mode : integer) : Boolean; Function Access (Path : Pathstr; Mode : integer) : Boolean;
\Description \Description
Tests user's access rights on the specified file. Mode is a mask existing of Tests user's access rights on the specified file. Mode is a mask existing of
one or more of one or more of
\begin{description} \begin{description}
@ -392,7 +395,6 @@ one or more of
\end{description} \end{description}
The test is done with the real user ID, instead of the effective user ID. The test is done with the real user ID, instead of the effective user ID.
If access is denied, or an error occurred, false is returned. If access is denied, or an error occurred, false is returned.
\Errors \Errors
\var{LinuxError} is used to report errors: \var{LinuxError} is used to report errors:
\begin{description} \begin{description}
@ -409,8 +411,25 @@ dangling symbolic link.
\SeeAlso \SeeAlso
\seef{Chown}, \seef{Chmod}, \seem{Access}{2} \seef{Chown}, \seef{Chmod}, \seem{Access}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex26.pp}}
\html{\input{linuxex/ex26.tex}} \FPCexample{ex26}
\begin{function}{Alarm}
\Declaration
Function Alarm(Sec : longint) : Longint;
\Description
Alarm schedules an alarm signal to be delivered to your process in \var{Sec}
seconds. When \var{Sec} seconds have elapsed, Linux will send a \var{SIGALRM}
signal to the current process. If \var{Sec} is zero, then no new alarm will
be set. Whatever the value of \var{Sec}, any previous alarm is cancelled.
The function returns the number of seconds till the previously scheduled
alarm was due to be delivered, or zero if there was none.
\Errors{None}
\end{function}
\FPCexample{ex59}
\begin{procedure}{AssignPipe} \begin{procedure}{AssignPipe}
\Declaration \Declaration
Procedure AssignPipe (Pipe\_in, Pipe\_out : Text); Procedure AssignPipe (Pipe\_in, Pipe\_out : Text);
@ -431,8 +450,7 @@ Reading and writing happens through the usual \var{Readln(Pipe\_in,...)} and
\SeeAlso \SeeAlso
\seep{POpen}, \seef{MkFifo}, \seem{pipe}{2} \seep{POpen}, \seef{MkFifo}, \seem{pipe}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex36.pp}} \FPCexample{ex36}
\html{\input{linuxex/ex36.tex}}
\begin{procedure}{AssignStream} \begin{procedure}{AssignStream}
\Declaration \Declaration
Procedure AssignStream (StreamIn,StreamOut : Text; Const prog : String); Procedure AssignStream (StreamIn,StreamOut : Text; Const prog : String);
@ -463,8 +481,7 @@ Other errors include the ones by the fork and exec programs
\SeeAlso \SeeAlso
\seep{AssignPipe}, \seep{POpen},\seem{pipe}{2} \seep{AssignPipe}, \seep{POpen},\seem{pipe}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex38.pp}} \FPCexample{ex38}
\html{\input{linuxex/ex38.tex}}
\begin{function}{BaseName} \begin{function}{BaseName}
\Declaration \Declaration
Function BaseName (Const Path;Suf : Pathstr) : Pathstr; Function BaseName (Const Path;Suf : Pathstr) : Pathstr;
@ -482,8 +499,7 @@ None.
\SeeAlso \SeeAlso
\seef{DirName}, \seef{FExpand}, \seem{Basename}{1} \seef{DirName}, \seef{FExpand}, \seem{Basename}{1}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex48.pp}} \FPCexample{ex48}
\html{\input{linuxex/ex48.tex}}
\begin{procedure}{CFMakeRaw} \begin{procedure}{CFMakeRaw}
\Declaration \Declaration
Procedure CFMakeRaw (var Tios:TermIOS); Procedure CFMakeRaw (var Tios:TermIOS);
@ -558,8 +574,7 @@ symbolic link, i.e. a symbolic link, whose expansion points to itself.
\SeeAlso \SeeAlso
\seef{Chmod}, \seef{Access}, \seem{Chown}(2) \seef{Chmod}, \seef{Access}, \seem{Chown}(2)
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex24.pp}} \FPCexample{ex24}
\html{\input{linuxex/ex24.tex}}
\begin{function}{Chmod} \begin{function}{Chmod}
\Declaration \Declaration
Function Chmod (Path : Pathstr;NewMode : Longint) : Boolean; Function Chmod (Path : Pathstr;NewMode : Longint) : Boolean;
@ -607,8 +622,7 @@ symbolic link, i.e. a symbolic link, whose expansion points to itself.
\SeeAlso \SeeAlso
\seef{Chown}, \seef{Access}, \seem{Chmod}(2) \seef{Chown}, \seef{Access}, \seem{Chmod}(2)
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex23.pp}} \FPCexample{ex23}
\html{\input{linuxex/ex23.tex}}
\begin{function}{CloseDir} \begin{function}{CloseDir}
\Declaration \Declaration
Function CloseDir (p:pdir) : integer; Function CloseDir (p:pdir) : integer;
@ -639,8 +653,7 @@ None.
\SeeAlso \SeeAlso
\seef{BaseName}, \seef{FExpand}, \seem{Dirname}{1} \seef{BaseName}, \seef{FExpand}, \seem{Dirname}{1}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex47.pp}} \FPCexample{ex47}
\html{\input{linuxex/ex47.tex}}
\begin{procedure}{Dup} \begin{procedure}{Dup}
\Declaration \Declaration
Procedure Dup (Var OldFile, NewFile : Text); Procedure Dup (Var OldFile, NewFile : Text);
@ -665,8 +678,7 @@ fileposition in both files.
\SeeAlso \SeeAlso
\seep{Dup2}, \seem{Dup}{2} \seep{Dup2}, \seem{Dup}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex31.pp}} \FPCexample{ex31}
\html{\input{linuxex/ex31.tex}}
\begin{procedure}{Dup2} \begin{procedure}{Dup2}
\Declaration \Declaration
Procedure Dup2 (Var OldFile, NewFile : Text); Procedure Dup2 (Var OldFile, NewFile : Text);
@ -693,8 +705,7 @@ fileposition in both files.
\SeeAlso \SeeAlso
\seep{Dup}, \seem{Dup2}{2} \seep{Dup}, \seem{Dup2}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex32.pp}} \FPCexample{ex32}
\html{\input{linuxex/ex32.tex}}
\begin{procedure}{EpochToLocal} \begin{procedure}{EpochToLocal}
\Declaration \Declaration
Procedure EpochToLocal (Epoch : Longint; var Year,Month,Day,Hour,Minute,Second : Word); Procedure EpochToLocal (Epoch : Longint; var Year,Month,Day,Hour,Minute,Second : Word);
@ -709,8 +720,7 @@ None
\SeeAlso \SeeAlso
\seef{GetEpochTime}, \seef{LocalToEpoch}, \seep{GetTime},\seep{GetDate} \seef{GetEpochTime}, \seef{LocalToEpoch}, \seep{GetTime},\seep{GetDate}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex3.pp}} \FPCexample{ex3}
\html{\input{linuxex/ex3.tex}}
\begin{procedure}{Execl} \begin{procedure}{Execl}
\Declaration \Declaration
Procedure Execl (Path : pathstr); Procedure Execl (Path : pathstr);
@ -740,8 +750,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle}, \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
\seep{Execlp}, \seef {Fork}, \seem{execvp}{3} \seep{Execlp}, \seef {Fork}, \seem{execvp}{3}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex10.pp}} \FPCexample{ex10}
\html{\input{linuxex/ex10.tex}}
\begin{procedure}{Execle} \begin{procedure}{Execle}
\Declaration \Declaration
Procedure Execle (Path : pathstr, Ep : ppchar); Procedure Execle (Path : pathstr, Ep : ppchar);
@ -772,8 +781,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execve}, \seep{Execv}, \seep{Execvp},
\seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex11.pp}} \FPCexample{ex11}
\html{\input{linuxex/ex11.tex}}
\begin{procedure}{Execlp} \begin{procedure}{Execlp}
\Declaration \Declaration
Procedure Execlp (Path : pathstr); Procedure Execlp (Path : pathstr);
@ -804,8 +812,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle}, \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
\seep{Execl}, \seef {Fork}, \seem{execvp}{3} \seep{Execl}, \seef {Fork}, \seem{execvp}{3}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex12.pp}} \FPCexample{ex12}
\html{\input{linuxex/ex12.tex}}
\begin{procedure}{Execv} \begin{procedure}{Execv}
\Declaration \Declaration
Procedure Execv (Path : pathstr; args : ppchar); Procedure Execv (Path : pathstr; args : ppchar);
@ -837,8 +844,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execvp}, \seep{Execle}, \seep{Execve}, \seep{Execvp}, \seep{Execle},
\seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execv}{3} \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execv}{3}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex8.pp}} \FPCexample{ex8}
\html{\input{linuxex/ex8.tex}}
\begin{procedure}{Execve} \begin{procedure}{Execve}
\Declaration \Declaration
Procedure Execve (Path : pathstr; args,ep : ppchar); Procedure Execve (Path : pathstr; args,ep : ppchar);
@ -869,8 +875,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execv}, \seep{Execvp} \seep{Execle}, \seep{Execve}, \seep{Execv}, \seep{Execvp} \seep{Execle},
\seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execve}{2} \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execve}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex7.pp}} \FPCexample{ex7}
\html{\input{linuxex/ex7.tex}}
\begin{procedure}{Execvp} \begin{procedure}{Execvp}
\Declaration \Declaration
Procedure Execvp (Path : pathstr; args : ppchar); Procedure Execvp (Path : pathstr; args : ppchar);
@ -902,8 +907,7 @@ A compononent of the path has no search permission.
\seep{Execve}, \seep{Execv}, \seep{Execle}, \seep{Execve}, \seep{Execv}, \seep{Execle},
\seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex9.pp}} \FPCexample{ex9}
\html{\input{linuxex/ex9.tex}}
\begin{procedurel}{FD\_ZERO}{FDZero} \begin{procedurel}{FD\_ZERO}{FDZero}
\Declaration \Declaration
@ -1027,8 +1031,7 @@ Errors are returned in LinuxError
\seef{fdClose}, \seef{fdRead}, \seef{fdWrite},\seef{fdTruncate}, \seef{fdClose}, \seef{fdRead}, \seef{fdWrite},\seef{fdTruncate},
\seef{fdFlush}, \seef{fdSeek} \seef{fdFlush}, \seef{fdSeek}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex19.pp}} \FPCexample{ex19}
\html{\input{linuxex/ex19.tex}}
\begin{function}{fdRead} \begin{function}{fdRead}
\Declaration \Declaration
Function fdRead (fd:longint;var buf;size:longint : longint; Function fdRead (fd:longint;var buf;size:longint : longint;
@ -1046,8 +1049,7 @@ Errors are returned in LinuxError.
\seef{fdOpen}, \seef{fdClose}, \seef{fdWrite},\seef{fdTruncate}, \seef{fdOpen}, \seef{fdClose}, \seef{fdWrite},\seef{fdTruncate},
\seef{fdFlush}, \seef{fdSeek} \seef{fdFlush}, \seef{fdSeek}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex20.pp}} \FPCexample{ex20}
\html{\input{linuxex/ex20.tex}}
\begin{function}{fdSeek} \begin{function}{fdSeek}
\Declaration \Declaration
Function fdSeek (fd,Pos,SeekType:longint : longint; Function fdSeek (fd,Pos,SeekType:longint : longint;
@ -1115,8 +1117,7 @@ None
\SeeAlso \SeeAlso
\seef{BaseName},\seef{DirName} \seef{BaseName},\seef{DirName}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex45.pp}} \FPCexample{ex45}
\html{\input{linuxex/ex45.tex}}
\begin{procedure}{FLock} \begin{procedure}{FLock}
\Declaration \Declaration
Procedure FLock (Var F; Mode : longint); Procedure FLock (Var F; Mode : longint);
@ -1164,8 +1165,7 @@ failed.
\SeeAlso \SeeAlso
\seef{FStat}, \seef{LStat}, \seem{statfs}{2} \seef{FStat}, \seef{LStat}, \seem{statfs}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex30.pp}} \FPCexample{ex30}
\html{\input{linuxex/ex30.tex}}
\begin{function}{FSearch} \begin{function}{FSearch}
\Declaration \Declaration
Function FSearch (Path : pathstr;DirList : string) : Pathstr; Function FSearch (Path : pathstr;DirList : string) : Pathstr;
@ -1178,8 +1178,7 @@ An empty string if no such file was found.
\SeeAlso \SeeAlso
\seef{BaseName}, \seef{DirName}, \seef{FExpand} \seef{BaseName}, \seef{DirName}, \seef{FExpand}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex46.pp}} \FPCexample{ex46}
\html{\input{linuxex/ex46.tex}}
\begin{function}{FStat} \begin{function}{FStat}
\Declaration \Declaration
Function FStat (Path : Pathstr; Var Info : stat) : Boolean; Function FStat (Path : Pathstr; Var Info : stat) : Boolean;
@ -1200,8 +1199,7 @@ failed.
\SeeAlso \SeeAlso
\seef{FSStat}, \seef{LStat}, \seem{stat}{2} \seef{FSStat}, \seef{LStat}, \seem{stat}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex28.pp}} \FPCexample{ex28}
\html{\input{linuxex/ex28.tex}}
\begin{function}{Fcntl} \begin{function}{Fcntl}
\Declaration \Declaration
Function Fcntl (Fd : text, Cmd : Integer) : Integer; Function Fcntl (Fd : text, Cmd : Integer) : Integer;
@ -1280,8 +1278,7 @@ On error, -1 is returned to the parent, and no child is created.
\SeeAlso \SeeAlso
\seep{Execve}, \seem{fork}{2} \seep{Execve}, \seem{fork}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex14.pp}} \FPCexample{ex14}
\html{\input{linuxex/ex14.tex}}
\begin{procedure}{GetDate} \begin{procedure}{GetDate}
\Declaration \Declaration
Procedure GetDate (Var Year, Month, Day : Word) ; Procedure GetDate (Var Year, Month, Day : Word) ;
@ -1295,8 +1292,7 @@ None
\SeeAlso \SeeAlso
\seef{GetEpochTime}, \seep{GetTime}, \seep{EpochToLocal} \seef{GetEpochTime}, \seep{GetTime}, \seep{EpochToLocal}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex6.pp}} \FPCexample{ex6}
\html{\input{linuxex/ex6.tex}}
\begin{function}{GetDomainName} \begin{function}{GetDomainName}
\Declaration \Declaration
Function GetDomainName : String; Function GetDomainName : String;
@ -1311,8 +1307,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetHostName},seem{Getdomainname}{2} \seef{GetHostName},seem{Getdomainname}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex39.pp}} \FPCexample{ex39}
\html{\input{linuxex/ex39.tex}}
\begin{function}{GetEGid} \begin{function}{GetEGid}
\Declaration \Declaration
Function GetEGid : Longint; Function GetEGid : Longint;
@ -1324,8 +1319,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetGid}, \seem{getegid}{2} \seef{GetGid}, \seem{getegid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex18.pp}} \FPCexample{ex18}
\html{\input{linuxex/ex18.tex}}
\begin{function}{GetEUid} \begin{function}{GetEUid}
\Declaration \Declaration
Function GetEUid : Longint; Function GetEUid : Longint;
@ -1337,8 +1331,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetEUid}, \seem{geteuid}{2} \seef{GetEUid}, \seem{geteuid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex17.pp}} \FPCexample{ex17}
\html{\input{linuxex/ex17.tex}}
\begin{function}{GetEnv} \begin{function}{GetEnv}
\Declaration \Declaration
Function GetEnv (P : String) : PChar; Function GetEnv (P : String) : PChar;
@ -1355,8 +1348,7 @@ None.
\SeeAlso \SeeAlso
\seem{sh}{1}, \seem{csh}{1} \seem{sh}{1}, \seem{csh}{1}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex41.pp}} \FPCexample{ex41}
\html{\input{linuxex/ex41.tex}}
\begin{function}{GetEpochTime} \begin{function}{GetEpochTime}
\Declaration \Declaration
Function GetEpochTime : longint; Function GetEpochTime : longint;
@ -1371,8 +1363,7 @@ no errors
\SeeAlso \SeeAlso
\seep{EpochToLocal}, \seep{GetTime}, \seem{time}{2} \seep{EpochToLocal}, \seep{GetTime}, \seem{time}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex1.pp}} \FPCexample{ex1}
\html{\input{linuxex/ex1.tex}}
\begin{function}{GetFS} \begin{function}{GetFS}
\Declaration \Declaration
Function GetFS (Var F : Any File Type) : Longint; Function GetFS (Var F : Any File Type) : Longint;
@ -1386,8 +1377,7 @@ In case the file was not opened, then -1 is returned.
\SeeAlso \SeeAlso
\seef{Select} \seef{Select}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex34.pp}} \FPCexample{ex34}
\html{\input{linuxex/ex34.tex}}
\begin{function}{GetGid} \begin{function}{GetGid}
\Declaration \Declaration
Function GetGid : Longint; Function GetGid : Longint;
@ -1399,8 +1389,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetEGid}, \seem{getgid}{2} \seef{GetEGid}, \seem{getgid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex18.pp}} \FPCexample{ex18}
\html{\input{linuxex/ex18.tex}}
\begin{function}{GetHostName} \begin{function}{GetHostName}
\Declaration \Declaration
Function GetHostName : String; Function GetHostName : String;
@ -1415,8 +1404,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetDomainName},seem{Gethostname}{2} \seef{GetDomainName},seem{Gethostname}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex40.pp}} \FPCexample{ex40}
\html{\input{linuxex/ex40.tex}}
\begin{function}{GetPid} \begin{function}{GetPid}
\Declaration \Declaration
Function GetPid : Longint; Function GetPid : Longint;
@ -1428,8 +1416,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetPPid}, \seem{getpid}{2} \seef{GetPPid}, \seem{getpid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex16.pp}} \FPCexample{ex16}
\html{\input{linuxex/ex16.tex}}
\begin{function}{GetPPid} \begin{function}{GetPPid}
\Declaration \Declaration
Function GetPPid : Longint; Function GetPPid : Longint;
@ -1441,8 +1428,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetPid}, \seem{getppid}{2} \seef{GetPid}, \seem{getppid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex16.pp}} \FPCexample{ex16}
\html{\input{linuxex/ex16.tex}}
\begin{function}{GetPriority} \begin{function}{GetPriority}
\Declaration \Declaration
Function GetPriority (Which,Who : Integer) : Integer; Function GetPriority (Which,Who : Integer) : Integer;
@ -1481,8 +1467,7 @@ None
\SeeAlso \SeeAlso
\seef{GetEpochTime}, \seep{GetDate}, \seep{EpochToLocal} \seef{GetEpochTime}, \seep{GetDate}, \seep{EpochToLocal}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex5.pp}} \FPCexample{ex5}
\html{\input{linuxex/ex5.tex}}
\begin{function}{GetUid} \begin{function}{GetUid}
\Declaration \Declaration
Function GetUid : Longint; Function GetUid : Longint;
@ -1494,8 +1479,7 @@ None.
\SeeAlso \SeeAlso
\seef{GetEUid}, \seem{getuid}{2} \seef{GetEUid}, \seem{getuid}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex17.pp}} \FPCexample{ex17}
\html{\input{linuxex/ex17.tex}}
\begin{function}{Glob} \begin{function}{Glob}
\Declaration \Declaration
Function Glob (Const Path : Pathstr) : PGlob; Function Glob (Const Path : Pathstr) : PGlob;
@ -1517,8 +1501,7 @@ usual meaning.
\SeeAlso \SeeAlso
\seep{GlobFree}, \seem{Glob}{3} \seep{GlobFree}, \seem{Glob}{3}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex49.pp}} \FPCexample{ex49}
\html{\input{linuxex/ex49.tex}}
\begin{procedure}{GlobFree} \begin{procedure}{GlobFree}
\Declaration \Declaration
Procedure GlobFree (Var P : Pglob); Procedure GlobFree (Var P : Pglob);
@ -1553,8 +1536,7 @@ function, that's why we don't list them here
\SeeAlso \SeeAlso
\seem{ioctl}{2} \seem{ioctl}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex54.pp}} \FPCexample{ex54}
\html{\input{linuxex/ex54.tex}}
\begin{function}{IOperm} \begin{function}{IOperm}
\Declaration \Declaration
Function IOperm (From,Num : Cadinal; Value : Longint) : boolean; Function IOperm (From,Num : Cadinal; Value : Longint) : boolean;
@ -1676,6 +1658,7 @@ fifo (a named pipe). If so it returns \var{True}.
\SeeAlso \SeeAlso
ISLNK. ISLNK.
\end{functionl} \end{functionl}
\begin{functionl}{S\_ISLNK}{ISLNK} \begin{functionl}{S\_ISLNK}{ISLNK}
\Declaration \Declaration
Function S\_ISLNK (m:integer) : boolean; Function S\_ISLNK (m:integer) : boolean;
@ -1694,9 +1677,10 @@ symbolic link. If so it returns \var{True}
\seefl{S\_ISSOCK}{ISSOCK} \seefl{S\_ISSOCK}{ISSOCK}
\SeeAlso \SeeAlso
\lstinputlisting{linuxex/ex53.pp}
\end{functionl} \end{functionl}
\html{\input{linuxex/ex53.tex}}
\FPCexample{ex53}
\begin{functionl}{S\_ISREG}{ISREG} \begin{functionl}{S\_ISREG}{ISREG}
\Declaration \Declaration
Function S\_ISREG (m:integer) : boolean; Function S\_ISREG (m:integer) : boolean;
@ -1782,8 +1766,7 @@ failed.
\SeeAlso \SeeAlso
\seef{FStat}, \seef{FSStat}, \seem{stat}{2} \seef{FStat}, \seef{FSStat}, \seem{stat}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex29.pp}} \FPCexample{ex29}
\html{\input{linuxex/ex29.tex}}
\begin{function}{Link} \begin{function}{Link}
\Declaration \Declaration
Function Link (OldPath,NewPath : pathstr) : Boolean; Function Link (OldPath,NewPath : pathstr) : Boolean;
@ -1822,8 +1805,7 @@ entry.
\SeeAlso \SeeAlso
\seef{SymLink}, \seef{UnLink}, \seem{Link}{2} \seef{SymLink}, \seef{UnLink}, \seem{Link}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex21.pp}} \FPCexample{ex21}
\html{\input{linuxex/ex21.tex}}
\begin{function}{LocalToEpoch} \begin{function}{LocalToEpoch}
\Declaration \Declaration
Function LocalToEpoch (Year,Month,Day,Hour,Minute,Second : Word) : longint; Function LocalToEpoch (Year,Month,Day,Hour,Minute,Second : Word) : longint;
@ -1838,8 +1820,7 @@ None
\SeeAlso \SeeAlso
\seef{GetEpochTime}, \seep{EpochToLocal}, \seep{GetTime},\seep{GetDate} \seef{GetEpochTime}, \seep{EpochToLocal}, \seep{GetTime},\seep{GetDate}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex4.pp}} \FPCexample{ex4}
\html{\input{linuxex/ex4.tex}}
\begin{function}{MkFifo} \begin{function}{MkFifo}
\Declaration \Declaration
Function MkFifo (PathName: String; Mode : Longint) : Boolean; Function MkFifo (PathName: String; Mode : Longint) : Boolean;
@ -1878,8 +1859,7 @@ do a priority increase.
\SeeAlso \SeeAlso
\seef{GetPriority}, \seef{SetPriority}, \seem{Nice}{2} \seef{GetPriority}, \seef{SetPriority}, \seem{Nice}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex15.pp}} \FPCexample{ex15}
\html{\input{linuxex/ex15.tex}}
\begin{function}{OpenDir} \begin{function}{OpenDir}
\Declaration \Declaration
Function OpenDir (f:pchar) : pdir; Function OpenDir (f:pchar) : pdir;
@ -1894,8 +1874,23 @@ Errors are returned in LinuxError.
\seef{CloseDir}, \seef{ReadDir}, \seep{SeekDir}, \seef{TellDir}, \seef{CloseDir}, \seef{ReadDir}, \seep{SeekDir}, \seef{TellDir},
\seem{opendir}{3} \seem{opendir}{3}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex35.pp}}
\html{\input{linuxex/ex35.tex}} \FPCexample{ex35}
\begin{procedure}{pause}
\Declaration
Procedure Pause
\Description
\var{Pause} pus the processto sleep and waits until the application receives
a signal. If a signal handler is installed for the received sigal, the
handler will be called and after that pause will return control to the
process.
\Errors
None.
\end{procedure}
For an example, see \seef{Alarm}.
\begin{function}{PClose} \begin{function}{PClose}
\Declaration \Declaration
Function PClose (Var F : FileType) : longint; Function PClose (Var F : FileType) : longint;
@ -1934,8 +1929,7 @@ Execve, Dup and AssignPipe commands.
\SeeAlso \SeeAlso
\seep{AssignPipe}, \seem{popen}{3}, \seef{PClose} \seep{AssignPipe}, \seem{popen}{3}, \seef{PClose}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex37.pp}} \FPCexample{ex37}
\html{\input{linuxex/ex37.tex}}
\begin{function}{ReadDir} \begin{function}{ReadDir}
\Declaration \Declaration
Function ReadDir (p:pdir) : pdirent; Function ReadDir (p:pdir) : pdirent;
@ -2020,8 +2014,7 @@ On error, the function returns -1, and Errors are reported in LinuxError :
\seepl{FD\_Set}{FDSet}, \seepl{FD\_Set}{FDSet},
\seefl{FD\_IsSet}{FDIsSet} \seefl{FD\_IsSet}{FDIsSet}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex33.pp}} \FPCexample{ex33}
\html{\input{linuxex/ex33.tex}}
\begin{function}{SelectText} \begin{function}{SelectText}
\Declaration \Declaration
Function SelectText ( var T : Text; TimeOut :PTime) : Longint; Function SelectText ( var T : Text; TimeOut :PTime) : Longint;
@ -2083,8 +2076,7 @@ Errors are reported in LinuxError.
\SeeAlso \SeeAlso
\seep{POpen}, \seef{Fork}, \seep{Execve}, \seem{system}{3} \seep{POpen}, \seef{Fork}, \seep{Execve}, \seem{system}{3}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex56.pp}} \FPCexample{ex56}
\html{\input{linuxex/ex56.tex}}
\begin{procedure}{SigAction} \begin{procedure}{SigAction}
\Declaration \Declaration
Procedure SigAction (Signum : Integer; Var Act,OldAct : PSigActionRec); Procedure SigAction (Signum : Integer; Var Act,OldAct : PSigActionRec);
@ -2127,8 +2119,7 @@ from within its own signal handler.
\seem{Sigaction}{2} \seem{Sigaction}{2}
\end{procedure} \end{procedure}
\latex{\lstinputlisting{linuxex/ex57.pp}} \FPCexample{ex57}
\html{\input{linuxex/ex57.tex}}
\begin{function}{SigPending} \begin{function}{SigPending}
\Declaration \Declaration
Function SigPending : SigSet; Function SigPending : SigSet;
@ -2206,8 +2197,7 @@ The return value for Signal is the old signal handler, or nil on error.
\SeeAlso \SeeAlso
\seep{SigAction},\seef{Kill}, \seem{Signal}{2} \seep{SigAction},\seef{Kill}, \seem{Signal}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex58.pp}} \FPCexample{ex58}
\html{\input{linuxex/ex58.tex}}
\begin{function}{SymLink} \begin{function}{SymLink}
\Declaration \Declaration
Function SymLink (OldPath,NewPath : pathstr) : Boolean; Function SymLink (OldPath,NewPath : pathstr) : Boolean;
@ -2246,8 +2236,7 @@ entry.
\SeeAlso \SeeAlso
\seef{Link}, \seef{UnLink}, \seem{Symlink}{2} \seef{Link}, \seef{UnLink}, \seem{Symlink}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex22.pp}} \FPCexample{ex22}
\html{\input{linuxex/ex22.tex}}
\begin{function}{TCDrain} \begin{function}{TCDrain}
\Declaration \Declaration
Function TCDrain (Fd:longint) : Boolean; Function TCDrain (Fd:longint) : Boolean;
@ -2326,8 +2315,7 @@ Errors are reported in LinuxError
\SeeAlso \SeeAlso
\seef{TCSetAttr}, \seem{termios}{2} \seef{TCSetAttr}, \seem{termios}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex55.pp}} \FPCexample{ex55}
\html{\input{linuxex/ex55.tex}}
\begin{function}{TCGetPGrp} \begin{function}{TCGetPGrp}
\Declaration \Declaration
Function TCGetPGrp (Fd:longint;var Id:longint) : boolean; Function TCGetPGrp (Fd:longint;var Id:longint) : boolean;
@ -2446,8 +2434,7 @@ None
\SeeAlso \SeeAlso
\seef{Chmod}, \seem{Umask}{2} \seef{Chmod}, \seem{Umask}{2}
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex27.pp}} \FPCexample{ex27}
\html{\input{linuxex/ex27.tex}}
\begin{procedure}{Uname} \begin{procedure}{Uname}
\Declaration \Declaration
Procedure Uname (var unamerec:utsname); Procedure Uname (var unamerec:utsname);
@ -2519,8 +2506,7 @@ Other errors may occur, but aren't documented.
\SeeAlso \SeeAlso
\seef{GetEpochTime}, \seef{Chown}, \seef{Access}, \seem{utime}(2) \seef{GetEpochTime}, \seef{Chown}, \seef{Access}, \seem{utime}(2)
\end{function} \end{function}
\latex{\lstinputlisting{linuxex/ex25.pp}} \FPCexample{ex25}
\html{\input{linuxex/ex25.tex}}
\begin{function}{WaitPid} \begin{function}{WaitPid}
\Declaration \Declaration
Function WaitPid (Pid : longint; Status : pointer; Options : Integer) : Longint; Function WaitPid (Pid : longint; Status : pointer; Options : Integer) : Longint;