mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 23:19:24 +02:00
+ Added exit status examining functions
This commit is contained in:
parent
d076974adf
commit
3605a8a096
@ -226,6 +226,14 @@ Procedure ExitProcess(val:longint);
|
|||||||
Function WaitPid(Pid:longint;Status:pointer;Options:Longint):Longint; {=>PID (Status Valid), 0 (No Status), -1: Error, special case errno=EINTR }
|
Function WaitPid(Pid:longint;Status:pointer;Options:Longint):Longint; {=>PID (Status Valid), 0 (No Status), -1: Error, special case errno=EINTR }
|
||||||
Function WaitProcess(Pid:longint):Longint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
Function WaitProcess(Pid:longint):Longint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
||||||
Procedure Nice(N:integer);
|
Procedure Nice(N:integer);
|
||||||
|
function WEXITSTATUS(Status: Integer): Integer;
|
||||||
|
function WTERMSIG(Status: Integer): Integer;
|
||||||
|
function WSTOPSIG(Status: Integer): Integer;
|
||||||
|
Function WIFEXITED(Status: Integer): Boolean;
|
||||||
|
Function WIFSTOPPED(Status: Integer): Boolean;
|
||||||
|
Function WIFSIGNALED(Status: Integer): Boolean;
|
||||||
|
Function W_EXITCODE(ReturnCode, Signal: Integer): Integer;
|
||||||
|
Function W_STOPCODE(Signal: Integer): Integer;
|
||||||
{$ifdef bsd}
|
{$ifdef bsd}
|
||||||
Function GetPriority(Which,Who:longint):longint;
|
Function GetPriority(Which,Who:longint):longint;
|
||||||
procedure SetPriority(Which,Who,What:longint);
|
procedure SetPriority(Which,Who,What:longint);
|
||||||
@ -717,6 +725,47 @@ begin { Changes as above }
|
|||||||
FreeShellArgV(p);
|
FreeShellArgV(p);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function WEXITSTATUS(Status: Integer): Integer;
|
||||||
|
begin
|
||||||
|
WEXITSTATUS:=(Status and $FF00) shr 8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function WTERMSIG(Status: Integer): Integer;
|
||||||
|
begin
|
||||||
|
WTERMSIG:=(Status and $7F);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function WSTOPSIG(Status: Integer): Integer;
|
||||||
|
begin
|
||||||
|
WSTOPSIG:=WEXITSTATUS(Status);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function WIFEXITED(Status: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
WIFEXITED:=(WTERMSIG(Status)=0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function WIFSTOPPED(Status: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
WIFSTOPPED:=((Status and $FF)=$7F);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function WIFSIGNALED(Status: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
WIFSIGNALED:=(not WIFSTOPPED(Status)) and
|
||||||
|
(not WIFEXITED(Status));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function W_EXITCODE(ReturnCode, Signal: Integer): Integer;
|
||||||
|
begin
|
||||||
|
W_EXITCODE:=(ReturnCode shl 8) or Signal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Function W_STOPCODE(Signal: Integer): Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
W_STOPCODE:=(Signal shl 8) or $7F;
|
||||||
|
end;
|
||||||
|
|
||||||
{******************************************************************************
|
{******************************************************************************
|
||||||
Date and Time related calls
|
Date and Time related calls
|
||||||
@ -2922,7 +2971,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.17 2001-10-14 13:33:21 peter
|
Revision 1.18 2001-11-05 21:46:06 michael
|
||||||
|
+ Added exit status examining functions
|
||||||
|
|
||||||
|
Revision 1.17 2001/10/14 13:33:21 peter
|
||||||
* start of thread support for linux
|
* start of thread support for linux
|
||||||
|
|
||||||
Revision 1.16 2001/09/17 21:36:31 peter
|
Revision 1.16 2001/09/17 21:36:31 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user