Linux-specific operating system calls.

The linux unit contains linux specific operating system calls.

The platform independent functionality of the FPC 1.0.X version of the linux unit has been split out over the unix, baseunix and unixutil units.

The X86-specific parts have been moved to the X86 unit.

People wanting to use the old version (FPC 1.0.X and before) of the linux can use the oldlinux unit instead.

Record with system information, used by the call.
Number of seconds since boot.
1, 5 and 15 minute load averages.
total amount of main memory.
amount of free memory.
amount of shared memory.
amount of memory used by buffers.
total amount of swapspace.
amount of free swapspace.
number of current processes.
?
Pointer to record.
Return kernel system information

SysInfo returns system information in Info. Returned information in Info includes:

uptime
  Number of seconds since boot.
loads
  1, 5 and 15 minute load averages.
totalram
  total amount of main memory.
freeram
  amount of free memory.
sharedram
  amount of shared memory.
bufferram
  amount of memory used by buffers.
totalswap
  total amount of swapspace.
freeswap
  amount of free swapspace.
procs
  number of current processes.

None.
option: Signal mask to be sent at exit
option: VM shared between processes
option: fs info shared between processes
option: open files shared between processes
option: signal handlers shared between processes
option: PID shared between processes
Clone function prototype.
Clone current process (create new thread)

Clone creates a child process which is a copy of the parent process, just like FpFork does. In difference with Fork, however, the child process shares some parts of it's execution context with its parent, so it is suitable for the implementation of threads: many instances of a program that share the same memory.

When the child process is created, it starts executing the function Func, and passes it Args. The return value of Func is either the explicit return value of the function, or the exit code of the child process.

The sp pointer points to the memory reserved as stack space for the child process. This address should be the top of the memory block to be used as stack.

The Flags determine the behaviour of the Clone call. The low byte of the Flags contains the number of the signal that will be sent to the parent when the child dies. This may be bitwise OR'ed with the following constants:

CLONE_VM
  Parent and child share the same memory space, including memory (un)mapped with subsequent mmap calls.
CLONE_FS
  Parent and child have the same view of the filesystem; the chroot, chdir and umask calls affect both processes.
CLONE_FILES
  the file descriptor table of parent and child is shared.
CLONE_SIGHAND
  the parent and child share the same table of signal handlers. The signal masks are different, though.
CLONE_PID
  PArent and child have the same process ID.

Clone returns the process ID in the parent process, and -1 if an error occurred.

On error, -1 is returned to the parent, and no child is created.

sys_eagain
  Too many processes are running.
sys_enomem
  Not enough memory to create child process.