1.0.X version of the Linux unit - for compatibility only.
This document describes the LINUX unit for Free Pascal. The unit was written by Michael van Canneyt. It works only on the Linux/BSD operating systems.
Pointer to record.
Record containing one entry in the result of
Filename matching the search criteria
Next element in result of Glob call.
Record describing floating point register in signal handler.
Decimal part of floating point value
Exponent of floating point value
Pointer to record.
Record describing floating point unit in signal handler.
Pointer to record
Record describing the context of the program when it receives a signal
The above records contain information about the processor state and process state at the moment a signal is sent to your program.
Low part of gs register
High part of gs register
Low part of FS register
High part of FS register
Low part of ES register
High part of ES register
Low part of DS register
High part of DS register
EDI register
ESI register
EBP register
ESP register
EBX register
EDX register
ECX register
EAX register
Interrupt number
Error register (?)
IP (Instruction Pointer) register
Low part of CS register
High part of CS register
Flags register
ESP register at signal.
Low part of SS register
High part of SS register
Floating Point unit state
Old signal mask
?
Function prototype for call.
Function prototype for the call.
Pointer to type.
Signal restorer function prototype
Pointer to type
Pointer to record.
Record used in call.
Funcion called when signal is triggered.
Signal mask.
Flags for SigAction
Obsolete, don't use
Record describing an inode (file) in the call.
Device number
Pad byte. Do not use
Inode number of file
File mode
Number of links to file.
File owner UID
File owner GID
Pad byte. Do not use
File size
Block size
Number of blocks used
Last access time
Pad byte. Do not use
Last modification time.
Pad byte. Do not use
Creation time
Pad byte. Do not use
Pad byte. Do not use
Pad byte. Do not use
Record describing a file system in the call.
File system type
Block size
Total number of blocks
Number of free blocks
Number of available blocks
Number of files
?
?
Max name length for files.
Pad bytes. Do not use.
Pointer to record
Record used in and calls
File descriptor. Do not use.
Location in directory listing
File size
Pointer to records
?
?
?
Pointer to record.
Record used in the function to return files in a directory.
Inode number of file
Offset in directory.
Record length
Name of file
Number of control characters in record.
Number of control characters in record.
Terminal I/O description record (small)
input mode flags
output mode flags
control mode flags
local mode flags
line discipline
control characters
Terminal I/O description record
input mode flags
output mode flags
control mode flags
local mode flags
line discipline
control characters
Record used in to set file access and modificaton times.
Access time
Modification time
Pointer to array.
Array containing file descriptor bitmask for the call.
Record specifying a time inteval.
Number of seconds
Number of milliseconds
Pointer to record
Time interval for the function.
Number of seconds
Number of nanoseconds
Record used to return kernel information in function.
The elements of this record are null-terminated C style strings, you cannot access them directly.
System name
Computer name
Release number
Version number
Machine type
Domain name
Last operating system error
Linuxerror
is the variable in which the procedures in the linux unit report errors.
Standard error output (deprecated)

StdErr Is a Text variable, corresponding to Standard Error or diagnostic output. It is connected to file descriptor 2. It can be freely used, and will be closed on exit.

This variable is deprecated. Please use the corresponding variable in the system unit for disgnostic messages.

