On this page
posix_utils
A set of helpers for the POSIX module. Raw interfaces are in the other posix*.nim files.
Imports
Types
Procs
- 
    
proc uname(): Uname {...}{.raises: [OSError], tags: [].} - 
    Provides system information in a 
Unamestruct with sysname, nodename, release, version and machine attributes.Example:
Source Editecho uname().nodename, uname().release, uname().version doAssert uname().sysname.len != 0 - 
    
proc fsync(fd: int) {...}{.raises: [OSError], tags: [].} - synchronize a file's buffer cache to the storage device Source Edit
 - 
    
proc stat(path: string): Stat {...}{.raises: [OSError], tags: [].} - 
    Returns file status in a 
Statstructure Source Edit - 
    
proc memoryLock(a1: pointer; a2: int) {...}{.raises: [OSError], tags: [].} - Locks pages starting from a1 for a1 bytes and prevent them from being swapped. Source Edit
 - 
    
proc memoryLockAll(flags: int) {...}{.raises: [OSError], tags: [].} - 
    
Locks all memory for the running process to prevent swapping.
example:
Source EditmemoryLockAll(MCL_CURRENT or MCL_FUTURE) - 
    
proc memoryUnlock(a1: pointer; a2: int) {...}{.raises: [OSError], tags: [].} - Unlock pages starting from a1 for a1 bytes and allow them to be swapped. Source Edit
 - 
    
proc memoryUnlockAll() {...}{.raises: [OSError], tags: [].} - Unlocks all memory for the running process to allow swapping. Source Edit
 - 
    
proc sendSignal(pid: Pid; signal: int) {...}{.raises: [OSError], tags: [].} - 
    Sends a signal to a running process by calling 
kill. Raise exception in case of failure e.g. process not running. Source Edit - 
    
proc mkstemp(prefix: string; suffix = ""): (string, File) {...}{.raises: [OSError], tags: [].} - Creates a unique temporary file from a prefix string. A six-character string will be added. If suffix is provided it will be added to the string The file is created with perms 0600. Returns the filename and a file opened in r/w mode. Source Edit
 - 
    
proc mkdtemp(prefix: string): string {...}{.raises: [OSError], tags: [].} - Creates a unique temporary directory from a prefix string. Adds a six chars suffix. The directory is created with permissions 0700. Returns the directory name. Source Edit
 
© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
 https://nim-lang.org/docs/posix_utils.html