package core:sys/posix

Warning: This was generated for -target:windows_amd64 and might not represet every target this package supports.

⌘K
Ctrl+K
or
/

    Overview

    Bindings for most POSIX APIs.

    APIs that have been left out are due to not being useful, being fully replaced (and better) by other Odin packages, or when one of the targets hasn't implemented the API or option.

    The struct fields that are cross-platform are documented with [PSX]. Accessing these fields on one target should be the same on others. Other fields are implementation specific.

    Most macros have been reimplemented in Odin with inlined functions.

    Unimplemented headers: aio.h complex.h | See core:c/libc and our own complex types cpio.h ctype.h | See core:c/libc for most of it ndbm.h fenv.h float.h fmtmsg.h ftw.h semaphore.h | See core:sync inttypes.h | See core:c iso646.h | Impossible math.h | See core:c/libc mqueue.h | Targets don't seem to have implemented it regex.h | See core:regex search.h | Not useful in Odin spawn.h | Use fork, execve, etc. stdarg.h | See core:c/libc stdint.h | See core:c stropts.h syslog.h pthread.h | Only the actual threads API is bound, see core:sync for synchronization primitives string.h | Most of this is not useful in Odin, only a select few symbols are bound tar.h tgmath.h trace.h wchar.h wctype.h

    Index

    Types (198)
    Constants (643)
    Procedures (416)
    Procedure Groups (1)

    Types

    AF ¶

    AF :: enum i32 {
    	// Unspecified.
    	UNSPEC = 0, 
    	// Internet domain sockets for use with IPv4 addresses.
    	INET   = 2, 
    	// Internet domain sockets for use with IPv6 addresses.
    	INET6  = 30, 
    	// UNIX domain sockets.
    	UNIX   = 1, 
    }
    Related Procedures With Parameters

    AT_Flag_Bits ¶

    AT_Flag_Bits :: enum i32 {
    	EACCESS          = 4, 
    	SYMLINK_NOFOLLOW = 5, 
    	SYMLINK_FOLLOW   = 6, 
    	REMOVEDIR        = 7, 
    }

    AT_Flags ¶

    AT_Flags :: bit_set[AT_Flag_Bits; i32]

    Addrinfo_Flag_Bits ¶

    Addrinfo_Flag_Bits :: enum i32 {
    	// Socket address is intended for bind().
    	PASSIVE     = 0, 
    	// Request for canonical name.
    	CANONNAME   = 1, 
    	// Return numeric host address as name.
    	NUMERICHOST = 2, 
    	// Inhibit service name resolution.
    	NUMERICSERV = 12, 
    	// If no IPv6 addresses are found, query for IPv4 addresses and return them to the
    	// caller as IPv4-mapped IPv6 addresses.
    	V4MAPPED    = 11, 
    	// Query for both IPv4 and IPv6 addresses.
    	ALL         = 8, 
    	// Query for IPv4 addresses only when an IPv4 address is configured; query for IPv6 addresses
    	// only when an IPv6 address is configured.
    	ADDRCONFIG  = 10, 
    }

    Addrinfo_Flags ¶

    Addrinfo_Flags :: bit_set[Addrinfo_Flag_Bits; i32]

    Any_Code ¶

    Any_Code :: enum i32 {
    	// Signal sent by kill().
    	USER    = 65537, 
    	// Signal sent by sigqueue().
    	QUEUE   = 65538, 
    	// Signal generated by expiration of a timer set by timer_settime().
    	TIMER   = 65539, 
    	// Signal generated by completion of an asynchronous I/O request.
    	ASYNCIO = 65540, 
    	// Signal generated by arrival of a message on an empty message queue.
    	MESGQ   = 65541, 
    }

    BUS_Code ¶

    BUS_Code :: enum i32 {
    	// Invalid address alignment.
    	ADRALN = 1, 
    	// Nonexistent physical address.
    	ADRERR = 2, 
    	// Object-specific hardware error.
    	OBJERR = 3, 
    }

    CControl_Flag_Bits ¶

    CControl_Flag_Bits :: enum tcflag_t {
    	// CS5    = log2(CS5), /* 5 bits (pseudo) (default) */
    	CS6    = 8,  // 6 bits
    	CS7    = 9,  // 7 bits
    	CS8    = 9,  // 8 bits
    	CSTOPB = 10, // send 2 stop bits
    	CREAD  = 11, // enable receiver
    	PARENB = 12, // parity enable
    	PARODD = 13, // odd parity, else even
    	HUPCL  = 14, // hang up on last close
    	CLOCAL = 15, // ignore modem status lines
    }

    CControl_Flags ¶

    CControl_Flags :: bit_set[CControl_Flag_Bits; tcflag_t]
    Related Constants

    CInput_Flag_Bits ¶

    CInput_Flag_Bits :: enum tcflag_t {
    	IGNBRK = 0,  // ignore BREAK condition
    	BRKINT = 1,  // map BREAK to SIGINTR
    	IGNPAR = 2,  // ignore (discard) parity errors
    	PARMRK = 3,  // mark parity and framing errors
    	INPCK  = 4,  // enable checking of parity errors
    	ISTRIP = 5,  // strip 8th bit off chars
    	INLCR  = 6,  // map NL into CR
    	IGNCR  = 7,  // ignore CR
    	ICRNL  = 8,  // map CR to NL (ala CRMOD)
    	IXON   = 9,  // enable output flow control
    	IXOFF  = 10, // enable input flow control
    	IXANY  = 11, // any char will restart after stop
    }

    CLD_Code ¶

    CLD_Code :: enum i32 {
    	// Child has exited..
    	EXITED    = 1, 
    	// Child has terminated abnormally and did not create a core file.
    	KILLED    = 2, 
    	// Child has terminated abnormally and created a core file.
    	DUMPED    = 3, 
    	// Traced child trapped.
    	TRAPPED   = 4, 
    	// Child has stopped.
    	STOPPED   = 5, 
    	// Stopped child has continued.
    	CONTINUED = 6, 
    }

    CLocal_Flag_Bits ¶

    CLocal_Flag_Bits :: enum tcflag_t {
    	ECHO   = 3,  // visual erase for line kill
    	ECHOE  = 1,  // visually erase chars
    	ECHOK  = 2,  // echo NL after line kill
    	ECHONL = 4,  // echo NL even if ECHO is off
    	ICANON = 8,  // canonicalize input lines
    	IEXTEN = 10, // enable DISCARD and LNEXT
    	ISIG   = 7,  // enable signals INTR, QUIT, [D]SUSP
    	NOFLSH = 31, // don't flush after interrupt
    	TOSTOP = 22, // stop background jobs from output
    }

    COutput_Flag_Bits ¶

    COutput_Flag_Bits :: enum tcflag_t {
    	OPOST  = 0,  // enable following output processing
    	ONLCR  = 1,  // map NL to CR-NL (ala CRMOD)
    	OCRNL  = 4,  // map CR to NL on output
    	ONOCR  = 5,  // no CR output at column 0
    	ONLRET = 6,  // NL performs CR function
    	OFDEL  = 17, // fill is DEL, else NUL
    	OFILL  = 7,  // use fill characters for delay
    	// NL0    = log2(NL0), /* \n delay 0 (default) */
    	NL1    = 8,  // \n delay 1
    	// CR0    = log2(CR0), /* \r delay 0 (default) */
    	CR1    = 12, // \r delay 1
    	CR2    = 13, // \r delay 2
    	CR3    = 13, // \r delay 3
    	// TAB0   = log2(TAB0),/* horizontal tab delay 0 (default) */
    	TAB1   = 10, // horizontal tab delay 1
    	TAB3   = 11, // horizontal tab delay 3
    	// BS0    = log2(BS0), /* \b delay 0 (default) */
    	BS1    = 15, // \b delay 1
    	// VT0    = log2(VT0), /* vertical tab delay 0 (default) */
    	VT1    = 16, // vertical tab delay 1
    	// FF0    = log2(FF0), /* form feed delay 0 (default) */
    	FF1    = 14, // form feed delay 1
    }

    COutput_Flags ¶

    COutput_Flags :: bit_set[COutput_Flag_Bits; tcflag_t]
    Related Constants

    CS ¶

    CS :: enum i32 {
    	_PATH                           = 1, 
    	_POSIX_V6_ILP32_OFF32_CFLAGS    = 2, 
    	_POSIX_V6_ILP32_OFF32_LDFLAGS   = 3, 
    	_POSIX_V6_ILP32_OFF32_LIBS      = 4, 
    	_POSIX_V6_ILP32_OFFBIG_CFLAGS   = 5, 
    	_POSIX_V6_ILP32_OFFBIG_LDFLAGS  = 6, 
    	_POSIX_V6_ILP32_OFFBIG_LIBS     = 7, 
    	_POSIX_V6_LP64_OFF64_CFLAGS     = 8, 
    	_POSIX_V6_LP64_OFF64_LDFLAGS    = 9, 
    	_POSIX_V6_LP64_OFF64_LIBS       = 10, 
    	_POSIX_V6_LPBIG_OFFBIG_CFLAGS   = 11, 
    	_POSIX_V6_LPBIG_OFFBIG_LDFLAGS  = 12, 
    	_POSIX_V6_LPBIG_OFFBIG_LIBS     = 13, 
    	_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14, 
    }
    Related Procedures With Parameters

    Cancel_State ¶

    Cancel_State :: enum i32 {
    	ENABLE  = 1, 
    	DISABLE = 0, 
    }
    Related Procedures With Parameters

    Cancel_Type ¶

    Cancel_Type :: enum i32 {
    	DEFERRED     = 2, 
    	ASYNCHRONOUS = 0, 
    }
    Related Procedures With Parameters

    Clock ¶

    Clock :: enum clockid_t {
    	// system-wide monotonic clock, defined as clock measuring real time,
    	// can be set with clock_settime() and cannot have negative clock jumps.
    	MONOTONIC          = 6, 
    	// CPU-time clock associated with the process making a clock() function call.
    	PROCESS_CPUTIME_ID = 12, 
    	// system-wide clock measuring real time.
    	REALTIME           = 0, 
    	// CPU-time clock associated with the thread making a clock() function call.
    	THREAD_CPUTIME_ID  = 16, 
    }
    Related Procedures With Parameters

    Control_Char ¶

    Control_Char :: enum i32 {
    	VEOF   = 0, 
    	VEOL   = 1, 
    	VERASE = 3, 
    	VINTR  = 8, 
    	VKILL  = 5, 
    	VMIN   = 16, 
    	VQUIT  = 9, 
    	VSTART = 12, 
    	VSTOP  = 13, 
    	VSUSP  = 10, 
    	VTIME  = 17, 
    	NCCS   = 19, 
    }

    DIR ¶

    DIR :: distinct rawptr
    Related Procedures With Parameters
    Related Procedures With Returns

    D_Type ¶

    D_Type :: enum u8 {
    	UNKNOWN = 0, 
    	FIFO    = 1, 
    	CHR     = 2, 
    	DIR     = 4, 
    	BLK     = 6, 
    	REG     = 8, 
    	LNK     = 10, 
    	SOCK    = 12, 
    	WHT     = 14, 
    }
     

    NOTE: d_type is not a POSIX standard field, but all targets we support add it.

    Detach_State ¶

    Detach_State :: enum i32 {
    	// Causes all threads to be in the joinable state.
    	CREATE_JOINABLE = 1, 
    	// Causes all threads to be in the detached state.
    	CREATE_DETACHED = 2, 
    }
    Related Procedures With Parameters

    Errno ¶

    Errno :: enum i32 {
    	NONE            = 0, 
    	EDOM            = 33, 
    	EILSEQ          = 92, 
    	ERANGE          = 34, 
    	E2BIG           = 7, 
    	EACCES          = 13, 
    	EADDRINUSE      = 48, 
    	EADDRNOTAVAIL   = 49, 
    	EAFNOSUPPORT    = 47, 
    	EAGAIN          = 35, 
    	EALREADY        = 37, 
    	EBADF           = 9, 
    	EBADMSG         = 94, 
    	EBUSY           = 16, 
    	ECANCELED       = 89, 
    	ECHILD          = 10, 
    	ECONNABORTED    = 53, 
    	ECONNREFUSED    = 61, 
    	ECONNRESET      = 54, 
    	EDEADLK         = 11, 
    	EDESTADDRREQ    = 39, 
    	EDQUOT          = 69, 
    	EEXIST          = 17, 
    	EFAULT          = 14, 
    	EFBIG           = 27, 
    	EHOSTUNREACH    = 65, 
    	EIDRM           = 90, 
    	EINPROGRESS     = 36, 
    	EINTR           = 4, 
    	EINVAL          = 22, 
    	EIO             = 5, 
    	EISCONN         = 56, 
    	EISDIR          = 21, 
    	ELOOP           = 62, 
    	EMFILE          = 24, 
    	EMLINK          = 31, 
    	EMSGSIZE        = 40, 
    	EMULTIHOP       = 95, 
    	ENAMETOOLONG    = 63, 
    	ENETDOWN        = 50, 
    	ENETRESET       = 52, 
    	ENETUNREACH     = 51, 
    	ENFILE          = 23, 
    	ENOBUFS         = 55, 
    	ENODATA         = 96, 
    	ENODEV          = 19, 
    	ENOENT          = 2, 
    	ENOEXEC         = 8, 
    	ENOLCK          = 77, 
    	ENOLINK         = 97, 
    	ENOMEM          = 12, 
    	ENOMSG          = 91, 
    	ENOPROTOOPT     = 42, 
    	ENOSPC          = 28, 
    	ENOSR           = 98, 
    	ENOSTR          = 99, 
    	ENOSYS          = 78, 
    	ENOTCONN        = 57, 
    	ENOTDIR         = 20, 
    	ENOTEMPTY       = 66, 
    	ENOTRECOVERABLE = 104, 
    	ENOTSOCK        = 38, 
    	ENOTSUP         = 45, 
    	ENOTTY          = 25, 
    	ENXIO           = 6, 
    	EOPNOTSUPP      = 45, 
    	EOVERFLOW       = 84, 
    	EOWNERDEAD      = 105, 
    	EPERM           = 1, 
    	EPIPE           = 32, 
    	EPROTO          = 100, 
    	EPROTONOSUPPORT = 43, 
    	EPROTOTYPE      = 41, 
    	EROFS           = 30, 
    	ESPIPE          = 29, 
    	ESRCH           = 3, 
    	ESTALE          = 70, 
    	ETIME           = 101, 
    	ETIMEDOUT       = 60, 
    	ETXTBSY         = 26, 
    	EWOULDBLOCK     = 35, 
    	EXDEV           = 18, 
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    FCNTL_Cmd ¶

    FCNTL_Cmd :: enum i32 {
    	DUPFD         = 0, 
    	DUPFD_CLOEXEC = 67, 
    	GETFD         = 1, 
    	SETFD         = 2, 
    	GETFL         = 3, 
    	SETFL         = 4, 
    	GETLK         = 7, 
    	SETLK         = 8, 
    	SETLKW        = 9, 
    	GETOWN        = 5, 
    	SETOWN        = 6, 
    }
    Related Procedures With Parameters

    FILE ¶

    FILE :: libc.FILE

    FNM_Flag_Bits ¶

    FNM_Flag_Bits :: enum i32 {
    	// A <slash> character ( '/' ) in string shall be explicitly matched by a <slash> in pattern;
    	// it shall not be matched by either the <asterisk> or <question-mark> special characters,
    	// nor by a bracket expression.
    	PATHNAME = 1, 
    	// A leading <period> ( '.' ) in string shall match a <period> in pattern;
    	// as described by rule 2 in XCU [[ Patterns Used for Filename Expansion; https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_03 ]]
    	// where the location of "leading" is indicated by the value of PATHNAME:
    	// 1. If PATHNAME is set, a <period> is "leading" if it is the first character in string or if it immediately follows a <slash>.
    	// 2. If PATHNAME is not set, a <period> is "leading" only if it is the first character of string.
    	PERIOD   = 2, 
    	// A <backslash> character shall be treated as an ordinary character.
    	NOESCAPE = 0, 
    }

    FNM_Flags ¶

    FNM_Flags :: bit_set[FNM_Flag_Bits; i32]

    FPE_Code ¶

    FPE_Code :: enum i32 {
    	// Integer divide by zero.
    	INTDIV = 7, 
    	// Integer overflow.
    	INTOVF = 8, 
    	// Floating-point divide by zero.
    	FLTDIV = 1, 
    	// Floating-point overflow.
    	FLTOVF = 2, 
    	// Floating-point underflow.
    	FLTUND = 3, 
    	// Floating-point inexact result.
    	FLTRES = 4, 
    	// Invalid floating-point operation.
    	FLTINV = 5, 
    	// Subscript out of range.
    	FLTSUB = 6, 
    }

    Glob_Flag_Bits ¶

    Glob_Flag_Bits :: enum i32 {
    	// Append pathnames generated to the ones from a previous call to glob().
    	APPEND   = 0, 
    	// Make use of pglob->gl_offs. If this flag is set, pglob->gl_offs is used to specify how many null pointers to add to the beginning of pglob->gl_pathv.
    	// In other words, pglob->gl_pathv shall point to pglob->gl_offs null pointers, followed by pglob->gl_pathc pathname pointers, followed by a null pointer.
    	DOOFFS   = 1, 
    	// Cause glob() to return when it encounters a directory that it cannot open or read. Ordinarily,
    	// glob() continues to find matches.
    	ERR      = 2, 
    	// Each pathname that is a directory that matches pattern shall have a <slash> appended.
    	MARK     = 3, 
    	// Supports rule 3 in [[ XCU Patterns Used for Filename Expansion; https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_03 ]].
    	// If pattern does not match any pathname, then glob() shall return a list consisting of only pattern,
    	// and the number of matched pathnames is 1.
    	NOCHECK  = 4, 
    	// Disable backslash escaping.
    	NOESCAPE = 13, 
    	// Ordinarily, glob() sorts the matching pathnames according to the current setting of the
    	// LC_COLLATE category; see XBD LC_COLLATE. When this flag is used,
    	// the order of pathnames returned is unspecified.
    	NOSORT   = 5, 
    }

    Glob_Flags ¶

    Glob_Flags :: bit_set[Glob_Flag_Bits; i32]

    Glob_Result ¶

    Glob_Result :: enum i32 {
    	SUCCESS = 0, 
    	ABORTED = -2, 
    	NOMATCH = -3, 
    	NOSPACE = -1, 
    }
    Related Procedures With Returns

    ILL_Code ¶

    ILL_Code :: enum i32 {
    	// Illegal opcode.
    	ILLOPC = 1, 
    	// Illegal operand.
    	ILLOPN = 4, 
    	// Illegal addressing mode.
    	ILLADR = 5, 
    	// Illegal trap.
    	ILLTRP = 2, 
    	// Priviledged opcode.
    	PRVOPC = 3, 
    	// Priviledged register.
    	PRVREG = 6, 
    	// Coprocessor error.
    	COPROC = 7, 
    	// Internal stack error.
    	BADSTK = 8, 
    }

    IPC_Cmd ¶

    IPC_Cmd :: enum i32 {
    	RMID = 0, 
    	SET  = 1, 
    	STAT = 2, 
    }
    Related Procedures With Parameters

    IPC_Flag_Bits ¶

    IPC_Flag_Bits :: enum i32 {
    	CREAT       = 9, 
    	EXCL        = 10, 
    	NOWAIT      = 11, 
    	MSG_NOERROR = 12, 
    }

    IPC_Flags ¶

    IPC_Flags :: bit_set[IPC_Flag_Bits; i32]

    ITimer ¶

    ITimer :: enum i32 {
    	// Decrements in real time.
    	REAL    = 0, 
    	// Decrements in process virtual time, only when the process is executing.
    	VIRTUAL = 1, 
    	// Decrements both in process virtual time and when the system is running on 
    	// behalf of the process.
    	PROF    = 2, 
    }
    Related Procedures With Parameters

    Info_Errno ¶

    Info_Errno :: enum i32 {
    	NONE     = 0, 
    	// The name could not be resolved at this time. Future attempts may succeed.
    	AGAIN    = 2, 
    	// The flags had an invalid value.
    	BADFLAGS = 3, 
    	// A non-recoverable error ocurred.
    	FAIL     = 4, 
    	// The address family was not recognized or the address length was invald for the specified family.
    	FAMILY   = 5, 
    	// There was a memory allocation failure.
    	MEMORY   = 6, 
    	// The name does not resolve for the supplied parameters.
    	NONAME   = 8, 
    	// The service passed was not recognized for the specified socket.
    	SERVICE  = 9, 
    	// The intended socket type was not recognized.
    	SOCKTYPE = 10, 
    	// A system error occurred. The error code can be found in errno.
    	SYSTEM   = 11, 
    	// An argument buffer overflowed.
    	OVERFLOW = 14, 
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    Inherit_Sched ¶

    Inherit_Sched :: enum i32 {
    	// Threads inherit from the creating thread.
    	INHERIT_SCHED  = 1, 
    	// Threads scheduling shall be set to the corresponding values from the attributes object.
    	EXPLICIT_SCHED = 2, 
    }
    Related Procedures With Parameters

    Locale_Category ¶

    Locale_Category :: enum i32 {
    	ALL      = 0, 
    	COLLATE  = 1, 
    	CTYPE    = 2, 
    	MESSAGES = 6, 
    	MONETARY = 3, 
    	NUMERIC  = 4, 
    	TIME     = 5, 
    }
    Related Procedures With Parameters

    Lock_Flag_Bits ¶

    Lock_Flag_Bits :: enum i32 {
    	// Lock all pages currently mapped into the address space of the process.
    	CURRENT = 0, 
    	// Lock all pages that become mapped into the address space of the process in the future, 
    	// when those mappings are established.
    	FUTURE  = 1, 
    }

    Lock_Flags ¶

    Lock_Flags :: bit_set[Lock_Flag_Bits; i32]

    Lock_Function ¶

    Lock_Function :: enum i32 {
    	// Lock a section for exclusive use.
    	LOCK  = 1, 
    	// Test a section for locks by other processes.
    	TEST  = 3, 
    	// Test and lock a section for exclusive use.
    	TLOCK = 2, 
    	// Unlock locked sections.
    	ULOCK = 0, 
    }
    Related Procedures With Parameters

    Lock_Type ¶

    Lock_Type :: enum i16 {
    	RDLCK = 1, 
    	UNLCK = 2, 
    	WRLCK = 3, 
    }

    MAdvice ¶

    MAdvice :: enum i32 {
    	DONTNEED   = 4, 
    	NORMAL     = 0, 
    	RANDOM     = 1, 
    	SEQUENTIAL = 2, 
    	WILLNEED   = 3, 
    }
    Related Procedures With Parameters

    Map_Flag_Bits ¶

    Map_Flag_Bits :: enum i32 {
    	// Interpret addr exactly.
    	FIXED   = 4, 
    	// Changes are private.
    	PRIVATE = 1, 
    	// Changes are shared.
    	SHARED  = 0, 
    }

    Map_Flags ¶

    Map_Flags :: bit_set[Map_Flag_Bits; i32]

    Mode_Bits ¶

    Mode_Bits :: enum i32 {
    	IFCHR = 13, // Character special
    	IFIFO = 12, // FIFO special
    	IFREG = 15, // Regular
    	IFDIR = 14, // Directory
    	IRUSR = 8,  // R for owner
    	IWUSR = 7,  // W for owner
    	IXUSR = 6,  // X for owner
    	IRGRP = 5,  // R for group
    	IWGRP = 4,  // W for group
    	IXGRP = 3,  // X for group
    	IROTH = 2,  // R for other
    	IWOTH = 1,  // W for other
    	IXOTH = 0,  // X for other
    	ISUID = 11, // Set user ID on execution
    	ISGID = 10, // Set group ID on execution
    	ISVXT = 9,  // On directories, restricted deletion flag
    }

    Mode_Flag_Bits ¶

    Mode_Flag_Bits :: enum i32 {
    	X_OK = 0, 
    	W_OK = 1, 
    	R_OK = 2, 
    }

    Mode_Flags ¶

    Mode_Flags :: bit_set[Mode_Flag_Bits; i32]
    Related Constants

    Msg_Flag_Bits ¶

    Msg_Flag_Bits :: enum i32 {
    	// Control data truncated.
    	CTRUNC    = 5, 
    	// Send without using routing table.
    	DONTROUTE = 2, 
    	// Terminates a record (if supported by protocol).
    	EOR       = 3, 
    	// Out-of-band data.
    	OOB       = 0, 
    	// No SIGPIPE is generated when an attempt to send is made on a stream-oriented socket that is
    	// no longer connected.
    	NOSIGNAL  = 19, 
    	// Leave received data in queue.
    	PEEK      = 1, 
    	// Normal data truncated.
    	TRUNC     = 4, 
    	// Attempt to fill the read buffer.
    	WAITALL   = 6, 
    }

    Msg_Flags ¶

    Msg_Flags :: bit_set[Msg_Flag_Bits; i32]

    Nameinfo_Flag_Bits ¶

    Nameinfo_Flag_Bits :: enum i32 {
    	// Only the nodename portion of the FQDN is returned for local hosts.
    	NOFQDN       = 0, 
    	// The numeric form of the node's address is returned instead of its name.
    	NUMERICHOST  = 1, 
    	// Return an error if the node's name cannot be located in the database.
    	NAMEREQD     = 2, 
    	// The numeric form of the service address is returned instead of its name.
    	NUMERICSERV  = 3, 
    	// For IPv6 addresses, the numeric form of the scope identifier is returned instead of its name.
    	NUMERICSCOPE = 8, 
    	// Indicates that the service is a datagram service (SOCK_DGRAM).
    	DGRAM        = 4, 
    }

    Nameinfo_Flags ¶

    Nameinfo_Flags :: bit_set[Nameinfo_Flag_Bits; i32]

    O_Flag_Bits ¶

    O_Flag_Bits :: enum i32 {
    	// Sets FD_CLOEXEC on the file descriptor.
    	CLOEXEC   = 24, 
    	// If not exists, combined with DIRECTORY will cause creation of a directory, otherwise a regular file.
    	CREAT     = 9, 
    	// Fails if the opened descriptor would not be a directory.
    	DIRECTORY = 20, 
    	// If combined with CREAT, causes a failure if the file already exists.
    	EXCL      = 11, 
    	// If terminal device, do not make it the controlling terminal for the process.
    	NOCTTY    = 17, 
    	// Don't follow symbolic links, fail with errno ELOOP.
    	NOFOLLOW  = 8, 
    	// If exists and regular, truncate the length to 0.
    	TRUNC     = 10, 
    	// Set file offset to end of file prior to each write.
    	APPEND    = 3, 
    	// Write I/O shall complete as defined by synchronized I/O data integrity completion.
    	DSYNC     = 22, 
    	// Causes nonblocking behaviour in various situations.
    	NONBLOCK  = 2, 
    	// Write I/O shall complete as defined by synchronized I/O file integrity completion.
    	SYNC      = 7, 
    	// Execute only.
    	EXEC      = 30, 
    	// Reading and writing.
    	RDWR      = 1, 
    	// Writing only.
    	WRONLY    = 0, 
    }

    O_Flags ¶

    O_Flags :: bit_set[O_Flag_Bits; i32]
    Related Constants

    PC ¶

    PC :: enum i32 {
    	_2_SYMLINK          = 15, 
    	_ALLOC_SIZE_MIN     = 16, 
    	_ASYNC_IO           = 17, 
    	_CHOWN_RESTRICTED   = 7, 
    	_FILESIZEBITS       = 18, 
    	_LINK_MAX           = 1, 
    	_MAX_CANON          = 2, 
    	_MAX_INPUT          = 3, 
    	_NAME_MAX           = 4, 
    	_NO_TRUNC           = 8, 
    	_PATH_MAX           = 5, 
    	_PIPE_BUF           = 6, 
    	_PRIO_IO            = 19, 
    	_REC_INCR_XFER_SIZE = 20, 
    	_REC_MAX_XFER_SIZE  = 21, 
    	_REC_MIN_XFER_SIZE  = 22, 
    	_REC_XFER_ALIGN     = 23, 
    	_SYMLINK_MAX        = 24, 
    	_SYNC_IO            = 25, 
    	_VDISABLE           = 9, 
    }
    Related Procedures With Parameters

    POLL_Code ¶

    POLL_Code :: enum i32 {
    	// Data input is available.
    	IN  = 1, 
    	// Output buffers available.
    	OUT = 2, 
    	// Input message available.
    	MSG = 3, 
    	// I/O error.
    	ERR = 4, 
    	// High priority input available.
    	PRI = 5, 
    	// Device disconnected.
    	HUP = 6, 
    }

    Poll_Event ¶

    Poll_Event :: bit_set[Poll_Event_Bits; i16]

    Poll_Event_Bits ¶

    Poll_Event_Bits :: enum i16 {
    	// Data other than high-priority data may be read without blocking.
    	IN     = 0, 
    	// Normal data may be read without blocking.
    	RDNORM = 6, 
    	// Priority data may be read without blocking.
    	RDBAND = 7, 
    	// High priority data may be read without blocking.
    	PRI    = 1, 
    	// Normal data may be written without blocking.
    	OUT    = 2, 
    	// Equivalent to POLLOUT.
    	WRNORM = 2, 
    	// Priority data may be written.
    	WRBAND = 8, 
    	// An error has occurred (revents only).
    	ERR    = 3, 
    	// Device hsa been disconnected (revents only).
    	HUP    = 4, 
    	// Invalid fd member (revents only).
    	NVAL   = 5, 
    }

    Prot_Flag_Bits ¶

    Prot_Flag_Bits :: enum i32 {
    	// Data can be executed.
    	EXEC  = 2, 
    	// Data can be read.
    	READ  = 0, 
    	// Data can be written.
    	WRITE = 1, 
    }

    Prot_Flags ¶

    Prot_Flags :: bit_set[Prot_Flag_Bits; i32]
    Related Constants

    Protocol ¶

    Protocol :: enum i32 {
    	IP   = 0, 
    	ICMP = 1, 
    	IPV6 = 41, 
    	RAW  = 255, 
    	TCP  = 6, 
    	UDP  = 17, 
    }
    Related Procedures With Parameters

    RTLD_Flag_Bits ¶

    RTLD_Flag_Bits :: enum i32 {
    	LAZY   = 0, 
    	NOW    = 1, 
    	GLOBAL = 3, 
    	_MAX   = 31, 
    }

    RTLD_Flags ¶

    RTLD_Flags :: bit_set[RTLD_Flag_Bits; i32]
    Related Constants

    Resource ¶

    Resource :: enum i32 {
    	// Maximum byte size of a core file that may be created by a process.
    	CORE   = 4, 
    	// Maximum amount of CPU time, in seconds, used by a process.
    	CPU    = 0, 
    	// Maximum size of data segment of the process, in bytes.
    	DATA   = 2, 
    	// Maximum size of a file, in bytes, that may be created by a process.
    	FSIZE  = 1, 
    	// A number one greater than the maximum value that the system may assign to a newly-created descriptor.
    	NOFILE = 8, 
    	// The maximum size of the initial thread's stack, in bytes.
    	STACK  = 3, 
    	// Maximum size of total available memory of the process, in bytes.
    	AS     = 5, 
    }
    Related Procedures With Parameters

    SA_Flags ¶

    SA_Flags :: bit_set[SA_Flags_Bits; i32]

    SA_Flags_Bits ¶

    SA_Flags_Bits :: enum i32 {
    	// Do not generate SIGCHLD when children stop or stopped children continue.
    	NOCLDSTOP  = 3, 
    	// Cause signal delivery to occur on an alternate stack.
    	ONSTACK    = 0, 
    	// Cause signal disposition to be set to SIG_DFL on entry to signal handlers.
    	RESETHAND  = 2, 
    	// Cause certain functions to become restartable.
    	RESTART    = 1, 
    	// Cause extra information to be passed to signal handlers at the time of receipt of a signal.
    	SIGINFO    = 6, 
    	// Cause implementation not to create zombie processes or status information on child termination.
    	NOCLDWAIT  = 5, 
    	// Cause signal not to be automatically blocked on entry to signal handler.
    	SA_NODEFER = 4, 
    }

    SC ¶

    SC :: enum i32 {
    	_2_C_BIND                     = 18, 
    	_2_C_DEV                      = 19, 
    	_2_CHAR_TERM                  = 20, 
    	_2_FORT_DEV                   = 21, 
    	_2_FORT_RUN                   = 22, 
    	_2_LOCALEDEF                  = 23, 
    	_2_PBS                        = 59, 
    	_2_PBS_ACCOUNTING             = 60, 
    	_2_PBS_CHECKPOINT             = 61, 
    	_2_PBS_LOCATE                 = 62, 
    	_2_PBS_MESSAGE                = 63, 
    	_2_PBS_TRACK                  = 64, 
    	_2_SW_DEV                     = 24, 
    	_2_UPE                        = 25, 
    	_2_VERSION                    = 17, 
    	_ADVISORY_INFO                = 65, 
    	_AIO_LISTIO_MAX               = 42, 
    	_AIO_MAX                      = 43, 
    	_AIO_PRIO_DELTA_MAX           = 44, 
    	_ARG_MAX                      = 1, 
    	_ASYNCHRONOUS_IO              = 28, 
    	_ATEXIT_MAX                   = 107, 
    	_BARRIERS                     = 66, 
    	_BC_BASE_MAX                  = 9, 
    	_BC_DIM_MAX                   = 10, 
    	_BC_SCALE_MAX                 = 11, 
    	_BC_STRING_MAX                = 12, 
    	_CHILD_MAX                    = 2, 
    	_CLK_TCK                      = 3, 
    	_CLOCK_SELECTION              = 67, 
    	_COLL_WEIGHTS_MAX             = 13, 
    	_CPUTIME                      = 68, 
    	_DELAYTIMER_MAX               = 45, 
    	_EXPR_NEST_MAX                = 14, 
    	_FSYNC                        = 38, 
    	_GETGR_R_SIZE_MAX             = 70, 
    	_GETPW_R_SIZE_MAX             = 71, 
    	_HOST_NAME_MAX                = 72, 
    	_IOV_MAX                      = 56, 
    	_IPV6                         = 118, 
    	_JOB_CONTROL                  = 6, 
    	_LINE_MAX                     = 15, 
    	_LOGIN_NAME_MAX               = 73, 
    	_MAPPED_FILES                 = 47, 
    	_MEMLOCK                      = 30, 
    	_MEMLOCK_RANGE                = 31, 
    	_MEMORY_PROTECTION            = 32, 
    	_MESSAGE_PASSING              = 33, 
    	_MONOTONIC_CLOCK              = 74, 
    	_MQ_OPEN_MAX                  = 46, 
    	_MQ_PRIO_MAX                  = 75, 
    	_NGROUPS_MAX                  = 4, 
    	_OPEN_MAX                     = 5, 
    	_PAGE_SIZE                    = 29, 
    	_PAGESIZE                     = 29, 
    	_PRIORITIZED_IO               = 34, 
    	_PRIORITY_SCHEDULING          = 35, 
    	_RAW_SOCKETS                  = 119, 
    	_RE_DUP_MAX                   = 16, 
    	_READER_WRITER_LOCKS          = 76, 
    	_REALTIME_SIGNALS             = 36, 
    	_REGEXP                       = 77, 
    	_RTSIG_MAX                    = 48, 
    	_SAVED_IDS                    = 7, 
    	_SEM_NSEMS_MAX                = 49, 
    	_SEM_VALUE_MAX                = 50, 
    	_SEMAPHORES                   = 37, 
    	_SHARED_MEMORY_OBJECTS        = 39, 
    	_SHELL                        = 78, 
    	_SIGQUEUE_MAX                 = 51, 
    	_SPAWN                        = 79, 
    	_SPIN_LOCKS                   = 80, 
    	_SPORADIC_SERVER              = 81, 
    	_SS_REPL_MAX                  = 126, 
    	_STREAM_MAX                   = 26, 
    	_SYMLOOP_MAX                  = 120, 
    	_SYNCHRONIZED_IO              = 40, 
    	_THREAD_ATTR_STACKADDR        = 82, 
    	_THREAD_ATTR_STACKSIZE        = 83, 
    	_THREAD_CPUTIME               = 84, 
    	_THREAD_DESTRUCTOR_ITERATIONS = 85, 
    	_THREAD_KEYS_MAX              = 86, 
    	_THREAD_PRIO_INHERIT          = 87, 
    	_THREAD_PRIO_PROTECT          = 88, 
    	_THREAD_PRIORITY_SCHEDULING   = 89, 
    	_THREAD_PROCESS_SHARED        = 90, 
    	_THREAD_SAFE_FUNCTIONS        = 91, 
    	_THREAD_SPORADIC_SERVER       = 92, 
    	_THREAD_STACK_MIN             = 93, 
    	_THREAD_THREADS_MAX           = 94, 
    	_THREADS                      = 96, 
    	_TIMEOUTS                     = 95, 
    	_TIMER_MAX                    = 52, 
    	_TIMERS                       = 41, 
    	_TRACE                        = 97, 
    	_TRACE_EVENT_FILTER           = 98, 
    	_TRACE_EVENT_NAME_MAX         = 127, 
    	_TRACE_INHERIT                = 99, 
    	_TRACE_LOG                    = 100, 
    	_TRACE_NAME_MAX               = 128, 
    	_TRACE_SYS_MAX                = 129, 
    	_TRACE_USER_EVENT_MAX         = 130, 
    	_TTY_NAME_MAX                 = 101, 
    	_TYPED_MEMORY_OBJECTS         = 102, 
    	_TZNAME_MAX                   = 27, 
    	_V6_ILP32_OFF32               = 103, 
    	_V6_ILP32_OFFBIG              = 104, 
    	_V6_LP64_OFF64                = 105, 
    	_V6_LPBIG_OFFBIG              = 106, 
    	_VERSION                      = 8, 
    	_XOPEN_CRYPT                  = 108, 
    	_XOPEN_ENH_I18N               = 109, 
    	_XOPEN_REALTIME               = 111, 
    	_XOPEN_REALTIME_THREADS       = 112, 
    	_XOPEN_SHM                    = 113, 
    	_XOPEN_STREAMS                = 114, 
    	_XOPEN_UNIX                   = 115, 
    	_XOPEN_VERSION                = 116, 
    }
    Related Procedures With Parameters

    SEGV_Code ¶

    SEGV_Code :: enum i32 {
    	// Address not mapped to object.
    	MAPERR = 1, 
    	// Invalid permissions for mapped object.
    	ACCERR = 2, 
    }

    SHM_Flag_Bits ¶

    SHM_Flag_Bits :: enum i32 {
    	RDONLY = 12, 
    	RND    = 13, 
    }

    SHM_Flags ¶

    SHM_Flags :: bit_set[SHM_Flag_Bits; i32]

    SS_Flag_Bits ¶

    SS_Flag_Bits :: enum i32 {
    	// Process is executing on an alternate signal stack.
    	ONSTACK = 0, 
    	// Alternate signal stack is disabled.
    	DISABLE = 2, 
    }

    SS_Flags ¶

    SS_Flags :: bit_set[SS_Flag_Bits; i32]

    Sched_Policy ¶

    Sched_Policy :: enum i32 {
    	// Error condition of sched_getscheduler.
    	ERROR = -1, 
    	// First in-first out (FIFO) scheduling policy.
    	FIFO  = 4, 
    	// Round robin scheduling policy.
    	RR    = 2, 
    	// Another scheduling policy.
    	OTHER = 1, 
    }
    Related Procedures With Parameters

    Sem_Cmd ¶

    Sem_Cmd :: enum i32 {
    	// Returns the value of semncnt.
    	GETNCNT = 3, 
    	// Returns the value of sempid.
    	GETPID  = 4, 
    	// Return the value of semval.
    	GETVAL  = 5, 
    	// Returns the value of semval for each semaphore in the semaphore set.
    	GETALL  = 6, 
    	// Returns the value of semzcnt.
    	GETZCNT = 7, 
    	// Sets the value of semval to arg.val.
    	SETVAL  = 8, 
    	// Sets the value of semval for each semaphore in the set.
    	SETALL  = 9, 
    }
    Related Procedures With Parameters

    Shut ¶

    Shut :: enum i32 {
    	// Disables further receive operations.
    	RD   = 0, 
    	// Disables further send and receive operations.
    	RDWR = 2, 
    	// Disables further send operations.
    	WR   = 1, 
    }
    Related Procedures With Parameters

    Sig ¶

    Sig :: enum i32 {
    	// Resulting set is the union of the current set and the signal set and the complement of 
    	// the signal set pointed to by the argument.
    	BLOCK   = 1, 
    	// Resulting set is the intersection of the current set and the complement of the signal set
    	// pointed to by the argument.
    	UNBLOCK = 2, 
    	// Resulting set is the signal set pointed to by the argument.
    	SETMASK = 3, 
    }
    Related Procedures With Parameters

    Signal ¶

    Signal :: enum i32 {
    	NONE, 
    	// Process abort signal.
    	SIGABRT   = 6, 
    	// Erronous arithemtic operation.
    	SIGFPE    = 8, 
    	// Illegal instruction.
    	SIGILL    = 4, 
    	// Terminal interrupt signal.
    	SIGINT    = 2, 
    	// Invalid memory reference.
    	SIGSEGV   = 11, 
    	// Termination signal.
    	SIGTERM   = 15, 
    	// Process abort signal.
    	SIGALRM   = 14, 
    	// Access to an undefined portion of a memory object.
    	SIGBUS    = 10, 
    	// Child process terminated, stopped, or continued.
    	SIGCHLD   = 20, 
    	// Continue execution, if stopped.
    	SIGCONT   = 19, 
    	// Hangup.
    	SIGHUP    = 1, 
    	// Kill (cannot be caught or ignored).
    	SIGKILL   = 9, 
    	// Write on a pipe with no one to read it.
    	SIGPIPE   = 13, 
    	// Terminal quit signal.
    	SIGQUIT   = 3, 
    	// Stop executing (cannot be caught or ignored).
    	SIGSTOP   = 17, 
    	// Terminal stop process.
    	SIGTSTP   = 18, 
    	// Background process attempting read.
    	SIGTTIN   = 21, 
    	// Background process attempting write.
    	SIGTTOU   = 22, 
    	// User-defined signal 1.
    	SIGUSR1   = 30, 
    	// User-defined signal 2.
    	SIGUSR2   = 31, 
    	// Pollable event.
    	SIGPOLL   = 7, 
    	// Profiling timer expired.
    	SIGPROF   = 27, 
    	// Bad system call.
    	SIGSYS    = 12, 
    	// Trace/breakpoint trap.
    	SIGTRAP   = 5, 
    	// High bandwidth data is available at a socket.
    	SIGURG    = 16, 
    	// Virtual timer expired.
    	SIGVTALRM = 26, 
    	// CPU time limit exceeded.
    	SIGXCPU   = 24, 
    	// File size limit exceeded.
    	SIGXFSZ   = 25, 
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    Sock ¶

    Sock :: enum i32 {
    	// Datagram socket.
    	DGRAM     = 2, 
    	// Raw Protocol Interface.
    	RAW       = 3, 
    	// Sequenced-packet socket.
    	SEQPACKET = 5, 
    	// Byte-stream socket.
    	STREAM    = 1, 
    }
    Related Procedures With Parameters

    Sock_Option ¶

    Sock_Option :: enum i32 {
    	// Transmission of broadcast message is supported.
    	BROADCAST = 32, 
    	// Debugging information is being recorded.
    	DEBUG     = 1, 
    	// Bypass normal routing.
    	DONTROUTE = 16, 
    	// Socket error status.
    	ERROR     = 4103, 
    	// Connections are kept alive with periodic messages.
    	KEEPALIVE = 8, 
    	// Socket lingers on close.
    	LINGER    = 4224, 
    	// Out-of-band data is transmitted in line.
    	OOBINLINE = 256, 
    	// Receive buffer size.
    	RCVBUF    = 4098, 
    	// Receive low water mark.
    	RCVLOWAT  = 4100, 
    	// Receive timeout.
    	RCVTIMEO  = 4102, 
    	// Reuse of local addresses is supported.
    	REUSEADDR = 4, 
    	// Send buffer size.
    	SNDBUF    = 4097, 
    	// Send low water mark.
    	SNDLOWAT  = 4099, 
    	// Send timeout.
    	SNDTIMEO  = 4101, 
    	// Socket type.
    	TYPE      = 4104, 
    }
    Related Procedures With Parameters

    Symbol_Table ¶

    Symbol_Table :: distinct rawptr
    Related Procedures With Parameters
    Related Procedures With Returns

    Sync_Flags ¶

    Sync_Flags :: bit_set[Sync_Flags_Bits; i32]
    Related Constants

    Sync_Flags_Bits ¶

    Sync_Flags_Bits :: enum i32 {
    	// Perform asynchronous writes.
    	ASYNC      = 0, 
    	// Invalidate cached data.
    	INVALIDATE = 1, 
    	_MAX       = 31, 
    }

    TC_Action ¶

    TC_Action :: enum i32 {
    	TCIOFF = 3, 
    	TCION  = 4, 
    	TCOOFF = 1, 
    	TCOON  = 2, 
    }
    Related Procedures With Parameters

    TC_Optional_Action ¶

    TC_Optional_Action :: enum i32 {
    	TCSANOW, 
    	TCSADRAIN, 
    	TCSAFLUSH, 
    }
    Related Procedures With Parameters

    TC_Queue ¶

    TC_Queue :: enum i32 {
    	TCIFLUSH  = 1, 
    	TCOFLUSH  = 2, 
    	TCIOFLUSH = 3, 
    }
    Related Procedures With Parameters

    TRAP_Code ¶

    TRAP_Code :: enum i32 {
    	// Process breakpoint.
    	BRKPT = 1, 
    	// Process trace trap.
    	TRACE = 2, 
    }

    Thread_Scope ¶

    Thread_Scope :: enum i32 {
    	// System scheduling contention scope.
    	SYSTEM  = 1, 
    	// Process scheduling contention scope.
    	PROCESS = 2, 
    }
    Related Procedures With Parameters

    Ulimit_Cmd ¶

    Ulimit_Cmd :: enum i32 {
    	// Returns the file size limit of the process in units of 512-byte blocks inherited by children.
    	GETFSIZE = 1, 
    	// Set the file size limit for output operations, taken as a long, multiplied by 512.
    	SETFSIZE = 2, 
    }

    VFS_Flag_Bits ¶

    VFS_Flag_Bits :: enum u64 {
    	// Read-only file system.
    	RDONLY = 0, 
    	// Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.
    	NOSUID = 1, 
    }

    VFS_Flags ¶

    VFS_Flags :: bit_set[VFS_Flag_Bits; u64]

    WRDE_Errno ¶

    WRDE_Errno :: enum i32 {
    	OK      = 0, 
    	// One of the unquoted characters- <newline>, '|', '&', ';', '<', '>', '(', ')', '{', '}' -
    	// appears in words in an inappropriate context.
    	BADCHAR = 1, 
    	// Reference to undefined shell variable when WRDE_UNDEF is set in flags.
    	BADVAL  = 2, 
    	// Command substitution requested when WRDE_NOCMD was set in flags.
    	CMDSUB  = 3, 
    	// Attempt to allocate memory failed.
    	NOSPACE = 4, 
    	// Shell syntax error, such as unbalanced parentheses or an unterminated string.
    	SYNTAX  = 6, 
    }
    Related Procedures With Returns

    WRDE_Flag_Bits ¶

    WRDE_Flag_Bits :: enum i32 {
    	// Appends words to those previously generated.
    	APPEND  = 0, 
    	// Number of null pointers to prepend to we_wordv.
    	DOOFFS  = 1, 
    	// Fail if command substitution is requested.
    	NOCMD   = 2, 
    	// The pwordexp argument was passed to a previous successful call to wordexp(),
    	// and has not been passed to wordfree().
    	REUSE   = 3, 
    	// Do not redirect stderr to /dev/null.
    	SHOWERR = 4, 
    	// Report error on attempt to expand an undefined shell variable.
    	UNDEF   = 5, 
    }

    WRDE_Flags ¶

    WRDE_Flags :: bit_set[WRDE_Flag_Bits; i32]

    Wait_Flag_Bits ¶

    Wait_Flag_Bits :: enum i32 {
    	// Report the status of any continued child process specified by pid whose status has not been
    	// reported since it continued from a job control stop.
    	CONTINUED = 4, 
    	// Don't suspend execution of the calling thread if status is not immediately available for one
    	// of the child processes specified by pid.
    	NOHANG    = 0, 
    	// The status of any child process specified by pid that are stopped, and whose status has not
    	// yet been reported since they stopped, shall also be reported to the requesting process.
    	UNTRACED  = 1, 
    	// Wait for processes that have exited.
    	EXITED    = 2, 
    	// Keep the process whose status is returned in a waitable state, so it may be waited on again.
    	NOWAIT    = 5, 
    	// Children that have stopped upon receipt of a signal, and whose status either hasn't been reported
    	// or has been reported but that report was called with NOWAIT.
    	STOPPED   = 3, 
    }

    Wait_Flags ¶

    Wait_Flags :: bit_set[Wait_Flag_Bits; i32]

    Whence ¶

    Whence :: libc.Whence

    Which_Prio ¶

    Which_Prio :: enum i32 {
    	PROCESS = 0, 
    	PGRP    = 1, 
    	USER    = 2, 
    }
    Related Procedures With Parameters

    Which_Usage ¶

    Which_Usage :: enum i32 {
    	SELF     = 0, 
    	CHILDREN = -1, 
    }
    Related Procedures With Parameters

    addrinfo ¶

    addrinfo :: struct {
    	ai_flags:     bit_set[Addrinfo_Flag_Bits; i32],
    	// [PSX] input flags 
    	ai_family:    AF,
    	// [PSX] address family of socket 
    	ai_socktype:  Sock,
    	// [PSX] socket type 
    	ai_protocol:  Protocol,
    	// [PSX] protocol of socket 
    	ai_addrlen:   socklen_t,
    	// [PSX] length of socket address 
    	ai_canonname: cstring,
    	// [PSX] canonical name of service location 
    	ai_addr:      ^sockaddr,
    	// [PSX] binary address 
    	ai_next:      ^addrinfo,
    }
    Related Procedures With Parameters

    blkcnt_t ¶

    blkcnt_t :: distinct i64

    blksize_t ¶

    blksize_t :: distinct i32

    cc_t ¶

    cc_t :: distinct u8

    clock_t ¶

    clock_t :: libc.clock_t

    clockid_t ¶

    clockid_t :: distinct i32
    Related Procedures With Parameters

    cmsghdr ¶

    cmsghdr :: struct {
    	cmsg_len:   socklen_t,
    	// [PSX] data byte count, including cmsghdr 
    	cmsg_level: i32,
    	// [PSX] originating protocol 
    	cmsg_type:  i32,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    dev_t ¶

    dev_t :: distinct i32
    Related Procedures With Parameters

    dir_loc ¶

    dir_loc :: i64

    dirent ¶

    dirent :: struct {
    	d_ino:     ino_t,
    	// [PSX] file number of entry 
    	d_seekoff: u64,
    	// seek offset 
    	d_reclen:  u16,
    	// length of this record 
    	d_namelen: u16,
    	// length of string in d_name 
    	d_type:    D_Type,
    	// file type  
    	d_name:    [1024]u8 `fmt:"s,0"`,
    }
    Related Procedures With Returns

    div_t ¶

    div_t :: libc.div_t

    fd_set ¶

    fd_set :: struct #align (ALIGN) {
    	fds_bits: [32]i32,
    }
    Related Procedures With Parameters

    flock ¶

    flock :: struct {
    	l_start:  off_t,
    	// [PSX] relative offset in bytes 
    	l_len:    off_t,
    	// [PSX] size; if 0 then until EOF 
    	l_pid:    pid_t,
    	// [PSX] process ID of the process holding the lock 
    	l_type:   Lock_Type,
    	// [PSX] type of lock 
    	l_whence: i16,
    }

    fpos_t ¶

    fpos_t :: libc.fpos_t

    fsblkcnt_t ¶

    fsblkcnt_t :: distinct u32

    gid_t ¶

    gid_t :: distinct u32
    Related Procedures With Parameters
    Related Procedures With Returns

    glob_t ¶

    glob_t :: struct {
    	gl_pathc:    uint,
    	// [PSX] count of paths matched by pattern 
    	gl_matchc:   i32,
    	// count of paths matching pattern 
    	gl_offs:     uint,
    	// [PSX] slots to reserve at the beginning of gl_pathv 
    	gl_flags:    bit_set[Glob_Flag_Bits; i32],
    	// copy of flags parameter to glob 
    	gl_pathv:    [^]cstring `fmt:"v,gl_pathc"`,
    	using _:     struct #raw_union {
    		gl_errfunc: proc "c" (cstring, i32) -> i32,
    		gl_errblk:  proc "c" (cstring, i32) -> i32,
    	},
    	gl_closedir: proc "c" (dirp: DIR),
    	gl_readdir:  proc "c" (dirp: DIR) -> ^dirent,
    	gl_opendir:  proc "c" (path: cstring) -> DIR,
    	gl_lstat:    proc "c" (path: cstring, buf: ^stat_t) -> result,
    	gl_stat:     proc "c" (path: cstring, buf: ^stat_t) -> result,
    }
    Related Procedures With Parameters

    group ¶

    group :: struct {
    	gr_name:   cstring,
    	// [PSX] group name 
    	gr_passwd: cstring,
    	// group password 
    	gr_gid:    gid_t,
    	// [PSX] group id 
    	gr_mem:    [^]cstring,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    hostent ¶

    hostent :: struct {
    	h_name:      cstring,
    	// [PSX] official name of host 
    	h_aliases:   [^]cstring `fmt:"v,0"`,
    	// [PSX] alias list 
    	h_addrtype:  AF,
    	// [PSX] host address type 
    	h_length:    i32,
    	// [PSX] length of address 
    	h_addr_list: [^][^]u8 `fmt:"v,0"`,
    }
    Related Procedures With Returns

    iconv_t ¶

    iconv_t :: distinct rawptr
    Related Procedures With Parameters
    Related Procedures With Returns

    id_t ¶

    id_t :: distinct u32
    Related Procedures With Parameters

    idtype_t ¶

    idtype_t :: enum i32 {
    	// Wait for any children and `id` is ignored.
    	P_ALL, 
    	// Wait for any child wiith a process group ID equal to `id`.
    	P_PID, 
    	// Wait for any child with a process group ID equal to `id`.
    	P_PGID, 
    }
    Related Procedures With Parameters

    if_nameindex_t ¶

    if_nameindex_t :: struct {
    	if_index: u32,
    	// [PSX] 1, 2, ... 
    	if_name:  cstring,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    in_addr ¶

    in_addr :: struct {
    	s_addr: u32be,
    }
    Related Procedures With Parameters

    in_addr_t ¶

    in_addr_t :: u32be

    in_port_t ¶

    in_port_t :: u16be

    ino_t ¶

    ino_t :: distinct u64

    iovec ¶

    iovec :: struct {
    	iov_base: rawptr,
    	// [PSX] base address of I/O memory region 
    	iov_len:  uint,
    }
    Related Procedures With Parameters

    ipc_perm ¶

    ipc_perm :: struct {
    	uid:  uid_t,
    	// [PSX] owner's user ID 
    	gid:  gid_t,
    	// [PSX] owner's group ID 
    	cuid: uid_t,
    	// [PSX] creator's user ID 
    	cgid: gid_t,
    	// [PSX] creator's group ID 
    	mode: bit_set[Mode_Bits; _mode_t],
    	// [PSX] read/write perms 
    	_seq: u16,
    	_key: key_t,
    }

    ipv6_mreq ¶

    ipv6_mreq :: struct {
    	ipv6mr_multiaddr: in6_addr,
    	// [PSX] IPv6 multicast address 
    	ipv6mr_interface: u32,
    }

    itimerval ¶

    itimerval :: struct {
    	it_interval: timeval,
    	// [PSX] timer interval 
    	it_value:    timeval,
    }
    Related Procedures With Parameters

    jmp_buf ¶

    jmp_buf :: libc.jmp_buf

    key_t ¶

    key_t :: distinct i32
    Related Procedures With Parameters
    Related Procedures With Returns
    Related Constants

    lconv ¶

    lconv :: struct {
    	decimal_point:      cstring,
    	thousand_sep:       cstring,
    	grouping:           cstring,
    	int_curr_symbol:    cstring,
    	currency_symbol:    cstring,
    	mon_decimal_points: cstring,
    	mon_thousands_sep:  cstring,
    	mon_grouping:       cstring,
    	positive_sign:      cstring,
    	negative_sign:      cstring,
    	int_frac_digits:    u8,
    	frac_digits:        u8,
    	p_cs_precedes:      u8,
    	p_sep_by_space:     u8,
    	n_cs_precedes:      u8,
    	n_sep_by_space:     u8,
    	p_sign_posn:        u8,
    	n_sign_posn:        u8,
    	int_p_cs_precedes:  u8,
    	int_n_cs_precedes:  u8,
    	int_p_sep_by_space: u8,
    	int_n_sep_by_space: u8,
    	int_p_sign_posn:    u8,
    	int_n_sign_posn:    u8,
    }
     

    NOTE: All of these fields are standard ([PSX]).

    Related Procedures With Returns

    ldiv_t ¶

    ldiv_t :: libc.ldiv_t

    linger ¶

    linger :: struct {
    	l_onoff:  i32,
    	// [PSX] indicates whether linger option is enabled 
    	l_linger: i32,
    }

    lldiv_t ¶

    lldiv_t :: libc.lldiv_t

    msghdr ¶

    msghdr :: struct {
    	msg_name:       rawptr,
    	// [PSX] optional address 
    	msg_namelen:    socklen_t,
    	// [PSX] size of address 
    	msg_iov:        [^]iovec,
    	// [PSX] scatter/gather array 
    	msg_iovlen:     i32,
    	// [PSX] members in msg_iov 
    	msg_control:    rawptr,
    	// [PSX] ancillary data 
    	msg_controllen: socklen_t,
    	// [PSX] ancillary data buffer length 
    	msg_flags:      bit_set[Msg_Flag_Bits; i32],
    }
    Related Procedures With Parameters

    msglen_t ¶

    msglen_t :: distinct u64

    msgqnum_t ¶

    msgqnum_t :: distinct u64

    msqid_ds ¶

    msqid_ds :: struct #align (4) {
    	msg_perm:   ipc_perm,
    	// [PSX] operation permission structure 
    	msg_first:  i32,
    	msg_last:   i32,
    	msg_cbytes: msglen_t,
    	msg_qnum:   msgqnum_t,
    	// [PSX] number of messages currently on queue 
    	msg_qbytes: msglen_t,
    	// [PSX] maximum number of bytes allowed on queue 
    	msg_lspid:  pid_t,
    	// [PSX] process ID of last msgsnd() 
    	msg_lrpid:  pid_t,
    	// [PSX] process ID of last msgrcv() 
    	msg_stime:  libc.time_t,
    	// [PSX] time of last msgsnd() 
    	msg_pad1:   i32,
    	using _:    struct #align (4) {
    		msg_rtime: libc.time_t,
    		// [PSX] time of last msgrcv() 
    		msg_pad2:  i32,
    		using _:   struct #align (4) {
    			msg_ctime: libc.time_t,
    			// [PSX] time of last change 
    			msg_pad3:  i32,
    			msg_pad4:  [4]i32,
    		},
    	},
    }
    Related Procedures With Parameters

    netent ¶

    netent :: struct {
    	n_name:     cstring,
    	// [PSX] official name of net 
    	n_aliases:  [^]cstring `fmt:"v,0"`,
    	// [PSX] alias list 
    	n_addrtype: AF,
    	// [PSX] net address type 
    	n_net:      u32,
    }
    Related Procedures With Returns

    nfds_t ¶

    nfds_t :: u32

    nl_item ¶

    nl_item :: enum nl_item_t {
    	CODESET     = 0, 
    	D_T_FMT     = 1, 
    	D_FMT       = 2, 
    	T_FMT       = 3, 
    	T_FMT_AMPM  = 4, 
    	AM_STR      = 5, 
    	PM_STR      = 6, 
    	DAY_1       = 7, 
    	DAY_2       = 8, 
    	DAY_3       = 9, 
    	DAY_4       = 10, 
    	DAY_5       = 11, 
    	DAY_6       = 12, 
    	DAY_7       = 13, 
    	ABDAY_1     = 14, 
    	ABDAY_2     = 15, 
    	ABDAY_3     = 16, 
    	ABDAY_4     = 17, 
    	ABDAY_5     = 18, 
    	ABDAY_6     = 19, 
    	ABDAY_7     = 20, 
    	MON_1       = 21, 
    	MON_2       = 22, 
    	MON_3       = 23, 
    	MON_4       = 24, 
    	MON_5       = 25, 
    	MON_6       = 26, 
    	MON_7       = 27, 
    	MON_8       = 28, 
    	MON_9       = 29, 
    	MON_10      = 30, 
    	MON_11      = 31, 
    	MON_12      = 32, 
    	ABMON_1     = 33, 
    	ABMON_2     = 34, 
    	ABMON_3     = 35, 
    	ABMON_4     = 36, 
    	ABMON_5     = 37, 
    	ABMON_6     = 38, 
    	ABMON_7     = 39, 
    	ABMON_8     = 40, 
    	ABMON_9     = 41, 
    	ABMON_10    = 42, 
    	ABMON_11    = 43, 
    	ABMON_12    = 44, 
    	ERA         = 45, 
    	ERA_D_FMT   = 46, 
    	ERA_D_T_FMT = 47, 
    	ERA_T_FMT   = 48, 
    	ALT_DIGITS  = 49, 
    	RADIXCHAR   = 50, 
    	THOUSEP     = 51, 
    	YESEXPR     = 52, 
    	NOEXPR      = 53, 
    	CRNCYSTR    = 56, 
    }
    Related Procedures With Parameters

    nl_item_t ¶

    nl_item_t :: distinct i32
     

    NOTE: declared with _t so we can enumerate the real nl_info.

    nlink_t :: distinct u16

    off_t ¶

    off_t :: distinct i64
    Related Procedures With Parameters
    Related Procedures With Returns

    passwd ¶

    passwd :: struct {
    	pw_name:   cstring,
    	// [PSX] user name 
    	pw_passwd: cstring,
    	// encrypted password 
    	pw_uid:    uid_t,
    	// [PSX] user uid 
    	pw_gid:    gid_t,
    	// [PSX] user gid 
    	pw_change: libc.time_t,
    	// password change time 
    	pw_class:  cstring,
    	// user access class 
    	pw_gecos:  cstring,
    	// Honeywell login info 
    	pw_dir:    cstring,
    	// [PSX] home directory 
    	pw_shell:  cstring,
    	// [PSX] default shell 
    	pw_expire: libc.time_t,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    pid_t ¶

    pid_t :: distinct i32
    Related Procedures With Parameters
    Related Procedures With Returns

    pollfd ¶

    pollfd :: struct {
    	fd:      FD,
    	// [PSX] the following descriptor being polled 
    	events:  bit_set[Poll_Event_Bits; i16],
    	// [PSX] the input event flags 
    	revents: bit_set[Poll_Event_Bits; i16],
    }
    Related Procedures With Parameters

    protoent ¶

    protoent :: struct {
    	p_name:    cstring,
    	// [PSX] official protocol name 
    	p_aliases: [^]cstring `fmt:"v,0"`,
    	// [PSX] alias list 
    	p_proto:   i32,
    }
    Related Procedures With Returns

    pthread_key_t ¶

    pthread_key_t :: distinct u64
    Related Procedures With Parameters

    pton_result ¶

    pton_result :: enum i32 {
    	AFNOSUPPORT = -1, 
    	INVALID     = 0, 
    	SUCCESS     = 1, 
    }
    Related Procedures With Returns

    rlim_t ¶

    rlim_t :: distinct u64
    Related Constants

    rlimit ¶

    rlimit :: struct {
    	rlim_cur: rlim_t,
    	// [PSX] the current (soft) limit 
    	rlim_max: rlim_t,
    }
    Related Procedures With Parameters

    rusage ¶

    rusage :: struct {
    	ru_utime:    timeval,
    	// [PSX] user time used 
    	ru_stime:    timeval,
    	ru_maxrss:   i64,
    	// max resident set size (PL) 
    	ru_ixrss:    i64,
    	// integral shared memory size (NU) 
    	ru_idrss:    i64,
    	// integral unshared data (NU) 
    	ru_isrss:    i64,
    	// integral unshared stack (NU) 
    	ru_minflt:   i64,
    	// page reclaims (NU) 
    	ru_majflt:   i64,
    	// page faults (NU) 
    	ru_nswap:    i64,
    	// swaps (NU) 
    	ru_inblock:  i64,
    	// block input operations (atomic) 
    	ru_outblock: i64,
    	// block output operations (atomic) 
    	ru_msgsnd:   i64,
    	// messages sent (atomic) 
    	ru_msgrcv:   i64,
    	// messages received (atomic) 
    	ru_nsignals: i64,
    	// signals received (atomic) 
    	ru_nvcsw:    i64,
    	// voluntary context switches (atomic) 
    	ru_nivcsw:   i64,
    }
    Related Procedures With Parameters

    sa_family_t ¶

    sa_family_t :: enum _sa_family_t {
    	// Unspecified.
    	UNSPEC = 0, 
    	// Internet domain sockets for use with IPv4 addresses.
    	INET   = 2, 
    	// Internet domain sockets for use with IPv6 addresses.
    	INET6  = 30, 
    	// UNIX domain sockets.
    	UNIX   = 1, 
    }

    sched_param ¶

    sched_param :: struct {
    	sched_priority: i32,
    	// [PSX] process or thread execution scheduling priority 
    	_:              [4]u8,
    }
    Related Procedures With Parameters

    sembuf ¶

    sembuf :: struct {
    	sem_num: u16,
    	// [PSX] semaphore number 
    	sem_op:  i16,
    	// [PSX] semaphore operation 
    	sem_flg: i16,
    }
    Related Procedures With Parameters

    semid_ds ¶

    semid_ds :: struct #align (4) {
    	sem_perm:  ipc_perm,
    	// [PSX] operation permission structure 
    	sem_base:  i32,
    	// 32 bit base ptr for semaphore set 
    	sem_nsems: u16,
    	// [PSX] number of semaphores in set 
    	sem_otime: libc.time_t,
    	// [PSX] last semop() 
    	sem_pad1:  i32,
    	using _:   struct #align (4) {
    		sem_ctime: libc.time_t,
    		// [PSX] last time changed by semctl() 
    		sem_pad2:  i32,
    		sem_pad3:  [4]i32,
    	},
    }

    semun ¶

    semun :: struct #raw_union {
    	val:   i32,
    	buf:   ^semid_ds,
    	array: [^]u16,
    }
    Related Procedures With Parameters

    servent ¶

    servent :: struct {
    	s_name:    cstring,
    	// [PSX] official service name 
    	s_aliases: [^]cstring `fmt:"v,0"`,
    	// [PSX] alias list 
    	s_port:    i32,
    	// [PSX] port # 
    	s_proto:   cstring,
    }
    Related Procedures With Returns

    shmatt_t ¶

    shmatt_t :: distinct u16

    shmid_ds ¶

    shmid_ds :: struct #align (4) {
    	shm_perm:   ipc_perm,
    	// [PSX] operation permission structure 
    	shm_segsz:  uint,
    	// [PSX] size of segment in bytes 
    	shm_lpid:   pid_t,
    	// [PSX] process ID of last shared memory operation 
    	shm_cpid:   pid_t,
    	// [PSX] process ID of creator 
    	shm_nattch: shmatt_t,
    	// [PSX] number of current attaches 
    	using _:    struct #align (4) {
    		shm_atime:    libc.time_t,
    		// [PSX] time of last shmat() 
    		shm_dtime:    libc.time_t,
    		// [PSX] time of last shmdt() 
    		shm_ctime:    libc.time_t,
    		// [PSX] time of last change by shmctl() 
    		shm_internal: rawptr,
    	},
    }
    Related Procedures With Parameters

    sigaction_t ¶

    sigaction_t :: struct {
    	using _:  struct #raw_union {
    		sa_handler:   proc "c" (Signal),
    		// [PSX] signal-catching function or one of the SIG_IGN or SIG_DFL 
    		sa_sigaction: proc "c" (Signal, ^siginfo_t, rawptr),
    	},
    	sa_mask:  sigset_t,
    	// [PSX] set of signals to be blocked during execution of the signal handling function 
    	sa_flags: bit_set[SA_Flags_Bits; i32],
    }
    Related Procedures With Parameters

    siginfo_t ¶

    siginfo_t :: struct {
    	si_signo:  Signal,
    	// [PSX] signal number 
    	si_errno:  Errno,
    	// [PSX] errno value associated with this signal 
    	si_code:   struct #raw_union {
    		// [PSX] specific more detailed codes per signal 
    		ill:  ILL_Code,
    		fpe:  FPE_Code,
    		segv: SEGV_Code,
    		bus:  BUS_Code,
    		trap: TRAP_Code,
    		chld: CLD_Code,
    		poll: POLL_Code,
    		any:  Any_Code,
    	},
    	si_pid:    pid_t,
    	// [PSX] sending process ID 
    	si_uid:    uid_t,
    	// [PSX] real user ID of sending process 
    	si_status: i32,
    	// [PSX] exit value or signal 
    	si_addr:   rawptr,
    	// [PSX] address of faulting instruction 
    	si_value:  sigval,
    	// [PSX] signal value 
    	si_band:   i64,
    	// [PSX] band event for SIGPOLL 
    	__pad:     [7]u64,
    }
    Related Procedures With Parameters

    sigjmp_buf ¶

    sigjmp_buf :: struct #align (16) {
    	_: [4096]u8,
    }
    Related Procedures With Parameters

    sigval ¶

    sigval :: struct #raw_union {
    	sigval_int: i32,
    	// [PSX] integer signal value 
    	sigval_ptr: rawptr,
    }

    sockaddr ¶

    sockaddr :: struct {
    	sa_len:    u8,
    	// total length 
    	sa_family: sa_family_t,
    	// [PSX] address family 
    	sa_data:   [14]u8,
    }
    Related Procedures With Parameters

    sockaddr_in ¶

    sockaddr_in :: struct {
    	sin_len:    u8,
    	sin_family: sa_family_t,
    	// [PSX] AF_INET (but a smaller size) 
    	sin_port:   u16be,
    	// [PSX] port number 
    	sin_addr:   in_addr,
    	// [PSX] IP address 
    	sin_zero:   [8]u8,
    }

    sockaddr_in6 ¶

    sockaddr_in6 :: struct {
    	sin6_len:      u8,
    	sin6_family:   sa_family_t,
    	// [PSX] AF_INET6 (but a smaller size) 
    	sin6_port:     u16be,
    	// [PSX] port number 
    	sin6_flowinfo: u32,
    	// [PSX] IPv6 traffic class and flow information 
    	sin6_addr:     in6_addr,
    	// [PSX] IPv6 address 
    	sin6_scope_id: u32,
    }

    sockaddr_storage ¶

    sockaddr_storage :: struct {
    	ss_len:     u8,
    	// address length 
    	ss_family:  sa_family_t,
    	// [PSX] address family 
    	__ss_pad1:  [6]u8,
    	__ss_align: i64,
    	// force structure storage alignment 
    	__ss_pad2:  [112]u8,
    }

    sockaddr_un ¶

    sockaddr_un :: struct {
    	sun_len:    u8,
    	// sockaddr len including nil 
    	sun_family: sa_family_t,
    	// [PSX] address family 
    	sun_path:   [104]u8,
    }

    speed_t ¶

    speed_t :: enum _speed_t {
    	B0     = 0, 
    	B50    = 50, 
    	B75    = 75, 
    	B110   = 110, 
    	B134   = 134, 
    	B150   = 150, 
    	B200   = 200, 
    	B300   = 300, 
    	B600   = 600, 
    	B1200  = 1200, 
    	B1800  = 1800, 
    	B2400  = 2400, 
    	B4800  = 4800, 
    	B9600  = 9600, 
    	B19200 = 19200, 
    	B38400 = 38400, 
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    stack_t ¶

    stack_t :: struct {
    	ss_sp:    rawptr,
    	// [PSX] stack base or pointer 
    	ss_size:  uint,
    	// [PSX] stack size 
    	ss_flags: bit_set[SS_Flag_Bits; i32],
    }
    Related Procedures With Parameters

    stat_t ¶

    stat_t :: struct {
    	st_dev:           dev_t,
    	// [XSI] ID of device containing file 
    	st_mode:          bit_set[Mode_Bits; _mode_t],
    	// [XSI] mode of file 
    	st_nlink:         nlink_t,
    	// [XSI] number of hard links 
    	st_ino:           ino_t,
    	// [XSI] file serial number 
    	st_uid:           uid_t,
    	// [XSI] user ID of the file 
    	st_gid:           gid_t,
    	// [XSI] group ID of the file 
    	st_rdev:          dev_t,
    	// [XSI] device ID 
    	st_atim:          libc.timespec,
    	// [XSI] time of last access 
    	st_mtim:          libc.timespec,
    	// [XSI] time of last data modification 
    	st_ctim:          libc.timespec,
    	// [XSI] time of last status change 
    	st_birthtimespec: libc.timespec,
    	// time of file creation(birth) 
    	st_size:          off_t,
    	// [XSI] file size, in bytes 
    	st_blocks:        blkcnt_t,
    	// [XSI] blocks allocated for file 
    	st_blksize:       blksize_t,
    	// [XSI] optimal blocksize for I/O 
    	st_flags:         u32,
    	// user defined flags for file 
    	st_gen:           u32,
    	// file generation number 
    	st_lspare:        i32,
    	// RESERVED 
    	st_qspare:        [2]i64,
    }
    Related Procedures With Parameters

    statvfs_t ¶

    statvfs_t :: struct {
    	f_bsize:   u64,
    	// [PSX] file system block size 
    	f_frsize:  u64,
    	// [PSX] fundamental file system block size 
    	f_blocks:  fsblkcnt_t,
    	// [PSX] total number of blocks on file system in units of f_frsize 
    	f_bfree:   fsblkcnt_t,
    	// [PSX] total number of free blocks 
    	f_bavail:  fsblkcnt_t,
    	// [PSX] number of free blocks available to non-privileged process 
    	f_files:   fsblkcnt_t,
    	// [PSX] total number of file serial numbers 
    	f_ffree:   fsblkcnt_t,
    	// [PSX] total number of free file serial numbers 
    	f_favail:  fsblkcnt_t,
    	// [PSX] number of file serial numbers available to non-privileged process 
    	f_fsid:    u64,
    	// [PSX] file system ID 
    	f_flag:    bit_set[VFS_Flag_Bits; u64],
    	// [PSX] bit mask of f_flag values 
    	f_namemax: u64,
    }
    Related Procedures With Parameters

    suseconds_t ¶

    suseconds_t :: distinct i32

    tcflag_t ¶

    tcflag_t :: distinct u64

    termios ¶

    termios :: struct {
    	c_iflag:  bit_set[CInput_Flag_Bits; tcflag_t],
    	// [XBD] input flags 
    	c_oflag:  bit_set[COutput_Flag_Bits; tcflag_t],
    	// [XBD] output flags 
    	c_cflag:  bit_set[CControl_Flag_Bits; tcflag_t],
    	// [XBD] control flags 
    	c_lflag:  bit_set[CLocal_Flag_Bits; tcflag_t],
    	// [XBD] local flag 
    	c_cc:     [Control_Char]cc_t,
    	// [XBD] control chars 
    	c_ispeed: speed_t,
    	// input speed 
    	c_ospeed: speed_t,
    }
    Related Procedures With Parameters

    time_t ¶

    time_t :: libc.time_t

    timespec ¶

    timespec :: libc.timespec

    timeval ¶

    timeval :: struct {
    	tv_sec:  libc.time_t,
    	// [PSX] seconds 
    	tv_usec: suseconds_t,
    }
    Related Procedures With Parameters

    tm ¶

    tm :: libc.tm

    tms ¶

    tms :: struct {
    	tms_utime:  libc.clock_t,
    	// [PSX] user CPU time 
    	tms_stime:  libc.clock_t,
    	// [PSX] system CPU time 
    	tms_cutime: libc.clock_t,
    	// [PSX] terminated children user CPU time 
    	tms_cstime: libc.clock_t,
    }
    Related Procedures With Parameters

    uid_t ¶

    uid_t :: distinct u32
    Related Procedures With Parameters
    Related Procedures With Returns

    utimbuf ¶

    utimbuf :: struct {
    	actime:  libc.time_t,
    	// [PSX] access time (seconds since epoch) 
    	modtime: libc.time_t,
    }
    Related Procedures With Parameters

    utsname ¶

    utsname :: struct {
    	sysname:  [256]u8 `fmt:"s,0"`,
    	// [PSX] name of OS 
    	nodename: [256]u8 `fmt:"s,0"`,
    	// [PSX] name of this network node 
    	release:  [256]u8 `fmt:"s,0"`,
    	// [PSX] release level 
    	version:  [256]u8 `fmt:"s,0"`,
    	// [PSX] version level 
    	machine:  [256]u8 `fmt:"s,0"`,
    }
    Related Procedures With Parameters

    wordexp_t ¶

    wordexp_t :: struct {
    	we_wordc: uint,
    	// [PSX] count of words matched by words 
    	we_wordv: [^]cstring,
    	// [PSX] pointer to list of expanded words 
    	we_offs:  uint,
    }
    Related Procedures With Parameters

    Constants

    ABDAY_1 ¶

    ABDAY_1 :: 14

    ABDAY_2 ¶

    ABDAY_2 :: 15

    ABDAY_3 ¶

    ABDAY_3 :: 16

    ABDAY_4 ¶

    ABDAY_4 :: 17

    ABDAY_5 ¶

    ABDAY_5 :: 18

    ABDAY_6 ¶

    ABDAY_6 :: 19

    ABDAY_7 ¶

    ABDAY_7 :: 20

    ABMON_1 ¶

    ABMON_1 :: 33

    ABMON_10 ¶

    ABMON_10 :: 42

    ABMON_11 ¶

    ABMON_11 :: 43

    ABMON_12 ¶

    ABMON_12 :: 44

    ABMON_2 ¶

    ABMON_2 :: 34

    ABMON_3 ¶

    ABMON_3 :: 35

    ABMON_4 ¶

    ABMON_4 :: 36

    ABMON_5 ¶

    ABMON_5 :: 37

    ABMON_6 ¶

    ABMON_6 :: 38

    ABMON_7 ¶

    ABMON_7 :: 39

    ABMON_8 ¶

    ABMON_8 :: 40

    ABMON_9 ¶

    ABMON_9 :: 41

    AF_INET ¶

    AF_INET :: 2

    AF_INET6 ¶

    AF_INET6 :: 30

    AF_UNIX ¶

    AF_UNIX :: 1

    AF_UNSPEC ¶

    AF_UNSPEC :: 0

    AI_ADDRCONFIG ¶

    AI_ADDRCONFIG :: 0x00000400

    AI_ALL ¶

    AI_ALL :: 0x00000100

    AI_CANONNAME ¶

    AI_CANONNAME :: 0x00000002

    AI_NUMERICHOST ¶

    AI_NUMERICHOST :: 0x00000004

    AI_NUMERICSERV ¶

    AI_NUMERICSERV :: 0x00001000

    AI_PASSIVE ¶

    AI_PASSIVE :: 0x00000001

    AI_V4MAPPED ¶

    AI_V4MAPPED :: 0x00000800

    ALT_DIGITS ¶

    ALT_DIGITS :: 49

    AM_STR ¶

    AM_STR :: 5

    ARG_MAX ¶

    ARG_MAX :: 1024 * 1024
     

    AIO_LISTIO_MAX :: sysconf(._AIO_LISTIO_MAX) AIO_MAX :: sysconf(._AIO_MAX) AIO_PRIO_DELTA_MAX :: sysconf(._AIO_PRIO_DELTA_MAX)

    AT_EACCESS ¶

    AT_EACCESS :: 0x0010

    AT_FDCWD ¶

    AT_FDCWD: FD : -2

    AT_REMOVEDIR ¶

    AT_REMOVEDIR :: 0x0080
    AT_SYMLINK_FOLLOW :: 0x0040
    AT_SYMLINK_NOFOLLOW :: 0x0020

    B0 ¶

    B0 :: 0

    B110 ¶

    B110 :: 110

    B1200 ¶

    B1200 :: 1200

    B134 ¶

    B134 :: 134

    B150 ¶

    B150 :: 150

    B1800 ¶

    B1800 :: 1800

    B19200 ¶

    B19200 :: 19200

    B200 ¶

    B200 :: 200

    B2400 ¶

    B2400 :: 2400

    B300 ¶

    B300 :: 300

    B38400 ¶

    B38400 :: 38400

    B4800 ¶

    B4800 :: 4800

    B50 ¶

    B50 :: 50

    B600 ¶

    B600 :: 600

    B75 ¶

    B75 :: 75

    B9600 ¶

    B9600 :: 9600

    BC_BASE_MAX ¶

    BC_BASE_MAX :: 99

    BC_DIM_MAX ¶

    BC_DIM_MAX :: 2048

    BC_SCALE_MAX ¶

    BC_SCALE_MAX :: 99

    BC_STRING_MAX ¶

    BC_STRING_MAX :: 1000

    BRKINT ¶

    BRKINT :: 0x00000002

    BS0 ¶

    BS0 :: 0x00000000

    BS1 ¶

    BS1 :: 0x00008000

    BSDLY ¶

    BSDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.BS1}
     

    \b delay mask

    BUFSIZ ¶

    BUFSIZ :: libc.BUFSIZ

    BUS_ADRALN ¶

    BUS_ADRALN :: 1

    BUS_ADRERR ¶

    BUS_ADRERR :: 2

    BUS_OBJERR ¶

    BUS_OBJERR :: 3

    CHARCLASS_NAME_MAX ¶

    CHARCLASS_NAME_MAX :: 14

    CHILD_MAX ¶

    CHILD_MAX :: 266
     

    ATEXIT_MAX :: sysconf(._ATEXIT_MAX)

    CLD_CONTINUED ¶

    CLD_CONTINUED :: 6

    CLD_DUMPED ¶

    CLD_DUMPED :: 3

    CLD_EXITED ¶

    CLD_EXITED :: 1

    CLD_KILLED ¶

    CLD_KILLED :: 2

    CLD_STOPPED ¶

    CLD_STOPPED :: 5

    CLD_TRAPPED ¶

    CLD_TRAPPED :: 4

    CLOCAL ¶

    CLOCAL :: 0x00008000

    CLOCKS_PER_SEC ¶

    CLOCKS_PER_SEC :: libc.CLOCKS_PER_SEC

    CLOCK_MONOTONIC ¶

    CLOCK_MONOTONIC :: 6

    CLOCK_PROCESS_CPUTIME_ID ¶

    CLOCK_PROCESS_CPUTIME_ID :: 12

    CLOCK_REALTIME ¶

    CLOCK_REALTIME :: 0

    CLOCK_THREAD_CPUTIME_ID ¶

    CLOCK_THREAD_CPUTIME_ID :: 16

    CODESET ¶

    CODESET :: 0

    COLL_WEIGHTS_MAX ¶

    COLL_WEIGHTS_MAX :: 2

    CR0 ¶

    CR0 :: 0x00000000

    CR1 ¶

    CR1 :: 0x00001000

    CR2 ¶

    CR2 :: 0x00002000

    CR3 ¶

    CR3 :: 0x00003000

    CRDLY ¶

    CRDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.CR1, .CR2, .CR3}
     

    \r delay mask

    CREAD ¶

    CREAD :: 0x00000800

    CRNCYSTR ¶

    CRNCYSTR :: 56

    CS5 ¶

    CS5 :: 0x00000000

    CS6 ¶

    CS6 :: 0x00000100

    CS7 ¶

    CS7 :: 0x00000200

    CS8 ¶

    CS8 :: 0x00000300

    CSIZE ¶

    CSIZE: bit_set[CControl_Flag_Bits; tcflag_t] : CControl_Flags{.CS6, .CS7, .CS8}
     

    character size mask

    CSTOPB ¶

    CSTOPB :: 0x00000400

    DAY_1 ¶

    DAY_1 :: 7

    DAY_2 ¶

    DAY_2 :: 8

    DAY_3 ¶

    DAY_3 :: 9

    DAY_4 ¶

    DAY_4 :: 10

    DAY_5 ¶

    DAY_5 :: 11

    DAY_6 ¶

    DAY_6 :: 12

    DAY_7 ¶

    DAY_7 :: 13

    D_FMT ¶

    D_FMT :: 2

    D_T_FMT ¶

    D_T_FMT :: 1

    E2BIG ¶

    E2BIG :: 7

    EACCES ¶

    EACCES :: 13

    EADDRINUSE ¶

    EADDRINUSE :: 48

    EADDRNOTAVAIL ¶

    EADDRNOTAVAIL :: 49

    EAFNOSUPPORT ¶

    EAFNOSUPPORT :: 47

    EAGAIN ¶

    EAGAIN :: 35

    EAI_AGAIN ¶

    EAI_AGAIN :: 2

    EAI_BADFLAGS ¶

    EAI_BADFLAGS :: 3

    EAI_FAIL ¶

    EAI_FAIL :: 4

    EAI_FAMILY ¶

    EAI_FAMILY :: 5

    EAI_MEMORY ¶

    EAI_MEMORY :: 6

    EAI_NONAME ¶

    EAI_NONAME :: 8

    EAI_OVERFLOW ¶

    EAI_OVERFLOW :: 14

    EAI_SERVICE ¶

    EAI_SERVICE :: 9

    EAI_SOCKTYPE ¶

    EAI_SOCKTYPE :: 10

    EAI_SYSTEM ¶

    EAI_SYSTEM :: 11

    EALREADY ¶

    EALREADY :: 37

    EBADF ¶

    EBADF :: 9

    EBADMSG ¶

    EBADMSG :: 94

    EBUSY ¶

    EBUSY :: 16

    ECANCELED ¶

    ECANCELED :: 89

    ECHILD ¶

    ECHILD :: 10

    ECHO ¶

    ECHO :: 0x00000008

    ECHOE ¶

    ECHOE :: 0x00000002

    ECHOK ¶

    ECHOK :: 0x00000004

    ECHONL ¶

    ECHONL :: 0x00000010

    ECONNABORTED ¶

    ECONNABORTED :: 53

    ECONNREFUSED ¶

    ECONNREFUSED :: 61

    ECONNRESET ¶

    ECONNRESET :: 54

    EDEADLK ¶

    EDEADLK :: 11

    EDESTADDRREQ ¶

    EDESTADDRREQ :: 39

    EDOM ¶

    EDOM :: libc.EDOM

    EDQUOT ¶

    EDQUOT :: 69

    EEXIST ¶

    EEXIST :: 17

    EFAULT ¶

    EFAULT :: 14

    EFBIG ¶

    EFBIG :: 27

    EHOSTUNREACH ¶

    EHOSTUNREACH :: 65

    EIDRM ¶

    EIDRM :: 90

    EILSEQ ¶

    EILSEQ :: libc.EILSEQ

    EINPROGRESS ¶

    EINPROGRESS :: 36

    EINTR ¶

    EINTR :: 4

    EINVAL ¶

    EINVAL :: 22

    EIO ¶

    EIO :: 5

    EISCONN ¶

    EISCONN :: 56

    EISDIR ¶

    EISDIR :: 21

    ELOOP ¶

    ELOOP :: 62

    EMFILE ¶

    EMFILE :: 24
    EMLINK :: 31

    EMSGSIZE ¶

    EMSGSIZE :: 40

    EMULTIHOP ¶

    EMULTIHOP :: 95

    ENAMETOOLONG ¶

    ENAMETOOLONG :: 63

    ENETDOWN ¶

    ENETDOWN :: 50

    ENETRESET ¶

    ENETRESET :: 52

    ENETUNREACH ¶

    ENETUNREACH :: 51

    ENFILE ¶

    ENFILE :: 23

    ENOBUFS ¶

    ENOBUFS :: 55

    ENODATA ¶

    ENODATA :: 96

    ENODEV ¶

    ENODEV :: 19

    ENOENT ¶

    ENOENT :: 2

    ENOEXEC ¶

    ENOEXEC :: 8

    ENOLCK ¶

    ENOLCK :: 77
    ENOLINK :: 97

    ENOMEM ¶

    ENOMEM :: 12

    ENOMSG ¶

    ENOMSG :: 91

    ENOPROTOOPT ¶

    ENOPROTOOPT :: 42

    ENOSPC ¶

    ENOSPC :: 28

    ENOSR ¶

    ENOSR :: 98

    ENOSTR ¶

    ENOSTR :: 99

    ENOSYS ¶

    ENOSYS :: 78

    ENOTCONN ¶

    ENOTCONN :: 57

    ENOTDIR ¶

    ENOTDIR :: 20

    ENOTEMPTY ¶

    ENOTEMPTY :: 66

    ENOTRECOVERABLE ¶

    ENOTRECOVERABLE :: 104

    ENOTSOCK ¶

    ENOTSOCK :: 38

    ENOTSUP ¶

    ENOTSUP :: 45

    ENOTTY ¶

    ENOTTY :: 25

    ENXIO ¶

    ENXIO :: 6

    EOF ¶

    EOF: i32 : libc.EOF

    EOPNOTSUPP ¶

    EOPNOTSUPP :: 45

    EOVERFLOW ¶

    EOVERFLOW :: 84

    EOWNERDEAD ¶

    EOWNERDEAD :: 105

    EPERM ¶

    EPERM :: 1

    EPIPE ¶

    EPIPE :: 32

    EPROTO ¶

    EPROTO :: 100

    EPROTONOSUPPORT ¶

    EPROTONOSUPPORT :: 43

    EPROTOTYPE ¶

    EPROTOTYPE :: 41

    ERA ¶

    ERA :: 45

    ERANGE ¶

    ERANGE :: libc.ERANGE

    ERA_D_FMT ¶

    ERA_D_FMT :: 46

    ERA_D_T_FMT ¶

    ERA_D_T_FMT :: 47

    ERA_T_FMT ¶

    ERA_T_FMT :: 48

    EROFS ¶

    EROFS :: 30

    ESPIPE ¶

    ESPIPE :: 29

    ESRCH ¶

    ESRCH :: 3

    ESTALE ¶

    ESTALE :: 70

    ETIME ¶

    ETIME :: 101

    ETIMEDOUT ¶

    ETIMEDOUT :: 60

    ETXTBSY ¶

    ETXTBSY :: 26

    EWOULDBLOCK ¶

    EWOULDBLOCK :: 35

    EXDEV ¶

    EXDEV :: 18

    EXIT_FAILURE ¶

    EXIT_FAILURE :: libc.EXIT_FAILURE

    EXIT_SUCCESS ¶

    EXIT_SUCCESS :: libc.EXIT_SUCCESS

    EXPR_NEST_MAX ¶

    EXPR_NEST_MAX :: 2

    FD_CLOEXEC ¶

    FD_CLOEXEC :: 1

    FD_SETSIZE ¶

    FD_SETSIZE :: #config(POSIX_FD_SETSIZE, 256 when ODIN_OS == .NetBSD else 1024)
     

    Maximum number of file descriptors in the fd_set structure.

    FF0 ¶

    FF0 :: 0x00000000

    FF1 ¶

    FF1 :: 0x00004000

    FFDLY ¶

    FFDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.FF1}
     

    form feed delay mask

    FILENAME_MAX ¶

    FILENAME_MAX :: libc.FILENAME_MAX

    FNM_NOESCAPE ¶

    FNM_NOESCAPE :: 0x01

    FNM_NOMATCH ¶

    FNM_NOMATCH :: 1

    FNM_PATHNAME ¶

    FNM_PATHNAME :: 0x02

    FNM_PERIOD ¶

    FNM_PERIOD :: 0x04

    FOPEN_MAX ¶

    FOPEN_MAX :: libc.FOPEN_MAX

    FPE_FLTDIV ¶

    FPE_FLTDIV :: 1

    FPE_FLTINV ¶

    FPE_FLTINV :: 5

    FPE_FLTOVF ¶

    FPE_FLTOVF :: 2

    FPE_FLTRES ¶

    FPE_FLTRES :: 4

    FPE_FLTSUB ¶

    FPE_FLTSUB :: 6

    FPE_FLTUND ¶

    FPE_FLTUND :: 3

    FPE_INTDIV ¶

    FPE_INTDIV :: 7

    FPE_INTOVF ¶

    FPE_INTOVF :: 8

    F_DUPFD ¶

    F_DUPFD :: 0

    F_DUPFD_CLOEXEC ¶

    F_DUPFD_CLOEXEC :: 67

    F_GETFD ¶

    F_GETFD :: 1

    F_GETFL ¶

    F_GETFL :: 3

    F_GETLK ¶

    F_GETLK :: 7

    F_GETOWN ¶

    F_GETOWN :: 5

    F_LOCK ¶

    F_LOCK :: 1

    F_OK ¶

    F_OK: bit_set[Mode_Flag_Bits; i32] : Mode_Flags{}

    F_RDLCK ¶

    F_RDLCK :: 1

    F_SETFD ¶

    F_SETFD :: 2

    F_SETFL ¶

    F_SETFL :: 4

    F_SETLK ¶

    F_SETLK :: 8

    F_SETLKW ¶

    F_SETLKW :: 9

    F_SETOWN ¶

    F_SETOWN :: 6

    F_TEST ¶

    F_TEST :: 3

    F_TLOCK ¶

    F_TLOCK :: 2

    F_ULOCK ¶

    F_ULOCK :: 0

    F_UNLCK ¶

    F_UNLCK :: 2

    F_WRLCK ¶

    F_WRLCK :: 3

    GETALL ¶

    GETALL :: 6

    GETNCNT ¶

    GETNCNT :: 3

    GETPID ¶

    GETPID :: 4

    GETVAL ¶

    GETVAL :: 5

    GETZCNT ¶

    GETZCNT :: 7

    GLOB_ABORTED ¶

    GLOB_ABORTED :: -2

    GLOB_APPEND ¶

    GLOB_APPEND :: 0x0001

    GLOB_DOOFFS ¶

    GLOB_DOOFFS :: 0x0002

    GLOB_ERR ¶

    GLOB_ERR :: 0x0004

    GLOB_MARK ¶

    GLOB_MARK :: 0x0008

    GLOB_NOCHECK ¶

    GLOB_NOCHECK :: 0x0010

    GLOB_NOESCAPE ¶

    GLOB_NOESCAPE :: 0x2000

    GLOB_NOMATCH ¶

    GLOB_NOMATCH :: -3

    GLOB_NOSORT ¶

    GLOB_NOSORT :: 0x0020

    GLOB_NOSPACE ¶

    GLOB_NOSPACE :: -1

    HUPCL ¶

    HUPCL :: 0x00004000

    ICANON ¶

    ICANON :: 0x00000100

    ICRNL ¶

    ICRNL :: 0x00000100

    IEXTEN ¶

    IEXTEN :: 0x00000400

    IF_NAMESIZE ¶

    IF_NAMESIZE :: 16

    IGNBRK ¶

    IGNBRK :: 0x00000001

    IGNCR ¶

    IGNCR :: 0x00000080

    IGNPAR ¶

    IGNPAR :: 0x00000004

    ILL_BADSTK ¶

    ILL_BADSTK :: 8

    ILL_COPROC ¶

    ILL_COPROC :: 7

    ILL_ILLADR ¶

    ILL_ILLADR :: 5

    ILL_ILLOPC ¶

    ILL_ILLOPC :: 1

    ILL_ILLOPN ¶

    ILL_ILLOPN :: 4

    ILL_ILLTRP ¶

    ILL_ILLTRP :: 2

    ILL_PRVOPC ¶

    ILL_PRVOPC :: 3

    ILL_PRVREG ¶

    ILL_PRVREG :: 6

    INADDR_ANY ¶

    INADDR_ANY :: 0x00000000

    INADDR_BROADCAST ¶

    INADDR_BROADCAST :: 0xFFFFFFFF

    INET6_ADDRSTRLEN ¶

    INET6_ADDRSTRLEN :: 46

    INET_ADDRSTRLEN ¶

    INET_ADDRSTRLEN :: 16

    INLCR ¶

    INLCR :: 0x00000040

    INPCK ¶

    INPCK :: 0x00000010

    IOV_MAX ¶

    IOV_MAX :: 1024
     

    DELAYTIMER_MAX :: sysconf(._DELAYTIMER_MAX) HOST_NAME_MAX :: sysconf(._HOST_NAME_MAX)

    IPC_CREAT ¶

    IPC_CREAT :: 0o01000

    IPC_EXCL ¶

    IPC_EXCL :: 0o02000

    IPC_NOWAIT ¶

    IPC_NOWAIT :: 0o04000

    IPC_PRIVATE ¶

    IPC_PRIVATE :: key_t(0)

    IPC_RMID ¶

    IPC_RMID :: 0

    IPC_SET ¶

    IPC_SET :: 1

    IPC_STAT ¶

    IPC_STAT :: 2

    IPPORT_RESERVED ¶

    IPPORT_RESERVED :: 1024
     

    The highest reserved port number.

    IPPROTO_ICMP ¶

    IPPROTO_ICMP :: 1

    IPPROTO_IP ¶

    IPPROTO_IP :: 0

    IPPROTO_IPV6 ¶

    IPPROTO_IPV6 :: 41

    IPPROTO_RAW ¶

    IPPROTO_RAW :: 255

    IPPROTO_TCP ¶

    IPPROTO_TCP :: 6

    IPPROTO_UDP ¶

    IPPROTO_UDP :: 17

    IPV6_JOIN_GROUP ¶

    IPV6_JOIN_GROUP :: 12

    IPV6_LEAVE_GROUP ¶

    IPV6_LEAVE_GROUP :: 13

    IPV6_MULTICAST_HOPS ¶

    IPV6_MULTICAST_HOPS :: 10

    IPV6_MULTICAST_IF ¶

    IPV6_MULTICAST_IF :: 9

    IPV6_MULTICAST_LOOP ¶

    IPV6_MULTICAST_LOOP :: 11

    IPV6_UNICAST_HOPS ¶

    IPV6_UNICAST_HOPS :: 4

    IPV6_V6ONLY ¶

    IPV6_V6ONLY :: 27

    ISIG ¶

    ISIG :: 0x00000080

    ISTRIP ¶

    ISTRIP :: 0x00000020

    ITIMER_PROF ¶

    ITIMER_PROF :: 2

    ITIMER_REAL ¶

    ITIMER_REAL :: 0

    ITIMER_VIRTUAL ¶

    ITIMER_VIRTUAL :: 1

    IXANY ¶

    IXANY :: 0x00000800

    IXOFF ¶

    IXOFF :: 0x00000400

    IXON ¶

    IXON :: 0x00000200

    LC_ALL ¶

    LC_ALL :: 0

    LC_COLLATE ¶

    LC_COLLATE :: 1

    LC_CTYPE ¶

    LC_CTYPE :: 2

    LC_MESSAGES ¶

    LC_MESSAGES :: 6

    LC_MONETARY ¶

    LC_MONETARY :: 3

    LC_NUMERIC ¶

    LC_NUMERIC :: 4

    LC_TIME ¶

    LC_TIME :: 5

    LINE_MAX ¶

    LINE_MAX :: 2048
    LINK_MAX :: 32767
     

    FILESIZEBITS :: pathconf(".", ._FILESIZEBITS)

    LPSELECT ¶

    LPSELECT :: "pselect"

    LSELECT ¶

    LSELECT :: "select"

    L_ctermid ¶

    L_ctermid :: 1024

    L_tmpnam ¶

    L_tmpnam :: 1024

    MAP_FAILED ¶

    MAP_FAILED :: rawptr(~uintptr(0))

    MAP_FIXED ¶

    MAP_FIXED :: 0x0010

    MAP_PRIVATE ¶

    MAP_PRIVATE :: 0x0002

    MAP_SHARED ¶

    MAP_SHARED :: 0x0001

    MAX_CANON ¶

    MAX_CANON :: 1024

    MAX_INPUT ¶

    MAX_INPUT :: 1024

    MCL_CURRENT ¶

    MCL_CURRENT :: 0x0001

    MCL_FUTURE ¶

    MCL_FUTURE :: 0x0002

    MINSIGSTKSZ ¶

    MINSIGSTKSZ :: 32768

    MON_1 ¶

    MON_1 :: 21

    MON_10 ¶

    MON_10 :: 30

    MON_11 ¶

    MON_11 :: 31

    MON_12 ¶

    MON_12 :: 32

    MON_2 ¶

    MON_2 :: 22

    MON_3 ¶

    MON_3 :: 23

    MON_4 ¶

    MON_4 :: 24

    MON_5 ¶

    MON_5 :: 25

    MON_6 ¶

    MON_6 :: 26

    MON_7 ¶

    MON_7 :: 27

    MON_8 ¶

    MON_8 :: 28

    MON_9 ¶

    MON_9 :: 29

    MSG_CTRUNC ¶

    MSG_CTRUNC :: 0x20

    MSG_DONTROUTE ¶

    MSG_DONTROUTE :: 0x4

    MSG_EOR ¶

    MSG_EOR :: 0x8

    MSG_NOERROR ¶

    MSG_NOERROR :: 0o10000

    MSG_NOSIGNAL ¶

    MSG_NOSIGNAL :: 0x80000

    MSG_OOB ¶

    MSG_OOB :: 0x1

    MSG_PEEK ¶

    MSG_PEEK :: 0x2

    MSG_TRUNC ¶

    MSG_TRUNC :: 0x10

    MSG_WAITALL ¶

    MSG_WAITALL :: 0x40

    MS_ASYNC ¶

    MS_ASYNC :: 0x0001

    MS_INVALIDATE ¶

    MS_INVALIDATE :: 0x0002

    MS_SYNC ¶

    MS_SYNC: bit_set[Sync_Flags_Bits; i32] : Sync_Flags{Sync_Flags_Bits(log2(_MS_SYNC))}

    NAME_MAX ¶

    NAME_MAX :: 255

    NCCS ¶

    NCCS :: 20

    NGROUPS_MAX ¶

    NGROUPS_MAX :: 16

    NI_DGRAM ¶

    NI_DGRAM :: 0x00000010

    NI_NAMEREQD ¶

    NI_NAMEREQD :: 0x00000004

    NI_NOFQDN ¶

    NI_NOFQDN :: 0x00000001

    NI_NUMERICHOST ¶

    NI_NUMERICHOST :: 0x00000002

    NI_NUMERICSCOPE ¶

    NI_NUMERICSCOPE :: 0x00000100

    NI_NUMERICSERV ¶

    NI_NUMERICSERV :: 0x00000008

    NL0 ¶

    NL0 :: 0x00000000

    NL1 ¶

    NL1 :: 0x00000100

    NLDLY ¶

    NLDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.NL1, COutput_Flag_Bits(9)}
     

    \n delay mask

    NL_ARGMAX ¶

    NL_ARGMAX :: 9

    NL_LANGMAX ¶

    NL_LANGMAX :: 14

    NL_MSGMAX ¶

    NL_MSGMAX :: 32767

    NL_SETMAX ¶

    NL_SETMAX :: 255

    NL_TEXTMAX ¶

    NL_TEXTMAX :: 2048

    NOEXPR ¶

    NOEXPR :: 53

    NOFLSH ¶

    NOFLSH :: 0x80000000

    NZERO ¶

    NZERO :: 20

    OCRNL ¶

    OCRNL :: 0x00000010

    OFDEL ¶

    OFDEL :: 0x00020000

    OFILL ¶

    OFILL :: 0x00000080

    ONLCR ¶

    ONLCR :: 0x00000002

    ONLRET ¶

    ONLRET :: 0x00000040

    ONOCR ¶

    ONOCR :: 0x00000020

    OPOST ¶

    OPOST :: 0x00000001

    O_ACCMODE ¶

    O_ACCMODE: bit_set[O_Flag_Bits; i32] : O_Flags{.EXEC, .RDWR, .WRONLY}
     

    A mask of all the access mode bits.

    O_APPEND ¶

    O_APPEND :: 0x00000008

    O_CLOEXEC ¶

    O_CLOEXEC :: 0x01000000

    O_CREAT ¶

    O_CREAT :: 0x00000200

    O_DIRECTORY ¶

    O_DIRECTORY :: 0x00100000

    O_DSYNC ¶

    O_DSYNC :: 0x00400000

    O_EXCL ¶

    O_EXCL :: 0x00000800

    O_EXEC ¶

    O_EXEC :: 0x40000000

    O_NOCTTY ¶

    O_NOCTTY :: 0x00020000

    O_NOFOLOW ¶

    O_NOFOLOW :: 0x00000100

    O_NONBLOCK ¶

    O_NONBLOCK :: 0x00000004

    O_RDONLY ¶

    O_RDONLY :: 0

    O_RDWR ¶

    O_RDWR :: 0x0002

    O_RSYNC ¶

    O_RSYNC: bit_set[O_Flag_Bits; i32] : O_Flags{}
    O_SEARCH: bit_set[O_Flag_Bits; i32] : O_Flags{.EXEC, .DIRECTORY}

    O_SYNC ¶

    O_SYNC :: 0x0080

    O_TRUNC ¶

    O_TRUNC :: 0x00000400

    O_TTY_INIT ¶

    O_TTY_INIT: bit_set[O_Flag_Bits; i32] : O_Flags{}

    O_WRONLY ¶

    O_WRONLY :: 0x0001

    PAGESIZE ¶

    PAGESIZE :: PAGE_SIZE
     

    LOGIN_NAME_MAX :: sysconf(._LOGIN_NAME_MAX) MQ_OPEN_MAX :: sysconf(._MQ_OPEN_MAX) MQ_PRIO_MAX :: sysconf(._MQ_PRIO_MAX)

    PAGE_SIZE ¶

    PAGE_SIZE :: 1 << 12

    PARENB ¶

    PARENB :: 0x00001000

    PARMRK ¶

    PARMRK :: 0x00000008

    PARODD ¶

    PARODD :: 0x00002000

    PATH_MAX ¶

    PATH_MAX :: 1024

    PIPE_BUF ¶

    PIPE_BUF :: 512

    PM_STR ¶

    PM_STR :: 6

    POLLERR ¶

    POLLERR :: 0x0008

    POLLHUP ¶

    POLLHUP :: 0x0010

    POLLIN ¶

    POLLIN :: 0x0001

    POLLNVAL ¶

    POLLNVAL :: 0x0020

    POLLOUT ¶

    POLLOUT :: 0x0004

    POLLPRI ¶

    POLLPRI :: 0x0002

    POLLRDBAND ¶

    POLLRDBAND :: 0x0080

    POLLRDNORM ¶

    POLLRDNORM :: 0x0040

    POLLWRBAND ¶

    POLLWRBAND :: 0x0100

    POLLWRNORM ¶

    POLLWRNORM :: POLLOUT

    POLL_ERR ¶

    POLL_ERR :: 4

    POLL_HUP ¶

    POLL_HUP :: 6

    POLL_IN ¶

    POLL_IN :: 1

    POLL_MSG ¶

    POLL_MSG :: 3

    POLL_OUT ¶

    POLL_OUT :: 2

    POLL_PRI ¶

    POLL_PRI :: 5

    POSIX_MADV_DONTNEED ¶

    POSIX_MADV_DONTNEED :: 4

    POSIX_MADV_NORMAL ¶

    POSIX_MADV_NORMAL :: 0

    POSIX_MADV_RANDOM ¶

    POSIX_MADV_RANDOM :: 1

    POSIX_MADV_SEQUENTIAL ¶

    POSIX_MADV_SEQUENTIAL :: 2

    POSIX_MADV_WILLNEED ¶

    POSIX_MADV_WILLNEED :: 3

    PRIO_PGRP ¶

    PRIO_PGRP :: 1

    PRIO_PROCESS ¶

    PRIO_PROCESS :: 0

    PRIO_USER ¶

    PRIO_USER :: 2

    PROT_EXEC ¶

    PROT_EXEC :: 0x04

    PROT_NONE ¶

    PROT_NONE: bit_set[Prot_Flag_Bits; i32] : Prot_Flags{}

    PROT_READ ¶

    PROT_READ :: 0x01

    PROT_WRITE ¶

    PROT_WRITE :: 0x02

    PTHREAD_CANCELED ¶

    PTHREAD_CANCELED :: rawptr(uintptr(1))

    PTHREAD_CANCEL_ASYNCHRONOUS ¶

    PTHREAD_CANCEL_ASYNCHRONOUS :: 0x00

    PTHREAD_CANCEL_DEFERRED ¶

    PTHREAD_CANCEL_DEFERRED :: 0x02

    PTHREAD_CANCEL_DISABLE ¶

    PTHREAD_CANCEL_DISABLE :: 0x00

    PTHREAD_CANCEL_ENABLE ¶

    PTHREAD_CANCEL_ENABLE :: 0x01

    PTHREAD_CREATE_DETACHED ¶

    PTHREAD_CREATE_DETACHED :: 2

    PTHREAD_CREATE_JOINABLE ¶

    PTHREAD_CREATE_JOINABLE :: 1

    PTHREAD_DESTRUCTOR_ITERATIONS ¶

    PTHREAD_DESTRUCTOR_ITERATIONS :: 4

    PTHREAD_EXPLICIT_SCHED ¶

    PTHREAD_EXPLICIT_SCHED :: 2

    PTHREAD_INHERIT_SCHED ¶

    PTHREAD_INHERIT_SCHED :: 1

    PTHREAD_KEYS_MAX ¶

    PTHREAD_KEYS_MAX :: 512

    PTHREAD_PRIO_INHERIT ¶

    PTHREAD_PRIO_INHERIT :: 1

    PTHREAD_PRIO_NONE ¶

    PTHREAD_PRIO_NONE :: 0

    PTHREAD_PRIO_PROTECT ¶

    PTHREAD_PRIO_PROTECT :: 2

    PTHREAD_PROCESS_PRIVATE ¶

    PTHREAD_PROCESS_PRIVATE :: 2

    PTHREAD_PROCESS_SHARED ¶

    PTHREAD_PROCESS_SHARED :: 1

    PTHREAD_SCOPE_PROCESS ¶

    PTHREAD_SCOPE_PROCESS :: 2

    PTHREAD_SCOPE_SYSTEM ¶

    PTHREAD_SCOPE_SYSTEM :: 1

    PTHREAD_STACK_MIN ¶

    PTHREAD_STACK_MIN :: 16384 when ODIN_ARCH == .arm64 else 8192

    P_tmpdir ¶

    P_tmpdir :: "/var/tmp/"

    RADIXCHAR ¶

    RADIXCHAR :: 50

    RAND_MAX ¶

    RAND_MAX :: libc.RAND_MAX

    RE_DUP_MAX ¶

    RE_DUP_MAX :: 255

    RLIMIT_AS ¶

    RLIMIT_AS :: 5 when ODIN_OS == .Darwin || ODIN_OS == .OpenBSD else 10

    RLIMIT_CORE ¶

    RLIMIT_CORE :: 4

    RLIMIT_CPU ¶

    RLIMIT_CPU :: 0

    RLIMIT_DATA ¶

    RLIMIT_DATA :: 2

    RLIMIT_FSIZE ¶

    RLIMIT_FSIZE :: 1

    RLIMIT_NOFILE ¶

    RLIMIT_NOFILE :: 8

    RLIMIT_STACK ¶

    RLIMIT_STACK :: 3

    RLIM_INFINITY ¶

    RLIM_INFINITY: rlim_t : (rlim_t(1) << 63) - 1

    RLIM_SAVED_CUR ¶

    RLIM_SAVED_CUR: rlim_t : RLIM_INFINITY

    RLIM_SAVED_MAX ¶

    RLIM_SAVED_MAX: rlim_t : RLIM_INFINITY

    RTLD_GLOBAL ¶

    RTLD_GLOBAL :: 0x8

    RTLD_LAZY ¶

    RTLD_LAZY :: 0x1

    RTLD_LOCAL ¶

    RTLD_LOCAL: bit_set[RTLD_Flag_Bits; i32] : RTLD_Flags{RTLD_Flag_Bits(log2(_RTLD_LOCAL))}

    RTLD_NOW ¶

    RTLD_NOW :: 0x2

    RUSAGE_CHILDREN ¶

    RUSAGE_CHILDREN :: -1

    RUSAGE_SELF ¶

    RUSAGE_SELF :: 0

    R_OK ¶

    R_OK :: 1 << 2

    SA_NOCLDSTOP ¶

    SA_NOCLDSTOP :: 0x0008

    SA_NOCLDWAIT ¶

    SA_NOCLDWAIT :: 0x0020

    SA_NODEFER ¶

    SA_NODEFER :: 0x0010

    SA_ONSTACK ¶

    SA_ONSTACK :: 0x0001

    SA_RESETHAND ¶

    SA_RESETHAND :: 0x0004

    SA_RESTART ¶

    SA_RESTART :: 0x0002

    SA_SIGINFO ¶

    SA_SIGINFO :: 0x0040

    SCHED_FIFO ¶

    SCHED_FIFO :: 4

    SCHED_OTHER ¶

    SCHED_OTHER :: 1
     

    SCHED_SPORADIC :: 3 NOTE: not a thing on freebsd, netbsd and probably others, leaving it out

    SCHED_RR ¶

    SCHED_RR :: 2

    SCM_RIGHTS ¶

    SCM_RIGHTS :: 0x01

    SEEK_CUR ¶

    SEEK_CUR :: libc.SEEK_CUR

    SEEK_END ¶

    SEEK_END :: libc.SEEK_END

    SEEK_SET ¶

    SEEK_SET :: libc.SEEK_SET

    SEGV_ACCERR ¶

    SEGV_ACCERR :: 2

    SEGV_MAPERR ¶

    SEGV_MAPERR :: 1

    SEM_UNDO ¶

    SEM_UNDO :: 0o10000

    SETALL ¶

    SETALL :: 9

    SETVAL ¶

    SETVAL :: 8

    SHMLBA ¶

    SHMLBA :: 16 * 1024 when ODIN_ARCH == .arm64 else 4096

    SHM_RDONLY ¶

    SHM_RDONLY :: 0o10000

    SHM_RND ¶

    SHM_RND :: 0o20000

    SHUT_RD ¶

    SHUT_RD :: 0

    SHUT_RDWR ¶

    SHUT_RDWR :: 2

    SHUT_WR ¶

    SHUT_WR :: 1

    SIGABRT ¶

    SIGABRT :: libc.SIGABRT

    SIGALRM ¶

    SIGALRM :: 14

    SIGBUS ¶

    SIGBUS :: 10

    SIGCHLD ¶

    SIGCHLD :: 20

    SIGCONT ¶

    SIGCONT :: 19

    SIGFPE ¶

    SIGFPE :: libc.SIGFPE

    SIGHUP ¶

    SIGHUP :: 1

    SIGILL ¶

    SIGILL :: libc.SIGILL

    SIGINT ¶

    SIGINT :: libc.SIGINT

    SIGKILL ¶

    SIGKILL :: 9

    SIGPIPE ¶

    SIGPIPE :: 13

    SIGPOLL ¶

    SIGPOLL :: 7

    SIGPROF ¶

    SIGPROF :: 27

    SIGQUIT ¶

    SIGQUIT :: 3

    SIGSEGV ¶

    SIGSEGV :: libc.SIGSEGV

    SIGSTKSZ ¶

    SIGSTKSZ :: 131072

    SIGSTOP ¶

    SIGSTOP :: 17

    SIGSYS ¶

    SIGSYS :: 12

    SIGTERM ¶

    SIGTERM :: libc.SIGTERM

    SIGTRAP ¶

    SIGTRAP :: 5

    SIGTSTP ¶

    SIGTSTP :: 18

    SIGTTIN ¶

    SIGTTIN :: 21

    SIGTTOU ¶

    SIGTTOU :: 22

    SIGURG ¶

    SIGURG :: 16

    SIGUSR1 ¶

    SIGUSR1 :: 30

    SIGUSR2 ¶

    SIGUSR2 :: 31

    SIGVTALRM ¶

    SIGVTALRM :: 26

    SIGXCPU ¶

    SIGXCPU :: 24

    SIGXFSZ ¶

    SIGXFSZ :: 25

    SIG_BLOCK ¶

    SIG_BLOCK :: 1

    SIG_DFL ¶

    SIG_DFL: rawptr : libc.SIG_DFL
     

    Request for default signal handling.

    SIG_ERR ¶

    SIG_ERR: rawptr : libc.SIG_ERR
     

    Return value from signal() in case of error.

    SIG_HOLD ¶

    SIG_HOLD :: rawptr(uintptr(5))
     

    Request that signal be held

    SIG_IGN ¶

    SIG_IGN: rawptr : libc.SIG_IGN
     

    Request that signal be ignored.

    SIG_SETMASK ¶

    SIG_SETMASK :: 3

    SIG_UNBLOCK ¶

    SIG_UNBLOCK :: 2

    SI_ASYNCIO ¶

    SI_ASYNCIO :: 0x10004

    SI_MESGQ ¶

    SI_MESGQ :: 0x10005

    SI_QUEUE ¶

    SI_QUEUE :: 0x10002

    SI_TIMER ¶

    SI_TIMER :: 0x10003

    SI_USER ¶

    SI_USER :: 0x10001

    SOCK_DGRAM ¶

    SOCK_DGRAM :: 2

    SOCK_RAW ¶

    SOCK_RAW :: 3

    SOCK_SEQPACKET ¶

    SOCK_SEQPACKET :: 5

    SOCK_STREAM ¶

    SOCK_STREAM :: 1

    SOL_SOCKET ¶

    SOL_SOCKET :: 0xffff
     

    Options to be accessed at socket level, not protocol level.

    SOMAXCONN ¶

    SOMAXCONN :: 128
     

    The maximum backlog queue length for listen().

    SO_ACCEPTCONN ¶

    SO_ACCEPTCONN :: 0x0002

    SO_BROADCAST ¶

    SO_BROADCAST :: 0x0020

    SO_DEBUG ¶

    SO_DEBUG :: 0x0001

    SO_DONTROUTE ¶

    SO_DONTROUTE :: 0x0010

    SO_ERROR ¶

    SO_ERROR :: 0x1007

    SO_KEEPALIVE ¶

    SO_KEEPALIVE :: 0x0008

    SO_LINGER ¶

    SO_LINGER :: 0x1080

    SO_OOBINLINE ¶

    SO_OOBINLINE :: 0x0100

    SO_RCVBUF ¶

    SO_RCVBUF :: 0x1002

    SO_RCVLOWAT ¶

    SO_RCVLOWAT :: 0x1004

    SO_RCVTIMEO ¶

    SO_RCVTIMEO :: 0x1006

    SO_REUSEADDR ¶

    SO_REUSEADDR :: 0x0004

    SO_SNDBUF ¶

    SO_SNDBUF :: 0x1001

    SO_SNDLOWAT ¶

    SO_SNDLOWAT :: 0x1003

    SO_SNDTIMEO ¶

    SO_SNDTIMEO :: 0x1005

    SO_TYPE ¶

    SO_TYPE :: 0x1008

    SS_DISABLE ¶

    SS_DISABLE :: 0x0004

    SS_ONSTACK ¶

    SS_ONSTACK :: 0x0001

    STDERR_FILENO ¶

    STDERR_FILENO :: 2

    STDIN_FILENO ¶

    STDIN_FILENO :: 0

    STDOUT_FILENO ¶

    STDOUT_FILENO :: 1

    ST_NOSUID ¶

    ST_NOSUID :: 0x00000002

    ST_RDONLY ¶

    ST_RDONLY :: 0x00000001

    S_IFBLK ¶

    S_IFBLK: bit_set[Mode_Bits; _mode_t] : mode_t{.IFDIR, .IFCHR}

    S_IFCHR ¶

    S_IFCHR: bit_set[Mode_Bits; _mode_t] : mode_t{.IFCHR}

    S_IFDIR ¶

    S_IFDIR: bit_set[Mode_Bits; _mode_t] : mode_t{.IFDIR}

    S_IFIFO ¶

    S_IFIFO: bit_set[Mode_Bits; _mode_t] : mode_t{.IFIFO}

    S_IFLNK ¶

    S_IFLNK: bit_set[Mode_Bits; _mode_t] : mode_t{.IFREG, .IFCHR}

    S_IFMT ¶

    S_IFMT: bit_set[Mode_Bits; _mode_t] : mode_t{.IFCHR, .IFREG, .IFDIR, .IFIFO}

    S_IFREG ¶

    S_IFREG: bit_set[Mode_Bits; _mode_t] : mode_t{.IFREG}

    S_IFSOCK ¶

    S_IFSOCK: bit_set[Mode_Bits; _mode_t] : mode_t{.IFREG, .IFDIR}

    S_IRWXG ¶

    S_IRWXG: bit_set[Mode_Bits; _mode_t] : mode_t{.IRGRP, .IWGRP, .IXGRP}
     

    Read, write, execute group.

    S_IRWXO ¶

    S_IRWXO: bit_set[Mode_Bits; _mode_t] : mode_t{.IROTH, .IWOTH, .IXOTH}
     

    Read, write, execute other.

    S_IRWXU ¶

    S_IRWXU: bit_set[Mode_Bits; _mode_t] : mode_t{.IRUSR, .IWUSR, .IXUSR}
     

    Read, write, execute user.

    TAB0 ¶

    TAB0 :: 0x00000000

    TAB1 ¶

    TAB1 :: 0x00000400

    TAB3 ¶

    TAB3 :: 0x00000800

    TABDLY ¶

    TABDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.TAB1, .TAB3, COutput_Flag_Bits(2)}
     

    horizontal tab delay mask

    TCIFLUSH ¶

    TCIFLUSH :: 1

    TCIOFF ¶

    TCIOFF :: 3

    TCIOFLUSH ¶

    TCIOFLUSH :: 3

    TCION ¶

    TCION :: 4

    TCOFLUSH ¶

    TCOFLUSH :: 2

    TCOOFF ¶

    TCOOFF :: 1

    TCOON ¶

    TCOON :: 2

    TCP_NODELAY ¶

    TCP_NODELAY :: 0x01

    THOUSEP ¶

    THOUSEP :: 51

    TMP_MAX ¶

    TMP_MAX :: libc.TMP_MAX

    TOSTOP ¶

    TOSTOP :: 0x00400000

    TRAP_BRKPT ¶

    TRAP_BRKPT :: 1

    TRAP_TRACE ¶

    TRAP_TRACE :: 2

    T_FMT ¶

    T_FMT :: 3

    T_FMT_AMPM ¶

    T_FMT_AMPM :: 4

    UL_GETFSIZE ¶

    UL_GETFSIZE :: 1

    UL_SETFSIZE ¶

    UL_SETFSIZE :: 2

    UTIME_NOW ¶

    UTIME_NOW :: -1

    UTIME_OMIT ¶

    UTIME_OMIT :: -2

    VEOF ¶

    VEOF :: 0

    VEOL ¶

    VEOL :: 1

    VERASE ¶

    VERASE :: 3

    VINTR ¶

    VINTR :: 8

    VKILL ¶

    VKILL :: 5

    VMIN ¶

    VMIN :: 16

    VQUIT ¶

    VQUIT :: 9

    VSTART ¶

    VSTART :: 12

    VSTOP ¶

    VSTOP :: 13

    VSUSP ¶

    VSUSP :: 10

    VT0 ¶

    VT0 :: 0x00000000

    VT1 ¶

    VT1 :: 0x00010000

    VTDLY ¶

    VTDLY: bit_set[COutput_Flag_Bits; tcflag_t] : COutput_Flags{.VT1}
     

    vertical tab delay mask

    VTIME ¶

    VTIME :: 17

    WCONTINUED ¶

    WCONTINUED :: 0x00000010

    WEXITED ¶

    WEXITED :: 0x00000004

    WNOHANG ¶

    WNOHANG :: 0x00000001

    WNOWAIT ¶

    WNOWAIT :: 0x00000020

    WRDE_APPEND ¶

    WRDE_APPEND :: 0x01

    WRDE_BADCHAR ¶

    WRDE_BADCHAR :: 1

    WRDE_BADVAL ¶

    WRDE_BADVAL :: 2

    WRDE_CMDSUB ¶

    WRDE_CMDSUB :: 3

    WRDE_DOOFFS ¶

    WRDE_DOOFFS :: 0x02

    WRDE_NOCMD ¶

    WRDE_NOCMD :: 0x04

    WRDE_NOSPACE ¶

    WRDE_NOSPACE :: 4

    WRDE_REUSE ¶

    WRDE_REUSE :: 0x08

    WRDE_SHOWERR ¶

    WRDE_SHOWERR :: 0x10

    WRDE_SYNTAX ¶

    WRDE_SYNTAX :: 6

    WRDE_UNDEF ¶

    WRDE_UNDEF :: 0x20

    WSTOPPED ¶

    WSTOPPED :: 0x00000008

    WUNTRACED ¶

    WUNTRACED :: 0x00000002

    W_OK ¶

    W_OK :: 1 << 1

    X_OK ¶

    X_OK :: 1 << 0

    YESEXPR ¶

    YESEXPR :: 52

    Variables

    daylight ¶

    daylight: b32
     

    Whether daylight saving conversion should be done.

    environ ¶

    environ: [^]cstring
     
    Example:
    	for i, entry := 0, posix.environ[0]; entry != nil; i, entry = i+1, posix.environ[i] {
    		fmt.println(entry)
    	}
    
    [[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/execl.html ]]
    

    stderr ¶

    stderr: ^libc.FILE = …

    stdin ¶

    stdin: ^libc.FILE = …

    stdout ¶

    stdout: ^libc.FILE = …

    timezone ¶

    @(link_name=LTIMEZONE)
    timezone: i64
     

    The time in seconds between UTC and local standard time.

    Procedures

    CMSG_DATA ¶

    CMSG_DATA :: proc "contextless" (cmsg: ^cmsghdr) -> [^]u8 {…}
     

    Returns a pointer to the data array.

    CMSG_FIRSTHDR ¶

    CMSG_FIRSTHDR :: proc "contextless" (mhdr: ^msghdr) -> ^cmsghdr {…}
     

    Returns a pointer to the first cmsghdr or nil.

    CMSG_NXTHDR ¶

    CMSG_NXTHDR :: proc "contextless" (mhdr: ^msghdr, cmsg: ^cmsghdr) -> ^cmsghdr {…}
     

    Returns a pointer to the next cmsghdr or nil.

    FD_CLR ¶

    FD_CLR :: proc "contextless" (_fd: FD, _p: ^fd_set) {…}

    FD_ISSET ¶

    FD_ISSET :: proc "contextless" (_fd: FD, _p: ^fd_set) -> bool {…}

    FD_SET ¶

    FD_SET :: proc "contextless" (_fd: FD, _p: ^fd_set) {…}

    FD_ZERO ¶

    FD_ZERO :: proc "contextless" (_p: ^fd_set) {…}

    IN6_IS_ADDR_LINKLOCAL ¶

    IN6_IS_ADDR_LINKLOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_LOOPBACK ¶

    IN6_IS_ADDR_LOOPBACK :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MC_GLOBAL ¶

    IN6_IS_ADDR_MC_GLOBAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MC_LINKLOCAL ¶

    IN6_IS_ADDR_MC_LINKLOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MC_NODELOCAL ¶

    IN6_IS_ADDR_MC_NODELOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MC_ORGLOCAL ¶

    IN6_IS_ADDR_MC_ORGLOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MC_SITELOCAL ¶

    IN6_IS_ADDR_MC_SITELOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_MULTICAST ¶

    IN6_IS_ADDR_MULTICAST :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_SITELOCAL ¶

    IN6_IS_ADDR_SITELOCAL :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_UNSPECIFIED ¶

    IN6_IS_ADDR_UNSPECIFIED :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_V4COMPAT ¶

    IN6_IS_ADDR_V4COMPAT :: proc "contextless" (a: in6_addr) -> b32 {…}

    IN6_IS_ADDR_V4MAPPED ¶

    IN6_IS_ADDR_V4MAPPED :: proc "contextless" (a: in6_addr) -> b32 {…}

    S_ISBLK ¶

    S_ISBLK :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a block special file.

    S_ISCHR ¶

    S_ISCHR :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a character special file.

    S_ISDIR ¶

    S_ISDIR :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a directory.

    S_ISFIFO ¶

    S_ISFIFO :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a pipe or FIFO special file.

    S_ISLNK ¶

    S_ISLNK :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a symbolic link.

    S_ISREG ¶

    S_ISREG :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a regular file.

    S_ISSOCK ¶

    S_ISSOCK :: proc "contextless" (m: bit_set[Mode_Bits; _mode_t]) -> bool {…}
     

    Test for a socket.

    WEXITSTATUS ¶

    WEXITSTATUS :: proc "contextless" (x: i32) -> i32 {…}
     

    If WIFEXITED is true, returns the exit status.

    WIFCONTINUED ¶

    WIFCONTINUED :: proc "contextless" (x: i32) -> bool {…}
     

    If status was returned for a child process that has continued from a job control stop.

    WIFEXITED ¶

    WIFEXITED :: proc "contextless" (x: i32) -> bool {…}
     

    If terminated normally.

    WIFSIGNALED ¶

    WIFSIGNALED :: proc "contextless" (x: i32) -> bool {…}
     

    If terminated due to an uncaught signal.

    WIFSTOPPED ¶

    WIFSTOPPED :: proc "contextless" (x: i32) -> bool {…}
     

    If status was returned for a child process that is currently stopped.

    WSTOPSIG ¶

    WSTOPSIG :: proc "contextless" (x: i32) -> Signal {…}
     

    If WIFSTOPPED, the signal that caused the child process to stop.

    WTERMSIG ¶

    WTERMSIG :: proc "contextless" (x: i32) -> Signal {…}
     

    If WIFSIGNALED is true, returns the signal.

    a64l ¶

    a64l :: proc "c" (s: cstring) -> i64 ---
     

    Takes a pointer to a radix-64 representation, in which the first digit is the least significant, and return the corresponding long value.

    More

    accept ¶

    accept :: proc "c" (socket: FD, address: ^sockaddr, address_len: ^socklen_t) -> FD ---
     

    Extracts the first connection on the queue of pending connections.

    Blocks (if not O_NONBLOCK) if there is no pending connection.

    Returns:
    -1 (setting errno) on failure, file descriptor of accepted socket otherwise

    More

    access ¶

    access :: proc "c" (path: cstring, amode: bit_set[Mode_Flag_Bits; i32] = F_OK) -> result ---
     

    Checks the file named by the pathname pointed to by the path argument for accessibility according to the bit pattern contained in amode.

    Example:
    if (posix.access("/tmp/myfile", posix.F_OK) != .OK) {
    	fmt.printfln("/tmp/myfile access check failed: %v", posix.strerror(posix.errno()))
    }
    

    More

    alarm ¶

    alarm :: proc "c" (seconds: u32) -> u32 ---
     

    The alarm() function shall cause the system to generate a SIGALRM signal for the process after the number of realtime seconds specified by seconds have elapsed. Processor scheduling delays may prevent the process from handling the signal as soon as it is generated.

    If seconds is 0, a pending alarm request, if any, is canceled.

    Returns:
    the time left on the previous alarm() or 0

    More

    alphasort ¶

    alphasort :: proc "c" ([^]^dirent, [^]^dirent) -> i32 ---
     

    can be used as the comparison function for the scandir() function to sort the directory entries, d1 and d2, into alphabetical order.

    More

    asctime_r ¶

    asctime_r :: proc "c" (tm: ^libc.tm, buf: [^]u8) -> cstring ---
     

    Convert the broken down time in the structure to a string form: Sun Sep 16 01:03:52 1973.

    More

    basename ¶

    basename :: proc "c" (path: cstring) -> cstring ---
     

    Takes the pathname pointed to by path and return a pointer to the final component of the pathname, deleting any trailing '/' characters.

    NOTE: may modify input, so don't give it string literals.

    Returns:
    a string that might be a modification of the input string or a static string overwritten by subsequent calls

    Example:
    tests := []string{
    	"usr", "usr/", "", "/", "//", "///", "/usr/", "/usr/lib",
    	"//usr//lib//", "/home//dwc//test",
    }
    
    tbl: table.Table
    table.init(&tbl)
    table.header(&tbl, "input", "dirname", "basename")
    
    for test in tests {
    	din := strings.clone_to_cstring(test); defer delete(din)
    	dir := strings.clone_from_cstring(posix.dirname(din))
    
    	bin  := strings.clone_to_cstring(test); defer delete(bin)
    	base := strings.clone_from_cstring(posix.basename(bin))
    	table.row(&tbl, test, dir, base)
    }
    
    table.write_plain_table(os.stream_from_handle(os.stdout), &tbl)
    
    Output:
    +----------------+----------+--------+
    |input           |dirname   |basename|
    +----------------+----------+--------+
    |usr             |.         |usr     |
    |usr/            |.         |usr     |
    |                |.         |.       |
    |/               |/         |/       |
    |//              |/         |/       |
    |///             |/         |/       |
    |/usr/           |/         |usr     |
    |/usr/lib        |/usr      |lib     |
    |//usr//lib//    |//usr     |lib     |
    |/home//dwc//test|/home//dwc|test    |
    +----------------+----------+--------+
    

    More

    bind ¶

    bind :: proc "c" (socket: FD, address: ^sockaddr, address_len: socklen_t) -> result ---
     

    Assigns a local socket address to the socket.

    Example:
    sfd := posix.socket(.UNIX, .STREAM)
    if sfd == -1 {
    	/* Handle error */
    }
    
    addr: posix.sockaddr_un
    addr.sun_family = .UNIX
    copy(addr.sun_path[:], "/somepath\x00")
    
    if posix.bind(sfd, (^posix.sockaddr)(&addr), size_of(addr)) != .OK {
    	/* Handle error */
    }
    

    More

    cfgetispeed ¶

    cfgetispeed :: proc "c" (termios_p: ^termios) -> speed_t ---
     

    Get the input baud rate.

    More

    cfgetospeed ¶

    cfgetospeed :: proc "c" (termios_p: ^termios) -> speed_t ---
     

    Get the output baud rate.

    More

    cfsetispeed ¶

    cfsetispeed :: proc "c" (termios_p: ^termios, rate: speed_t) -> result ---
     

    Set the input baud rate.

    More

    cfsetospeed ¶

    cfsetospeed :: proc "c" (termios_p: ^termios, rate: speed_t) -> result ---
     

    Set the output baud rate.

    More

    chdir ¶

    chdir :: proc "c" (path: cstring) -> result ---
     

    Causes the directory named by path to become the current working directory.

    Example:
    if (posix.chdir("/tmp") == .OK) {
    	fmt.println("changed current directory to /tmp")
    }
    

    More

    chmod ¶

    chmod :: proc "c" (path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Change the mode of a file.

    More

    chown ¶

    chown :: proc "c" (path: cstring, owner: uid_t, group: gid_t) -> result ---
     

    Changes the user and group ownership of a file.

    If owner or group is specified as (uid_t)-1 or (gid_t)-1, respectively, the corresponding ID of the file shall not be changed.

    More

    clock_getres ¶

    clock_getres :: proc "c" (clock_id: Clock, res: ^libc.timespec) -> result ---
     

    Returns the resolution of any clock.

    More

    clock_gettime ¶

    clock_gettime :: proc "c" (clock_id: Clock, tp: ^libc.timespec) -> result ---
     

    Returns the current value tp for the specified clock, clock_id.

    More

    clock_settime ¶

    clock_settime :: proc "c" (clock_id: Clock, tp: ^libc.timespec) -> result ---
     

    Sets the specified clock's time.

    More

    close ¶

    close :: proc "c" (fildes: FD) -> result ---
     

    Deallocates the file descriptor indicated by fildes.

    More

    closedir ¶

    closedir :: proc "c" (dirp: DIR) -> result ---
     

    Close the directory stream referred to by the argument dirp.

    More

    confstr ¶

    confstr :: proc "c" (name: CS, buf: [^]u8, len: uint) -> uint ---
     

    Return configuration-defined string values. Its use and purpose are similar to sysconf(), but it is used where string values rather than numeric values are returned.

    Returns:
    0 (setting errno) if name is invalid, need buf of len bytes if buf is nil, amount of bytes added to buf otherwise

    More

    connect ¶

    connect :: proc "c" (socket: FD, address: ^sockaddr, address_len: socklen_t) -> result ---
     

    Attempt to make a connection.

    More

    creat ¶

    creat :: proc "c" (path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> FD ---
     

    Implemented as return open(path, O_WRONLY|O_CREAT|O_TRUNC, mode);

    More

    crypt ¶

    crypt :: proc "c" (key: cstring, salt: cstring) -> cstring ---
     

    A string encoding function. The algorithm is implementation-defined.

    The use of crypt() for anything other than password hashing is not recommended.

    Returns:
    a static string overwritten by subsequent calls, nil (setting errno) on failure

    ctermid ¶

    ctermid :: proc "c" (s: [^]u8) -> cstring ---
     

    Generates a string that, when used as a pathname, refers to the current controlling terminal for the current process.

    If s is nil, the returned string might be static and overwritten by subsequent calls or other factors. If s is not nil, s is assumed len(s) >= L_ctermid.

    More

    ctime_r ¶

    ctime_r :: proc "c" (clock: ^libc.time_t, buf: [^]u8) -> cstring ---
     

    Convert a time value to a date and time string in the same format as asctime().

    More

    dirfd ¶

    dirfd :: proc "c" (dirp: DIR) -> FD ---
     

    Return a file descriptor referring to the same directory as the dirp argument.

    // TODO: this is a macro on NetBSD?

    More

    dirname ¶

    dirname :: proc "c" (path: cstring) -> cstring ---
     

    Takes a string that contains a pathname, and returns a string that is a pathname of the parent directory of that file.

    NOTE: may modify input, so don't give it string literals.

    Returns:
    a string that might be a modification of the input string or a static string overwritten by subsequent calls

    See example for basename().

    More

    dlclose ¶

    dlclose :: proc "c" (handle: Symbol_Table) -> i32 ---
     

    inform the system that the object referenced by a handle returned from a previous dlopen() invocation is no longer needed by the application.

    Returns:
    0 on success, non-zero on failure (use dlerror() for more information)

    More

    dlerror ¶

    dlerror :: proc "c" () -> cstring ---
     

    return a null-terminated character string (with no trailing <newline>) that describes the last error that occurred during dynamic linking processing.

    More

    dlopen ¶

    dlopen :: proc "c" (file: cstring, mode: bit_set[RTLD_Flag_Bits; i32]) -> Symbol_Table ---
     

    Make the symbols (function identifiers and data object identifiers) in the executable object file specified by file available to the calling program.

    Returns:
    a reference to the symbol table on success, nil on failure (use dlerror() for more information)

    More

    dlsym ¶

    dlsym :: proc "c" (handle: Symbol_Table, name: cstring) -> rawptr ---
     

    Obtain the address of a symbol (a function identifier or a data object identifier) defined in the symbol table identified by the handle argument.

    Returns:
    the address of the matched symbol on success, nil on failure (use dlerror() for more information)

    Example:
    handle := posix.dlopen("/usr/home/me/libfoo.so", posix.RTLD_LOCAL + { .RTLD_LAZY })
    defer posix.dlclose(handle)
    
    if handle == nil {
    	panic(string(posix.dlerror()))
    }
    
    foo: proc(a, b: int) -> int
    foo = auto_cast posix.dlsym(handle, "foo")
    
    if foo == nil {
    	panic(string(posix.dlerror()))
    }
    
    fmt.printfln("foo(%v, %v) == %v", 1, 2, foo(1, 2))
    

    More

    dprintf ¶

    dprintf :: proc "c" (fildse: FD, format: cstring, .. args: ..any) -> i32 ---
     

    Equivalent to fprintf but output is written to the file descriptor.

    Return: number of bytes written, negative (setting errno) on failure

    More

    drand48 ¶

    drand48 :: proc "c" () -> f64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    non-negative, double-precision, floating-point values, uniformly distributed over the interval [0.0,1.0)

    More

    dup ¶

    dup :: proc "c" (fildes: FD) -> FD ---
     

    Returns a new file descriptor referring to the one given, sharing locks, clearing CLOEXEC.

    Returns:
    -1 (setting errno) on failure, the new file descriptor on success

    Example:
    // Redirecting stdout to a file:
    file := posix.open("/tmp/out", { .RDWR })
    posix.close(1)
    posix.dup(file)
    posix.close(file)
    

    More

    dup2 ¶

    dup2 :: proc "c" (fildes, fildes2: FD) -> FD ---
     

    Causes the file descriptor fildes2 to refer to the same open file description as the file descriptor fildes and to share any locks, and shall return fildes2.

    Returns:
    -1 (setting errno) on failure, fildes2 on success

    Example:
    // Redirecting stderr to stdout:
    posix.dup2(1, 2)
    

    More

    encrypt ¶

    encrypt :: proc "c" (block: [^]u8, decode: b32) ---
     

    An implementation-defined encoding algorithm. The key generated by setkey() is used to encrypt the string block with encrypt().

    block must be 64 bytes.

    decode controls if the block is encoded or decoded.

    May set errno to ENOSYS if the functionality is not supported.

    Example:
    block: [64]byte
    copy(block[:], "Hello, World!")
    
    posix.set_errno(.NONE)
    posix.encrypt(raw_data(block[:]), decode=false)
    assert(posix.errno() == .NONE, "encrypt not supported")
    

    More

    endgrent ¶

    endgrent :: proc "c" () ---
     

    Closes the group database.

    Checking status would be done by setting errno to 0, calling this, and checking errno.

    More

    endhostent ¶

    endhostent :: proc "c" () ---
     

    Closes the connection to the database.

    More

    endnetent ¶

    endnetent :: proc "c" () ---
     

    Closes the database.

    More

    endprotoent ¶

    endprotoent :: proc "c" () ---
     

    Closes the database.

    More

    endpwent ¶

    endpwent :: proc "c" () ---
     

    Closes the user database.

    More

    endservent ¶

    endservent :: proc "c" () ---
     

    Closes the database.

    More

    erand48 ¶

    erand48 :: proc "c" (xsubi: ^[3]u16) -> f64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    non-negative, double-precision, floating-point values, uniformly distributed over the interval [0.0,1.0)

    More

    execl ¶

    execl :: proc "c" (path: cstring, arg0: cstring, .. args: ..cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    Takes arguments as varargs and the last of them must be nil.

    Example:
    ret := posix.execl("/bin/ls", "ls", "-l", nil)
    fmt.panicf("could not execute: %v %v", ret, posix.strerror(posix.errno()))
    

    More

    execle ¶

    execle :: proc "c" (path: cstring, arg0: cstring, .. args: ..any) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    Takes arguments as varargs and the last of them must be nil. After the arguments an array of environment strings (also nil terminated) is expected.

    Example:
    env := []cstring{
    	"HOME=/usr/home",
    	"LOGNAME=home",
    	nil,
    }
    ret := posix.execle("/bin/ls", "ls", cstring("-l"), cstring(nil), raw_data(env))
    fmt.panicf("could not execute: %v", posix.strerror(posix.errno()))
    

    More

    execlp ¶

    execlp :: proc "c" (file: cstring, arg0: cstring, .. args: ..cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    If file does not contain a slash the PATH environment variable is searched for a matching file. Takes arguments as varargs and the last of them must be nil.

    Example:
    ret := posix.execlp("ls", "-l", cstring(nil))
    fmt.panicf("could not execute: %v, %v", ret, posix.strerror(posix.errno()))
    

    More

    execv ¶

    execv :: proc "c" (path: cstring, argv: [^]cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    Takes arguments as an array which should be nil terminated.

    Example:
    args := []cstring{ "ls", "-l", nil }
    ret := posix.execv("/bin/ls", raw_data(args))
    fmt.panicf("could not execute: %v, %v", ret, posix.strerror(posix.errno()))
    

    More

    execve ¶

    execve :: proc "c" (path: cstring, argv: [^]cstring, envp: [^]cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    Takes arguments as an array which should be nil terminated. Takes environment variables as an array which should be nil terminated.

    Example:
    cmd := []cstring{ "ls", "-l", nil }
    env := []cstring{ "HOME=/usr/home", "LOGNAME=home", nil }
    ret := posix.execve("/bin/ls", raw_data(cmd), raw_data(env))
    fmt.panicf("could not execute: %v, %v", ret, posix.strerror(posix.errno()))
    

    More

    execvp ¶

    execvp :: proc "c" (file: cstring, argv: [^]cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    If file does not contain a slash the PATH environment variable is searched for a matching file. Takes arguments as an array which should be nil terminated.

    Example:
    cmd := []cstring{ "ls", "-l", nil }
    ret := posix.execvp("ls", raw_data(cmd))
    fmt.panicf("could not execute: %v, %v", ret, posix.strerror(posix.errno()))
    

    More

    faccessat ¶

    faccessat :: proc "c" (fd: FD, path: cstring, amode: bit_set[Mode_Flag_Bits; i32], flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to access but relative paths are resolved based on fd.

    More

    fchdir ¶

    fchdir :: proc "c" (fildes: FD) -> result ---
     

    Equivalent to chdir but instead of a path the fildes is resolved to a directory.

    More

    fchmod ¶

    fchmod :: proc "c" (fd: FD, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Equivalent to chmod but takes an open file descriptor.

    More

    fchmodat ¶

    fchmodat :: proc "c" (fd: FD, path: cstring, mode: bit_set[Mode_Bits; _mode_t], flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to chmod but follows (or doesn't) symlinks based on the flag and resolves relative paths from the given fd.

    More

    fchown ¶

    fchown :: proc "c" (fildes: FD, owner: uid_t, mode: gid_t) -> result ---
     

    Equivalent to chown expect that it takes a file descriptor.

    Example:
    fildes := posix.open("/home/cnd/mod1", {.RDWR})
    pwd := posix.getpwnam("jones")
    grp := posix.getgrnam("cnd")
    posix.fchown(fildes, pwd.pw_uid, grp.gr_gid)
    

    More

    fchownat ¶

    fchownat :: proc "c" (fildes: FD, path: cstring, owner: uid_t, group: gid_t, flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to fchown except that relative paths are based on the given fildes.

    More

    fcntl ¶

    fcntl :: proc "c" (fd: FD, cmd: FCNTL_Cmd, .. args: ..any) -> i32 ---
     

    Perform the operations on open files.

    More

    fdatasync ¶

    fdatasync :: proc "c" (fd: FD) -> result ---
     

    Forcec all currently queued I/O operations associated with the file indicated by file descriptor fildes to the synchronized I/O completion state.

    More

    fdopen ¶

    fdopen :: proc "c" (fildes: FD, mode: cstring) -> ^libc.FILE ---
     

    Associate a stream with a file descriptor.

    Returns:
    nil (setting errno) on failure, the stream on success

    More

    fdopendir ¶

    fdopendir :: proc "c" (dirp: FD) -> DIR ---
     

    Equivalent to the opendir() function except that the directory is specified by a file descriptor rather than by a name. The file offset associated with the file descriptor at the time of the call determines which entries are returned.

    More

    fexecve ¶

    fexecve :: proc "c" (fd: FD, argv: [^]cstring, envp: [^]cstring) -> i32 ---
     

    The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

    Equivalent to execve but takes a file descriptor instead of a path.

    Example:
    ls := posix.open("/bin/ls", { .EXEC })
    cmd := []cstring{ "ls", "-l", nil }
    env := []cstring{ "HOME=/usr/home", "LOGNAME=home", nil }
    ret := posix.fexecve(ls, raw_data(cmd), raw_data(env))
    fmt.panicf("could not execute: %v, %v", ret, posix.strerror(posix.errno()))
    

    More

    fileno ¶

    fileno :: proc "c" (stream: ^libc.FILE) -> FD ---
     

    Map a stream pointer to a file descriptor.

    Returns:
    the file descriptor or -1 (setting errno) on failure

    More

    flockfile ¶

    flockfile :: proc "c" (file: ^libc.FILE) ---
     

    Locks a file.

    More

    fmemopen ¶

    fmemopen :: proc "c" (buf: [^]u8, size: uint, mode: cstring) -> ^libc.FILE ---
     

    Open a memory buffer stream.

    More

    fnmatch ¶

    fnmatch :: proc "c" (pattern: cstring, string: cstring, flags: bit_set[FNM_Flag_Bits; i32]) -> i32 ---
     

    Match patterns as described in XCU Patterns Matching a Single Character // and Patterns Matching Multiple Characters. It checks the string specified by the string argument to see if it matches the pattern specified by the pattern argument.

    Returns:
    0 when matched. if there is no match, fnmatch() shall return FNM_NOMATCH. Non-zero on other errors.

    Example:
    assert(posix.fnmatch("*.odin", "foo.odin", {}) == 0)
    assert(posix.fnmatch("*.txt",  "foo.odin", {}) == posix.FNM_NOMATCH)
    

    More

    fork ¶

    fork :: proc "c" () -> pid_t ---
     

    The fork() function shall create a new process. The new process (child process) shall be an exact copy of the calling process (parent process). With some exceptions outlined below.

    Result: -1 (setting errno) on failure, otherwise 0 to the child process and the child process id to the parent process.

    More

    fpathconf ¶

    fpathconf :: proc "c" (fildes: FD, name: PC) -> i64 ---
     

    Equivalent to pathconf but takes a file descriptor instead of a path.

    More

    free ¶

    free :: proc(ptr: $T) {…}

    freeaddrinfo ¶

    freeaddrinfo :: proc "c" (ai: ^addrinfo) ---
     

    Frees the given address info linked list.

    More

    fseeko ¶

    fseeko :: proc "c" (stream: ^libc.FILE, offset: off_t, whence: libc.Whence) -> result ---
     

    Reposition a file-position indicator in a stream.

    More

    fstat ¶

    fstat :: proc "c" (fildes: FD, buf: ^stat_t) -> result ---
     

    Obtain information about an open file.

    Follows symbol links.

    More

    fstatat ¶

    fstatat :: proc "c" (fd: FD, path: cstring, buf: ^stat_t, flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to either stat or lstat (based on the SYMLINK_NOFOLLOW bit in flags) but resolves relative paths based on the given fd.

    More

    fstatvfs ¶

    fstatvfs :: proc "c" (fildes: FD, buf: ^statvfs_t) -> result ---
     

    Obtains information about the file system containing the fildes.

    More

    fsync ¶

    fsync :: proc "c" (fildes: FD) -> result ---
     

    Requests that all data for the open file descriptor named by fildes is to be transferred to the storage device associated with the file described by fildes.

    More

    ftello ¶

    ftello :: proc "c" (^libc.FILE) -> off_t ---
     

    Return the file offset in a stream.

    Returns:
    the current file offset, -1 (setting errno) on error

    More

    ftok ¶

    ftok :: proc "c" (path: cstring, id: i32) -> key_t ---
     

    Generate an IPC key.

    Returns:
    -1 (setting errno) on failure, the key otherwise

    More

    ftruncate ¶

    ftruncate :: proc "c" (fildes: FD, length: off_t) -> result ---
     

    Truncates a file to the specified length.

    More

    ftrylockfile ¶

    ftrylockfile :: proc "c" (file: ^libc.FILE) -> i32 ---
     

    Tries to lock a file.

    Returns:
    0 if it could be locked, non-zero if it couldn't

    More

    funlockfile ¶

    funlockfile :: proc "c" (file: ^libc.FILE) ---
     

    Unlocks a file.

    More

    futimens ¶

    futimens :: proc "c" (fd: FD, times: ^[2]libc.timespec) -> result ---
     

    Sets the file access and modification time of the given file descriptor.

    More

    gai_strerror ¶

    gai_strerror :: proc "c" (ecode: Info_Errno) -> cstring ---
     

    Get a textual description for the address info errors.

    More

    get_errno ¶

    get_errno :: proc "contextless" () -> Errno {…}

    getaddrinfo ¶

    getaddrinfo :: proc "c" (nodename: cstring, servname: cstring, hints: ^addrinfo, res: ^^addrinfo) -> Info_Errno ---
     

    Translate node/serv name and return a set of socket addresses and associated information to be used in creating a socket with which to address the specified service.

    Example:
    // The following (incomplete) program demonstrates the use of getaddrinfo() to obtain the
    // socket address structure(s) for the service named in the program's command-line argument.
    // The program then loops through each of the address structures attempting to create and bind
    // a socket to the address, until it performs a successful bind().
    
    args := runtime.args__
    if len(args) != 2 {
    	fmt.eprintfln("Usage: %s port", args[0])
    	posix.exit(1)
    }
    
    hints: posix.addrinfo
    hints.ai_socktype = .DGRAM
    hints.ai_flags    = { .PASSIVE }
    
    result: ^posix.addrinfo
    s := posix.getaddrinfo(nil, args[1], &hints, &result)
    if s != .NONE {
    	fmt.eprintfln("getaddrinfo: %s", posix.gai_strerror(s))
    	posix.exit(1)
    }
    defer posix.freeaddrinfo(result)
    
    // Try each address until a successful bind().
    rp: ^posix.addrinfo
    for rp = result; rp != nil; rp = rp.ai_next {
    	sfd := posix.socket(rp.ai_family, rp.ai_socktype, rp.ai_protocol)
    	if sfd == -1 {
    		continue
    	}
    
    	if posix.bind(sfd, rp.ai_addr, rp.ai_addrlen) == 0 {
    		// Success.
    		break
    	}
    
    	posix.close(sfd)
    }
    
    if rp == nil {
    	fmt.eprintln("Could not bind")
    	posix.exit(1)
    }
    
    // Use the socket...
    

    More

    getc_unlocked ¶

    getc_unlocked :: proc "c" (stream: ^libc.FILE) -> i32 ---
     

    Equivalent to getc but unaffected by locks.

    More

    getchar_unlocked ¶

    getchar_unlocked :: proc "c" () -> i32 ---
     

    Equivalent to getchar but unaffected by locks.

    More

    getcwd ¶

    getcwd :: proc "c" (buf: [^]u8, size: uint) -> cstring ---
     

    Places an absolute pathname of the current working directory into buf.

    Returns:
    buf as a cstring on success, nil (setting errno) on failure

    Example:
    size: int
    path_max := posix.pathconf(".", ._PATH_MAX)
    if path_max == -1 {
    	size = 1024
    } else if path_max > 10240 {
    	size = 10240
    } else {
    	size = int(path_max)
    }
    
    buf: [dynamic]byte
    cwd: cstring
    for ; cwd == nil; size *= 2 {
    	if err := resize(&buf, size); err != nil {
    		fmt.panicf("allocation failure: %v", err)
    	}
    
    	cwd = posix.getcwd(raw_data(buf), len(buf))
    	if cwd == nil {
    		errno := posix.errno()
    		if errno != .ERANGE {
    			fmt.panicf("getcwd failure: %v", posix.strerror(errno))
    		}
    	}
    }
    
    fmt.println(path_max, cwd)
    

    More

    getdate ¶

    getdate :: proc "c" (string: cstring) -> ^libc.tm ---
     

    Converts a string representation of a date or time into a broken-down time.

    Returns:
    nil (setting getdate_err) on failure, the broken-down time otherwise

    More

    getdelim ¶

    getdelim :: proc "c" (lineptr: ^cstring, n: ^uint, delimiter: i32, stream: ^libc.FILE) -> int ---
     

    Read a delimited record from the stream.

    Returns:
    the number of bytes written or -1 on failure/EOF

    More

    getegid ¶

    getegid :: proc "c" () -> gid_t ---
     

    Returns the effective group ID of the calling process.

    Returns:
    the ID, no failure is defined

    More

    geteuid ¶

    geteuid :: proc "c" () -> uid_t ---
     

    Returns the effective user ID of the calling process.

    Returns:
    the ID, no failure is defined

    More

    getgid ¶

    getgid :: proc "c" () -> gid_t ---
     

    Returns the real group ID of the calling process.

    Returns:
    the ID, no failure is defined

    More

    getgrent ¶

    getgrent :: proc "c" () -> ^group ---
     

    Returns a pointer to an entry of the group database.

    Opens the group database if it isn't.

    Returns:
    nil on failure (setting errno) or EOF (not setting errno), the entry otherwise

    More

    getgrgid ¶

    getgrgid :: proc "c" (gid: gid_t) -> ^group ---
     

    Searches for an entry with a matching gid in the group database.

    Returns:
    nil (setting errno) on failure, a pointer to the entry on success

    More

    getgrgid_r ¶

    getgrgid_r :: proc "c" (gid: gid_t, grp: ^group, buffer: [^]u8, bufsize: uint, result: ^^group) -> Errno ---
     

    Searches for an entry with a matching gid in the group database.

    Updates grp with the matching entry and stores it (or a nil pointer (setting errno)) into result.

    Strings are allocated into the given buffer, you can call sysconf(._GETGR_R_SIZE_MAX) for an appropriate size.

    More

    getgrnam ¶

    getgrnam :: proc "c" (name: cstring) -> ^group ---
     

    Searches for an entry with a matching gid in the group database.

    Returns:
    nil (setting errno) on failure, a pointer to the entry on success

    More

    getgrnam_r ¶

    getgrnam_r :: proc "c" (name: cstring, grp: ^group, buffer: [^]u8, bufsize: uint, result: ^^group) -> Errno ---
     

    Searches for an entry with a matching gid in the group database.

    Updates grp with the matching entry and stores it (or a nil pointer (setting errno)) into result.

    Strings are allocated into the given buffer, you can call sysconf(._GETGR_R_SIZE_MAX) for an appropriate size.

    Example:
    length := posix.sysconf(._GETGR_R_SIZE_MAX)
    if length == -1 {
    	length = 1024
    }
    
    result:  posix.group
    resultp: ^posix.group
    
    e: posix.Errno
    
    buffer: [dynamic]byte
    defer delete(buffer)
    
    for {
    	mem_err := resize(&buffer, length)
    	assert(mem_err == nil)
    
    	e = posix.getgrnam_r("nobody", &result, raw_data(buffer), len(buffer), &resultp)
    	if e != .ERANGE {
    		break
    	}
    
    	length *= 2
    	assert(length > 0)
    }
    
    if e != .NONE {
    	panic(string(posix.strerror(e)))
    }
    
    fmt.println(result)
    

    More

    getgroups ¶

    getgroups :: proc "c" (gidsetsize: i32, grouplist: [^]gid_t) -> i32 ---
     

    Fills the grouplist array with the current supplementary group IDs of the calling process.

    Returns:
    -1 (setting errno) on failure, desired grouplist length if gidsetsize is 0, amount of IDs added otherwise

    Example:
    length := posix.getgroups(0, nil)
    if length == -1 {
    	fmt.panicf("getgroups failure: %v", posix.strerror(posix.errno()))
    }
    
    groups := make([]posix.gid_t, length) or_else panic("allocation failure")
    if posix.getgroups(length, raw_data(groups)) != length {
    	fmt.panicf("getgroups failure: %v", posix.strerror(posix.errno()))
    }
    
    fmt.println(groups)
    

    More

    gethostent ¶

    gethostent :: proc "c" () -> ^hostent ---
     

    Reads the next entry in the database, opening and closing a connection as necessary.

    This reads /etc/hosts on most systems.

    Example:
    posix.sethostent(true)
    defer posix.endhostent()
    for ent := posix.gethostent(); ent != nil; ent = posix.gethostent() {
    	fmt.println(ent)
    	fmt.println(ent.h_addr_list[0][:ent.h_length])
    }
    

    More

    gethostid ¶

    gethostid :: proc "c" () -> i64 ---
     

    Retrieves a 32-bit identifier for the current host.

    Returns:
    the ID, no failure is defined

    More

    gethostname ¶

    gethostname :: proc "c" (name: [^]u8, namelen: uint) -> result ---
     

    Returns the standard host name for the current machine.

    Host names are limited to HOST_NAME_MAX bytes.

    More

    getitimer ¶

    getitimer :: proc "c" (which: ITimer, value: ^itimerval) -> result ---
     

    Store the current value of timer into value.

    More

    getline ¶

    getline :: proc "c" (lineptr: ^cstring, n: ^uint, stream: ^libc.FILE) -> int ---
     

    Read a line delimited record from the stream.

    Returns:
    the number of bytes written or -1 on failure/EOF

    Example:
    fp := posix.fopen(#file, "r")
    if fp == nil {
    	posix.exit(1)
    }
    
    line: cstring
    length: uint
    for {
    	read := posix.getline(&line, &length, fp)
    	if read == -1 do break
    	posix.printf("Retrieved line of length %zu :\n", read)
    	posix.printf("%s", line)
    }
    if posix.ferror(fp) != 0 {
    	/* handle error */
    }
    posix.free(rawptr(line))
    posix.fclose(fp)
    

    More

    getlogin ¶

    getlogin :: proc "c" () -> cstring ---
     

    Returns a string containing the user name associated by the login activity.

    Returns:
    nil (setting errno) on failure, the login name otherwise in a potentially static buffer overwritten by subsequent calls

    More

    getlogin_r ¶

    getlogin_r :: proc "c" (name: [^]u8, namelen: uint) -> Errno ---
     

    Equivalent to getlogin but puts the name in the name buffer given.

    The name is limited to LOGIN_NAME_MAX bytes.

    Example:
    max := posix.sysconf(posix._SC_LOGIN_NAME_MAX)+1
    buf := make([]byte, max)
    posix.getlogin_r(raw_data(buf), uint(len(max)))
    fmt.printfln("login: %v", cstring(buf))
    

    More

    getnameinfo ¶

    getnameinfo :: proc "c" (
    	sa:         ^sockaddr, 
    	salen:      socklen_t, 
    	node:       [^]u8, 
    	nodelen:    socklen_t, 
    	service:    [^]u8, 
    	servicelen: socklen_t, 
    	flags:      bit_set[Nameinfo_Flag_Bits; i32], 
    ) -> Info_Errno ---
     

    Translate a socket address to a node name and service location.

    More

    getnetbyaddr ¶

    getnetbyaddr :: proc "c" (net: u32, type: AF) -> ^netent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getnetbyname ¶

    getnetbyname :: proc "c" (name: cstring) -> ^netent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getnetent ¶

    getnetent :: proc "c" () -> ^netent ---
     

    Reads the next entry of the database.

    Example:
    posix.setnetent(true)
    defer posix.endnetent()
    for ent := posix.getnetent(); ent != nil; ent = posix.getnetent() {
    	fmt.println(ent)
    	fmt.println(transmute([4]byte)ent.n_net)
    }
    

    More

    getopt ¶

    getopt :: proc "c" (argc: i32, argv: [^]cstring, optstring: cstring) -> i32 ---
     

    A command-line parser, see linked docs.

    Example:
    // The following code fragment shows how you might process the arguments for a utility that
    // can take the mutually-exclusive options a and b and the options f and o, both of which
    // require arguments.
    
    bflg, aflg, errflg: bool
    ifile: string
    ofile: string
    
    for {
    	c := posix.getopt(i32(len(runtime.args__)), raw_data(runtime.args__), ":abf:o:")
    	(c != -1) or_break
    
    	switch c {
    	case 'a':
    		if bflg {
    			errflg = true
    		} else {
    			aflg = true
    		}
    	case 'b':
    		if aflg {
    			errflg = true
    		} else {
    			bflg = true
    		}
    	case 'f':
    		ifile = string(posix.optarg)
    	case 'o':
    		ofile = string(posix.optarg)
    	case ':': /* -f or -o without operand */
    		fmt.eprintfln("Option -%c requires an operand", posix.optopt)
    		errflg = true
    	case '?':
    		fmt.eprintfln("Unrecognized option: '-%c'", posix.optopt)
    		errflg = true
    	}
    }
    
    if errflg {
    	fmt.eprintfln("usage: . . . ")
    	posix.exit(2)
    }
    
    // Loop through remaining arguments:
    for ; posix.optind < i32(len(runtime.args__)); posix.optind += 1 {
    	fmt.println(runtime.args__[posix.optind])
    }
    

    More

    getpeername ¶

    getpeername :: proc "c" (socket: FD, address: ^sockaddr, address_len: ^socklen_t) -> result ---
     

    Get the peer address of the specified socket.

    More

    getpgid ¶

    getpgid :: proc "c" (pid: pid_t) -> pid_t ---
     

    Returns the process group ID of the process whose process ID is equal to pid. If pid is 0, it returns the process group ID of the calling process.

    Returns:
    -1 on failure, the ID otherwise

    More

    getpgrp ¶

    getpgrp :: proc "c" () -> pid_t ---
     

    Returns the process group ID of the calling process.

    Returns:
    no failure

    More

    getpid ¶

    getpid :: proc "c" () -> pid_t ---
     

    Returns the ID of the calling process.

    Returns:
    no failure

    More

    getppid ¶

    getppid :: proc "c" () -> pid_t ---
     

    Returns the parent process ID.

    Returns:
    no failure

    More

    getpriority ¶

    getpriority :: proc "c" (which: Which_Prio, who: id_t) -> i32 ---
     

    Gets the nice value of the process, process group or user given.

    Note that a nice value can be -1, so checking for an error would mean clearing errno, doing the call and then checking that this returns -1 and it has an errno.

    Returns:
    -1 (setting errno) on failure, the value otherwise

    Example:
    pid := posix.getpid()
    posix.set_errno(.NONE)
    prio := posix.getpriority(.PROCESS, pid)
    if err := posix.errno(); prio == -1 && err != .NONE {
    	// Handle error...
    }
    

    More

    getprotobyname ¶

    getprotobyname :: proc "c" (name: cstring) -> ^protoent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getprotobynumber ¶

    getprotobynumber :: proc "c" (proto: i32) -> ^protoent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getprotoent ¶

    getprotoent :: proc "c" () -> ^protoent ---
     

    Reads the next entry of the database.

    Example:
    posix.setprotoent(true)
    defer posix.endprotoent()
    for ent := posix.getprotoent(); ent != nil; ent = posix.getprotoent() {
    	fmt.println(ent)
    }
    

    More

    getpwent ¶

    getpwent :: proc "c" () -> ^passwd ---
     

    Returns the current entry in the user database.

    Returns:
    nil (setting errno) on error, nil (not setting errno) on success.

    Example:
    posix.setpwent()
    defer posix.endpwent()
    for e := posix.getpwent(); e != nil; e = posix.getpwent() {
    	fmt.println(e)
    }
    

    More

    getpwnam ¶

    getpwnam :: proc "c" (name: cstring) -> ^passwd ---
     

    Searches the database for an entry with a matching name.

    Returns:
    nil (setting errno) on error, nil (not setting errno) on success.

    More

    getpwnam_r ¶

    getpwnam_r :: proc "c" (name: cstring, pwd: ^passwd, buffer: [^]u8, bufsize: uint, result: ^^passwd) -> Errno ---
     

    Searches the database for an entry with a matching name. Populating the pwd fields and using the buffer to allocate strings into. Setting result to nil on failure and to the address of pwd otherwise.

    ERANGE will be returned if there is not enough space in buffer. sysconf(_SC_GETPW_R_SIZE_MAX) can be called for the suggested size of this buffer, note that it could return -1.

    Example:
    length := posix.sysconf(._GETPW_R_SIZE_MAX)
    length  = length == -1 ? 1024 : length
    
    buffer: [dynamic]byte
    defer delete(buffer)
    
    result:  posix.passwd
    resultp: ^posix.passwd
    errno:   posix.Errno
    for {
    	if err := resize(&buffer, length); err != nil {
    		fmt.panicf("allocation failure: %v", err)
    	}
    
    	errno = posix.getpwnam_r("root", &result, raw_data(buffer), len(buffer), &resultp)
    	if errno != .ERANGE {
    		break
    	}
    }
    
    if errno != .NONE {
    	panic(string(posix.strerror(errno)))
    }
    
    fmt.println(result)
    

    More

    getpwuid ¶

    getpwuid :: proc "c" (uid: uid_t) -> ^passwd ---
     

    Searches the database for an entry with a matching uid.

    Returns:
    nil (setting errno) on error, nil (not setting errno) on success.

    More

    getpwuid_r ¶

    getpwuid_r :: proc "c" (uid: uid_t, pwd: ^passwd, buffer: [^]u8, bufsize: uint, result: ^^passwd) -> Errno ---
     

    Searches the database for an entry with a matching uid. Populating the pwd fields and using the buffer to allocate strings into. Setting result to nil on failure and to the address of pwd otherwise.

    ERANGE will be returned if there is not enough space in buffer. sysconf(_SC_GETPW_R_SIZE_MAX) can be called for the suggested size of this buffer, note that it could return -1.

    See the example for getpwnam_r.

    More

    getrlimit ¶

    getrlimit :: proc "c" (resource: Resource, rlp: ^rlimit) -> result ---
     

    Get a resource limit.

    More

    getrusage ¶

    getrusage :: proc "c" (who: Which_Usage, rusage: ^rusage) -> result ---
     

    Get resource usage.

    More

    gets ¶

    gets :: proc "c" (s: [^]u8) -> cstring ---
     

    Get a string from the stdin stream.

    It is up to the user to make sure s is big enough.

    More

    getservbyname ¶

    getservbyname :: proc "c" (name: cstring, proto: cstring) -> ^servent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getservbyport ¶

    getservbyport :: proc "c" (port: i32, proto: cstring) -> ^servent ---
     

    Search the database from the beginning, and find the first entry that matches.

    More

    getservent ¶

    getservent :: proc "c" () -> ^servent ---
     

    Reads the next entry of the database.

    Example:
    posix.setservent(true)
    defer posix.endservent()
    for ent := posix.getservent(); ent != nil; ent = posix.getservent() {
    	fmt.println(ent)
    }
    

    More

    getsid ¶

    getsid :: proc "c" (pid: pid_t) -> pid_t ---
     

    Get the process group ID of the session leader. If pid is 0, it is the current process.

    Returns:
    -1 (setting errno) on failure, the pid otherwise

    More

    getsockname ¶

    getsockname :: proc "c" (socket: FD, address: ^sockaddr, address_len: ^socklen_t) -> result ---
     

    Get the socket name.

    More

    getsockopt ¶

    getsockopt :: proc "c" (socket: FD, level: i32, option_name: Sock_Option, option_value: rawptr, option_len: ^socklen_t) -> result ---
     

    Retrieves the value for the option specified by option_name.

    level: either c.int(posix.Protocol(...)) to specify a protocol level or posix.SOL_SOCKET to specify the socket local level.

    More

    getsubopt ¶

    getsubopt :: proc "c" (optionp: ^cstring, keylistp: [^]cstring, valuep: ^cstring) -> i32 ---
     

    Parses suboption arguments in a flag argument.

    Returns:
    the index of the matched token string, or -1 if no token strings were matched

    Example:
    args := runtime.args__
    
    Opt :: enum {
    	RO,
    	RW,
    	NAME,
    	NIL,
    }
    token := [Opt]cstring{
    	.RO   = "ro",
    	.RW   = "rw",
    	.NAME = "name",
    	.NIL  = nil,
    }
    
    Options :: struct {
    	readonly, readwrite: bool,
    	name: cstring,
    
    }
    opts: Options
    
    errfnd: bool
    for {
    	opt := posix.getopt(i32(len(args)), raw_data(args), "o:")
    	if opt == -1 {
    		break
    	}
    
    	switch opt {
    	case 'o':
    		subopt := posix.optarg
    		value: cstring
    		for subopt != "" && !errfnd {
    			o := posix.getsubopt(&subopt, &token[.RO], &value)
    			switch Opt(o) {
    			case .RO:   opts.readonly  = true
    			case .RW:   opts.readwrite = true
    			case .NAME:
    				if value == nil {
    					fmt.eprintfln("missing value for suboption %s", token[.NAME])
    					errfnd = true
    					continue
    				}
    
    				opts.name = value
    			case .NIL:
    				fallthrough
    			case:
    				fmt.eprintfln("no match found for token: %s", value)
    				errfnd = true
    			}
    		}
    		if opts.readwrite && opts.readonly {
    			fmt.eprintfln("Only one of %s and %s can be specified", token[.RO], token[.RW])
    			errfnd = true
    		}
    	case:
    		errfnd = true
    	}
    }
    
    if errfnd || len(args) == 1 {
    	fmt.eprintfln("\nUsage: %s -o <suboptstring>", args[0])
    	fmt.eprintfln("suboptions are 'ro', 'rw', and 'name=<value>'")
    	posix.exit(1)
    }
    
    fmt.println(opts)
    

    More

    gettimeofday ¶

    gettimeofday :: proc "c" (tp: ^timeval, tzp: rawptr = nil) -> result ---
     

    Obtains the current time.

    More

    getuid ¶

    getuid :: proc "c" () -> uid_t ---
     

    Returns the real user ID of the calling process.

    Returns:
    no failure

    More

    glob ¶

    glob :: proc "c" (pattern: cstring, flags: bit_set[Glob_Flag_Bits; i32], errfunc: proc "c" (epath: cstring, eerrno: Errno) -> b32 = nil, pglob: ^glob_t) -> Glob_Result ---
     

    The glob() function is a pathname generator that shall implement the rules defined in XCU Pattern Matching Notation, with optional support for rule 3 in XCU Patterns Used for Filename Expansion.

    More

    globfree ¶

    globfree :: proc "c" (^glob_t) ---
     

    Free the glob results.

    More

    gmtime_r ¶

    gmtime_r :: proc "c" (timer: ^libc.time_t, result: ^libc.tm) -> ^libc.tm ---
     

    Converts the time in seconds since epoch to a broken-down tm struct.

    Returns:
    nil (setting errno) on failure, the result pointer on success.

    More

    grantpt ¶

    grantpt :: proc "c" (fildes: FD) -> result ---
     

    Changes the mode and ownership of the slave pseudo-terminal device associated with its master pseudo-terminal counterpart.

    More

    iconv ¶

    iconv :: proc "c" (cd: iconv_t, inbuf: ^[^]u8, inbytesleft: ^uint, outbuf: ^[^]u8, outbyteslen: ^uint) -> uint ---
     

    Convert the sequence of characters from one codeset, in the array specified by inbuf, into a sequence of corresponding characters in another codeset, in the array specified by outbuf.

    Returns:
    -1 (setting errno) on failure, the number of non-identical conversions performed on success

    More

    iconv_close ¶

    iconv_close :: proc "c" (cd: iconv_t) -> result ---
     

    Deallocates the conversion descriptor cd and all other associated resources allocated by iconv_open().

    More

    iconv_open ¶

    iconv_open :: proc "c" (tocode: cstring, fromcode: cstring) -> iconv_t ---
     

    Returns a conversion descriptor that describes a conversion from the codeset specified by the string pointed to by the fromcode argument to the codeset specified by the string pointed to by the tocode argument.

    Returns:
    -1 (setting errno) on failure, a conversion descriptor on success

    More

    if_freenameindex ¶

    if_freenameindex :: proc "c" (ptr: ^if_nameindex_t) ---
     

    Frees memory allocated by if_nameindex.

    More

    if_indextoname ¶

    if_indextoname :: proc "c" (ifindex: u32, ifname: [^]u8) -> cstring ---
     

    Returns the name corresponding to the index.

    ifname should be at least IF_NAMESIZE bytes in size.

    More

    if_nameindex ¶

    if_nameindex :: proc "c" () -> [^]if_nameindex_t ---
     

    Retrieve an array of name indexes. Where the last one has an index of 0 and name of nil.

    Returns:
    nil (setting errno) on failure, an array that should be freed with if_freenameindex otherwise

    More

    if_nametoindex ¶

    if_nametoindex :: proc "c" (name: cstring) -> u32 ---
     

    Returns the interface index matching the name or zero.

    More

    inet_ntoa ¶

    inet_ntoa :: proc "c" (in_addr) -> cstring ---
     

    Convert the Internet host address specified by in to a string in the Internet standard dot notation.

    NOTE: returns a static string overwritten by further calls.

    More

    inet_ntop ¶

    inet_ntop :: proc "c" (af: AF, src: rawptr, dst: [^]u8, size: socklen_t) -> cstring ---
     

    Convert a numeric address into a text string suitable for presentation.

    Returns nil and sets errno on failure.

    More

    inet_pton ¶

    inet_pton :: proc "c" (af: AF, src: cstring, dst: rawptr, size: socklen_t) -> pton_result ---
     

    Convert an address in its standard text presentation form into its numeric binary form.

    More

    initstate ¶

    initstate :: proc "c" (seed: u32, state: [^]u8, size: uint) -> [^]u8 ---
     

    Allows a state array, pointed to by the state argument, to be initialized for future use.

    Returns:
    the previous state array or nil on failure

    More

    isatty ¶

    isatty :: proc "c" (fildes: FD) -> b32 ---
     

    Tests whether fildes is associated with a terminal device.

    Returns:
    false (setting errno) if fildes is invalid or not a terminal, true otherwise

    More

    jrand48 ¶

    jrand48 :: proc "c" (xsubi: ^[3]u16) -> i64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    return signed long integers uniformly distributed over the interval [-231,231)

    More

    kill ¶

    kill :: proc "c" (pid: pid_t, sig: Signal) -> result ---
     

    Raise a signal to the process/group specified by pid.

    If sig is 0, this function can be used to check if the pid is just checked for validity.

    If pid is -1, the signal is sent to all processes that the current process has permission to send.

    If pid is negative (not -1), the signal is sent to all processes in the group identifier by the absolute value.

    More

    killpg ¶

    killpg :: proc "c" (pgrp: pid_t, sig: Signal) -> result ---
     

    Shorthand for kill(-pgrp, sig) which will kill all processes in the given process group.

    More

    l64a ¶

    l64a :: proc "c" (value: i64) -> cstring ---
     

    The l64a() function shall take a long argument and return a pointer to the corresponding radix-64 representation.

    Returns:
    a string that may be invalidated by subsequent calls

    More

    lchown ¶

    lchown :: proc "c" (path: cstring, owner: uid_t, group: gid_t) -> result ---
     

    If path points to a symbolic link, the owner and group of the link itself is changed. Equivalent to chown on normal files.

    More

    lcong48 ¶

    lcong48 :: proc "c" (param: ^[7]u16) ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    The srand48(), seed48(), and lcong48() functions are initialization entry points, one of which should be invoked before either drand48(), lrand48(), or mrand48() is called.

    More

    link :: proc "c" (path1: cstring, path2: cstring) -> result ---
     

    Creates a new link for the existing file path1 to path2.

    More

    linkat ¶

    linkat :: proc "c" (fd1: FD, path1: cstring, fd2: FD, path2: cstring, flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    If path1 is relative it is relative to directory fd1. If path2 is relative it is relative to directory fd2. If flag is { .SYMLINK_FOLLOW } path1 is resolved to its link if it is a link. Equivalent to link otherwise.

    More

    listen ¶

    listen :: proc "c" (socket: FD, backlog: i32) -> result ---
     

    Mark the socket as a socket accepting connections.

    backlog provides a hint to limit the number of connections on the listen queue. Implementation may silently reduce the backlog, additionally SOMAXCONN specifies the maximum an implementation has to support.

    More

    localeconv ¶

    localeconv :: proc "c" () -> ^lconv ---
     

    Sets the components of an object with the type lconv with the values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale.

    Returns:
    a pointer to the lconv structure, might be invalidated by subsequent calls to localeconv() and setlocale()

    More

    localtime_r ¶

    localtime_r :: proc "c" (timer: ^libc.time_t, result: ^libc.tm) -> ^libc.tm ---
     

    Convert the time in seconds since epoch to a broken-down tm struct in local time.

    Returns:
    nil (setting errno) on failure, the result pointer on success.

    More

    lockf ¶

    lockf :: proc "c" (fildes: FD, function: Lock_Function, size: off_t) -> result ---
     

    Locks sections of a file with advisory-mode locks.

    Example:
    fildes := posix.open("/home/cnd/mod1", { .RDWR })
    if posix.lockf(fildes, .TLOCK, 10000) != .OK {
    	errno := posix.errno(); #partial switch errno {
    	case .EACCES, .EAGAIN:
    		// File is already locked.
    	case:
    		// Other error.
    		fmt.panicf("lockf failure: %v", posix.strerror(errno))
    	}
    }
    

    More

    lrand48 ¶

    lrand48 :: proc "c" () -> i64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    non-negative, long integers, uniformly distributed over the interval [0,231)

    More

    lseek ¶

    lseek :: proc "c" (fildes: FD, offset: off_t, whence: libc.Whence) -> off_t ---
     

    Sets the file offset of the given file descriptor.

    If whence is .SET, the offset is set If whence is .CUR, the offset is the current offset + given offset If whence is .END, the offset is set to the size of the file + given offset

    Returns:
    the resulting offset or -1 (setting errno)

    More

    lstat ¶

    lstat :: proc "c" (path: cstring, buf: ^stat_t) -> result ---
     

    Obtain information about a "file" at the given path.

    Does not follow symlinks (will stat the symlink itself).

    More

    mkdir ¶

    mkdir :: proc "c" (path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Make a directory.

    More

    mkdirat ¶

    mkdirat :: proc "c" (fd: FD, path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Equivalent to mkdir but relative paths are relative to fd.

    More

    mkdtemp ¶

    mkdtemp :: proc "c" (template: [^]u8) -> cstring ---
     

    Creates a directory with a unique name derived from template. The application shall ensure that the string provided in template is a pathname ending with at least six trailing 'X' characters.

    Returns:
    nil (setting errno) on failure, template on success

    More

    mkfifo ¶

    mkfifo :: proc "c" (path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Make a FIFO special file.

    More

    mkfifoat ¶

    mkfifoat :: proc "c" (fd: FD, path: cstring, mode: bit_set[Mode_Bits; _mode_t]) -> result ---
     

    Equivalent to mkfifo but relative paths are relative to fd.

    More

    mknod ¶

    mknod :: proc "c" (path: cstring, mode: bit_set[Mode_Bits; _mode_t], dev: dev_t) -> result ---
     

    Make directory, special file, or regular file.

    More

    mknodat ¶

    mknodat :: proc "c" (fd: FD, path: cstring, mode: bit_set[Mode_Bits; _mode_t], dev: dev_t) -> result ---
     

    Equivalent to mknod but relative paths are relative to fd.

    More

    mkstemp ¶

    mkstemp :: proc "c" (template: cstring) -> FD ---
     

    Creates a regular file with a unique name derived from template and return a file descriptor for the file open for reading and writing. The application shall ensure that the string provided in template is a pathname ending with at least six trailing 'X' characters.

    Returns:
    -1 (setting errno) on failure, an open file descriptor on success

    More

    mlock ¶

    mlock :: proc "c" (addr: rawptr, len: uint) -> result ---
     

    Locks a range of the process address space.

    More

    mlockall ¶

    mlockall :: proc "c" (flags: bit_set[Lock_Flag_Bits; i32]) -> result ---
     

    Locks all pages of the process address space.

    More

    mmap ¶

    mmap :: proc "c" (
    	addr:  rawptr, 
    	len:   uint, 
    	prot:  bit_set[Prot_Flag_Bits; i32], 
    	flags: bit_set[Map_Flag_Bits; i32], 
    	fd:    FD = -1, 
    	off:   off_t = 0, 
    ) -> rawptr ---
     

    Establish a mapping between an address space of a process and a memory object.

    Returns:
    MAP_FAILED (setting errno) on failure, the address in memory otherwise

    More

    mprotect ¶

    mprotect :: proc "c" (addr: rawptr, len: uint, prot: bit_set[Prot_Flag_Bits; i32]) -> result ---
     

    Set protection of a memory mapping.

    More

    mrand48 ¶

    mrand48 :: proc "c" () -> i64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    return signed long integers uniformly distributed over the interval [-231,231)

    More

    msgctl ¶

    msgctl :: proc "c" (msqid: FD, cmd: IPC_Cmd, buf: ^msqid_ds) -> result ---
     

    Provides various operation as specified by the given cmd.

    More

    msgget ¶

    msgget :: proc "c" (key: key_t, msgflg: bit_set[IPC_Flag_Bits; i32]) -> FD ---
     

    Returns the message queue identifier associated with the argument key.

    Returns:
    -1 (setting errno) on failure, the identifier otherwise

    More

    msgrcv ¶

    msgrcv :: proc "c" (msgid: FD, msgp: rawptr, msgsz: uint, msgtyp: i64, msgflg: bit_set[IPC_Flag_Bits; i32]) -> int ---
     

    Read a message from the queue.

    Returns:
    -1 (setting errno) on failure, the bytes received otherwise

    More

    msgsnd ¶

    msgsnd :: proc "c" (msgid: FD, msgp: rawptr, msgsz: uint, msgflg: bit_set[IPC_Flag_Bits; i32]) -> result ---
     

    Send a message on the queue.

    More

    msync ¶

    msync :: proc "c" (addr: rawptr, len: uint, flags: bit_set[Sync_Flags_Bits; i32]) -> result ---
     

    Write all modified data to permanent storage locations.

    More

    munlock ¶

    munlock :: proc "c" (addr: rawptr, len: uint) -> result ---
     

    Unlocks a range of the process address space.

    More

    munlockall ¶

    munlockall :: proc "c" () -> result ---
     

    Unlocks all pages of the process address space.

    More

    munmap ¶

    munmap :: proc "c" (addr: rawptr, len: uint) -> result ---
     

    Unmaps pages of memory.

    More

    nanosleep ¶

    nanosleep :: proc "c" (rqtp: ^libc.timespec, rmtp: ^libc.timespec) -> result ---
     

    Causes the current thread to be suspended from execution until either the time interval specified by rqtp has elapsed or a signal is delivered.

    Returns:
    -1 on failure (setting errno), if it was due to a signal, rmtp will be filled with the remaining time, 0 if all time has been slept

    More

    nice ¶

    nice :: proc "c" (incr: i32) -> i32 ---
     

    Changes the nice value of a process.

    Higher values result in less favorable scheduling.

    Because -1 is a valid nice value, checking failure would be done by first setting errno to .NONE and then calling nice.

    Returns:
    the new nice value, or -1 (setting) errno on failure

    Example:
    posix.set_errno(.NONE)
    niceness := posix.nice(-20)
    if errno := posix.errno(); niceness == -1 && errno != .NONE {
    	fmt.panicf("nice failure: %v", posix.strerror(errno))
    }
    fmt.printfln("Niceness is now: %v", niceness)
    

    More

    nl_langinfo ¶

    nl_langinfo :: proc "c" (nl_item) -> cstring ---
     

    Return a pointer to a string containing information relevant to the particular language or cultural area defined in the current locale.

    Returns:
    a string that should not be freed or modified, and that can be invalidated at any time later

    Example:
    for item in posix.nl_item {
    	fmt.printfln("%v: %q", item, posix.nl_langinfo(item))
    }
    
    Possible Output:
    CODESET: "US-ASCII"
    D_T_FMT: "%a %b %e %H:%M:%S %Y"
    D_FMT: "%m/%d/%y"
    T_FMT: "%H:%M:%S"
    T_FMT_AMPM: "%I:%M:%S %p"
    AM_STR: "AM"
    PM_STR: "PM"
    DAY_1: "Sunday"
    DAY_2: "Monday"
    DAY_3: "Tuesday"
    DAY_4: "Wednesday"
    DAY_5: "Thursday"
    DAY_6: "Friday"
    DAY_7: "Saturday"
    ABDAY_1: "Sun"
    ABDAY_2: "Mon"
    ABDAY_3: "Tue"
    ABDAY_4: "Wed"
    ABDAY_5: "Thu"
    ABDAY_6: "Fri"
    ABDAY_7: "Sat"
    MON_1: "January"
    MON_2: "February"
    MON_3: "March"
    MON_4: "April"
    MON_5: "May"
    MON_6: "June"
    MON_7: "July"
    MON_8: "August"
    MON_9: "September"
    MON_10: "October"
    MON_11: "November"
    MON_12: "December"
    ABMON_1: "Jan"
    ABMON_2: "Feb"
    ABMON_3: "Mar"
    ABMON_4: "Apr"
    ABMON_5: "May"
    ABMON_6: "Jun"
    ABMON_7: "Jul"
    ABMON_8: "Aug"
    ABMON_9: "Sep"
    ABMON_10: "Oct"
    ABMON_11: "Nov"
    ABMON_12: "Dec"
    ERA: ""
    ERA_D_FMT: ""
    ERA_D_T_FMT: ""
    ERA_T_FMT: ""
    ALT_DIGITS: ""
    RADIXCHAR: "."
    THOUSEP: ""
    YESEXPR: "^[yY]"
    NOEXPR: "^[nN]"
    CRNCYSTR: ""
    

    More

    nrand48 ¶

    nrand48 :: proc "c" (xsubi: ^[3]u16) -> i64 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    Returns:
    non-negative, long integers, uniformly distributed over the interval [0,231)

    More

    open ¶

    open :: proc "c" (path: cstring, flags: bit_set[O_Flag_Bits; i32], .. mode: ..bit_set[Mode_Bits; _mode_t]) -> FD ---
     

    Establish the connection between a file and a file descriptor. It shall create an open file description that refers to a file and a file descriptor that refers to that open file description. The file descriptor is used by other I/O functions to refer to that file. The path argument points to a pathname naming the file

    Returns:
    -1 on failure (setting errno), a file descriptor on success.

    Example:
    // The following example opens the file /tmp/file, either by creating it (if it does not already exist),
    // or by truncating its length to 0 (if it does exist). In the former case, if the call creates a new file,
    // the access permission bits in the file mode of the file are set to permit reading and writing by the owner,
    // and to permit reading only by group members and others.
    fd := posix.open("/tmp/file", { .WRONLY, .CREAT, .TRUNC }, { .IRUSR, .IWUSR, .IRGRP, .IROTH })
    
    // The following example uses the open() function to try to create the LOCKFILE file and open it for writing.
    // Since the open() function specifies the O_EXCL flag, the call fails if the file already exists.
    // In that case, the program assumes that someone else is updating the password file and exits.
    fd := posix.open("/etc/ptmp", { .WRONLY, .CREAT, .EXCL }, { .IRUSR, .IWUSR, .IRGRP, .IROTH })
    if fd == -1 {
    	fmt.println("cannot open /etc/ptmp")
    }
    
    // The following example opens a file for writing, creating the file if it does not already exist.
    // If the file does exist, the system truncates the file to zero bytes.
    fd := posix.open("/etc/ptmp", { .WRONLY, .CREAT, .TRUNC }, { .IRUSR, .IWUSR, .IRGRP, .IROTH })
    if fd == -1 {
    	fmt.println("cannot open output file")
    }
    

    More

    open_memstream ¶

    open_memstream :: proc "c" (bufp: ^[^]u8, sizep: ^uint) -> ^libc.FILE ---
     

    Open a dynamic memory buffer stream.

    Returns:
    nil (setting errno) on failure, the stream on success

    More

    openat ¶

    openat :: proc "c" (fd: FD, path: cstring, flags: bit_set[O_Flag_Bits; i32], mode: bit_set[Mode_Bits; _mode_t] = {}) -> FD ---
     

    Equivalent to the open() function except in the case where path specifies a relative path. In this case the file to be opened is determined relative to the directory associated with the file descriptor fd instead of the current working directory.

    Returns:
    -1 on failure (setting errno), a file descriptor on success.

    More

    opendir ¶

    opendir :: proc "c" (path: cstring) -> DIR ---
     

    Open a directory stream corresponding to the directory named by the dirname argument.

    More

    pathconf ¶

    pathconf :: proc "c" (path: cstring, name: PC) -> i64 ---
     

    Determines the current value of a configurable limit or option that is associated with a file or directory.

    Returns:
    value on success, -1 (setting errno) on failure, -1 (no errno) if the variable should be taken from limits

    More

    pause ¶

    pause :: proc "c" () -> i32 ---
     

    Suspend the thread until a signal is received.

    Returns:
    -1 (setting errno to EINTR)

    More

    pclose ¶

    pclose :: proc "c" (stream: ^libc.FILE) -> i32 ---
     

    Closes a pipe stream to or from a process.

    More

    pipe ¶

    pipe :: proc "c" (fildes: ^[2]FD) -> result ---
     

    Create an interprocess channel.

    Example:
    fildes: [2]posix.FD
    if posix.pipe(&fildes) != .OK {
    	// Handle error ...
    }
    
    switch posix.fork() {
    case -1:
    	// Handle error ...
    
    case 0: /* Child - reads from pipe */
    	BSIZE :: 100
    	buf: [BSIZE]byte
    	nbytes: int
    
    	posix.close(fildes[1])                                  /* Write end is unused */
    	nbytes = posix.read(fildes[0], raw_data(buf[:]), BSIZE) /* Get data from pipe */
    	/* At this point, a further read would see end-of-file ... */
    	posix.close(fildes[0])                                  /* Finished with pipe */
    
    	fmt.println(string(buf[:nbytes]))
    
    	posix.exit(0)
    
    case: /* Parent - write to pipe */
    	msg := raw_data(transmute([]byte)string("Hello world\n"))
    	posix.close(fildes[0])           /* Read end is unused */
    	posix.write(fildes[1], msg, 12); /* Write data on pipe */
    	posix.close(fildes[1])
    	posix.exit(0)
    }
    

    More

    poll ¶

    poll :: proc "c" (fds: [^]pollfd, nfds: u32, timeout: i32) -> i32 ---
     

    For each pointer in fds, poll() shall examine the given descriptor for the events. poll will identify on which descriptors writes or reads can be done.

    Returns:
    -1 (setting errno) on failure, 0 on timeout, the amount of fds that have been changed on success.

    More

    popen ¶

    popen :: proc "c" (command: cstring, mode: cstring) -> ^libc.FILE ---
     

    Executes the command specified, creating a pipe and returning a pointer to a stream that can read or write from/to the pipe.

    Returns:
    nil (setting errno) on failure or a pointer to the stream

    Example:
    fp := posix.popen("ls *", "r")
    if fp == nil {
    	/* Handle error */
    }
    
    path: [1024]byte
    for posix.fgets(raw_data(path[:]), len(path), fp) != nil {
    	posix.printf("%s", &path)
    }
    
    status := posix.pclose(fp)
    if status == -1 {
    	/* Error reported by pclose() */
    } else {
    	/* Use functions described under wait() to inspect `status` in order
    	   to determine success/failure of the command executed by popen() */
    }
    

    More

    posix_madvise ¶

    posix_madvise :: proc "c" (addr: rawptr, len: uint, advice: MAdvice) -> Errno ---
     

    Advise the implementation of expected behavior of the application.

    More

    posix_memalign ¶

    posix_memalign :: proc "c" (memptr: ^[^]u8, alignment: uint, size: uint) -> Errno ---
     

    Allocates size bytes aligned on a boundary specified by alignment, and shall return a pointer to the allocated memory in memptr.

    More

    posix_openpt ¶

    posix_openpt :: proc "c" (oflag: bit_set[O_Flag_Bits; i32]) -> FD ---
     

    Establishes a connection between a master device for a pseudo-terminal and a file descriptor.

    Returns:
    -1 (setting errno) on failure, an open file descriptor otherwise

    More

    pread ¶

    pread :: proc "c" (fd: FD, buf: [^]u8, nbyte: uint, offset: off_t) -> int ---
     

    Equivalent to read on a specified offset instead of the internal offset.

    More

    pselect ¶

    pselect :: proc "c" (
    	nfds:     i32, 
    	readfds:  ^fd_set, 
    	writefds: ^fd_set, 
    	errorfds: ^fd_set, 
    	timeout:  ^libc.timespec, 
    	sigmask:  ^sigset_t, 
    ) -> i32 ---
     

    Examines the file descriptor sets to see whether some of their descriptors are ready for writing, or have an exceptional condition pending, respectively.

    Returns:
    -1 (setting errno) on failure, total amount of bits set in the bit masks otherwise

    More

    psignal ¶

    psignal :: proc "c" (signum: Signal, message: cstring) ---
     

    Writes a language-dependent message to stderror.

    Example:
    posix.psignal(.SIGSEGV, "that didn't go well")
    
    Possible Output:
    that didn't go well: Segmentation fault
    

    More

    pthread_atfork ¶

    pthread_atfork :: proc "c" (prepare: proc "c" (), parent: proc "c" (), child: proc "c" ()) -> Errno ---
     

    Register fork handlers to be called before and after fork().

    More

    pthread_attr_destroy ¶

    pthread_attr_destroy :: proc "c" (attr: ^pthread_attr_t) -> Errno ---
     

    Destroys a thread attributes object.

    More

    pthread_attr_getdetachstate ¶

    pthread_attr_getdetachstate :: proc "c" (attr: ^pthread_attr_t, detachstate: ^Detach_State) -> Errno ---
     

    The detachstate attribute controls whether the thread is created in a detached state. If the thread is created detached, then use of the ID of the newly created thread is an error.

    More

    pthread_attr_getguardsize ¶

    pthread_attr_getguardsize :: proc "c" (attr: ^pthread_attr_t, guardsize: ^uint) -> Errno ---
     

    The guardsize attribute controls the size of the guard area for the created thread's stack. The guardsize attribute provides protection against overflow of the stack pointer. If a thread's stack is created with guard protection, the implementation allocates extra memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer. If an application overflows into this buffer an error shall result (possibly in a SIGSEGV signal being delivered to the thread).

    More

    pthread_attr_getinheritsched ¶

    pthread_attr_getinheritsched :: proc "c" (attr: ^pthread_attr_t, inheritsched: ^Inherit_Sched) -> Errno ---
     

    When the attributes objects are used by pthread_create(), the inheritsched attribute determines how the other scheduling attributes of the created thread shall be set.

    More

    pthread_attr_getschedparam ¶

    pthread_attr_getschedparam :: proc "c" (attr: ^pthread_attr_t, param: ^sched_param) -> Errno ---
     

    Gets the scheduling param.

    More

    pthread_attr_getschedpolicy ¶

    pthread_attr_getschedpolicy :: proc "c" (attr: ^pthread_attr_t, policy: ^Sched_Policy) -> Errno ---
     

    Gets the scheduling poicy.

    More

    pthread_attr_getscope ¶

    pthread_attr_getscope :: proc "c" (attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
     

    Gets the contention scope.

    More

    pthread_attr_getstack ¶

    pthread_attr_getstack :: proc "c" (attr: ^pthread_attr_t, stackaddr: ^[^]u8, stacksize: ^uint) -> Errno ---
     

    Get the area of storage to be used for the created thread's stack.

    More

    pthread_attr_getstacksize ¶

    pthread_attr_getstacksize :: proc "c" (attr: ^pthread_attr_t, stacksize: ^uint) -> Errno ---
     

    Gets the stack size.

    More

    pthread_attr_init ¶

    pthread_attr_init :: proc "c" (attr: ^pthread_attr_t) -> Errno ---
     

    Initializes a thread attributes object.

    More

    pthread_attr_setdetachstate ¶

    pthread_attr_setdetachstate :: proc "c" (attr: ^pthread_attr_t, detachstate: Detach_State) -> Errno ---
     

    The detachstate attribute controls whether the thread is created in a detached state. If the thread is created detached, then use of the ID of the newly created thread is an error.

    More

    pthread_attr_setguardsize ¶

    pthread_attr_setguardsize :: proc "c" (attr: ^pthread_attr_t, guardsize: uint) -> Errno ---
     

    The guardsize attribute controls the size of the guard area for the created thread's stack. The guardsize attribute provides protection against overflow of the stack pointer. If a thread's stack is created with guard protection, the implementation allocates extra memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer. If an application overflows into this buffer an error shall result (possibly in a SIGSEGV signal being delivered to the thread).

    More

    pthread_attr_setinheritsched ¶

    pthread_attr_setinheritsched :: proc "c" (attr: ^pthread_attr_t, inheritsched: Inherit_Sched) -> Errno ---
     

    When the attributes objects are used by pthread_create(), the inheritsched attribute determines how the other scheduling attributes of the created thread shall be set.

    More

    pthread_attr_setschedparam ¶

    pthread_attr_setschedparam :: proc "c" (attr: ^pthread_attr_t, param: ^sched_param) -> Errno ---
     

    Sets the scheduling param.

    More

    pthread_attr_setschedpolicy ¶

    pthread_attr_setschedpolicy :: proc "c" (attr: ^pthread_attr_t, policy: Sched_Policy) -> Errno ---
     

    Sets the scheduling poicy.

    More

    pthread_attr_setscope ¶

    pthread_attr_setscope :: proc "c" (attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
     

    Sets the contention scope.

    More

    pthread_attr_setstack ¶

    pthread_attr_setstack :: proc "c" (attr: ^pthread_attr_t, stackaddr: [^]u8, stacksize: uint) -> Errno ---
     

    Specify the area of storage to be used for the created thread's stack.

    More

    pthread_attr_setstacksize ¶

    pthread_attr_setstacksize :: proc "c" (attr: ^pthread_attr_t, stacksize: uint) -> Errno ---
     

    Sets the stack size.

    More

    pthread_cancel ¶

    pthread_cancel :: proc "c" (thread: pthread_t) -> Errno ---
     

    Cancel the execution of a thread.

    More

    pthread_create ¶

    pthread_create :: proc "c" (thread: ^pthread_t, attr: ^pthread_attr_t, start_routine: proc "c" (arg: rawptr) -> rawptr, arg: rawptr) -> Errno ---
     

    Creates a new thread with the given attributes.

    More

    pthread_detach ¶

    pthread_detach :: proc "c" (thread: pthread_t) -> Errno ---
     

    Indicate that storage for the thread can be reclaimed when the thread terminates.

    More

    pthread_equal ¶

    pthread_equal :: proc "c" (t1: pthread_t, t2: pthread_t) -> b32 ---
     

    Compare thread IDs.

    More

    pthread_exit ¶

    pthread_exit :: proc "c" (value_ptr: rawptr) -> ! ---
     

    Terminates the calling thread and make the given value available to any successfull join calls.

    More

    pthread_getconcurrency ¶

    pthread_getconcurrency :: proc "c" () -> i32 ---
     

    Gets the current concurrency hint.

    More

    pthread_getcpuclockid ¶

    pthread_getcpuclockid :: proc "c" (thread_id: pthread_t, clock_id: ^clockid_t) -> Errno ---
     

    Access a thread CPU-time clock.

    More

    pthread_getschedparam ¶

    pthread_getschedparam :: proc "c" (thread: pthread_t, policy: ^Sched_Policy, param: ^sched_param) -> Errno ---
     

    Gets the scheduling policy and parameters.

    More

    pthread_getspecific ¶

    pthread_getspecific :: proc "c" (key: pthread_key_t) -> rawptr ---
     

    Returns the value currently bound to the specified key on behalf of the calling thread.

    More

    pthread_join ¶

    pthread_join :: proc "c" (thread: pthread_t, value_ptr: ^rawptr = nil) -> Errno ---
     

    Suspends execution of the calling thread until the target thread terminates.

    Example:
    ar: [10_000]i32
    
    sb1 := ar[:5_000]
    sb2 := ar[5_000:]
    
    th1, th2: posix.pthread_t
    
    posix.pthread_create(&th1, nil, incer, &sb1)
    posix.pthread_create(&th2, nil, incer, &sb2)
    
    posix.pthread_join(th1)
    posix.pthread_join(th2)
    
    incer :: proc "c" (arg: rawptr) -> rawptr {
    	sb := (^[]i32)(arg)
    	for &val in sb {
    		val += 1
    	}
    
    	return nil
    }
    

    More

    pthread_key_create ¶

    pthread_key_create :: proc "c" (key: ^pthread_key_t, destructor: proc "c" (value: rawptr) = nil) -> Errno ---
     

    Creates a thread-specific data key visible to all threads in the process.

    More

    pthread_key_delete ¶

    pthread_key_delete :: proc "c" (key: pthread_key_t) -> Errno ---
     

    Deletes a thread-specific data key visible to all threads in the process.

    More

    pthread_kill ¶

    pthread_kill :: proc "c" (thread: pthread_t, sig: Signal) -> Errno ---
     

    Send a signal to a thread.

    As with kill, if sig is 0, only validation (of the pthread_t given) is done and no signal is sent.

    More

    pthread_self ¶

    pthread_self :: proc "c" () -> pthread_t ---
     

    Get the calling thread ID.

    More

    pthread_setcancelstate ¶

    pthread_setcancelstate :: proc "c" (state: Cancel_State, oldstate: ^Cancel_State) -> Errno ---
     

    Atomically set the calling thread's cancelability and return the previous value.

    More

    pthread_setcanceltype ¶

    pthread_setcanceltype :: proc "c" (type: Cancel_Type, oldtype: ^Cancel_Type) -> Errno ---
     

    Atomically set the calling thread's cancel type and return the previous value.

    More

    pthread_setconcurrency ¶

    pthread_setconcurrency :: proc "c" (new_level: i32) -> Errno ---
     

    Sets the current desired concurrency hint.

    More

    pthread_setschedparam ¶

    pthread_setschedparam :: proc "c" (thread: pthread_t, policy: Sched_Policy, param: ^sched_param) -> Errno ---
     

    Sets the scheduling policy and parameters.

    More

    pthread_setschedprio ¶

    pthread_setschedprio :: proc "c" (thread: pthread_t, prio: i32) -> Errno ---
     

    Sets the scheduling priority for the thread given.

    More

    pthread_setspecific ¶

    pthread_setspecific :: proc "c" (key: pthread_key_t, value: rawptr) -> Errno ---
     

    Sets the value currently bound to the specified key on behalf of the calling thread.

    More

    pthread_sigmask ¶

    pthread_sigmask :: proc "c" (how: Sig, set: ^sigset_t, oset: ^sigset_t) -> Errno ---
     

    Examine and change blocked signals.

    Equivalent to sigprocmask(), without the restriction that the call be made in a single-threaded process.

    More

    pthread_testcancel ¶

    pthread_testcancel :: proc "c" () ---
     

    Creates a cancellation point in the calling thread.

    More

    ptsname ¶

    ptsname :: proc "c" (fildes: FD) -> cstring ---
     

    Returns the name of the slave pseudo-terminal device associated with a master pseudo-terminal device.

    Returns:
    nil (setting errno) on failure, the name on success, which may be invalidated on subsequent calls

    More

    putc_unlocked ¶

    putc_unlocked :: proc "c" (ch: i32, stream: ^libc.FILE) -> i32 ---
     

    Equivalent to putc but unaffected by locks.

    More

    putchar_unlocked ¶

    putchar_unlocked :: proc "c" (ch: i32) -> i32 ---
     

    Equivalent to putchar but unaffected by locks.

    More

    putenv ¶

    putenv :: proc "c" (string: cstring) -> i32 ---
     

    Uses the string argument to set environment variable values.

    Returns:
    0 on success, non-zero (setting errno) on failure

    Example:
    if posix.putenv("HOME=/usr/home") != 0 {
    	fmt.panicf("putenv failure: %v", posix.strerror(posix.errno()))
    }
    

    More

    pwrite ¶

    pwrite :: proc "c" (fd: FD, buf: [^]u8, buflen: uint, offset: off_t) -> int ---
     

    Equivalent to write on a specified offset instead of the internal offset.

    More

    raise ¶

    raise :: proc "c" (sig: Signal) -> result ---
     

    Raises a signal, calling its handler and then returning.

    More

    rand_r ¶

    rand_r :: proc "c" (seed: ^u32) -> i32 ---
     

    Computes a sequence of pseudo-random integers in the range [0, {RAND_MAX}]. (The value of the {RAND_MAX} macro shall be at least 32767.)

    If rand_r() is called with the same initial value for the object pointed to by seed and that object is not modified between successive returns and calls to rand_r(), the same sequence shall be generated.

    More

    random ¶

    random :: proc "c" () -> i64 ---
     

    Use a non-linear additive feedback random-number generator employing a default state array size of 31 long integers to return successive pseudo-random numbers in the range from 0 to 231-1. The period of this random-number generator is approximately 16 x (231-1). The size of the state array determines the period of the random-number generator. Increasing the state array size shall increase the period.

    More

    read ¶

    read :: proc "c" (fd: FD, buf: [^]u8, nbyte: uint) -> int ---
     

    Read from a file.

    Returns:
    the amount of bytes read or -1 (setting errno) on failure

    More

    readdir ¶

    readdir :: proc "c" (dirp: DIR) -> ^dirent ---
     

    Returns a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry.

    Returns nil when the end is reached or an error occurred (which sets errno).

    Example:

    posix.set_errno(.NONE) entry := posix.readdir(dirp) if entry == nil { if errno := posix.errno(); errno != .NONE { panic(string(posix.strerror(errno))) } else { fmt.println("end of directory stream") } } else { fmt.println(entry)

    }
    
    

    More

    readlink :: proc "c" (path: cstring, buf: [^]u8, bufsize: uint) -> int ---
     

    Read the contents of a symbolic link.

    Returns:
    the amount of bytes read or -1 (setting errno) on failure.

    More

    readlinkat ¶

    readlinkat :: proc "c" (fd: FD, path: cstring, buf: [^]u8, bufsize: uint) -> int ---
     

    Equivalent to readlink but relative paths are resolved based on the dir fd.

    More

    readv ¶

    readv :: proc "c" (fildes: FD, iov: [^]iovec, iovcnt: i32) -> int ---
     

    Equivalent to read() but takes a vector of inputs.

    iovcnt can be 0..=IOV_MAX in length.

    More

    realpath ¶

    realpath :: proc "c" (file_name: cstring, resolved_name: [^]u8 = nil) -> cstring ---
     

    Derive, from the pathname file_name, an absolute pathname that resolves to the same directory entry, whose resolution does not involve '.', '..', or symbolic links.

    If resolved_name is not nil it should be larger than PATH_MAX and the result will use it as a backing buffer. If resolved_name is nil the returned string is allocated by malloc.

    Returns:
    nil (setting errno) on failure, the "real path" otherwise

    More

    recv ¶

    recv :: proc "c" (socket: FD, buffer: rawptr, length: uint, flags: bit_set[Msg_Flag_Bits; i32]) -> int ---
     

    Receives a message from a socket.

    Blocks (besides with O_NONBLOCK) if there is nothing to receive.

    Returns:
    0 when the peer shutdown with no more messages, -1 (setting errno) on failure, the amount of bytes received on success

    More

    recvfrom ¶

    recvfrom :: proc "c" (
    	socket:      FD, 
    	buffer:      rawptr, 
    	length:      uint, 
    	flags:       bit_set[Msg_Flag_Bits; i32], 
    	address:     ^sockaddr, 
    	address_len: ^socklen_t, 
    ) -> int ---
     

    Receives a message from a socket.

    Equivalent to recv() but retrieves the source address too.

    Returns:
    0 when the peer shutdown with no more messages, -1 (setting errno) on failure, the amount of bytes received on success

    More

    recvmsg ¶

    recvmsg :: proc "c" (socket: FD, message: ^msghdr, flags: bit_set[Msg_Flag_Bits; i32]) -> int ---
     

    Receives a message from a socket.

    Returns:
    0 when the peer shutdown with no more messages, -1 (setting errno) on failure, the amount of bytes received on success

    More

    renameat ¶

    renameat :: proc "c" (oldfd: FD, old: cstring, newfd: FD, new: cstring) -> result ---
     

    Equivalent to rename but relative directories are resolved from their respective fds.

    More

    rewinddir ¶

    rewinddir :: proc "c" (dirp: DIR) ---
     

    Reset the position of the directory stream to which dirp refers to the beginning of the directory. It shall also cause the directory stream to refer to the current state of the corresponding directory, as a call to opendir() would have done.

    More

    rmdir ¶

    rmdir :: proc "c" (path: cstring) -> result ---
     

    Remove an (empty) directory.

    ]] More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html ]]

    scandir ¶

    scandir :: proc "c" (dir: cstring, sel: ^[^]^dirent, filter: proc "c" (^dirent) -> b32 = nil, compar: proc "c" ([^]^dirent, [^]^dirent) -> i32 = alphasort) -> i32 ---
     

    Scan the directory dir, calling the function referenced by sel on each directory entry.

    Example:
    list: [^]^posix.dirent
    ret := posix.scandir(#directory, &list, nil, posix.alphasort)
    if ret < 0 {
    	panic(string(posix.strerror(posix.errno())))
    }
    defer posix.free(list)
    
    entries := list[:ret]
    

    for entry in entries { log.info(entry) posix.free(entry) }

    More

    sched_get_priority_max ¶

    sched_get_priority_max :: proc "c" (policy: Sched_Policy) -> i32 ---
     

    Returns the minimum for the given scheduling policy.

    More

    sched_get_priority_min ¶

    sched_get_priority_min :: proc "c" (policy: Sched_Policy) -> i32 ---
     

    Returns the maximum for the given scheduling policy.

    Returns:
    -1 (setting errno) on failure, the maximum on success

    More

    sched_yield ¶

    sched_yield :: proc "c" () -> result ---
     

    Forces the running thread to relinquish the processor until it again becomes the head of its thread list.

    seed48 ¶

    seed48 :: proc "c" (seed16v: ^[3]u16) -> ^[3]u16 ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    The srand48(), seed48(), and lcong48() functions are initialization entry points, one of which should be invoked before either drand48(), lrand48(), or mrand48() is called.

    More

    seekdir ¶

    seekdir :: proc "c" (dirp: DIR, loc: i64) ---
     

    The seekdir() function shall set the position of the next readdir() operation on the directory stream specified by dirp to the position specified by loc.

    More

    select ¶

    select :: proc "c" (nfds: i32, readfds: ^fd_set, writefds: ^fd_set, errorfds: ^fd_set, timeout: ^timeval) -> i32 ---
     

    Equivalent to pselect() except a more specific timeout resolution (nanoseconds), does not have a signal mask, and may modify the timeout.

    More

    semctl ¶

    semctl :: proc "c" (semid: FD, semnum: i32, cmd: Sem_Cmd, arg: ^semun = nil) -> i32 ---
     

    Provides various semaphore control operation as specified by cmd.

    More

    semget ¶

    semget :: proc "c" (key: key_t, nsems: i32, semflg: bit_set[IPC_Flag_Bits; i32]) -> FD ---
     

    Returns the semaphore identifier associated with key.

    Returns:
    -1 (setting errno) on failure, a semaphore file descriptor otherwise

    More

    semop ¶

    semop :: proc "c" (semid: FD, sops: [^]sembuf, nsops: uint) -> result ---
     

    Perform atomically a user-defined array of semaphore operations in array order on the set of semaphores associated with the semaphore identifier specified by the argument semid.

    More

    send ¶

    send :: proc "c" (socket: FD, buffer: rawptr, length: uint, flags: bit_set[Msg_Flag_Bits; i32]) -> int ---
     

    Sends a message on a socket.

    Returns:
    -1 (setting errno) on failure, the amount of bytes received on success

    More

    sendmsg ¶

    sendmsg :: proc "c" (socket: FD, message: ^msghdr, flags: bit_set[Msg_Flag_Bits; i32]) -> int ---
     

    Sends a message on a socket.

    Returns:
    -1 (setting errno) on failure, the amount of bytes received on success

    More

    sendto ¶

    sendto :: proc "c" (
    	socket:    FD, 
    	message:   rawptr, 
    	length:    uint, 
    	flags:     bit_set[Msg_Flag_Bits; i32], 
    	dest_addr: ^sockaddr, 
    	dest_len:  socklen_t, 
    ) -> int ---
     

    Sends a message on a socket.

    If the socket is connectionless, the dest_addr is used to send to.

    Returns:
    -1 (setting errno) on failure, the amount of bytes received on success

    More

    set_errno ¶

    set_errno :: proc "contextless" (err: Errno) {…}

    setegid ¶

    setegid :: proc "c" (gid: gid_t) -> result ---
     

    Set the effective group ID.

    More

    setenv ¶

    setenv :: proc "c" (envname: cstring, envval: cstring, overwrite: b32) -> result ---
     

    Updates or add a variable in the environment of the calling process.

    Example:
    if posix.setenv("HOME", "/usr/home") != .OK {
    	fmt.panicf("putenv failure: %v", posix.strerror(posix.errno()))
    }
    

    More

    seteuid ¶

    seteuid :: proc "c" (uid: uid_t) -> result ---
     

    Sets the effective user ID.

    More

    setgid ¶

    setgid :: proc "c" (gid: gid_t) -> result ---
     

    Sets the group ID.

    More

    setgrent ¶

    setgrent :: proc "c" () ---
     

    Rewinds the group database so getgrent() returns the first entry again.

    Checking status would be done by setting errno to 0, calling this, and checking errno.

    More

    sethostent ¶

    sethostent :: proc "c" (stayopen: b32) ---
     

    Opens a connection to the database and set the next entry to the first entry in the database.

    This reads /etc/hosts on most systems.

    More

    setitimer ¶

    setitimer :: proc "c" (which: ITimer, value: ^itimerval, ovalue: ^itimerval) -> result ---
     

    Set the timer to the value given, and store the previous value in ovalue if it is not nil.

    More

    setkey ¶

    setkey :: proc "c" (key: [^]u8) ---
     

    Provides access to an implementation-defined encoding algorithm. The argument of setkey() is an array of length 64 bytes containing only the bytes with numerical value of 0 and 1.

    If this string is divided into groups of 8, the low-order bit in each group is ignored; this gives a 56-bit key which is used by the algorithm. This is the key that shall be used with the algorithm to encode a string block passed to encrypt().

    The setkey() function shall not change the setting of errno if successful. An application wishing to check for error situations should set errno to 0 before calling setkey(). If errno is non-zero on return, an error has occurred.

    Example:
    key: [64]byte
    // set key bytes...
    
    posix.set_errno(.NONE)
    posix.setkey(raw_data(key))
    if errno := posix.errno(); errno != .NONE {
    	fmt.panicf("setkey failure: %s", posix.strerror(errno))
    }
    

    More

    setlocale ¶

    setlocale :: proc "c" (category: Locale_Category, locale: cstring) -> cstring ---
     

    Selects the appropriate piece of the global locale, as specified by the category and locale arguments, and can be used to change or query the entire global locale or portions thereof.

    Returns:
    the current locale if locale is nil, the set locale otherwise

    More

    setnetent ¶

    setnetent :: proc "c" (stayopen: b32) ---
     

    Opens and rewinds the database.

    More

    setpgid ¶

    setpgid :: proc "c" (pid: pid_t, pgid: pid_t) -> result ---
     

    Set process group ID.

    More

    setpgrp ¶

    setpgrp :: proc "c" () -> pid_t ---
     

    Set the process group ID to that of the process.

    Returns:
    the process group id, no failures are defined

    More

    setpriority ¶

    setpriority :: proc "c" (which: Which_Prio, who: id_t, value: i32) -> result ---
     

    Sets the nice value of the process, process group or user given.

    More

    setprotoent ¶

    setprotoent :: proc "c" (stayopen: b32) ---
     

    Opens and rewinds the database.

    More

    setpwent ¶

    setpwent :: proc "c" () ---
     

    Rewinds the user database so that the next getpwent() returns the first entry.

    More

    setregid ¶

    setregid :: proc "c" (rgid: gid_t, egid: gid_t) -> result ---
     

    Set the real and effective group IDs.

    More

    setreuid ¶

    setreuid :: proc "c" (ruid: uid_t, euid: uid_t) -> result ---
     

    Set real and effective user IDs.

    More

    setrlimit ¶

    setrlimit :: proc "c" (resource: Resource, rlp: ^rlimit) -> result ---
     

    Set a resource limit.

    More

    setservent ¶

    setservent :: proc "c" (stayopen: b32) ---
     

    Opens and rewinds the database.

    More

    setsid ¶

    setsid :: proc "c" () -> pid_t ---
     

    Create session and set process group ID.

    Returns:
    the new process group ID or -1 (setting errno) on failure

    More

    setsockopt ¶

    setsockopt :: proc "c" (socket: FD, level: i32, option_name: Sock_Option, option_value: rawptr, option_len: socklen_t) -> result ---
     

    Sets the specified option.

    level: either c.int(posix.Protocol(...)) to specify a protocol level or posix.SOL_SOCKET to specify the socket local level.

    More

    setstate ¶

    setstate :: proc "c" (state: [^]u8) -> [^]u8 ---
     

    Sets the state array of the random number generator.

    Returns:
    the previous state array or nil on failure

    More

    setuid ¶

    setuid :: proc "c" (uid: uid_t) -> result ---
     

    Set user ID.

    More

    shm_open ¶

    shm_open :: proc "c" (name: cstring, oflag: bit_set[O_Flag_Bits; i32], mode: bit_set[Mode_Bits; _mode_t]) -> FD ---
     

    Open a shared memory object.

    Returns:
    -1 (setting errno) on failure, an open file descriptor otherwise

    More

    shm_unlink :: proc "c" (name: cstring) -> result ---
     

    Removes a shared memory object.

    More

    shmat ¶

    shmat :: proc "c" (shmid: FD, shmaddr: rawptr, shmflag: bit_set[SHM_Flag_Bits; i32]) -> rawptr ---
     

    Attaches the shared memory segment associated with the identifier into the address space of the calling process.

    Returns:
    nil (setting errno) on failure, the address otherwise

    More

    shmctl ¶

    shmctl :: proc "c" (shmid: FD, cmd: IPC_Cmd, buf: ^shmid_ds) -> result ---
     

    Provides various shared memory operation as specified by the given cmd.

    More

    shmdt ¶

    shmdt :: proc "c" (shmaddr: rawptr) -> result ---
     

    Detaches the shared memory segment located at the address specified.

    More

    shmget ¶

    shmget :: proc "c" (key: key_t, size: uint, shmflag: bit_set[SHM_Flag_Bits; i32]) -> FD ---
     

    Returns the shared memory identifier associated with key.

    Returns:
    -1 (setting errno) on failure, the shared memory ID otherwise

    More

    shutdown ¶

    shutdown :: proc "c" (socket: FD, how: Shut) -> result ---
     

    Shuts down a socket end or both.

    More

    sigaction ¶

    sigaction :: proc "c" (sig: Signal, act: ^sigaction_t, oact: ^sigaction_t) -> result ---
     

    Examine and change a signal action.

    More

    sigaddset ¶

    sigaddset :: proc "c" (set: ^sigset_t, signo: Signal) -> result ---

    sigaltstack ¶

    sigaltstack :: proc "c" (ss: ^stack_t, oss: ^stack_t) -> result ---
     

    Set and get the signal alternate stack context.

    Example:
    sigstk := posix.stack_t {
    	ss_sp    = make([^]byte, posix.SIGSTKSZ) or_else panic("allocation failure"),
    	ss_size  = posix.SIGSTKSZ,
    	ss_flags = {},
    }
    if posix.sigaltstack(&sigstk, nil) != .OK {
    	fmt.panicf("sigaltstack failure: %v", posix.strerror(posix.errno()))
    }
    

    More

    sigdelset ¶

    sigdelset :: proc "c" (^sigset_t, Signal) -> i32 ---

    sigemptyset ¶

    sigemptyset :: proc "c" (^sigset_t) -> i32 ---

    sigfillset ¶

    sigfillset :: proc "c" (^sigset_t) -> i32 ---

    sighold ¶

    sighold :: proc "c" (sig: Signal) -> result ---
     

    Adds sig to the signal mask of the calling process.

    More

    sigignore ¶

    sigignore :: proc "c" (sig: Signal) -> result ---
     

    Sets the disposition of sig to SIG_IGN.

    More

    siginterrupt ¶

    siginterrupt :: proc "c" (sig: Signal, flag: b32) -> result ---
     

    Changes the restart behavior when a function is interrupted by the specified signal.

    If flag is true, SA_RESTART is removed, added otherwise.

    More

    sigismember ¶

    sigismember :: proc "c" (set: ^sigset_t, signo: Signal) -> i32 ---
     

    Test for a signal in a signal set.

    Returns:
    1 if it is a member, 0 if not, -1 (setting errno) on failure

    More

    siglongjmp ¶

    siglongjmp :: proc "c" (env: ^sigjmp_buf, val: i32) -> ! ---
     

    Equivalent to longjmp() but restores saved signal masks.

    More

    signal ¶

    signal :: proc "c" (sig: Signal, func: proc "c" (Signal)) -> proc "c" (Signal) ---
     

    Set a signal handler.

    func can either be: auto_cast posix.SIG_DFL setting the default handler for that specific signal auto_cast posix.SIG_IGN causing the specific signal to be ignored a custom signal handler

    Returns:
    SIG_ERR (setting errno), the last value of func on success

    More

    sigpause ¶

    sigpause :: proc "c" (sig: Signal) -> result ---
     

    Removes sig from the signal mask of the calling process and suspend the calling process until a signal is received.

    More

    sigpending ¶

    sigpending :: proc "c" (set: ^sigset_t) -> result ---
     

    Stores the set of signals that are blocked from delivery to the calling thread and that are pending on the process or the calling thread.

    More

    sigprocmask ¶

    sigprocmask :: proc "c" (how: Sig, set: ^sigset_t, oldset: ^sigset_t) -> result ---
     

    Examine and change blocked signals in a single-threaded process.

    More

    sigrelse ¶

    sigrelse :: proc "c" (sig: Signal) -> result ---
     

    Removes sig from the signal mask of the calling process.

    Returns:
    always -1.

    More

    sigsetjmp ¶

    sigsetjmp :: proc "c" (env: ^sigjmp_buf, savemask: b32) -> i32 ---
     

    Equivalent to setjmp() but restores saved signal masks.

    More

    sigsuspend ¶

    sigsuspend :: proc "c" (sigmask: ^sigset_t) -> result ---
     

    Wait for one of the given signals.

    Returns:
    always -1

    More

    sigwait ¶

    sigwait :: proc "c" (set: ^sigset_t, sig: ^Signal) -> Errno ---
     

    Wait for queued signals.

    More

    sleep ¶

    sleep :: proc "c" (seconds: u32) -> u32 ---
     

    Suspend execution for an interval of time.

    Returns:
    the time left to sleep (may be > 0 in case of signals)

    More

    sockatmark ¶

    sockatmark :: proc "c" (socket: FD) -> i32 ---
     

    Determine wheter a socket is at the out-of-band mark.

    Returns:
    -1 (setting errno) on failure, 0 if not at the mark, 1 if it is

    More

    socket ¶

    socket :: proc "c" (domain: AF, type: Sock, protocol: Protocol = .IP) -> FD ---
     

    Creates a socket.

    Returns:
    -1 (setting errno) on failure, file descriptor of socket otherwise

    More

    socketpair ¶

    socketpair :: proc "c" (domain: AF, type: Sock, protocol: Protocol, socket_vector: ^[2]FD) -> result ---
     

    Create a pair of connected sockets.

    More

    sprintf ¶

    sprintf :: proc "c" (s: [^]u8, format: cstring, .. args: ..any) -> i32 ---
     

    Equivalent to fprintf but output is written to s, it is the user's responsibility to ensure there is enough space.

    Return: number of bytes written, negative (setting errno) on failure

    More

    srand48 ¶

    srand48 :: proc "c" (seedval: i64) ---
     

    This family of functions shall generate pseudo-random numbers using a linear congruential algorithm and 48-bit integer arithmetic.

    The srand48(), seed48(), and lcong48() functions are initialization entry points, one of which should be invoked before either drand48(), lrand48(), or mrand48() is called.

    More

    srandom ¶

    srandom :: proc "c" (seed: u32) ---
     

    Initializes the current state array using the value of seed.

    More

    stat ¶

    stat :: proc "c" (path: cstring, buf: ^stat_t) -> result ---
     

    Obtain information about a "file" at the given path.

    Follows symbolic links.

    More

    statvfs ¶

    statvfs :: proc "c" (path: cstring, buf: ^statvfs_t) -> result ---
     

    Obtains information about the file system containing the file named by path.

    More

    strerror ¶

    strerror :: proc "contextless" (errnum: runtime.Maybe($T=Errno) = nil) -> cstring {…}

    strerror_r ¶

    strerror_r :: proc "c" (errnum: Errno, strerrbuf: [^]u8, buflen: uint) -> Errno ---
     

    Map the error number to a locale-dependent error message string and put it in the buffer.

    Returns:
    ERANGE if the buffer is not big enough

    More

    strfmon ¶

    strfmon :: proc "c" (s: [^]u8, maxsize: uint, format: cstring, .. args: ..any) -> uint ---
     

    Places characters into the array pointed to by s as controlled by the string format. No more than maxsize bytes are placed into the array.

    Returns:
    -1 (setting errno) on failure, the number of bytes added to s otherwise

    Example:
    posix.setlocale(.ALL, "en_US.UTF-8")
    value := 123456.789
    buffer: [100]byte
    size := posix.strfmon(raw_data(buffer[:]), len(buffer), "%n", value)
    if int(size) == -1 {
    	fmt.panicf("strfmon failure: %s", posix.strerror(posix.errno()))
    }
    fmt.println(string(buffer[:size]))
    
    Output:
    $123,456.79
    

    More

    strptime ¶

    strptime :: proc "c" (buf: [^]u8, format: cstring, tm: ^libc.tm) -> cstring ---
     

    Converts the character string to values which are stored in tm, using the specified format.

    More

    strsignal ¶

    strsignal :: proc "c" (sig: Signal) -> cstring ---
     

    Map the signal number to an implementation-defined string.

    Returns:
    a string that may be invalidated by subsequent calls

    More

    swab ¶

    swab :: proc "c" (src: [^]u8, dest: [^]u8, nbytes: int) ---
     

    Copy nbyte bytes, from src, to dest, exchanging adjecent bytes.

    More

    symlink :: proc "c" (path1: cstring, path2: cstring) -> result ---
     

    Creates a symbolic link called path2 that contains a link to path1.

    More

    symlinkat ¶

    symlinkat :: proc "c" (path1: cstring, fd: FD, path2: cstring) -> result ---
     

    Equivalent to symlink but relative paths are resolved to dir fd.

    More

    sync ¶

    sync :: proc "c" () ---
     

    Schedule file system updates.

    More

    sysconf ¶

    sysconf :: proc "c" (name: SC) -> i64 ---
     

    Determines the current value of configurable system limit or options.

    Returns:
    value on success, -1 (setting errno) on failure, -1 (no errno) if the variable should be taken from limits

    More

    tcdrain ¶

    tcdrain :: proc "c" (fildes: FD) -> result ---
     

    Wait for transmission of output.

    More

    tcflow ¶

    tcflow :: proc "c" (fildes: FD, action: TC_Action) -> result ---
     

    Suspend or restart the transmission or reception of data.

    More

    tcflush ¶

    tcflush :: proc "c" (fildes: FD, queue_selector: TC_Queue) -> result ---
     

    Flush non-transmitted output data, non-read input data, or both.

    More

    tcgetattr ¶

    tcgetattr :: proc "c" (fildes: FD, termios_p: ^termios) -> result ---
     

    Get the parameters associated with the terminal.

    More

    tcgetpgrp ¶

    tcgetpgrp :: proc "c" (fildes: FD) -> pid_t ---
     

    Get the foreground process group ID.

    Returns:
    -1 (setting errno) on failure, the id otherwise

    More

    tcgetsid ¶

    tcgetsid :: proc "c" (fildes: FD) -> pid_t ---
     

    Get the process group ID for the session leader for the controlling terminal.

    Returns:
    -1 (setting errno) on failure, the pid otherwise

    More

    tcsendbreak ¶

    tcsendbreak :: proc "c" (fildes: FD, duration: i32) -> result ---
     

    Send a break for a specific duration.

    More

    tcsetattr ¶

    tcsetattr :: proc "c" (fildes: FD, optional_actions: TC_Optional_Action, termios_p: ^termios) -> result ---
     

    Set the parameters associated with the terminal.

    More

    tcsetpgrp ¶

    tcsetpgrp :: proc "c" (fildes: FD, pgid_id: pid_t) -> result ---
     

    Set the foreground process group ID.

    More

    telldir ¶

    telldir :: proc "c" (dirp: DIR) -> i64 ---
     

    The telldir() function shall obtain the current location associated with the directory stream specified by dirp.

    More

    tempnam ¶

    tempnam :: proc "c" (dir: cstring, pfx: cstring) -> cstring ---
     

    Create a name for a temporary file.

    Returns:
    an allocated cstring that needs to be freed, nil on failure

    More

    times ¶

    times :: proc "c" (buffer: ^tms) -> libc.clock_t ---
     

    Get time accounting information.

    Returns:
    -1 (setting errno) on failure, the elapsed real time, since an arbitrary point in the past

    truncate ¶

    truncate :: proc "c" (path: cstring, length: off_t) -> result ---
     

    Truncates a file to the specified length.

    More

    ttyname ¶

    ttyname :: proc "c" (fildes: FD) -> cstring ---
     

    Find the path name of a terminal.

    Returns:
    nil (setting errno) on failure, the name, which may be invalidated by subsequent calls on success

    More

    ttyname_r ¶

    ttyname_r :: proc "c" (fildes: FD, name: [^]u8, namesize: uint) -> Errno ---
     

    Equivalent to ttyname but name is placed into the buf.

    More

    tzset ¶

    tzset :: proc "c" () ---
     

    Uses the value of the environment variable TZ (or default) to set time conversion info.

    daylight is set to whether daylight saving time conversion should be done. timezone is set to the difference, in seconds, between UTC and local standard time. tzname is set by tzname[0] = "std" and tzname[1] = "dst"

    Example:
    posix.tzset()
    fmt.println(posix.tzname)
    fmt.println(posix.daylight)
    fmt.println(posix.timezone)
    
    Possible Output:
    ["CET", "CEST"]
    true
    -3600
    

    More

    ulimit ¶

    ulimit :: proc "c" (i: i32, .. arg: ..i64) -> i64 ---
     

    Control process limits.

    Note that -1 is a valid return value, applications should clear errno, do this call and then check both -1 and the errno to determine status.

    Returns:
    -1 (setting errno) on failure.

    More

    umask ¶

    umask :: proc "c" (cmask: bit_set[Mode_Bits; _mode_t]) -> bit_set[Mode_Bits; _mode_t] ---
     

    Set and get the file mode creation flags.

    Makes the file mode permissions bits in cmask the new default for the process.

    Returns:
    the previous value

    More

    uname ¶

    uname :: proc "c" (uname: ^utsname) -> i32 ---
     

    Stores information identifying the current system in the given structure.

    Returns:
    non-negative on success, -1 (setting errno) on failure

    NOTE: have a look at core:sys/info for similar/better system information.

    Example:
    uname: posix.utsname
    posix.uname(&uname)
    fmt.printfln("%#v", uname)
    
    Possible Output:
    utsname{
    	sysname = Darwin,
    	nodename = Laytans-MacBook-Pro.local,
    	release = 23.5.0,
    	version = Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-11331.111.3~1/RELEASE_ARM64_T8103,
    	machine = arm64,
    }
    

    More

    unlink :: proc "c" (path: cstring) -> result ---
     

    Remove a directory entry.

    More

    unlinkat ¶

    unlinkat :: proc "c" (fd: FD, path: cstring, flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to unlink or rmdir (if flag is .REMOVEDIR) but relative paths are relative to the dir fd.

    More

    unlockpt ¶

    unlockpt :: proc "c" (fildes: FD) -> result ---
     

    Unlocks the slave pseudo-terminal device associated with the master to which fildes refers.

    More

    unsetenv ¶

    unsetenv :: proc "c" (name: cstring) -> result ---
     

    Removes an environment variable from the environment of the calling process.

    More

    utime ¶

    utime :: proc "c" (path: cstring, times: ^utimbuf) -> result ---
     

    Set file access and modification times.

    More

    utimensat ¶

    utimensat :: proc "c" (fd: FD, path: cstring, times: ^[2]libc.timespec, flag: bit_set[AT_Flag_Bits; i32]) -> result ---
     

    Equivalent to futimens. Relative directories are based on fd. Symlinks may or may not be followed based on the flags.

    More

    utimes ¶

    utimes :: proc "c" (path: cstring, times: ^[2]timeval) -> result ---
     

    Sets the access and modification times of the file at the given path.

    More

    wait ¶

    wait :: proc "c" (stat_loc: ^i32) -> pid_t ---
     

    Obtains status information pertaining to one of the caller's child processes.

    Returns:
    -1 (setting errno) on failure or signal on calling process, the pid of the process that caused the return otherwise

    More

    waitid ¶

    waitid :: proc "c" (idtype: idtype_t, id: id_t, infop: ^siginfo_t, options: bit_set[Wait_Flag_Bits; i32]) -> i32 ---
     

    Obtains status information pertaining to the given idtype_t and id specifier.

    Returns:
    0 if WNOHANG and no status available, 0 if child changed state, -1 (setting errno) on failure

    More

    waitpid ¶

    waitpid :: proc "c" (pid: pid_t, stat_loc: ^i32, options: bit_set[Wait_Flag_Bits; i32]) -> pid_t ---
     

    Obtains status information pertaining to the given pid specifier.

    If pid is -1, status is requested for any child process. If pid is greater than 0, it specifies the process ID of a single child process. If pid is 0, it specifies any child process whose process group ID is equal to that of the call. If pid is < -1, status is requested for any child whose process group ID is the absolute value of pid.

    Returns:
    -1 (setting errno) on failure or signal on calling process, 0 if NOHANG and status is not available, the pid of the process that caused the return otherwise

    Example:
    // The following example demonstrates the use of waitpid(), fork(), and the macros used to
    // interpret the status value returned by waitpid() (and wait()). The code segment creates a
    // child process which does some unspecified work. Meanwhile the parent loops performing calls
    // to waitpid() to monitor the status of the child. The loop terminates when child termination
    // is detected.
    
    child_pid := posix.fork(); switch child_pid {
    case -1: // `fork` failed.
    	panic("fork failed")
    
    case 0:  // This is the child.
    
    	// Do some work...
    
    case:
    	for {
    		status: i32
    		wpid := posix.waitpid(child_pid, &status, { .UNTRACED, .CONTINUED })
    		if wpid == -1 {
    			panic("waitpid failure")
    		}
    
    		switch {
    		case posix.WIFEXITED(status):
    			fmt.printfln("child exited, status=%v", posix.WEXITSTATUS(status))
    		case posix.WIFSIGNALED(status):
    			fmt.printfln("child killed (signal %v)", posix.WTERMSIG(status))
    		case posix.WIFSTOPPED(status):
    			fmt.printfln("child stopped (signal %v", posix.WSTOPSIG(status))
    		case posix.WIFCONTINUED(status):
    			fmt.println("child continued")
    		case:
    			// Should never happen.
    			fmt.println("unexpected status (%x)", status)
    		}
    
    		if posix.WIFEXITED(status) || posix.WIFSIGNALED(status) {
    			break
    		}
    	}
    }
    

    More

    wordexp ¶

    wordexp :: proc "c" (words: cstring, pwordexp: ^wordexp_t, flags: bit_set[WRDE_Flag_Bits; i32]) -> WRDE_Errno ---
     

    Perform word expansion.

    More

    wordfree ¶

    wordfree :: proc "c" (pwordexp: ^wordexp_t) ---
     

    Free the space allocated during word expansion.

    More

    write ¶

    write :: proc "c" (fd: FD, buf: [^]u8, buflen: uint) -> int ---
     

    Write on a file.

    Returns:
    the amount of bytes written or -1 (setting errno) on failure.

    More

    writev ¶

    writev :: proc "c" (fildes: FD, iov: [^]iovec, iovcnt: i32) -> int ---
     

    Equivalent to write() but takes a vector of inputs.

    iovcnt can be 0..=IOV_MAX in length.

    More

    Procedure Groups

    errno ¶

    errno :: proc{
    	get_errno,
    	set_errno,
    }
    

    Source Files

    Generation Information

    Generated with odin version dev-2024-09 (vendor "odin") Windows_amd64 @ 2024-09-15 21:11:17.420294000 +0000 UTC