4
// close is very Linux specific. 1.9.x threading is done via pthreads.
10
Ready : Boolean = false;
13
function CloneProc( Arg: Pointer ): LongInt; Cdecl;
15
WriteLn('Hello from the clone ',PChar(Arg));
20
WriteLn( 'Clone finished.');
29
WriteLn('cloned process PID: ', PID );
30
WriteLn('Press <ESC> to kill ... ' );
48
theFlags = CLONE_VM+CLONE_FS+CLONE_FILES+CLONE_SIGHAND;
49
aMsg : PChar = 'Oops !';
56
GetMem(theStack,StackSze);
57
PID := Clone(@CloneProc,
58
Pointer( LongInt(theStack)+StackSze),
62
WriteLn('Error : ', LinuxError, ' when cloning.')
66
case WaitPID(0,@ExitStat,Wait_Untraced or wait_clone) of
67
-1: WriteLn('error:',LinuxError,'; ',StrError(LinuxError));
68
0: WriteLn('error:',LinuxError,'; ',StrError(LinuxError));
70
WriteLn('Clone exited with: ',ExitStat shr 8);
73
FreeMem( theStack, StackSze );
b'\\ No newline at end of file'