Get/Set process priority
Get/set process group priority
Get/set user priority
call test: read allowed
call test: write allowed
call test: execute allowed
call test: file exists.
Sigaction options: Do not receive notification when child processes stop
Sigaction options: ?
Sigaction options: Call the signal handler on an alternate signal stack.
Sigaction options: Provide behaviour compatible with BSD signal semantics
Sigaction options: ?
Sigaction options: Do not prevent the signal from being received when it is handled.
Sigaction options: Restore the signal action to the default state.
Sigprocmask flags: Add signals to the set of blocked signals.
Sigprocmask flags: Remove signals from the set set of blocked signals.
Sigprocmask flags: Set of blocked signals is given.
Signal handler: Default signal handler
Signal handler: Ignore signal
Signal handler: error
Signal: HUP (Hangup)
Signal: INT (Interrupt)
Signal: QUIT
Signal: ILL (Illegal instruction)
Signal: TRAP (Trace trap)
Signal: ABRT (Abort)
Signal: IOT (IOT trap)
Signal: BUS (bus error)
Signal: FPE (Floating point error)
Signal: KILL (unblockable)
Signal: USR1 (User-defined signal 1)
Signal: SEGV (Segmentation violation)
Signal: USR2 (User-defined signal 2)
Signal: PIPE (Broken pipe
Signal: ALRM (Alarm clock)
Signal: TERM (Terminate)
Signal: STKFLT (Stack Fault)
Signal: CHLD (child status changed)
Signal: CONT (Continue)
Signal: STOP (Stop, unblockable)
Signal: TSTP (keyboard stop)
Signal: TTIN (Terminal input, background)
Signal: TTOU (Terminal output, background)
Signal: URG (Socket urgent condition)
Signal: XCPU (CPU limit exceeded)
Signal: XFSZ (File size limit exceeded)
Signal: VTALRM (Virtual alarm clock)
Signal: PROF (Profiling alarm)
Signal: WINCH (Window/Terminal size change)
Signal: IO (I/O operation possible)
Signal: POLL (Pollable event)
Signal: PWR (power failure restart)
Signal: Unused
command: Get close-on-exec flag
command: Set close-on-exec flag
command: Get filedescriptor flags
command: Set filedescriptor flags
command: Get lock
command: Set lock
command: Test lock
command: get owner of filedescriptor events
command: Set owner of filedescriptor events
File ( record) mode: File type bit mask
File ( record) mode: Socket
File ( record) mode: Link
File ( record) mode: Regular file
File ( record) mode: Block device
File ( record) mode: Directory
File ( record) mode: Character device
File ( record) mode: FIFO
File ( record) mode: UID bit set
File ( record) mode: GID bit set
File ( record) mode: Sticky bit set
File ( record) mode: Other permission bits mask
File ( record) mode: Other read permission
File ( record) mode: Other write permission
File ( record) mode: Others execute permission
File ( record) mode: Group permission bits mask
File ( record) mode: Group read permission
File ( record) mode: Group write permission
File ( record) mode: Others execute permission
File ( record) mode: Owner permission bits mask
File ( record) mode: Owner read permission
File ( record) mode: Owner write permission
File ( record) mode: Others execute permission
File system type (): (ext2) Old second extended
File system type (): (ext2) Second extended
File system type (): (ext) Extended
File system type (): ISO 9660
File system type (): Minix
File system type (): Minix 3.0
File system type (): Minix V2
File system type (): MSDOS (FAT)
File system type (): NFS
File system type (): PROC fs
File system type (): XIA
Shared lock
Exclusive lock
unlock
Non-blocking operation
memory access: page can be read
memory access: page can be written
memory access: page can be executed
memory access: page can not be accessed
map type: Share changes
map type: Changes are private
map type: Bitmask for type of mapping
map type: Interpret addr exactly
map type: Don't use a file
File Input/Output routines

Functions for handling file input/output.

| Name | Description
| Duplicate a file handle
| Copy one file handle to another
| General file control
| Close file descriptor
| Flush file descriptor
| Open new file descriptor
| Read from file descriptor
| Position in file
| Truncate file
| Write to file descriptor
| Get file descriptor of pascal file
| Wait for input from file descriptor
| Wait for input from pascal file

General File handling routines

Functions for handling files on disk.

| Name | Description
| Check access rights on file
| Return name part of file
| Change owner of file
| Change access rights on file
| Return directory part of file
| Split filename in parts
| Return full-grown filename
| Set lock on a file
| Match filename to searchpattern
| Search for a file in a path
| Return filesystem information
| Return file information
| Rename file
| Return information on a link
| Create a link
| Read contents of a symbolic link
| Create a symbolic link
| Set the file creation mask
| Remove a file
| Change file timestamps

Pipes, FIFOs and streams

Functions for creating and managing pipes.

| Name | Description
| Create a pipe
| Create pipes to program's input and output
| Make a fifo
| Close a pipe
| Open a pipe for to program's input or output

Directory handling routines

Functions for reading and searching directories.

| Name | Description
| Close directory handle
| Return files matching a search expression
| Free result of Glob
| Open directory for reading
| Read directory entry
| Seek directory
| Seek directory

Process handling

Functions for managing processes and programs.

| Name | Description
| Create a thread
| Execute process with command-line list
| Execute process with command-line list and environment
| Search in path and execute process with command list
| Execute process
| Execute process with environment
| Search in path and execute process
| Spawn child process
| Get effective group id
| Get environment variable
| Get effective user id
| Get group id
| Get process id
| Get parent process id
| Get process priority
| Get user id
| Change priority of process
| Change priority of process
| Execute shell command
| Wait for child process to terminate

Signals

Functions for managing and responding to signals.

| Name | Description
| Send alarm signal to self
| Send arbitrary signal to process
| Wait for signal to arrive
| Set signal action
| Set signal action
| See if signals are waiting
| Set signal processing mask
| Send signal to self
| Sets signal mask and waits for signal
| Waits for a specific amount of time

System information

Functions for retrieving system information such as date and time.

| Name | Description
| Return system date
| Return system date and time
| Return system domain name
| Return epoch time
| Return system host name
| Return system timezone
| Return system time
| Return system time
| Return name of timezone file
| Read timezone file contents
| Return general system information
| Return system information

Terminal functions

Functions for controlling the terminal to which the process is connected.

| Name | Description
| Set terminal to raw mode
| Set terminal reading speed
| Set terminal writing speed
| General IO control call
| See if filedescriptor is a terminal
| Wait till all output was written
| Suspend transmission or receipt of data
| Discard data written to terminal
| Get terminal attributes
| Return PID of foreground process
| Send data for specific time
| Set terminal attributes
| Set foreground process
| Name of tty file

Utility routines

Auxiliary functions that are useful in connection with the other functions.

| Name | Description
| Create an array of pchars from string
| Convert epoch time to local time
| Clear item of select filedescriptors
| Check item of select filedescriptors
| Set item of select filedescriptors
| Clear all items in select filedecriptors
| Convert local time to epoch time
| Map a file into memory
| Unmap previously mapped memory file
| Convert octal to digital
| Check file mode for block device
| Check file mode for character device
| Check file mode for directory
| Check file mode for FIFO
| Check file mode for symboloc link
| Check file mode for regular file
| Check file mode for socket
| Create an array of pchars from string

Check file access

Access tests user's access rights on the specified file. Mode is a mask existing of one or more of the following:

R_OK
  User has read rights.
W_OK
  User has write rights.
X_OK
  User has execute rights.
F_OK
  File exists.

The test is done with the real user ID, instead of the effective user ID. If access is denied, or an error occurred, False is returned.

LinuxError is used to report errors:

sys_eaccess
  The requested access is denied, either to the file or one of the directories in its path.
sys_einval
  Mode
  was incorrect.
sys_enoent
  A directory component in Path doesn't exist or is a dangling symbolic link.
sys_enotdir
  A directory component in Path is not a directory.
sys_enomem
  Insufficient kernel memory.
sys_eloop
  Path
  has a circular symbolic link.

Schedule an alarm signal to be delivered

Alarm schedules an alarm signal to be delivered to your process in Sec seconds. When Sec seconds have elapsed, Linux will send a SIGALRM signal to the current process. If Sec is zero, then no new alarm will be set. Whatever the value of Sec, any previous alarm is cancelled.

The function returns the number of seconds till the previously scheduled alarm was due to be delivered, or zero if there was none.

Create a set of pipe file handlers

AssignePipe creates a pipe, i.e. two file objects, one for input, one for output. What is written to Pipe_out, can be read from Pipe_in.

This call is overloaded. The in and out pipe can take three forms: an typed or untyped file, a text file or a file descriptor.

If a text file is passed then reading and writing from/to the pipe can be done through the usual Readln(Pipe_in,...) and Writeln(Pipe_out,...) procedures.

The function returns True if everything went succesfully, False otherwise.

In case the function fails and returns False, LinuxError is used to report errors:

sys_emfile
  Too many file descriptors for this process.
sys_enfile
  The system file table is full.

Assign stream for in and output to a program

AssignStream creates a 2 or 3 pipes, i.e. two (or three) file objects, one for input, one for output,(and one for standard error) the other ends of these pipes are connected to standard input and output (and standard error) of Prog. Prog is the name of a program (including path) with options, which will be executed.

What is written to StreamOut, will go to the standard input of Prog. Whatever is written by Prog to it's standard output can be read from StreamIn. Whatever is written by Prog to it's standard error read from StreamErr, if present.

Reading and writing happens through the usual Readln(StreamIn,...) and Writeln (StreamOut,...) procedures.

You should not use Reset or Rewrite on a file opened with POpen. This will close the file before re-opening it again, thereby closing the connection with the program.

The function returns the process ID of the spawned process, or -1 in case of error.

In case of error (return value -1) LinuxError is used to report errors:

sys_emfile
  Too many file descriptors for this process.
sys_enfile
  The system file table is full.

Other errors include the ones by the fork and exec programs

Return basename of a file

Returns the filename part of Path, stripping off Suf if it exists. The filename part is the whole name if Path contains no slash, or the part of Path after the last slash. The last character of the result is not a slash, unless the directory is the root directory.

None.
Sets flags in record.

CFMakeRaw sets the flags in the Termios structure Tios to a state so that the terminal will function in Raw Mode.

For an example, see .

None.
Set input baud rate in record
CFSetISpeed
Sets the input baudrate in the TermIOS structure Tios to Speed.
None.
Set output baud rate in record
CFSetOSpeed
Sets the output baudrate in the Termios structure Tios to Speed.
None.
Change owner of file
Chown
sets the User ID and Group ID of the file in Path to NewUid, NewGid The function returns True if the call was succesfull, False if the call failed.

Errors are returned in LinuxError.

sys_eperm
  The effective UID doesn't match the ownership of the file, and is not zero. Owner or group were not specified correctly.
sys_eaccess
  One of the directories in Path has no search (=execute) permission.
sys_enoent
  A directory entry in Path does not exist or is a symbolic link pointing to a non-existent directory.
sys_enomem
  Insufficient kernel memory.
sys_erofs
  The file is on a read-only filesystem.
sys_eloop
  Path
  has a reference to a circular symbolic link, i.e. a symbolic link, whose expansion points to itself.

Change file permission bits

Chmod Sets the Mode bits of the file in Path to NewMode. Newmode can be specified by 'or'-ing the following:

S_ISUID
  Set user ID on execution.
S_ISGID
  Set Group ID on execution.
S_ISVTX
  Set sticky bit.
S_IRUSR
  Read by owner.
S_IWUSR
  Write by owner.
S_IXUSR
  Execute by owner.
S_IRGRP
  Read by group.
S_IWGRP
  Write by group.
S_IXGRP
  Execute by group.
S_IROTH
  Read by others.
S_IWOTH
  Write by others.
S_IXOTH
  Execute by others.
S_IRWXO
  Read, write, execute by others.
S_IRWXG
  Read, write, execute by groups.
S_IRWXU
  Read, write, execute by user.

Errors are returned in LinuxError.

sys_eperm
  The effective UID doesn't match the ownership of the file, and is not zero. Owner or group were not specified correctly.
sys_eaccess
  One of the directories in Path has no search (=execute) permission.
sys_enoent
  A directory entry in Path does not exist or is a symbolic link pointing to a non-existent directory.
sys_enomem
  Insufficient kernel memory.
sys_erofs
  The file is on a read-only filesystem.
sys_eloop
  Path
  has a reference to a circular symbolic link, i.e. a symbolic link, whose expansion points to itself.

Clone current process (create new thread)

Clone creates a child process which is a copy of the parent process, just like 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.

Close directory file descriptor

CloseDir closes the directory pointed to by p. It returns zero if the directory was closed succesfully, -1 otherwise.

For an example, see .

Errors are returned in LinuxError.
Create an array of null-terminated strings

CreateShellArgV creates an array of 3 PChar pointers that can be used as arguments to ExecVE the first elements in the array will contain /bin/sh, the second will contain -c, and the third will contain prog.

The function returns a pointer to this array, of type PPChar.

None.
Extract directory part from filename

Returns the directory part of Path. The directory is the part of Path before the last slash, or empty if there is no slash. The last character of the result is not a slash, unless the directory is the root directory.

None.
Duplicate a file handle

Makes NewFile an exact copy of OldFile, after having flushed the buffer of OldFile in case it is a Text file or untyped file. Due to the buffering mechanism of Pascal, this has not the same functionality as the dup call in C. The internal Pascal buffers are not the same after this call, but when the buffers are flushed (e.g. after output), the output is sent to the same file. Doing an lseek will, however, work as in C, i.e. doing a lseek will change the fileposition in both files.

The function returns False in case of an error, True if successful.

In case of errors, Linuxerror is used to report errors.

sys_ebadf
  OldFile
  hasn't been assigned.
sys_emfile
  Maximum number of open files for the process is reached.

Duplicate one filehandle to another

Makes NewFile an exact copy of OldFile, after having flushed the buffer of OldFile in the case of text or untyped files.

NewFile can be an assigned file. If newfile was open, it is closed first. Due to the buffering mechanism of Pascal, this has not the same functionality as the dup2 call in C. The internal Pascal buffers are not the same after this call, but when the buffers are flushed (e.g. after output), the output is sent to the same file. Doing an lseek will, however, work as in C, i.e. doing a lseek will change the fileposition in both files.

The function returns True if succesful, false otherwise.

In case of error, Linuxerror is used to report errors.

sys_ebadf
  OldFile
  hasn't been assigned.
sys_emfile
  Maximum number of open files for the process is reached.

Convert epoch time to local time

Converts the epoch time (=Number of seconds since 00:00:00 , January 1, 1970, corrected for your time zone ) to local date and time.

This function takes into account the timzeone settings of your system.

None
Execute process (using argument list)
Replaces the currently running program with the program, specified in path. Path is split into a command and it's options. The executable in path is NOT searched in the path. The current environment is passed to the program. On success, execl does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel, or to split command line.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Execute process (using argument list, environment)

Replaces the currently running program with the program, specified in path. Path is split into a command and it's options. The executable in path is searched in the path, if it isn't an absolute filename. The environment in ep is passed to the program. On success, execle does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel, or to split command line.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Execute process (using argument list, environment; search path)
Replaces the currently running program with the program, specified in path. Path is split into a command and it's options. The executable in path is searched in the path, if it isn't an absolute filename. The current environment is passed to the program. On success, execlp does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel, or to split command line.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Execute process
Replaces the currently running program with the program, specified in path. It gives the program the options in args. This is a pointer to an array of pointers to null-terminated strings. The last pointer in this array should be nil. The current environment is passed to the program. On success, execv does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Execute process using environment
Replaces the currently running program with the program, specified in path. It gives the program the options in args, and the environment in ep. They are pointers to an array of pointers to null-terminated strings. The last pointer in this array should be nil. On success, execve does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Execute process, search path
Replaces the currently running program with the program, specified in path. The executable in path is searched in the path, if it isn't an absolute filename. It gives the program the options in args. This is a pointer to an array of pointers to null-terminated strings. The last pointer in this array should be nil. The current environment is passed to the program. On success, execvp does not return.

Errors are reported in LinuxError:

sys_eacces
  File is not a regular file, or has no execute permission. A compononent of the path has no search permission.
sys_eperm
  The file system is mounted noexec.
sys_e2big
  Argument list too big.
sys_enoexec
  The magic number in the file is incorrect.
sys_enoent
  The file does not exist.
sys_enomem
  Not enough memory for kernel.
sys_enotdir
  A component of the path is not a directory.
sys_eloop
  The path contains a circular reference (via symlinks).

Clear all file descriptors in set

FD_ZERO clears all the filedescriptors in the file descriptor set fds.

For an example, see .

None.
Clears a filedescriptor in a set

FD_Clr clears file descriptor fd in filedescriptor set fds.

For an example, see .

None.
,
Check whether a filedescriptor is set

FD_Set Checks whether file descriptor fd in filedescriptor set fds is set.

For an example, see .

None.
Set a filedescriptor in a set

FD_Set sets file descriptor fd in filedescriptor set fds.

For an example, see .

None.
Close file descriptor

fdClose closes a file with file descriptor Fd. The function returns True if the file was closed successfully, False otherwise.

For an example, see .

Errors are returned in LinuxError.
Flush kernel file buffer

fdflush flushes the Linux kernel file buffer, so the file is actually written to disk. This is NOT the same as the internal buffer, maintained by Free Pascal. The function returns True if the call was successful, false if an error occurred.

For an example, see .

Errors are returned in LinuxError.
Open file and return file descriptor

fdOpen opens a file in PathName with flags flags One of the following:

Open_RdOnly
  File is opened Read-only
Open_WrOnly
  File is opened Write-only
Open_RdWr
  File is opened Read-Write

The flags may beOR-ed with one of the following constants:

Open_Creat
  File is created if it doesn't exist.
Open_Excl
  If the file is opened with Open_Creat and it already exists, the call wil fail.
Open_NoCtty
  If the file is a terminal device, it will NOT become the process' controlling terminal.
Open_Trunc
  If the file exists, it will be truncated.
Open_Append
  the file is opened in append mode. Before each write, the file pointer is positioned at the end of the file.
Open_NonBlock
  The file is opened in non-blocking mode. No operation on the file descriptor will cause the calling process to wait till.
Open_NDelay
  Idem as Open_NonBlock
Open_Sync
  The file is opened for synchronous IO. Any write operation on the file will not return untill the data is physically written to disk.
Open_NoFollow
  if the file is a symbolic link, the open fails. (linux 2.1.126 and higher only)
Open_Directory
  if the file is not a directory, the open fails. (linux 2.1.126 and higher only)

PathName can be of type PChar or String. The optional mode argument specifies the permissions to set when opening the file. This is modified by the umask setting. The real permissions are Mode and not umask. The return value of the function is the filedescriptor, or a negative value if there was an error.

Errors are returned in LinuxError.
Read data from file descriptor

fdRead reads at most size bytes from the file descriptor fd, and stores them in buf. The function returns the number of bytes actually read, or -1 if an error occurred. No checking on the length of buf is done.

Errors are returned in LinuxError.
Set file pointer position.

fdSeek sets the current fileposition of file fd to Pos, starting from SeekType, which can be one of the following:

Seek_Set
  Pos
  is the absolute position in the file.
Seek_Cur
  Pos
  is relative to the current position.
Seek_end
  Pos
  is relative to the end of the file.

The function returns the new fileposition, or -1 of an error occurred.

For an example, see .

Errors are returned in LinuxError.
Truncate file on certain size.
fdTruncate
sets the length of a file in fd on size bytes, where size must be less than or equal to the current length of the file in fd. The function returns True if the call was successful, false if an error occurred.
Errors are returned in LinuxError.
Write data to file descriptor

fdWrite writes at most size bytes from buf to file descriptor fd. The function returns the number of bytes actually written, or -1 if an error occurred.

Errors are returned in LinuxError.
Expand filename to fully qualified path
FExpand
expands Path to a full path, starting from root, eliminating directory references such as . and .. from the result.
None
Lock a file (advisory lock)

FLock implements file locking. it sets or removes a lock on the file F. F can be of type Text or File, or it can be a linux filedescriptor (a longint) Mode can be one of the following constants :

LOCK_SH
  sets a shared lock.
LOCK_EX
  sets an exclusive lock.
LOCK_UN
  unlocks the file.
LOCK_NB
  This can be OR-ed together with the other. If this is done the application doesn't block when locking.

The function returns True if successful, False otherwise.

If an error occurs, it is reported in LinuxError.
Check whether filename matches wildcard specification

FNMatch returns True if the filename in Name matches the wildcard pattern in Pattern, False otherwise.

Pattern can contain the wildcards * (match zero or more arbitrary characters) or ? (match a single character).

None.
Search for file in search path.
FSearch
searches in DirList, a colon separated list of directories, for a file named Path. It then returns a path to the found file.
An empty string if no such file was found.
Split filename into path, name and extension
FSplit
splits a full file name into 3 parts : A Path, a Name and an extension (in ext). The extension is taken to be all letters after the last dot (.).
None.
Retrieve filesystem information.
FSStat
returns in Info information about the filesystem on which the file Path resides, or on which the file with file descriptor fd resides. Info is of type statfs. The function returns True if the call was succesfull, False if the call failed.

LinuxError is used to report errors.

sys_enotdir
  A component of Path is not a directory.
sys_einval
  Invalid character in Path.
sys_enoent
  Path
  does not exist.
sys_eaccess
  Search permission is denied for component inPath.
sys_eloop
  A circular symbolic link was encountered in Path.
sys_eio
  An error occurred while reading from the filesystem.

Retrieve information about a file

FStat gets information about the file specified in one of the following:

Path
  a file on the filesystem.
Fd
  a valid file descriptor.
F
  an opened text file or untyped file.

and stores it in Info, which is of type stat. The function returns True if the call was succesfull, False if the call failed.

LinuxError is used to report errors.

sys_enoent
  Path
  does not exist.

File control operations.

Read a file's attributes. Fd is an assigned file, or a valid file descriptor. Cmd speciefies what to do, and is one of the following:

F_GetFd
  Read the close_on_exec flag. If the low-order bit is 0, then the file will remain open across execve calls.
F_GetFl
  Read the descriptor's flags.
F_GetOwn
  Get the Process ID of the owner of a socket.
F_SetFd
  Set the close_on_exec flag of Fd. (only the least siginificant bit is used).
F_GetLk
  Return the flock record that prevents this process from obtaining the lock, or set the l_type field of the lock of there is no obstruction. Arg is a pointer to a flock record.
F_SetLk
  Set the lock or clear it (depending on l_type in the flock structure). if the lock is held by another process, an error occurs.
F_GetLkw
  Same as for F_Setlk, but wait until the lock is released.
F_SetOwn
  Set the Process or process group that owns a socket.

LinuxError is used to report errors.

sys_ebadf
  Fd
  has a bad file descriptor.
sys_eagain or sys_eaccess
  For F_SetLk, if the lock is held by another process.

Create child process
Fork
creates a child process which is a copy of the parent process. Fork returns the process ID in the parent process, and zero in the child's process. (you can get the parent's PID with ).

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

