7
Ready : Boolean = false;
10
function CloneProc( Arg: Pointer ): LongInt; Cdecl;
12
WriteLn('Hello from the clone ',PChar(Arg));
15
Select(0,Nil,Nil,Nil,Nil);
17
WriteLn( 'Clone finished.');
26
WriteLn('cloned process PID: ', PID );
27
WriteLn('Press <ESC> to kill ... ' );
30
Select(0,Nil,Nil,Nil,Nil);
45
theFlags = CLONE_VM+CLONE_FS+CLONE_FILES+CLONE_SIGHAND;
46
aMsg : PChar = 'Oops !';
53
GetMem(theStack,StackSze);
54
PID := Clone(@CloneProc,
55
Pointer( LongInt(theStack)+StackSze),
59
WriteLn('Error : ', LinuxError, ' when cloning.')
63
case WaitPID(0,@ExitStat,Wait_Untraced or wait_clone) of
64
-1: WriteLn('error:',LinuxError,'; ',StrError(LinuxError));
65
0: WriteLn('error:',LinuxError,'; ',StrError(LinuxError));
67
WriteLn('Clone exited with: ',ExitStat shr 8);
70
FreeMem( theStack, StackSze );
b'\\ No newline at end of file'