mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 10:59:10 +02:00
* 1.9.x updates
This commit is contained in:
parent
72fa25740f
commit
92ed8c2f77
@ -2,7 +2,7 @@ Program Example10;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execl function. }
|
{ Program to demonstrate the Execl function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses unix, strings;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Execute 'ls -l', with current environment. }
|
{ Execute 'ls -l', with current environment. }
|
||||||
|
@ -2,7 +2,7 @@ Program Example11;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execle function. }
|
{ Program to demonstrate the Execle function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses Unix, strings;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Execute 'ls -l', with current environment. }
|
{ Execute 'ls -l', with current environment. }
|
||||||
|
@ -2,7 +2,7 @@ Program Example12;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execlp function. }
|
{ Program to demonstrate the Execlp function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses Unix, strings;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Execute 'ls -l', with current environment. }
|
{ Execute 'ls -l', with current environment. }
|
||||||
|
@ -2,7 +2,7 @@ Program Example13;
|
|||||||
|
|
||||||
{ Program to demonstrate the Shell function. }
|
{ Program to demonstrate the Shell function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ This will send the output of 'ls -l' to the file ls.out }
|
{ This will send the output of 'ls -l' to the file ls.out }
|
||||||
|
@ -2,13 +2,13 @@ Program Example14;
|
|||||||
|
|
||||||
{ Program to demonstrate the Fork and WaitPidfunction. }
|
{ Program to demonstrate the Fork and WaitPidfunction. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
Var PID, ExitStatus : Longint;
|
Var PID, ExitStatus : cint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Spawning a child');
|
Writeln ('Spawning a child');
|
||||||
PID:=Fork;
|
PID:=fpFork;
|
||||||
If PID=0 then
|
If PID=0 then
|
||||||
begin
|
begin
|
||||||
Writeln ('Hello From the Child !!');
|
Writeln ('Hello From the Child !!');
|
||||||
@ -18,7 +18,7 @@ begin
|
|||||||
Else
|
Else
|
||||||
begin
|
begin
|
||||||
Writeln ('Spawned child with PID : ',PID);
|
Writeln ('Spawned child with PID : ',PID);
|
||||||
WaitPid (PID,@ExitStatus,0);
|
fpWaitPid (PID,@ExitStatus,0);
|
||||||
Writeln ('Child exited with status : ',ExitStatus shr 8);
|
Writeln ('Child exited with status : ',ExitStatus shr 8);
|
||||||
end;
|
end;
|
||||||
end.
|
end.
|
||||||
|
@ -2,13 +2,13 @@ Program Example15;
|
|||||||
|
|
||||||
{ Program to demonstrate the Nice and Get/SetPriority functions. }
|
{ Program to demonstrate the Nice and Get/SetPriority functions. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix,Unix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
writeln ('Setting priority to 5');
|
writeln ('Setting priority to 5');
|
||||||
setpriority (prio_process,getpid,5);
|
fpsetpriority (prio_process,fpgetpid,5);
|
||||||
writeln ('New priority = ',getpriority (prio_process,getpid));
|
writeln ('New priority = ',fpgetpriority (prio_process,fpgetpid));
|
||||||
writeln ('Doing nice 10');
|
writeln ('Doing nice 10');
|
||||||
nice (10);
|
fpnice (10);
|
||||||
writeln ('New Priority = ',getpriority (prio_process,getpid));
|
writeln ('New Priority = ',fpgetpriority (prio_process,fpgetpid));
|
||||||
end.
|
end.
|
||||||
|
@ -2,8 +2,8 @@ Program Example16;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetPid, GetPPid function. }
|
{ Program to demonstrate the GetPid, GetPPid function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Process Id = ',getpid,' Parent process Id = ',getppid);
|
Writeln ('Process Id = ',fpgetpid,' Parent process Id = ',fpgetppid);
|
||||||
end.
|
end.
|
||||||
|
@ -2,8 +2,8 @@ Program Example17;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetUid and GetEUid functions. }
|
{ Program to demonstrate the GetUid and GetEUid functions. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
writeln ('User Id = ',getuid,' Effective user Id = ',geteuid);
|
writeln ('User Id = ',fpgetuid,' Effective user Id = ',fpgeteuid);
|
||||||
end.
|
end.
|
||||||
|
@ -2,8 +2,8 @@ Program Example18;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetGid and GetEGid functions. }
|
{ Program to demonstrate the GetGid and GetEGid functions. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
writeln ('Group Id = ',getgid,' Effective group Id = ',getegid);
|
writeln ('Group Id = ',fpgetgid,' Effective group Id = ',fpgetegid);
|
||||||
end.
|
end.
|
||||||
|
@ -2,7 +2,7 @@ Program Example6;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetDate function. }
|
{ Program to demonstrate the GetDate function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix;
|
||||||
|
|
||||||
Var Year, Month, Day : Word;
|
Var Year, Month, Day : Word;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Program Example7;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execve function. }
|
{ Program to demonstrate the Execve function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses BaseUnix, strings;
|
||||||
|
|
||||||
Const Arg0 : PChar = '/bin/ls';
|
Const Arg0 : PChar = '/bin/ls';
|
||||||
Arg1 : Pchar = '-l';
|
Arg1 : Pchar = '-l';
|
||||||
@ -17,5 +17,5 @@ begin
|
|||||||
PP[3]:=Nil;
|
PP[3]:=Nil;
|
||||||
{ Execute '/bin/ls -l', with current environment }
|
{ Execute '/bin/ls -l', with current environment }
|
||||||
{ Envp is defined in system.inc }
|
{ Envp is defined in system.inc }
|
||||||
ExecVe ('/bin/ls',pp,envp);
|
fpExecVe ('/bin/ls',pp,envp);
|
||||||
end.
|
end.
|
||||||
|
@ -2,7 +2,7 @@ Program Example8;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execv function. }
|
{ Program to demonstrate the Execv function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses Unix, strings;
|
||||||
|
|
||||||
Const Arg0 : PChar = '/bin/ls';
|
Const Arg0 : PChar = '/bin/ls';
|
||||||
Arg1 : Pchar = '-l';
|
Arg1 : Pchar = '-l';
|
||||||
@ -16,5 +16,5 @@ begin
|
|||||||
PP[1]:=Arg1;
|
PP[1]:=Arg1;
|
||||||
PP[3]:=Nil;
|
PP[3]:=Nil;
|
||||||
{ Execute '/bin/ls -l', with current environment }
|
{ Execute '/bin/ls -l', with current environment }
|
||||||
Execv ('/bin/ls',pp);
|
fpExecv ('/bin/ls',pp);
|
||||||
end.
|
end.
|
||||||
|
@ -2,7 +2,7 @@ Program Example9;
|
|||||||
|
|
||||||
{ Program to demonstrate the Execvp function. }
|
{ Program to demonstrate the Execvp function. }
|
||||||
|
|
||||||
Uses linux, strings;
|
Uses Unix, strings;
|
||||||
|
|
||||||
Const Arg0 : PChar = 'ls';
|
Const Arg0 : PChar = 'ls';
|
||||||
Arg1 : Pchar = '-l';
|
Arg1 : Pchar = '-l';
|
||||||
@ -18,5 +18,5 @@ begin
|
|||||||
{ Execute 'ls -l', with current environment. }
|
{ Execute 'ls -l', with current environment. }
|
||||||
{ 'ls' is looked for in PATH environment variable.}
|
{ 'ls' is looked for in PATH environment variable.}
|
||||||
{ Envp is defined in the system unit. }
|
{ Envp is defined in the system unit. }
|
||||||
Execvp ('ls',pp,envp);
|
fpExecvpe ('ls',pp,envp);
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user