sys_eagain
  Not enough memory to create child process.

Rename file

FRename renames the file OldName to NewName. NewName can be in a different directory than OldName, but it cannot be on another partition (device). Any existing file on the new location will be replaced.

If the operation fails, then the OldName file will be preserved.

The function returns True on succes, False on failure.

On error, errors are reported in LinuxError. Possible errors include:

sys_eisdir
  NewName
  exists and is a directory, but OldName is not a directory.
sys_exdev
  NewName
  and OldName are on different devices.
sys_enotempty or sys_eexist
  NewName
  is an existing, non-empty directory.
sys_ebusy
  OldName
  or NewName is a directory and is in use by another process.
sys_einval
  NewName
  is part of OldName.
sys_emlink
  OldPath
  or NewPath already have tha maximum amount of links pointing to them.
sys_enotdir
  part of OldName or NewName is not directory.
sys_efault
  For the pchar case: One of the pointers points to an invalid address.
sys_eaccess
  access is denied when attempting to move the file.
sys_enametoolong
  Either OldName or NewName is too long.
sys_enoent
  a directory component in OldName or NewName didn't exist.
sys_enomem
  not enough kernel memory.
sys_erofs
  NewName
  or OldName is on a read-only file system.
sys_eloop
  too many symbolic links were encountered trying to expand OldName or NewName
