std.posix
Function Description
The posix package encapsulates POSIX system calls, providing cross-platform system operation interfaces.
This package offers unified multi-platform control capabilities, currently supporting Linux, macOS, and Windows platforms.
Note:
All contents of this package will be deprecated in future versions.
API List
Functions
| Function Name | Functionality | Supported Platforms |
|---|---|---|
| open(String, Int32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux Windows macOS |
| open(String, Int32, UInt32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux Windows macOS |
| access(String, Int32) (deprecated) | Checks if a file has specific permissions. Returns 0 if true, otherwise -1. |
Linux Windows macOS |
| chdir(String) (deprecated) | Changes the current working directory of the calling process by specifying a path. | Linux Windows macOS |
| chmod(String, UInt32) (deprecated) | Modifies file access permissions. | Linux Windows macOS |
| chown(String, UInt32, UInt32) (deprecated) | Changes file owner and group. | Linux macOS |
| close(Int32) (deprecated) | Closes a file. close triggers data write-back to disk and releases file resources. |
Linux Windows macOS |
| creat(String, UInt32) (deprecated) | Creates a file and returns a file descriptor, or -1 on failure. |
Linux Windows macOS |
| dup(Int32) (deprecated) | Duplicates the file descriptor specified by the old fd parameter and returns it. |
Linux Windows macOS |
| dup2(Int32, Int32) (deprecated) | Duplicates the file descriptor specified by oldfd and returns it to the newfd parameter. |
Linux Windows macOS |
| faccessat(Int32, String, Int32, Int32) (deprecated) | Checks if the file corresponding to fd has specific permissions. Returns 0 if true, otherwise -1. |
Linux macOS |
| fchdir(Int32) (deprecated) | Changes the current working directory of the calling process by specifying a file descriptor. | Linux macOS |
| fchmod(Int32, UInt32) (deprecated) | Modifies file access permissions for the file descriptor. | Linux Windows macOS |
| fchmodat(Int32, String, UInt32, Int32) (deprecated) | Modifies file access permissions for the file descriptor. | Linux Windows macOS |
| fchown(Int32, UInt32, UInt32) (deprecated) | Changes file owner and group for the file corresponding to fd. |
Linux macOS |
| fchownat(Int32, String, UInt32, UInt32, Int32) (deprecated) | Changes file owner and group for the file descriptor. | Linux macOS |
| getcwd() (deprecated) | Gets the absolute path of the current working directory of the executing process. | Linux Windows macOS |
| getgid() (deprecated) | Gets the group ID. |
Linux macOS |
| getgroups(Int32, CPointer<UInt32>) (deprecated) | Gets the group codes of the current user. | Linux macOS |
| gethostname() (deprecated) | Gets the hostname, typically the name of the host on a TCP/IP network. |
Linux macOS |
| getlogin() (deprecated) | Gets the current login name. | Linux macOS |
| getos() (deprecated) | Gets Linux system information from the /proc/version file. |
Linux |
| getpgid(Int32) (deprecated) | Gets the PGID of the process specified by pid. If pid is zero, returns the process ID of the calling process. |
Linux macOS |
| getpgrp() (deprecated) | Gets the parent process ID of the calling process. |
Linux macOS |
| getpid() (deprecated) | Gets the process ID (PID) of the calling process. |
Linux Windows macOS |
| getppid() (deprecated) | Gets the parent process ID of the calling process. |
Linux macOS |
| getuid() (deprecated) | Gets the real user ID of the calling process. |
Linux macOS |
| isBlk(String) (deprecated) | Checks if the input object is a block device and returns a boolean. | Linux Windows macOS |
| isChr(String) (deprecated) | Checks if the input object is a character device and returns a boolean. | Linux Windows macOS |
| isDir(String) (deprecated) | Checks if the input object is a directory and returns a boolean. | Linux Windows macOS |
| isFIFO(String) (deprecated) | Checks if the input object is a FIFO file and returns a boolean. |
Linux macOS |
| isLnk(String) (deprecated) | Checks if the input object is a symbolic link and returns a boolean. | Linux macOS |
| isReg(String) (deprecated) | Checks if the input object is a regular file and returns a boolean. | Linux Windows macOS |
| isSock(String) (deprecated) | Checks if the input object is a socket file and returns a boolean. | Linux macOS |
| isType(String, UInt32) (deprecated) | Checks if the file is of the specified mode. | Linux macOS |
| isatty(Int32) (deprecated) | Tests if the file descriptor refers to a terminal. Returns true on success, otherwise false. |
Linux Windows macOS |
| kill(Int32, Int32) (deprecated) | The system call can be used to send any signal to any process group or process. | Linux macOS |
| killpg(Int32, Int32) (deprecated) | Sends signal sig to process group pgrp. If pgrp is 0, killpg() sends the signal to the process group of the calling process. |
Linux macOS |
| lchown(String, UInt32, UInt32) (deprecated) | Changes the owner and group of the symbolic link itself. | Linux macOS |
| link(String, String) (deprecated) | Creates a link for an existing file. A file can have multiple directory entries pointing to its i-node. |
Linux macOS |
| linkat(Int32, String, Int32, String, Int32) (deprecated) | Creates a file link relative to the directory file descriptor. | Linux macOS |
| lseek(Int32, Int64, Int32) (deprecated) | When reading or writing a file, the read or write position increases accordingly. | Linux Windows macOS |
| nice(Int32) (deprecated) | Changes the priority of the current thread. | Linux macOS |
| open64(String, Int32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux |
| open64(String, Int32, UInt32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux |
| openat(Int32, String, Int32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux macOS |
| openat(Int32, String, Int32, UInt32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux macOS |
| openat64(Int32, String, Int32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux macOS |
| openat64(Int32, String, Int32, UInt32) (deprecated) | Opens a file and returns a new file descriptor, or -1 on failure. |
Linux macOS |
| pread(Int32, CPointer<UInt8>, UIntNative, Int32) (deprecated) | Transfers nbyte bytes from the file pointed to by fd to the memory pointed to by buffer. |
Linux macOS |
| pwrite(Int32, CPointer<UInt8>, UIntNative, Int32) (deprecated) | Writes nbyte bytes from the memory pointed to by buffer to the file pointed to by fd, starting at the specified offset. |
Linux macOS |
| read(Int32, CPointer<UInt8>, UIntNative) (deprecated) | Transfers nbyte bytes from the file pointed to by fd to the memory pointed to by buffer. |
Linux Windows macOS |
| remove(String) (deprecated) | Deletes a file or directory. | Linux Windows macOS |
| rename(String, String) (deprecated) | Renames a file and moves it to another directory if necessary. | Linux Windows macOS |
| renameat(Int32, String, Int32, String) (deprecated) | Renames a file and moves it to another directory if necessary. | Linux macOS |
| setgid(UInt32) (deprecated) | Sets the effective group ID of the calling process. Requires appropriate permissions. |
Linux macOS |
| sethostname(String) (deprecated) | Sets the hostname (superuser privilege required). | Linux macOS |
| setpgid(Int32, Int32) (deprecated) | Sets the group ID of the process specified by pid to the group ID specified by pgrp. |
Linux macOS |
| setpgrp() (deprecated) | Sets the group ID of the current process to its process ID (equivalent to setpgid(0, 0)). | Linux macOS |
| setuid(UInt32) (deprecated) | Sets the effective user ID of the calling process (requires appropriate privileges). | Linux macOS |
| symlink(String, String) (deprecated) | Creates a symbolic link named symPath pointing to the file specified by path. |
Linux macOS |
| symlinkat(String, Int32, String) (deprecated) | Creates a symbolic link named symPath pointing to the file specified by path and fd. |
Linux macOS |
| ttyname(Int32) (deprecated) | Returns terminal name. | Linux Windows macOS |
| umask(UInt32) (deprecated) | Sets file mode creation mask. | Linux Windows macOS |
| unlink(String) (deprecated) | Removes a file from the filesystem. | Linux macOS |
| unlinkat(Int32, String, Int32) (deprecated) | Removes a file from the filesystem. | Linux macOS |
| write(Int32, CPointer<UInt8>, UIntNative) (deprecated) | Writes nbyte bytes from buffer to the file referenced by fd. |
Linux Windows macOS |
Constants
| Constant Name | Description | Supported Platforms |
|---|---|---|
| AT_EMPTY_PATH (deprecated) | Indicates file descriptor behavior for empty paths in filesystem operations (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows |
| AT_FDCWD (deprecated) | Special file descriptor constant for relative path operations (used with *at() system calls like fchmodat, fchownat, linkat, etc. in fd parameter). |
Linux Windows macOS |
| AT_REMOVEDIR (deprecated) | When set, performs directory removal equivalent to rmdir(2) (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| AT_SYMLINK_FOLLOW (deprecated) | Controls symbolic link resolution behavior (follows link targets when set). Typically used with AT_FDCWD in fd parameter for functions like linkat, unlinkat. |
Linux Windows macOS |
| O_CLOEXEC (deprecated) | Ensures file descriptor is closed on execve(2) to avoid race conditions in multithreaded programs (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_DIRECTORY (deprecated) | Fails if pathname is not a directory (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_CREAT (deprecated) | Creates file if it doesn't exist (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_DSYNC (deprecated) | Waits for physical I/O completion but not file attribute updates (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_EXCL (deprecated) | With O_CREAT, ensures file doesn't exist before creation (fails if file exists or is symlink) (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_NOCTTY (deprecated) | Prevents terminal device from becoming controlling terminal (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_NOFOLLOW (deprecated) | Fails if pathname is a symbolic link (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_NONBLOCK (deprecated) | Opens file in non-blocking mode (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_SYNC (deprecated) | Opens file with synchronous I/O (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux macOS |
| O_RDONLY (deprecated) | Opens file read-only (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_RDWR (deprecated) | Opens file read-write (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_WRONLY (deprecated) | Opens file write-only (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_APPEND (deprecated) | Appends data to file end on writes (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| O_RSYNC (deprecated) | Synchronizes read operations (must be combined with O_SYNC or O_DSYNC) (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux |
| O_TRUNC (deprecated) | Truncates existing file to zero length (used with open, open64, openat, openat64 functions in oflag parameter). |
Linux Windows macOS |
| R_OK (deprecated) | Tests read permission (used with access, faccessat functions in mode parameter). |
Linux Windows macOS |
| W_OK (deprecated) | Tests write permission (used with access, faccessat functions in mode parameter). |
Linux Windows macOS |
| X_OK (deprecated) | Tests execute permission (used with access, faccessat functions in mode parameter). |
Linux Windows macOS |
| F_OK (deprecated) | Tests file existence (used with access, faccessat functions in mode parameter). |
Linux Windows macOS |
| SEEK_SET (deprecated) | Sets file offset to absolute value (used with lseek function in whence parameter). |
Linux Windows macOS |
| SEEK_CUR (deprecated) | Sets file offset relative to current position (used with lseek function in whence parameter). |
Linux Windows macOS |
| SEEK_END (deprecated) | Sets file offset relative to end (used with lseek function in whence parameter). |
Linux Windows macOS |
| SIGABRT (deprecated) | Abnormal termination signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGBUS (deprecated) | Hardware fault signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGFPE (deprecated) | Arithmetic error signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGKILL (deprecated) | Termination signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGCONT (deprecated) | Continue paused process signal (default action: continue/ignore) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGHUP (deprecated) | Hangup signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGINT (deprecated) | Terminal interrupt signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGQUIT (deprecated) | Terminal quit signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGILL (deprecated) | Illegal instruction signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGTRAP (deprecated) | Hardware trap signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGIOT (deprecated) | Hardware fault signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGIO (deprecated) | Asynchronous I/O signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGPIPE (deprecated) | Broken pipe signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGALRM (deprecated) | Timer expiration signal (default action: terminate) (used with kill, killpg functions in sig parameter). |
Linux Windows macOS |
| SIGPWR (deprecated) | Power failure or restart, system call invalid, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows |
| SIGSEGV (deprecated) | Invalid memory reference, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGSTOP (deprecated) | Stop, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGSYS (deprecated) | Terminate, default action terminates process and generates core dump file for debugging analysis, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGTERM (deprecated) | Terminate, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGSTKFLT (deprecated) | Coprocessor stack fault, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows |
| SIGCHLD (deprecated) | Child process status changed, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGTSTP (deprecated) | Terminal stop signal, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGTTIN (deprecated) | Background read control tty, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGTTOU (deprecated) | Background write control tty, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGURG (deprecated) | Socket urgent condition, default action ignored, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGUSR1 (deprecated) | User-defined signal, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGUSR2 (deprecated) | User-defined signal, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGVTALRM (deprecated) | Virtual timer alarm, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGPROF (deprecated) | Profiling timer expired, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGWINCH (deprecated) | Terminal window size changed, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGXCPU (deprecated) | CPU time limit exceeded, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| SIGXFSZ (deprecated) | File size limit exceeded, default action terminates, applicable functions kill, killpg, function parameter sig. |
Linux Windows macOS |
| S_IRUSR (deprecated) | File owner has read permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IWUSR (deprecated) | File owner has write permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IRGRP (deprecated) | File group has read permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IWGRP (deprecated) | File group has write permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IFREG (deprecated) | File type is regular file, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFBLK (deprecated) | File type is block device, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFDIR (deprecated) | File type is directory, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFCHR (deprecated) | File type is character device, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFIFO (deprecated) | File type is FIFO, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFLNK (deprecated) | File type is symbolic link, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IFSOCK (deprecated) | File type is socket, applicable function isType, function parameter mode. |
Linux Windows macOS |
| S_IROTH (deprecated) | Other users have read permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IRWXG (deprecated) | File group has read, write, and execute permissions, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IRWXU (deprecated) | File owner has read, write, and execute permissions, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IWOTH (deprecated) | Other users have write permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IXOTH (deprecated) | Other users have execute permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IRWXO (deprecated) | Other users have read, write, and execute permissions, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IXGRP (deprecated) | File group has execute permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |
| S_IXUSR (deprecated) | File owner has execute permission, applicable functions open, open64, openat, openat64, chmod(mode), fchmod(mode), fchmodat(mode), creat, function parameter flag. |
Linux Windows macOS |