sys_enospc
  the filesystem has no room for the new directory entry.

Return the system date
Returns the current date.
None
Return system date and time
Returns the current date and time. The time is corrected for the local time zone. This procedure is equivalent to the and GetTime calls.
None
Return current domain name
Get the domain name of the machine on which the process is running. An empty string is returned if the domain is not set.
None.
Return effective group ID
Get the effective group ID of the currently running process.
None.
Return effective user ID
Get the effective user ID of the currently running process.
None.
Return value of environment variable.

GetEnv returns the value of the environment variable in P. If the variable is not defined, nil is returned. The value of the environment variable may be the empty string. A PChar is returned to accomodate for strings longer than 255 bytes, TERMCAP and LS_COLORS, for instance.

None.
Return the current unix time

returns the number of seconds since 00:00:00 gmt, january 1, 1970. it is adjusted to the local time zone, but not to DST.

no errors
Return file selector
GetFS
returns the file selector that the kernel provided for your file. In principle you don' need this file selector. Only for some calls it is needed, such as the call or so.
In case the file was not opened, then -1 is returned.
Return real group ID
Get the real group ID of the currently running process.
None.
Return host name
Get the hostname of the machine on which the process is running. An empty string is returned if hostname is not set.
None.
Return local timzeone information

GetLocalTimeZone returns the local timezone information. It also initializes the TZSeconds variable, which is used to correct the epoch time to local time.

There should never be any need to call this function directly. It is called by the initialization routines of the Linux unit.

Return current process ID
Get the Process ID of the currently running process.
None.
Return parent process ID
Get the Process ID of the parent process.
None.
Return process priority

GetPriority returns the priority with which a process is running. Which process(es) is determined by the Which and Who variables. Which can be one of the pre-defined Prio_Process, Prio_PGrp, Prio_User, in which case Who is the process ID, Process group ID or User ID, respectively.

For an example, see .

Error checking must be done on LinuxError, since a priority can be negative.

sys_esrch
  No process found using which and who.
sys_einval
  Which
  was not one of Prio_Process, Prio_Grp or Prio_User.

Return current system time

Returns the current time of the day, adjusted to local time. Upon return, the parameters are filled with

hour
  Hours since 00:00 today.
min
  minutes in current hour.
sec
  seconds in current minute.
sec100
  hundreds of seconds in current second.
msec
  milliseconds in current second.
usec
  microseconds in current second.

None
Return kernel time of day in GMT

GetTimeOfDay returns the number of seconds since 00:00, January 1 1970, GMT in a timeval record. This time NOT corrected any way, not taking into account timezones, daylight savings time and so on.

It is simply a wrapper to the kernel system call. To get the local time, .

None.
Return name of timezone information file

GetTimezoneFile returns the location of the current timezone file. The location of file is determined as follows:

1. If /etc/timezone exists, it is read, and the contents of this file is returned. This should work on Debian systems.
2. If /usr/lib/zoneinfo/localtime exists, then it is returned. (this file is a symlink to the timezone file on SuSE systems)
3. If /etc/localtime exists, then it is returned. (this file is a symlink to the timezone file on RedHat systems)

If no file was found, an empty string is returned.
Return current user ID
Get the real user ID of the currently running process.
None.
Find filenames matching a wildcard pattern

Glob returns a pointer to a glob structure which contains all filenames which exist and match the pattern in Path. The pattern can contain wildcard characters, which have their usual meaning.

Returns nil on error, and LinuxError is set.

sys_enomem
  No memory on heap for glob structure.
others
  As returned by the opendir call, and sys_readdir.

Free result of call

Releases the memory, occupied by a pglob structure. P is set to nil.

For an example, see .

None
General kernel IOCTL call.
This is a general interface to the Unix/ linux ioctl call. It performs various operations on the filedescriptor Handle. Ndx describes the operation to perform. Data points to data needed for the Ndx function. The structure of this data is function-dependent, so we don't elaborate on this here. For more information on this, see various manual pages under linux.
Errors are reported in LinuxError. They are very dependent on the used function, that's why we don't list them here
Set permission on IO ports

IOperm sets permissions on Num ports starting with port From to Value. The function returns True if the call was successfull, False otherwise.

Note:

- This works ONLY as root.
- Only the first 0x03ff ports can be set.
- When doing a , the permissions are reset. When doing a they are kept.

Errors are returned in LinuxError
Check if filehandle is a TTY (terminal)

Check if the filehandle described by f is a terminal. f can be of type

1. longint
   for file handles;
2. Text
   for text variables such as input etc.

Returns True if f is a terminal, False otherwise.

No errors are reported
Is file a block device
S_ISBLK
checks the file mode m to see whether the file is a block device file. If so it returns True.
Is file a character device
S_ISCHR
checks the file mode m to see whether the file is a character device file. If so it returns True.
Is file a directory
S_ISDIR
checks the file mode m to see whether the file is a directory. If so it returns True
Is file a FIFO
S_ISFIFO
checks the file mode m to see whether the file is a fifo (a named pipe). If so it returns True.
Is file a symbolic link
S_ISLNK
checks the file mode m to see whether the file is a symbolic link. If so it returns True
Is file a regular file
S_ISREG
checks the file mode m to see whether the file is a regular file. If so it returns True
Is file a unix socket
S_ISSOCK
checks the file mode m to see whether the file is a socket. If so it returns True.
Send a signal to a process
Send a signal Sig to a process or process group. If Pid>0 then the signal is sent to Pid, if it equals -1, then the signal is sent to all processes except process 1. If Pid<-1 then the signal is sent to process group -Pid. The return value is zero, except in case three, where the return value is the number of processes to which the signal was sent.

LinuxError is used to report errors:

sys_einval
  An invalid signal is sent.
sys_esrch
  The Pid or process group don't exist.
sys_eperm
  The effective userid of the current process doesn't math the one of process Pid.

Return information about symbolic link. Do not follow the link
LStat
gets information about the link specified in Path, and stores it in Info, which is of type stat. Contrary to FStat, it stores information about the link, not about the file the link points to. The function returns True if the call was succesfull, False if the call failed.

LinuxError is used to report errors.

sys_enoent
  Path
  does not exist.

Create a hard link to a file
Link
makes NewPath point to the same file als OldPath. The two files then have the same inode number. This is known as a 'hard' link. The function returns True if the call was succesfull, False if the call failed.

Errors are returned in LinuxError.

sys_exdev
  OldPath
  and NewPath are not on the same filesystem.
sys_eperm
  The filesystem containing oldpath and newpath doesn't support linking files.
sys_eaccess
  Write access for the directory containing Newpath is disallowed, or one of the directories in OldPath or {NewPath} has no search (=execute) permission.
sys_enoent
  A directory entry in OldPath or NewPath does not exist or is a symbolic link pointing to a non-existent directory.
sys_enotdir
  A directory entry in OldPath or NewPath is nor a directory.
sys_enomem
  Insufficient kernel memory.
sys_erofs
  The files are on a read-only filesystem.
sys_eexist
  NewPath
  already exists.
sys_emlink
  OldPath
  has reached maximal link count.
sys_eloop
  OldPath
  or NewPath has a reference to a circular symbolic link, i.e. a symbolic link, whose expansion points to itself.
sys_enospc
  The device containing NewPath has no room for another entry.
sys_eperm
  OldPath
  points to . or .. of a directory.

Convert local time to epoch (unix) time
Converts the Local time to epoch time (=Number of seconds since 00:00:00 , January 1, 1970 ).
None
Create FIFO (named pipe) in file system
MkFifo
creates named a named pipe in the filesystem, with name PathName and mode Mode.

LinuxError is used to report errors:

sys_emfile
  Too many file descriptors for this process.
sys_enfile
  The system file table is full.

Create memory map of a file

MMap maps or unmaps files or devices into memory. The different fields of the argument m determine what and how the mmap maps this:

address
  Address where to mmap the device. This address is a hint, and may not be followed.
size
  Size (in bytes) of area to be mapped.
prot

  Protection of mapped memory. This is a OR-ed combination of the following constants:

  PROT_EXEC
    The memory can be executed.
  PROT_READ
    The memory can be read.
  PROT_WRITE
    The memory can be written.
  PROT_NONE
    The memory can not be accessed.
flags

  Contains some options for the mmap call. It is an OR-ed combination of the following constants:

  MAP_FIXED
    Do not map at another address than the given address. If the address cannot be used, MMap will fail.
  MAP_SHARED
    Share this map with other processes that map this object.
  MAP_PRIVATE
    Create a private map with copy-on-write semantics.
  MAP_ANONYMOUS
    fd
    does not have to be a file descriptor.

  One of the options MAP_SHARED and MAP_PRIVATE must be present, but not both at the same time.

fd
  File descriptor from which to map.
offset
  Offset to be used in file descriptor fd.

The function returns a pointer to the mapped memory, or a -1 in case of en error.

On error, -1 is returned and LinuxError is set to the error code:

Sys_EBADF
  fd
  is not a valid file descriptor and MAP_ANONYMOUS was not specified.
Sys_EACCES
  MAP_PRIVATE
  was specified, but fd is not open for reading. Or MAP_SHARED was asked and PROT_WRITE is set, fd is not open for writing
Sys_EINVAL
  One of the record fields Start, length or offset is invalid.
Sys_ETXTBUSY
  MAP_DENYWRITE
  was set but the object specified by fd is open for writing.
Sys_EAGAIN
  fd
  is locked, or too much memory is locked.
Sys_ENOMEM
  Not enough memory for this operation.

Unmap previously mapped memory block

MUnMap unmaps the memory block of size Size, pointed to by P, which was previously allocated with .

The function returns True if successful, False otherwise.

For an example, see .

In case of error the function returns False and LinuxError is set to an error value. See for possible error values.
Suspend process for a short time

NanoSleep suspends the process till a time period as specified in req has passed. Then the function returns. If the call was interrupted (e.g. by some signal) then the function may return earlier, and rem will contain the remaining time till the end of the intended period. In this case the return value will be -1, and LinuxError will be set to EINTR

If the function returns without error, the return value is zero.

If the call was interrupted, -1 is returned, and LinuxError is set to EINTR. If invalid time values were specified, then -1 is returned and LinuxError is set to EINVAL.
Set process priority

Nice adds -N to the priority of the running process. The lower the priority numerically, the less the process is favored. Only the superuser can specify a negative N, i.e. increase the rate at which the process is run.

Errors are returned in LinuxError

sys_eperm
  A non-superuser tried to specify a negative N, i.e. do a priority increase.

Convert octal to decimal value

Octal will convert a number specified as an octal number to it's decimal value.

This is useful for the call, where permissions are specified as octal numbers.

No checking is performed whether the given number is a correct Octal number. e.g. specifying 998 is possible; the result will be wrong in that case.
Open directory for reading
OpenDir
opens the directory f, and returns a pdir pointer to a Dir record, which can be used to read the directory structure. If the directory cannot be opened, nil is returned.
Errors are returned in LinuxError.
Wait for a signal

Pause puts the process to sleep and waits until the application receives a signal. If a signal handler is installed for the received sigal, the handler will be called and after that pause will return control to the process.

For an example, see .

Close file opened with

PClose closes a file opened with . It waits for the command to complete, and then returns the exit status of the command.

For an example, see

LinuxError
is used to report errors. If it is different from zero, the exit status is not valid.
Pipe file to standard input/output of program
POpen
runs the command specified in Cmd, and redirects the standard in or output of the command to the other end of the pipe F. The parameter rw indicates the direction of the pipe. If it is set to 'W', then F can be used to write data, which will then be read by the command from stdinput. If it is set to 'R', then the standard output of the command can be read from F. F should be reset or rewritten prior to using it. F can be of type Text or File. A file opened with POpen can be closed with Close, but also with . The result is the same, but PClose returns the exit status of the command Cmd.
Errors are reported in LinuxError and are essentially those of the Execve, Dup and AssignPipe commands.
Read entry from directory

ReadDir reads the next entry in the directory pointed to by p. It returns a pdirent pointer to a structure describing the entry. If the next entry can't be read, Nil is returned.

For an example, see .

Errors are returned in LinuxError.
,
Read destination of symbolic link

ReadLink returns the file the symbolic link name is pointing to. The first form of this function accepts a buffer linkname of length maxlen where the filename will be stored. It returns the actual number of characters stored in the buffer.

The second form of the function returns simply the name of the file.

On error, the first form of the function returns -1; the second one returns an empty string. LinuxError is set to report errors:

SYS_ENOTDIR
  A part of the path in Name is not a directory.
SYS_EINVAL
  maxlen is not positive, or the file is not a symbolic link.
SYS_ENAMETOOLONG
  A pathname, or a component of a pathname, was too long.
SYS_ENOENT
  the link name does not exist.
SYS_EACCES
  No permission to search a directory in the path
SYS_ELOOP
  Too many symbolic links were encountered in translating the pathname.
SYS_EIO
  An I/O error occurred while reading from the file system.
SYS_EFAULT
  The buffer is not part of the the process's memory space.
SYS_ENOMEM
  Not enough kernel memory was available.

Read the timezone file and initialize time routines

ReadTimeZoneFile reads the timezone file fn and initializes the local time routines based on the information found there.

There should be no need to call this function. The initialization routines of the linux unit call this routine at unit startup.

None.
Seek to position in directory

SeekDir sets the directory pointer to the off-th entry in the directory structure pointed to by p.

For an example, see .

Errors are returned in LinuxError.
Wait for events on file descriptors

Select checks one of the file descriptors in the FDSets to see if its status changed.

readfds, writefds and exceptfds are pointers to arrays of 256 bits. If you want a file descriptor to be checked, you set the corresponding element in the array to 1. The other elements in the array must be set to zero. Three arrays are passed : The entries in readfds are checked to see if characters become available for reading. The entries in writefds are checked to see if it is OK to write to them, while entries in exceptfds are cheked to see if an exception occorred on them.

You can use the functions , or to manipulate the individual elements of a set.

The pointers can be Nil.

N is the largest index of a nonzero entry plus 1. (= the largest file-descriptor + 1).

TimeOut can be used to set a time limit. If TimeOut can be two types :

1. TimeOut
   is of type PTime and contains a zero time, the call returns immediately. If TimeOut is Nil, the kernel will wait forever, or until a status changed.
2. TimeOut
   is of type Longint. If it is -1, this has the same effect as a Timeout of type PTime which is Nil. Otherwise, TimeOut contains a time in milliseconds.

When the TimeOut is reached, or one of the file descriptors has changed, the Select call returns. On return, it will have modified the entries in the array which have actually changed, and it returns the number of entries that have been changed. If the timout was reached, and no decsriptor changed, zero is returned; The arrays of indexes are undefined after that. On error, -1 is returned.

On error, the function returns -1, and Errors are reported in LinuxError :

SYS_EBADF
  An invalid descriptor was specified in one of the sets.
SYS_EINTR
  A non blocked signal was caught.
SYS_EINVAL
  N
  is negative or too big.
SYS_ENOMEM
  Select
  was unable to allocate memory for its internal tables.

Wait for event on typed ontyped file.
SelectText
executes the call on a file of type Text. You can specify a timeout in TimeOut. The SelectText call determines itself whether it should check for read or write, depending on how the file was opened : With Reset it is checked for reading, with Rewrite and Append it is checked for writing.
See . SYS_EBADF can also mean that the file wasn't opened.
Set process priority

SetPriority sets the priority with which a process is running. Which process(es) is determined by the Which and Who variables. Which can be one of the pre-defined constants:

Prio_Process
  Who
  is interpreted as process ID
Prio_PGrp
  Who
  is interpreted as process group ID
Prio_User
  Who
  is interpreted as user ID

Prio is a value in the range -20 to 20.

For an example, see .

Error checking must be done on LinuxError, since a priority can be negative.

sys_esrch
  No process found using which and who.
sys_einval
  Which
  was not one of Prio_Process, Prio_Grp or Prio_User.
sys_eperm
  A process was found, but neither its effective or real user ID match the effective user ID of the caller.
sys_eacces
  A non-superuser tried to a priority increase.

Execute and feed command to system shell
Shell
invokes the bash shell (/bin/sh), and feeds it the command Command (using the -c option). The function then waits for the command to complete, and then returns the exit status of the command, or 127 if it could not complete the or calls.
Errors are reported in LinuxError.
Install signal handler

Changes the action to take upon receipt of a signal. Act and Oldact are pointers to a SigActionRec record. SigNum specifies the signal, and can be any signal except SIGKILL or SIGSTOP.

If Act is non-nil, then the new action for signal SigNum is taken from it. If OldAct is non-nil, the old action is stored there. Sa_Handler may be SIG_DFL for the default action or SIG_IGN to ignore the signal. Sa_Mask Specifies which signals should be ignord during the execution of the signal handler. Sa_Flags Speciefies a series of flags which modify the behaviour of the signal handler. You can 'or' none or more of the following :

SA_NOCLDSTOP
  If signum is SIGCHLD do not receive notification when child processes stop.
SA_ONESHOT or SA_RESETHAND
  Restore the signal action to the default state once the signal handler has been called.
SA_RESTART
  For compatibility with BSD signals.
SA_NOMASK or SA_NODEFER
  Do not prevent the signal from being received from within its own signal handler.

LinuxError is used to report errors.

sys_einval
  an invalid signal was specified, or it was SIGKILL or SIGSTOP.
sys_efault
  Act,OldAct
  point outside this process address space
sys_eintr
  System call was interrupted.

Return set of currently pending signals
Sigpending allows the examination of pending signals (which have been raised while blocked.) The signal mask of pending signals is returned.
None
Set list of blocked signals

Changes the list of currently blocked signals. The behaviour of the call depends on How :

SIG_BLOCK
  The set of blocked signals is the union of the current set and the SSet argument.
SIG_UNBLOCK
  The signals in SSet are removed from the set of currently blocked signals.
SIG_SETMASK
  The list of blocked signals is set so SSet.

If OldSSet is non-nil, then the old set is stored in it.

LinuxError is used to report errors.

sys_efault
  SSet
  or OldSSet point to an adress outside the range of the process.
sys_eintr
  System call was interrupted.

Raise a signal (send to current process)
SigRaise
sends a Sig signal to the current process.
None.
Set signal mask and suspend process till signal is received
SigSuspend temporarily replaces the signal mask for the process with the one given in Mask, and then suspends the process until a signal is received.
None
Install signal handler (deprecated)

Signal installs a new signal handler for signal SigNum. This call has the same functionality as the SigAction call. The return value for Signal is the old signal handler, or nil on error.

LinuxError is used to report errors :

SIG_ERR
  An error occurred.

Split string in list of null-terminated strings

StringToPPChar splits the string S in words, replacing any whitespace with zero characters. It returns a pointer to an array of pchars that point to the first letters of the words in S. This array is terminated by a Nil pointer.

The function does not add a zero character to the end of the string unless it ends on whitespace.

The function reserves memory on the heap to store the array of PChar; The caller is responsible for freeing this memory.

This function can be called to create arguments for the various Exec calls.

None.
Create a symbolic link

SymLink makes Newpath point to the file in OldPath, which doesn't necessarily exist. The two files DO NOT have the same inode number. This is known as a 'soft' link.

The permissions of the link are irrelevant, as they are not used when following the link. Ownership of the file is only checked in case of removal or renaming of the link.

The function returns True if the call was succesfull, False if the call failed.

Errors are returned in LinuxError.

sys_eperm
  The filesystem containing oldpath and newpath does not support linking files.
sys_eaccess
  Write access for the directory containing Newpath is disallowed, or one of the directories in OldPath or NewPath has no search (=execute) permission.
sys_enoent
  A directory entry in OldPath or NewPath does not exist or is a symbolic link pointing to a non-existent directory.
sys_enotdir
  A directory entry in OldPath or NewPath is nor a directory.
sys_enomem
  Insufficient kernel memory.
sys_erofs
  The files are on a read-only filesystem.
sys_eexist
  NewPath
  already exists.
sys_eloop
  OldPath
  or NewPath has a reference to a circular symbolic link, i.e. a symbolic link, whose expansion points to itself.
sys_enospc
  The device containing NewPath has no room for another entry.

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.
Terminal control: Wait till all data was transmitted

TCDrain waits until all data to file descriptor Fd is transmitted.

The function returns True if the call was succesfull, False otherwise.

Errors are reported in LinuxError
Terminal control: Suspend transmission of data

TCFlow suspends/resumes transmission or reception of data to or from the file descriptor Fd, depending on the action Act.

This can be one of the following pre-defined values:

TCOOFF
  suspend reception/transmission
TCOON
  resume reception/transmission
TCIOFF
  transmit a stop character to stop input from the terminal
TCION
  transmit start to resume input from the terminal.

The function returns True if the call was succesfull, False otherwise.

Errors are reported in LinuxError.
Terminal control: Discard data buffer

TCFlush discards all data sent or received to/from file descriptor fd. QSel indicates which queue should be discard. It can be one of the following pre-defined values :

TCIFLUSH
  input buffer
TCOFLUSH
  output buffer
TCIOFLUSH
  both input and output buffers

The function returns True if the call was succesfull, False otherwise.

Errors are reported in LinuxError.
Terminal Control: Get terminal attributes
TCGetAttr
gets the terminal parameters from the terminal referred to by the file descriptor fd and returns them in a TermIOS structure tios. The function returns True if the call was succesfull, False otherwise.
Errors are reported in LinuxError
Terminal control: Get process group
TCGetPGrp
returns the process group ID of a foreground process group in Id The function returns True if the call was succesfull, False otherwise.
Errors are reported in LinuxError
Terminal control: Send break
TCSendBreak
Sends zero-valued bits on an asynchrone serial connection decsribed by file-descriptor Fd, for duration Duration. The function returns True if the action was performed successfully, False otherwise.
Errors are reported in LinuxError.
Terminal control: Set attributes

TCSetAttr sets the terminal parameters you specify in a TermIOS structureTios for the terminal referred to by the file descriptor Fd.

OptAct specifies an optional action when the set need to be done, this could be one of the following pre-defined values:

TCSANOW
  set immediately.
TCSADRAIN
  wait for output.
TCSAFLUSH
  wait for output and discard all input not yet read.

The function Returns True if the call was succesfull, False otherwise.

For an example, see .

Errors are reported in LinuxError.
Terminal control: Set process group

TCSetPGrp Sets the Process Group Id to Id. The function returns True if the call was successful, False otherwise.

For an example, see .

Errors are returned in LinuxError.
Terminal control: Get terminal name

TTYNameReturns the name of the terminal pointed to by f. f must be a terminal. f can be of type:

1. longint
   for file handles;
2. Text
   for text variables such as input etc.

Returns an empty string in case of an error. Linuxerror may be set to indicate what error occurred, but this is uncertain.
Return current location in a directory

TellDir returns the current location in the directory structure pointed to by p. It returns -1 on failure.

For an example, see .

Errors are returned in LinuxError.
Set file creation mask.
Change the file creation mask for the current user to Mask. The current mask is returned.
Return system name.
Uname
gets the name and configuration of the current linux kernel, and returns it in unamerec.
LinuxError
is used to report errors.
Unlink (i.e. remove) a file.

UnLink decreases the link count on file Path. Path can be of type PathStr or PChar. If the link count is zero, the file is removed from the disk. The function returns True if the call was succesfull, False if the call failed.

For an example, see .

Errors are returned in LinuxError.

sys_eaccess
  You have no write access right in the directory containing Path, or you have no search permission in one of the directory components of Path.
sys_eperm
  The directory containing pathname has the sticky-bit set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it.
sys_enoent
  A component of the path doesn't exist.
sys_enotdir
  A directory component of the path is not a directory.
sys_eisdir
  Path
  refers to a directory.
sys_enomem
  Insufficient kernel memory.
sys_erofs
  Path
  is on a read-only filesystem.

Set access and modification times of a file (touch).
Utime
sets the access and modification times of a file. the utimbuf record contains 2 fields, actime, and modtime, both of type Longint. They should be filled with an epoch-like time, specifying, respectively, the last access time, and the last modification time. For some filesystem (most notably, FAT), these times are the same.

Errors are returned in LinuxError.

sys_eaccess
  One of the directories in Path has no search (=execute) permission.
sys_enoent
  A directory entry in Path does not exist or is a symbolic link pointing to a non-existent directory.

Other errors may occur, but aren't documented.

Wait for a process to terminate

WaitPid waits for a child process with process ID Pid to exit. The value of Pid can be one of the following:

Pid < -1
  Causes WaitPid to wait for any child process whose process group ID equals the absolute value of pid.
Pid = -1
  Causes WaitPid to wait for any child process.
Pid = 0
  Causes WaitPid to wait for any child process whose process group ID equals the one of the calling process.
Pid > 0
  Causes WaitPid to wait for the child whose process ID equals the value of Pid.

The Options parameter can be used to specify further how WaitPid behaves:

WNOHANG
  Causes Waitpid to return immediately if no child hasexited.
WUNTRACED
  Causes WaitPid to return also for children which are stopped, but whose status has not yet been reported.
__WCLONE
  Causes WaitPid also to wait for threads created by the call.

Upon return, it returns the exit status of the process, or -1 in case of failure.

For an example, see .

Errors are returned in LinuxError.
Seek option: Set absolute position.
Seek option: Set position relative to current position.
Seek option: Set position relative to end of file.
Bitmask to determine access mode in open flags.
File open mode: Read only
File open mode: Write only
File open mode: Read/Write
File open mode: Create if file does not yet exist.
File open mode: Open exclusively
File open mode: No TTY control.
File open mode: Truncate file to length 0
File open mode: Append to file
File open mode: Open in non-blocking mode
File open mode: Alias for
File open mode: Write to disc at once
File open mode: Minimize caching effects
File open mode: Open for 64-bit I/O
File open mode: File must be directory.
File open mode: Fail if file is symbolic link.
: Do not wait
: Also report stopped but untraced processes
: Wait on any process
: Wait processes from current process group
: Wait on clone processes only.
IOCTL call number: get Terminal Control settings
Register describing system calls.
Register 1
Register 2
Register 3
Register 4
Register 5
Register 6
Pointer to record.
Alias for record
Alias for record
Device descriptor type
Block size
Pointer to record.
Alias for record.
Pointer to record.
Alias for type.
Alias for type.
Alias for record.
Record describing a timezone
Minutes west of GMT
Daylight savings time
Pointer to record.
Alias for record.
Pointer to record.
Alias for record.
Signal set type
Pointer to signal set.
Socket option
Signal information record pad bytes size. Do not use.
Size type
Socket options
Socket options
Signal Stack size error
Alternate stack registers record
Stack pointer
Flags
Stack size
Alias for type
Pointer to record
Pointer to record
Error number of last operation.
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.
option: Do not wait for processes to terminate.
option: Also report children wich were stopped but not yet reported
Waitpid option: Wait for clone children only
Input file descriptor of pipe pair.
Output file descriptor of pipe pair.
Array describing a pipe pair of filedescriptors.
Command-line string type.
Filename path part string type.
Filename directory part string type.
Filename name part string type.
Filename extension part string type.
Record describing terminal window size.
Number of rows
Number of columns
Number of pixels in horizontal direction
Number of pixels in vertical direction
Alias for record.
Alias for record
Input speed
Output speed
Alias for record.
Alias for record.
Alias for record.
Pointer to record
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.
Execute system call.
SysCall
can be used to execute a direct system call. The call parameters must be encoded in regs and the call number must be specified by callnr. The call result is returned, and any modified registers are in regs
None.
Indicates whether daylight savings time is active.
Seconds west of GMT
Timezone name.
Set the current system time.

SetTime sets the system time to hour, min, Sec. This is the kernel time, so it is in GMT. The date is not touched. The function returns True if the call was executed corretly, False otherwise.

You must be root to execute this call.
Errors are returned in
Set the current system date.

SetDate sets the system date to year, month, day. This is the kernel date, so it is in GMT. The time is not touched. The function returns True if the call was executed corretly, False otherwise.

You must be root to execute this call.
Errors are returned in
Set the current system date and time

SetDate sets the system date and time to year, month, day, hour, min, Sec. This is the kernel date/time, so it is in GMT. The time is not touched. The function returns True if the call was executed corretly, False otherwise.

You must be root to execute this call.
Errors are returned in
Exit the current process

ExitProcess exits the currently running process, and report Val as the exit status.

If this call is executed, the normal unit finalization code will not be executed. This may lead to unexpected errors and stray files on your system. It is therefore recommended to use the Halt call instead.
None.
Wait for process to terminate.

WaitProcess waits for process PID to exit. WaitProcess is equivalent to the call:

WaitPid(PID,@result,0)

Handles of Signal interrupts (errno=EINTR), and returns the Exitcode of Process PID (>=0) or -Status if it was terminated

None.
Extract the exit status from the result.
WEXITSTATUS
can be used to extract the exit status from Status, the result of the call.
Return the signal that caused a process to exit.
WTERMSIG
extracts from Status the signal number which caused the process to exit.
Return the exit code from the process.
WSTOPSIG
is an alias for .
Check whether the process exited normally
WIFEXITED
checks Status and returns True if the status indicates that the process terminated normally, i.e. was not stopped by a signal.
Check whether the process is currently stopped.
WIFSTOPPED
checks Status and returns true if the process is currently stopped. This is only possible if WUNTRACED was specified in the options of .
Check whether the process was exited by a signal.
WIFSIGNALED
returns True if Status indicates that the process exited because it received a signal.
Construct an exit status based on an return code and signal.
W_EXITCODE
combines ReturnCode and Signal to a status code fit for WaitPid.
Construct an exit status based on a signal.
W_STOPCODE
constructs an exit status based on Signal, which will cause to return True
option: Memory grows downward (like a stack)
option: Ignored.
option: Ignored.
option: lock the pages in memory.
option: Do not reserve swap pages for this memory.
Record containing mmap args.
Address pointer
Size of region.
Memory protection flags
Flags
File descriptor
Offset: Multiple of page size
Set I/O privilege level
IoPL
sets the I/O privilige level. It is intended for completeness only, one should normally not use it.