package core:sys/posix
Warning: This was generated for -target:darwin_arm64
and might not represent every target this package supports.
Overview
Raw bindings for most POSIX APIs.
Targets glibc and musl compatibility.
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.
The parts of POSIX that Windows implements are also supported here, but other symbols are undefined on Windows targets.
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 (200)
- AF
- AT_Flag_Bits
- AT_Flags
- Addrinfo_Flag_Bits
- Addrinfo_Flags
- Any_Code
- BUS_Code
- CControl_Flag_Bits
- CControl_Flags
- CInput_Flag_Bits
- CInput_Flags
- CLD_Code
- CLocal_Flag_Bits
- CLocal_Flags
- COutput_Flag_Bits
- COutput_Flags
- CS
- Cancel_State
- Cancel_Type
- Clock
- Control_Char
- DIR
- D_Type
- Detach_State
- Errno
- FCNTL_Cmd
- FD
- FILE
- FNM_Flag_Bits
- FNM_Flags
- FPE_Code
- Glob_Flag_Bits
- Glob_Flags
- Glob_Result
- ILL_Code
- IPC_Cmd
- IPC_Flag_Bits
- IPC_Flags
- ITimer
- Info_Errno
- Inherit_Sched
- Locale_Category
- Lock_Flag_Bits
- Lock_Flags
- Lock_Function
- Lock_Type
- MAdvice
- Map_Flag_Bits
- Map_Flags
- Mode_Bits
- Mode_Flag_Bits
- Mode_Flags
- Msg_Flag_Bits
- Msg_Flags
- Nameinfo_Flag_Bits
- Nameinfo_Flags
- O_Flag_Bits
- O_Flags
- PC
- POLL_Code
- Poll_Event
- Poll_Event_Bits
- Prot_Flag_Bits
- Prot_Flags
- Protocol
- RTLD_Flag_Bits
- RTLD_Flags
- Resource
- SA_Flags
- SA_Flags_Bits
- SC
- SEGV_Code
- SHM_Flag_Bits
- SHM_Flags
- SS_Flag_Bits
- SS_Flags
- Sched_Policy
- Sem_Cmd
- Shut
- Sig
- Signal
- Sock
- Sock_Option
- Symbol_Table
- Sync_Flags
- Sync_Flags_Bits
- TC_Action
- TC_Optional_Action
- TC_Queue
- TRAP_Code
- Thread_Scope
- Ulimit_Cmd
- VFS_Flag_Bits
- VFS_Flags
- WRDE_Errno
- WRDE_Flag_Bits
- WRDE_Flags
- Wait_Flag_Bits
- Wait_Flags
- Whence
- Which_Prio
- Which_Usage
- addrinfo
- blkcnt_t
- blksize_t
- cc_t
- clock_t
- clockid_t
- cmsghdr
- dev_t
- dir_loc
- dirent
- div_t
- fd_set
- flock
- fpos_t
- fsblkcnt_t
- gid_t
- glob_t
- group
- hostent
- iconv_t
- id_t
- idtype_t
- if_nameindex_t
- in6_addr
- in_addr
- in_addr_t
- in_port_t
- ino_t
- iovec
- ipc_perm
- ipv6_mreq
- itimerval
- jmp_buf
- key_t
- lconv
- ldiv_t
- linger
- lldiv_t
- mode_t
- msghdr
- msglen_t
- msgqnum_t
- msqid_ds
- netent
- nfds_t
- nl_item
- nl_item_t
- nlink_t
- off_t
- passwd
- pid_t
- pollfd
- protoent
- pthread_attr_t
- pthread_cond_t
- pthread_key_t
- pthread_mutex_t
- pthread_t
- pton_result
- result
- rlim_t
- rlimit
- rusage
- sa_family_t
- sched_param
- sembuf
- semid_ds
- semun
- servent
- shmatt_t
- shmid_ds
- sigaction_t
- siginfo_t
- sigjmp_buf
- sigset_t
- sigval
- sockaddr
- sockaddr_in
- sockaddr_in6
- sockaddr_storage
- sockaddr_un
- socklen_t
- speed_t
- stack_t
- stat_t
- statvfs_t
- suseconds_t
- tcflag_t
- termios
- time_t
- timespec
- timeval
- tm
- tms
- uid_t
- utimbuf
- utsname
- wordexp_t
Constants (636)
- ABDAY_1
- ABDAY_2
- ABDAY_3
- ABDAY_4
- ABDAY_5
- ABDAY_6
- ABDAY_7
- ABMON_1
- ABMON_10
- ABMON_11
- ABMON_12
- ABMON_2
- ABMON_3
- ABMON_4
- ABMON_5
- ABMON_6
- ABMON_7
- ABMON_8
- ABMON_9
- AF_INET
- AF_INET6
- AF_UNIX
- AF_UNSPEC
- AI_ADDRCONFIG
- AI_ALL
- AI_CANONNAME
- AI_NUMERICHOST
- AI_NUMERICSERV
- AI_PASSIVE
- AI_V4MAPPED
- ALT_DIGITS
- AM_STR
- ARG_MAX
- AT_EACCESS
- AT_FDCWD
- AT_REMOVEDIR
- AT_SYMLINK_FOLLOW
- AT_SYMLINK_NOFOLLOW
- B0
- B110
- B1200
- B134
- B150
- B1800
- B19200
- B200
- B2400
- B300
- B38400
- B4800
- B50
- B600
- B75
- B9600
- BC_BASE_MAX
- BC_DIM_MAX
- BC_SCALE_MAX
- BC_STRING_MAX
- BRKINT
- BS0
- BS1
- BSDLY
- BUFSIZ
- BUS_ADRALN
- BUS_ADRERR
- BUS_OBJERR
- CHARCLASS_NAME_MAX
- CHILD_MAX
- CLD_CONTINUED
- CLD_DUMPED
- CLD_EXITED
- CLD_KILLED
- CLD_STOPPED
- CLD_TRAPPED
- CLOCAL
- CLOCKS_PER_SEC
- CLOCK_MONOTONIC
- CLOCK_PROCESS_CPUTIME_ID
- CLOCK_REALTIME
- CLOCK_THREAD_CPUTIME_ID
- CODESET
- COLL_WEIGHTS_MAX
- CR0
- CR1
- CR2
- CR3
- CRDLY
- CREAD
- CRNCYSTR
- CS5
- CS6
- CS7
- CS8
- CSIZE
- CSTOPB
- DAY_1
- DAY_2
- DAY_3
- DAY_4
- DAY_5
- DAY_6
- DAY_7
- D_FMT
- D_T_FMT
- E2BIG
- EACCES
- EADDRINUSE
- EADDRNOTAVAIL
- EAFNOSUPPORT
- EAGAIN
- EAI_AGAIN
- EAI_BADFLAGS
- EAI_FAIL
- EAI_FAMILY
- EAI_MEMORY
- EAI_NONAME
- EAI_OVERFLOW
- EAI_SERVICE
- EAI_SOCKTYPE
- EAI_SYSTEM
- EALREADY
- EBADF
- EBADMSG
- EBUSY
- ECANCELED
- ECHILD
- ECHO
- ECHOE
- ECHOK
- ECHONL
- ECONNABORTED
- ECONNREFUSED
- ECONNRESET
- EDEADLK
- EDESTADDRREQ
- EDOM
- EDQUOT
- EEXIST
- EFAULT
- EFBIG
- EHOSTUNREACH
- EIDRM
- EILSEQ
- EINPROGRESS
- EINTR
- EINVAL
- EIO
- EISCONN
- EISDIR
- ELOOP
- EMFILE
- EMLINK
- EMSGSIZE
- EMULTIHOP
- ENAMETOOLONG
- ENETDOWN
- ENETRESET
- ENETUNREACH
- ENFILE
- ENOBUFS
- ENODATA
- ENODEV
- ENOENT
- ENOEXEC
- ENOLCK
- ENOLINK
- ENOMEM
- ENOMSG
- ENOPROTOOPT
- ENOSPC
- ENOSR
- ENOSTR
- ENOSYS
- ENOTCONN
- ENOTDIR
- ENOTEMPTY
- ENOTRECOVERABLE
- ENOTSOCK
- ENOTSUP
- ENOTTY
- ENXIO
- EOF
- EOPNOTSUPP
- EOVERFLOW
- EOWNERDEAD
- EPERM
- EPIPE
- EPROTO
- EPROTONOSUPPORT
- EPROTOTYPE
- ERA
- ERANGE
- ERA_D_FMT
- ERA_D_T_FMT
- ERA_T_FMT
- EROFS
- ESPIPE
- ESRCH
- ESTALE
- ETIME
- ETIMEDOUT
- ETXTBSY
- EWOULDBLOCK
- EXDEV
- EXIT_FAILURE
- EXIT_SUCCESS
- EXPR_NEST_MAX
- FD_CLOEXEC
- FD_SETSIZE
- FF0
- FF1
- FFDLY
- FILENAME_MAX
- FNM_NOESCAPE
- FNM_NOMATCH
- FNM_PATHNAME
- FNM_PERIOD
- FOPEN_MAX
- FPE_FLTDIV
- FPE_FLTINV
- FPE_FLTOVF
- FPE_FLTRES
- FPE_FLTSUB
- FPE_FLTUND
- FPE_INTDIV
- FPE_INTOVF
- F_DUPFD
- F_DUPFD_CLOEXEC
- F_GETFD
- F_GETFL
- F_GETLK
- F_GETOWN
- F_LOCK
- F_OK
- F_RDLCK
- F_SETFD
- F_SETFL
- F_SETLK
- F_SETLKW
- F_SETOWN
- F_TEST
- F_TLOCK
- F_ULOCK
- F_UNLCK
- F_WRLCK
- GETALL
- GETNCNT
- GETPID
- GETVAL
- GETZCNT
- GLOB_ABORTED
- GLOB_APPEND
- GLOB_DOOFFS
- GLOB_ERR
- GLOB_MARK
- GLOB_NOCHECK
- GLOB_NOESCAPE
- GLOB_NOMATCH
- GLOB_NOSORT
- GLOB_NOSPACE
- HUPCL
- ICANON
- ICRNL
- IEXTEN
- IF_NAMESIZE
- IGNBRK
- IGNCR
- IGNPAR
- ILL_BADSTK
- ILL_COPROC
- ILL_ILLADR
- ILL_ILLOPC
- ILL_ILLOPN
- ILL_ILLTRP
- ILL_PRVOPC
- ILL_PRVREG
- INADDR_ANY
- INADDR_BROADCAST
- INET6_ADDRSTRLEN
- INET_ADDRSTRLEN
- INLCR
- INPCK
- IOV_MAX
- IPC_CREAT
- IPC_EXCL
- IPC_NOWAIT
- IPC_PRIVATE
- IPC_RMID
- IPC_SET
- IPC_STAT
- IPPORT_RESERVED
- IPPROTO_ICMP
- IPPROTO_IP
- IPPROTO_IPV6
- IPPROTO_RAW
- IPPROTO_TCP
- IPPROTO_UDP
- IPV6_JOIN_GROUP
- IPV6_LEAVE_GROUP
- IPV6_MULTICAST_HOPS
- IPV6_MULTICAST_IF
- IPV6_MULTICAST_LOOP
- IPV6_UNICAST_HOPS
- IPV6_V6ONLY
- ISIG
- ISTRIP
- ITIMER_PROF
- ITIMER_REAL
- ITIMER_VIRTUAL
- IXANY
- IXOFF
- IXON
- LINE_MAX
- LINK_MAX
- LPSELECT
- LSELECT
- L_ctermid
- L_tmpnam
- MAP_FAILED
- MAP_FIXED
- MAP_PRIVATE
- MAP_SHARED
- MAX_CANON
- MAX_INPUT
- MCL_CURRENT
- MCL_FUTURE
- MINSIGSTKSZ
- MON_1
- MON_10
- MON_11
- MON_12
- MON_2
- MON_3
- MON_4
- MON_5
- MON_6
- MON_7
- MON_8
- MON_9
- MSG_CTRUNC
- MSG_DONTROUTE
- MSG_EOR
- MSG_NOERROR
- MSG_NOSIGNAL
- MSG_OOB
- MSG_PEEK
- MSG_TRUNC
- MSG_WAITALL
- MS_ASYNC
- MS_INVALIDATE
- MS_SYNC
- NAME_MAX
- NCCS
- NGROUPS_MAX
- NI_DGRAM
- NI_NAMEREQD
- NI_NOFQDN
- NI_NUMERICHOST
- NI_NUMERICSCOPE
- NI_NUMERICSERV
- NL0
- NL1
- NLDLY
- NL_ARGMAX
- NL_LANGMAX
- NL_MSGMAX
- NL_SETMAX
- NL_TEXTMAX
- NOEXPR
- NOFLSH
- NZERO
- OCRNL
- OFDEL
- OFILL
- ONLCR
- ONLRET
- ONOCR
- OPOST
- O_ACCMODE
- O_APPEND
- O_CLOEXEC
- O_CREAT
- O_DIRECTORY
- O_DSYNC
- O_EXCL
- O_EXEC
- O_NOCTTY
- O_NOFOLLOW
- O_NONBLOCK
- O_RDONLY
- O_RDWR
- O_RSYNC
- O_SEARCH
- O_SYNC
- O_TRUNC
- O_TTY_INIT
- O_WRONLY
- PAGESIZE
- PAGE_SIZE
- PARENB
- PARMRK
- PARODD
- PATH_MAX
- PIPE_BUF
- PM_STR
- POLLERR
- POLLHUP
- POLLIN
- POLLNVAL
- POLLOUT
- POLLPRI
- POLLRDBAND
- POLLRDNORM
- POLLWRBAND
- POLLWRNORM
- POLL_ERR
- POLL_HUP
- POLL_IN
- POLL_MSG
- POLL_OUT
- POLL_PRI
- POSIX_MADV_DONTNEED
- POSIX_MADV_NORMAL
- POSIX_MADV_RANDOM
- POSIX_MADV_SEQUENTIAL
- POSIX_MADV_WILLNEED
- PRIO_PGRP
- PRIO_PROCESS
- PRIO_USER
- PROT_EXEC
- PROT_NONE
- PROT_READ
- PROT_WRITE
- PTHREAD_CANCELED
- PTHREAD_CANCEL_ASYNCHRONOUS
- PTHREAD_CANCEL_DEFERRED
- PTHREAD_CANCEL_DISABLE
- PTHREAD_CANCEL_ENABLE
- PTHREAD_CREATE_DETACHED
- PTHREAD_CREATE_JOINABLE
- PTHREAD_DESTRUCTOR_ITERATIONS
- PTHREAD_EXPLICIT_SCHED
- PTHREAD_INHERIT_SCHED
- PTHREAD_KEYS_MAX
- PTHREAD_PRIO_INHERIT
- PTHREAD_PRIO_NONE
- PTHREAD_PRIO_PROTECT
- PTHREAD_PROCESS_PRIVATE
- PTHREAD_PROCESS_SHARED
- PTHREAD_SCOPE_PROCESS
- PTHREAD_SCOPE_SYSTEM
- PTHREAD_STACK_MIN
- P_tmpdir
- RADIXCHAR
- RAND_MAX
- RE_DUP_MAX
- RLIMIT_AS
- RLIMIT_CORE
- RLIMIT_CPU
- RLIMIT_DATA
- RLIMIT_FSIZE
- RLIMIT_NOFILE
- RLIMIT_STACK
- RLIM_INFINITY
- RLIM_SAVED_CUR
- RLIM_SAVED_MAX
- RTLD_GLOBAL
- RTLD_LAZY
- RTLD_LOCAL
- RTLD_NOW
- RUSAGE_CHILDREN
- RUSAGE_SELF
- R_OK
- SA_NOCLDSTOP
- SA_NOCLDWAIT
- SA_NODEFER
- SA_ONSTACK
- SA_RESETHAND
- SA_RESTART
- SA_SIGINFO
- SCHED_FIFO
- SCHED_OTHER
- SCHED_RR
- SCM_RIGHTS
- SEEK_CUR
- SEEK_END
- SEEK_SET
- SEGV_ACCERR
- SEGV_MAPERR
- SEM_UNDO
- SETALL
- SETVAL
- SHMLBA
- SHM_RDONLY
- SHM_RND
- SHUT_RD
- SHUT_RDWR
- SHUT_WR
- SIGABRT
- SIGALRM
- SIGBUS
- SIGCHLD
- SIGCONT
- SIGFPE
- SIGHUP
- SIGILL
- SIGINT
- SIGKILL
- SIGPIPE
- SIGPOLL
- SIGPROF
- SIGQUIT
- SIGSEGV
- SIGSTKSZ
- SIGSTOP
- SIGSYS
- SIGTERM
- SIGTRAP
- SIGTSTP
- SIGTTIN
- SIGTTOU
- SIGURG
- SIGUSR1
- SIGUSR2
- SIGVTALRM
- SIGXCPU
- SIGXFSZ
- SIG_BLOCK
- SIG_DFL
- SIG_ERR
- SIG_HOLD
- SIG_IGN
- SIG_SETMASK
- SIG_UNBLOCK
- SI_ASYNCIO
- SI_MESGQ
- SI_QUEUE
- SI_TIMER
- SI_USER
- SOCK_DGRAM
- SOCK_RAW
- SOCK_SEQPACKET
- SOCK_STREAM
- SOL_SOCKET
- SOMAXCONN
- SO_ACCEPTCONN
- SO_BROADCAST
- SO_DEBUG
- SO_DONTROUTE
- SO_ERROR
- SO_KEEPALIVE
- SO_LINGER
- SO_OOBINLINE
- SO_RCVBUF
- SO_RCVLOWAT
- SO_RCVTIMEO
- SO_REUSEADDR
- SO_SNDBUF
- SO_SNDLOWAT
- SO_SNDTIMEO
- SO_TYPE
- SS_DISABLE
- SS_ONSTACK
- STDERR_FILENO
- STDIN_FILENO
- STDOUT_FILENO
- ST_NOSUID
- ST_RDONLY
- S_IFBLK
- S_IFCHR
- S_IFDIR
- S_IFIFO
- S_IFLNK
- S_IFMT
- S_IFREG
- S_IFSOCK
- S_IRWXG
- S_IRWXO
- S_IRWXU
- TAB0
- TAB1
- TAB3
- TABDLY
- TCIFLUSH
- TCIOFF
- TCIOFLUSH
- TCION
- TCOFLUSH
- TCOOFF
- TCOON
- TCP_NODELAY
- THOUSEP
- TMP_MAX
- TOSTOP
- TRAP_BRKPT
- TRAP_TRACE
- T_FMT
- T_FMT_AMPM
- UL_GETFSIZE
- UL_SETFSIZE
- UTIME_NOW
- UTIME_OMIT
- VEOF
- VEOL
- VERASE
- VINTR
- VKILL
- VMIN
- VQUIT
- VSTART
- VSTOP
- VSUSP
- VT0
- VT1
- VTDLY
- VTIME
- WCONTINUED
- WEXITED
- WNOHANG
- WNOWAIT
- WRDE_APPEND
- WRDE_BADCHAR
- WRDE_BADVAL
- WRDE_CMDSUB
- WRDE_DOOFFS
- WRDE_NOCMD
- WRDE_NOSPACE
- WRDE_REUSE
- WRDE_SHOWERR
- WRDE_SYNTAX
- WRDE_UNDEF
- WSTOPPED
- WUNTRACED
- W_OK
- X_OK
- YESEXPR
Variables (14)
Procedures (414)
- CMSG_DATA
- CMSG_FIRSTHDR
- CMSG_NXTHDR
- FD_CLR
- FD_ISSET
- FD_SET
- FD_ZERO
- IN6_IS_ADDR_LINKLOCAL
- IN6_IS_ADDR_LOOPBACK
- IN6_IS_ADDR_MC_GLOBAL
- IN6_IS_ADDR_MC_LINKLOCAL
- IN6_IS_ADDR_MC_NODELOCAL
- IN6_IS_ADDR_MC_ORGLOCAL
- IN6_IS_ADDR_MC_SITELOCAL
- IN6_IS_ADDR_MULTICAST
- IN6_IS_ADDR_SITELOCAL
- IN6_IS_ADDR_UNSPECIFIED
- IN6_IS_ADDR_V4COMPAT
- IN6_IS_ADDR_V4MAPPED
- S_ISBLK
- S_ISCHR
- S_ISDIR
- S_ISFIFO
- S_ISLNK
- S_ISREG
- S_ISSOCK
- WEXITSTATUS
- WIFCONTINUED
- WIFEXITED
- WIFSIGNALED
- WIFSTOPPED
- WSTOPSIG
- WTERMSIG
- a64l
- accept
- access
- alarm
- alphasort
- asctime_r
- basename
- bind
- cfgetispeed
- cfgetospeed
- cfsetispeed
- cfsetospeed
- chdir
- chmod
- chown
- clock_getres
- clock_gettime
- clock_settime
- close
- closedir
- confstr
- connect
- creat
- crypt
- ctermid
- ctime_r
- dirfd
- dirname
- dlclose
- dlerror
- dlopen
- dlsym
- dprintf
- drand48
- dup
- dup2
- encrypt
- endgrent
- endhostent
- endnetent
- endprotoent
- endpwent
- endservent
- erand48
- execl
- execle
- execlp
- execv
- execve
- execvp
- faccessat
- fchdir
- fchmod
- fchmodat
- fchown
- fchownat
- fcntl
- fdatasync
- fdopen
- fdopendir
- fexecve
- fileno
- flockfile
- fmemopen
- fnmatch
- fork
- fpathconf
- free
- freeaddrinfo
- fseeko
- fstat
- fstatat
- fstatvfs
- fsync
- ftello
- ftok
- ftruncate
- ftrylockfile
- funlockfile
- futimens
- gai_strerror
- get_errno
- getaddrinfo
- getc_unlocked
- getchar_unlocked
- getcwd
- getdate
- getdelim
- getegid
- geteuid
- getgid
- getgrent
- getgrgid
- getgrgid_r
- getgrnam
- getgrnam_r
- getgroups
- gethostent
- gethostid
- gethostname
- getitimer
- getline
- getlogin
- getlogin_r
- getnameinfo
- getnetbyaddr
- getnetbyname
- getnetent
- getopt
- getpeername
- getpgid
- getpgrp
- getpid
- getppid
- getpriority
- getprotobyname
- getprotobynumber
- getprotoent
- getpwent
- getpwnam
- getpwnam_r
- getpwuid
- getpwuid_r
- getrlimit
- getrusage
- gets
- getservbyname
- getservbyport
- getservent
- getsid
- getsockname
- getsockopt
- getsubopt
- gettimeofday
- getuid
- glob
- globfree
- gmtime_r
- grantpt
- iconv
- iconv_close
- iconv_open
- if_freenameindex
- if_indextoname
- if_nameindex
- if_nametoindex
- inet_ntoa
- inet_ntop
- inet_pton
- initstate
- isatty
- jrand48
- kill
- killpg
- l64a
- lchown
- lcong48
- link
- linkat
- listen
- localtime_r
- lockf
- lrand48
- lseek
- lstat
- mkdir
- mkdirat
- mkdtemp
- mkfifo
- mkfifoat
- mknod
- mknodat
- mkstemp
- mlock
- mlockall
- mmap
- mprotect
- mrand48
- msgctl
- msgget
- msgrcv
- msgsnd
- msync
- munlock
- munlockall
- munmap
- nanosleep
- nice
- nl_langinfo
- nrand48
- open
- open_memstream
- openat
- opendir
- pathconf
- pause
- pclose
- pipe
- poll
- popen
- posix_madvise
- posix_memalign
- posix_openpt
- pread
- pselect
- psignal
- pthread_atfork
- pthread_attr_destroy
- pthread_attr_getdetachstate
- pthread_attr_getguardsize
- pthread_attr_getinheritsched
- pthread_attr_getschedparam
- pthread_attr_getschedpolicy
- pthread_attr_getscope
- pthread_attr_getstack
- pthread_attr_getstacksize
- pthread_attr_init
- pthread_attr_setdetachstate
- pthread_attr_setguardsize
- pthread_attr_setinheritsched
- pthread_attr_setschedparam
- pthread_attr_setschedpolicy
- pthread_attr_setscope
- pthread_attr_setstack
- pthread_attr_setstacksize
- pthread_cancel
- pthread_create
- pthread_detach
- pthread_equal
- pthread_exit
- pthread_getconcurrency
- pthread_getcpuclockid
- pthread_getschedparam
- pthread_getspecific
- pthread_join
- pthread_key_create
- pthread_key_delete
- pthread_kill
- pthread_self
- pthread_setcancelstate
- pthread_setcanceltype
- pthread_setconcurrency
- pthread_setschedparam
- pthread_setschedprio
- pthread_setspecific
- pthread_sigmask
- pthread_testcancel
- ptsname
- putc_unlocked
- putchar_unlocked
- putenv
- pwrite
- raise
- rand_r
- random
- read
- readdir
- readlink
- readlinkat
- readv
- realpath
- recv
- recvfrom
- recvmsg
- renameat
- rewinddir
- rmdir
- scandir
- sched_get_priority_max
- sched_get_priority_min
- sched_yield
- seed48
- seekdir
- select
- semctl
- semget
- semop
- send
- sendmsg
- sendto
- set_errno
- setegid
- setenv
- seteuid
- setgid
- setgrent
- sethostent
- setitimer
- setkey
- setnetent
- setpgid
- setpgrp
- setpriority
- setprotoent
- setpwent
- setregid
- setreuid
- setrlimit
- setservent
- setsid
- setsockopt
- setstate
- setuid
- shm_open
- shm_unlink
- shmat
- shmctl
- shmdt
- shmget
- shutdown
- sigaction
- sigaddset
- sigaltstack
- sigdelset
- sigemptyset
- sigfillset
- sighold
- sigignore
- siginterrupt
- sigismember
- siglongjmp
- signal
- sigpause
- sigpending
- sigprocmask
- sigrelse
- sigsetjmp
- sigsuspend
- sigwait
- sleep
- sockatmark
- socket
- socketpair
- sprintf
- srand48
- srandom
- stat
- statvfs
- strerror
- strerror_r
- strfmon
- strptime
- strsignal
- swab
- symlink
- symlinkat
- sync
- sysconf
- tcdrain
- tcflow
- tcflush
- tcgetattr
- tcgetpgrp
- tcgetsid
- tcsendbreak
- tcsetattr
- tcsetpgrp
- telldir
- tempnam
- times
- truncate
- ttyname
- ttyname_r
- tzset
- ulimit
- umask
- uname
- unlink
- unlinkat
- unlockpt
- unsetenv
- utime
- utimensat
- utimes
- wait
- waitid
- waitpid
- wordexp
- wordfree
- write
- writev
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 }
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 }
CInput_Flags ¶
CInput_Flags :: bit_set[CInput_Flag_Bits; tcflag_t]
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 }
CLocal_Flags ¶
CLocal_Flags :: bit_set[CLocal_Flag_Bits; tcflag_t]
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 }
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 { // Cancel takes place at next cancellation point. ENABLE = 1, // Cancel postponed. DISABLE = 0, }
Related Procedures With Parameters
Cancel_Type ¶
Cancel_Type :: enum i32 { // Cancel waits until cancellation point. DEFERRED = 2, // Cancel occurs immediately. 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, }
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
- set_errno
- strerror_r
- errno (procedure groups)
Related Procedures With Returns
- get_errno
- getgrgid_r
- getgrnam_r
- getlogin_r
- getpwnam_r
- getpwuid_r
- posix_madvise
- posix_memalign
- pthread_atfork
- pthread_attr_destroy
- pthread_attr_getdetachstate
- pthread_attr_getguardsize
- pthread_attr_getinheritsched
- pthread_attr_getschedparam
- pthread_attr_getschedpolicy
- pthread_attr_getscope
- pthread_attr_getstack
- pthread_attr_getstacksize
- pthread_attr_init
- pthread_attr_setdetachstate
- pthread_attr_setguardsize
- pthread_attr_setinheritsched
- pthread_attr_setschedparam
- pthread_attr_setschedpolicy
- pthread_attr_setscope
- pthread_attr_setstack
- pthread_attr_setstacksize
- pthread_cancel
- pthread_create
- pthread_detach
- pthread_getcpuclockid
- pthread_getschedparam
- pthread_join
- pthread_key_create
- pthread_key_delete
- pthread_kill
- pthread_setcancelstate
- pthread_setcanceltype
- pthread_setconcurrency
- pthread_setschedparam
- pthread_setschedprio
- pthread_setspecific
- pthread_sigmask
- sigwait
- ttyname_r
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
FD ¶
FD :: distinct i32
Related Procedures With Parameters
- FD_CLR
- FD_ISSET
- FD_SET
- accept
- bind
- close
- connect
- dprintf
- dup
- dup2
- faccessat
- fchdir
- fchmod
- fchmodat
- fchown
- fchownat
- fcntl
- fdatasync
- fdopen
- fdopendir
- fexecve
- fpathconf
- fstat
- fstatat
- fstatvfs
- fsync
- ftruncate
- futimens
- getpeername
- getsockname
- getsockopt
- grantpt
- isatty
- linkat
- listen
- lockf
- lseek
- mkdirat
- mkfifoat
- mknodat
- mmap
- msgctl
- msgrcv
- msgsnd
- openat
- pread
- ptsname
- pwrite
- read
- readlinkat
- readv
- recv
- recvfrom
- recvmsg
- renameat
- semctl
- semop
- send
- sendmsg
- sendto
- setsockopt
- shmat
- shmctl
- shutdown
- sockatmark
- symlinkat
- tcdrain
- tcflow
- tcflush
- tcgetattr
- tcgetpgrp
- tcgetsid
- tcsendbreak
- tcsetattr
- tcsetpgrp
- ttyname
- ttyname_r
- unlinkat
- unlockpt
- utimensat
- write
- writev
Related Procedures With Returns
Related Constants
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_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 :: libc.Locale_Category
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, }
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, }
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, }
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, }
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
- kill
- killpg
- psignal
- pthread_kill
- raise
- sigaction
- sigaddset
- sigdelset
- sighold
- sigignore
- siginterrupt
- sigismember
- signal
- sigpause
- sigrelse
- sigwait
- strsignal
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_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]
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
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
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
fsblkcnt_t ¶
fsblkcnt_t :: distinct u32
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
idtype_t ¶
idtype_t :: enum i32 { // Wait for any children and `id` is ignored. P_ALL = 0, // Wait for any child wiith a process group ID equal to `id`. P_PID = 1, // Wait for any child with a process group ID equal to `id`. P_PGID = 2, }
Related Procedures With Parameters
in6_addr ¶
in6_addr :: struct { using _: struct #raw_union { s6_addr: [16]u8, // [PSX] big endian address __u6_addr16: [8]u16, __u6_addr32: [4]u32, }, }
Related Procedures With Parameters
in_addr_t ¶
in_addr_t :: u32be
in_port_t ¶
in_port_t :: u16be
iovec ¶
Related Procedures With Parameters
itimerval ¶
Related Procedures With Parameters
key_t ¶
key_t :: distinct i32
Related Procedures With Parameters
Related Procedures With Returns
Related Constants
mode_t ¶
Related Constants
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 { 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, msg_rtime: libc.time_t, // [PSX] time of last msgrcv() msg_pad2: i32, 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
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
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
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_attr_t ¶
Related Procedures With Parameters
- pthread_attr_destroy
- pthread_attr_getdetachstate
- pthread_attr_getguardsize
- pthread_attr_getinheritsched
- pthread_attr_getschedparam
- pthread_attr_getschedpolicy
- pthread_attr_getscope
- pthread_attr_getstack
- pthread_attr_getstacksize
- pthread_attr_init
- pthread_attr_setdetachstate
- pthread_attr_setguardsize
- pthread_attr_setinheritsched
- pthread_attr_setschedparam
- pthread_attr_setschedpolicy
- pthread_attr_setscope
- pthread_attr_setstack
- pthread_attr_setstacksize
- pthread_create
pthread_t ¶
pthread_t :: distinct u64
Related Procedures With Parameters
- pthread_cancel
- pthread_create
- pthread_detach
- pthread_equal
- pthread_getcpuclockid
- pthread_getschedparam
- pthread_join
- pthread_kill
- pthread_setschedparam
- pthread_setschedprio
Related Procedures With Returns
pton_result ¶
pton_result :: enum i32 { AFNOSUPPORT = -1, INVALID = 0, SUCCESS = 1, }
Related Procedures With Returns
result ¶
result :: enum i32 { // Use `errno` and `strerror` for more information. FAIL = -1, // Operation succeeded. OK = 0, }
Related Procedures With Returns
- access
- bind
- cfsetispeed
- cfsetospeed
- chdir
- chmod
- chown
- clock_getres
- clock_gettime
- clock_settime
- close
- closedir
- connect
- faccessat
- fchdir
- fchmod
- fchmodat
- fchown
- fchownat
- fdatasync
- fseeko
- fstat
- fstatat
- fstatvfs
- fsync
- ftruncate
- futimens
- gethostname
- getitimer
- getpeername
- getrlimit
- getrusage
- getsockname
- getsockopt
- gettimeofday
- grantpt
- iconv_close
- kill
- killpg
- lchown
- link
- linkat
- listen
- lockf
- lstat
- mkdir
- mkdirat
- mkfifo
- mkfifoat
- mknod
- mknodat
- mlock
- mlockall
- mprotect
- msgctl
- msgsnd
- msync
- munlock
- munlockall
- munmap
- nanosleep
- pipe
- raise
- renameat
- rmdir
- sched_yield
- semop
- setegid
- setenv
- seteuid
- setgid
- setitimer
- setpgid
- setpriority
- setregid
- setreuid
- setrlimit
- setsockopt
- setuid
- shm_unlink
- shmctl
- shmdt
- shutdown
- sigaction
- sigaddset
- sigaltstack
- sighold
- sigignore
- siginterrupt
- sigpause
- sigpending
- sigprocmask
- sigrelse
- sigsuspend
- socketpair
- stat
- statvfs
- symlink
- symlinkat
- tcdrain
- tcflow
- tcflush
- tcgetattr
- tcsendbreak
- tcsetattr
- tcsetpgrp
- truncate
- unlink
- unlinkat
- unlockpt
- unsetenv
- utime
- utimensat
- utimes
rlimit ¶
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 { 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, sem_ctime: libc.time_t, // [PSX] last time changed by semctl() sem_pad2: i32, sem_pad3: [4]i32, }
semun ¶
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 { 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 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
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_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, // [PSX] ID of device containing file st_mode: bit_set[Mode_Bits; _mode_t], // [PSX] mode of file st_nlink: nlink_t, // [PSX] number of hard links st_ino: ino_t, // [PSX] file serial number st_uid: uid_t, // [PSX] user ID of the file st_gid: gid_t, // [PSX] group ID of the file st_rdev: dev_t, // [PSX] device ID st_atim: libc.timespec, // [PSX] time of last access st_mtim: libc.timespec, // [PSX] time of last data modification st_ctim: libc.timespec, // [PSX] time of last status change st_birthtimespec: libc.timespec, // time of file creation(birth) st_size: off_t, // [PSX] file size, in bytes st_blocks: blkcnt_t, // [PSX] blocks allocated for file st_blksize: blksize_t, // [PSX] 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
timespec ¶
timespec :: libc.timespec
timeval ¶
timeval :: struct { tv_sec: libc.time_t, // [PSX] seconds tv_usec: suseconds_t, }
Related Procedures With Parameters
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
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
ABMON_10 ¶
ABMON_10 :: 42
ABMON_11 ¶
ABMON_11 :: 43
ABMON_12 ¶
ABMON_12 :: 44
AF_INET6 ¶
AF_INET6 :: 30
AF_UNSPEC ¶
AF_UNSPEC :: 0
AI_ADDRCONFIG ¶
AI_ADDRCONFIG :: 0x00000400
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
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 ¶
AT_SYMLINK_FOLLOW :: 0x0040
AT_SYMLINK_NOFOLLOW ¶
AT_SYMLINK_NOFOLLOW :: 0x0020
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
BSDLY ¶
BSDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_BSDLY)
\b delay mask
BUS_ADRALN ¶
BUS_ADRALN :: 1
BUS_ADRERR ¶
BUS_ADRERR :: 2
BUS_OBJERR ¶
BUS_OBJERR :: 3
CHARCLASS_NAME_MAX ¶
CHARCLASS_NAME_MAX :: 14
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
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
COLL_WEIGHTS_MAX ¶
COLL_WEIGHTS_MAX :: 2
CRDLY ¶
CRDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_CRDLY)
\r delay mask
CRNCYSTR ¶
CRNCYSTR :: 56
CSIZE ¶
CSIZE: bit_set[CControl_Flag_Bits; tcflag_t] : transmute(CControl_Flags)tcflag_t(_CSIZE)
character size mask
EADDRINUSE ¶
EADDRINUSE :: 48
EADDRNOTAVAIL ¶
EADDRNOTAVAIL :: 49
EAFNOSUPPORT ¶
EAFNOSUPPORT :: 47
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
ECANCELED ¶
ECANCELED :: 89
ECONNABORTED ¶
ECONNABORTED :: 53
ECONNREFUSED ¶
ECONNREFUSED :: 61
ECONNRESET ¶
ECONNRESET :: 54
EDESTADDRREQ ¶
EDESTADDRREQ :: 39
EHOSTUNREACH ¶
EHOSTUNREACH :: 65
EINPROGRESS ¶
EINPROGRESS :: 36
EMSGSIZE ¶
EMSGSIZE :: 40
EMULTIHOP ¶
EMULTIHOP :: 95
ENAMETOOLONG ¶
ENAMETOOLONG :: 63
ENETDOWN ¶
ENETDOWN :: 50
ENETRESET ¶
ENETRESET :: 52
ENETUNREACH ¶
ENETUNREACH :: 51
ENOPROTOOPT ¶
ENOPROTOOPT :: 42
ENOTCONN ¶
ENOTCONN :: 57
ENOTEMPTY ¶
ENOTEMPTY :: 66
ENOTRECOVERABLE ¶
ENOTRECOVERABLE :: 104
ENOTSOCK ¶
ENOTSOCK :: 38
EOPNOTSUPP ¶
EOPNOTSUPP :: ENOTSUP
EOVERFLOW ¶
EOVERFLOW :: 84
EOWNERDEAD ¶
EOWNERDEAD :: 105
EPROTONOSUPPORT ¶
EPROTONOSUPPORT :: 43
EPROTOTYPE ¶
EPROTOTYPE :: 41
ERA_D_FMT ¶
ERA_D_FMT :: 46
ERA_D_T_FMT ¶
ERA_D_T_FMT :: 47
ERA_T_FMT ¶
ERA_T_FMT :: 48
ETIMEDOUT ¶
ETIMEDOUT :: 60
EWOULDBLOCK ¶
EWOULDBLOCK :: EAGAIN
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.
FFDLY ¶
FFDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_FFDLY)
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_CLOEXEC ¶
F_DUPFD_CLOEXEC :: 67
F_GETOWN ¶
F_GETOWN :: 5
F_OK ¶
F_OK: bit_set[Mode_Flag_Bits; i32] : Mode_Flags{}
F_SETLKW ¶
F_SETLKW :: 9
F_SETOWN ¶
F_SETOWN :: 6
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
IF_NAMESIZE ¶
IF_NAMESIZE :: 16
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
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_STAT ¶
IPC_STAT :: 2
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
ITIMER_PROF ¶
ITIMER_PROF :: 2
ITIMER_REAL ¶
ITIMER_REAL :: 0
ITIMER_VIRTUAL ¶
ITIMER_VIRTUAL :: 1
LINE_MAX ¶
LINE_MAX :: 2048
LPSELECT ¶
LPSELECT :: "pselect"
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
MSG_CTRUNC ¶
MSG_CTRUNC :: 0x20
MSG_DONTROUTE ¶
MSG_DONTROUTE :: 0x4
MSG_NOERROR ¶
MSG_NOERROR :: 0o10000
MSG_NOSIGNAL ¶
MSG_NOSIGNAL :: 0x80000
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
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
NLDLY ¶
NLDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_NLDLY)
\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
O_ACCMODE ¶
O_ACCMODE: bit_set[O_Flag_Bits; i32] : O_Flags{.EXEC, .RDWR, .WRONLY}
O_APPEND ¶
O_APPEND :: 0x00000008
O_CLOEXEC ¶
O_CLOEXEC :: 0x01000000
O_DIRECTORY ¶
O_DIRECTORY :: 0x00100000
O_NOCTTY ¶
O_NOCTTY :: 0x00020000
O_NOFOLLOW ¶
O_NOFOLLOW :: 0x00000100
O_NONBLOCK ¶
O_NONBLOCK :: 0x00000004
O_RDONLY ¶
O_RDONLY :: 0
O_RSYNC ¶
O_RSYNC: bit_set[O_Flag_Bits; i32] : O_Flags{}
O_SEARCH ¶
O_SEARCH: bit_set[O_Flag_Bits; i32] : O_Flags{.EXEC, .DIRECTORY}
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
PATH_MAX ¶
PATH_MAX :: 1024
PIPE_BUF ¶
PIPE_BUF :: 512
POLLNVAL ¶
POLLNVAL :: 0x0020
POLLRDBAND ¶
POLLRDBAND :: 0x0080
POLLRDNORM ¶
POLLRDNORM :: 0x0040
POLLWRBAND ¶
POLLWRBAND :: 0x0100
POLLWRNORM ¶
POLLWRNORM :: POLLOUT
POLL_ERR ¶
POLL_ERR :: 4
POLL_HUP ¶
POLL_HUP :: 6
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
RLIMIT_CORE ¶
RLIMIT_CORE :: 4
RLIMIT_CPU ¶
RLIMIT_CPU :: 0
RLIMIT_DATA ¶
RLIMIT_DATA :: 2
RLIMIT_FSIZE ¶
RLIMIT_FSIZE :: 1
RLIMIT_NOFILE ¶
RLIMIT_NOFILE :: 7 when ODIN_OS == .Linux else 8
RLIMIT_STACK ¶
RLIMIT_STACK :: 3
RLIM_INFINITY ¶
RLIM_INFINITY: rlim_t : ~rlim_t(0) when ODIN_OS == .Linux else (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
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
SHM_RDONLY ¶
SHM_RDONLY :: 0o10000
SHUT_RDWR ¶
SHUT_RDWR :: 2
SIGSTKSZ ¶
SIGSTKSZ :: 131072
SIGVTALRM ¶
SIGVTALRM :: 26
SIG_BLOCK ¶
SIG_BLOCK :: 1
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
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
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
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_IRWXG ¶
Read, write, execute group.
S_IRWXO ¶
Read, write, execute other.
S_IRWXU ¶
Read, write, execute user.
TABDLY ¶
TABDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_TABDLY)
horizontal tab delay mask
TCIFLUSH ¶
TCIFLUSH :: 1
TCIOFLUSH ¶
TCIOFLUSH :: 3
TCOFLUSH ¶
TCOFLUSH :: 2
TCP_NODELAY ¶
TCP_NODELAY :: 0x01
TRAP_BRKPT ¶
TRAP_BRKPT :: 1
TRAP_TRACE ¶
TRAP_TRACE :: 2
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
VTDLY ¶
VTDLY: bit_set[COutput_Flag_Bits; tcflag_t] : transmute(COutput_Flags)tcflag_t(_VTDLY)
vertical tab delay mask
WCONTINUED ¶
WCONTINUED :: 0x00000010
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
Variables
environ ¶
environ: [^]cstring
Example:
for i, entry := 0, posix.environ[0]; entry != nil; i, entry = i+1, posix.environ[i] {
fmt.println(entry)
}
getdate_err ¶
getdate_err: Errno
in6addr_any ¶
in6addr_any: in6_addr
in6addr_loopback ¶
in6addr_loopback: in6_addr
timezone ¶
@(link_name=LTIMEZONE) timezone: i64
The time in seconds between UTC and local standard time.
Procedures
CMSG_DATA ¶
Returns a pointer to the data array.
CMSG_FIRSTHDR ¶
Returns a pointer to the first cmsghdr or nil.
CMSG_NXTHDR ¶
Returns a pointer to the next cmsghdr or nil.
S_ISBLK ¶
Test for a block special file.
S_ISCHR ¶
Test for a character special file.
S_ISDIR ¶
Test for a directory.
S_ISFIFO ¶
Test for a pipe or FIFO special file.
S_ISLNK ¶
Test for a symbolic link.
S_ISREG ¶
Test for a regular file.
S_ISSOCK ¶
Test for a socket.
WEXITSTATUS ¶
If WIFEXITED is true, returns the exit status.
WIFCONTINUED ¶
If status was returned for a child process that has continued from a job control stop.
WIFSIGNALED ¶
If terminated due to an uncaught signal.
WIFSTOPPED ¶
If status was returned for a child process that is currently stopped.
WSTOPSIG ¶
If WIFSTOPPED, the signal that caused the child process to stop.
WTERMSIG ¶
If WIFSIGNALED is true, returns the signal.
a64l ¶
Takes a pointer to a radix-64 representation, in which the first digit is the least significant, and return the corresponding long value.
accept ¶
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
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()))
}
alarm ¶
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
alphasort ¶
can be used as the comparison function for the scandir() function to sort the directory entries, d1 and d2, into alphabetical order.
basename ¶
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)
+----------------+----------+--------+ |input |dirname |basename| +----------------+----------+--------+ |usr |. |usr | |usr/ |. |usr | | |. |. | |/ |/ |/ | |// |/ |/ | |/// |/ |/ | |/usr/ |/ |usr | |/usr/lib |/usr |lib | |//usr//lib// |//usr |lib | |/home//dwc//test|/home//dwc|test | +----------------+----------+--------+
bind ¶
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")
/*
unlink the socket before binding in case
of previous runs not cleaning up the socket
*/
posix.unlink("/somepath")
if posix.bind(sfd, (^posix.sockaddr)(&addr), size_of(addr)) != .OK {
/* Handle error */
}
chdir ¶
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")
}
chown ¶
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.
confstr ¶
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
crypt ¶
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 ¶
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.
dirname ¶
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().
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)
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.
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)
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))
dprintf ¶
Equivalent to fprintf but output is written to the file descriptor.
Return: number of bytes written, negative (setting errno) on failure
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)
dup ¶
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)
dup2 ¶
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)
encrypt ¶
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")
endgrent ¶
endgrent :: proc "c" () ---
Closes the group database.
Checking status would be done by setting errno to 0, calling this, and checking errno.
erand48 ¶
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)
execl ¶
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()))
execle ¶
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()))
execlp ¶
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()))
execv ¶
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()))
execve ¶
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()))
execvp ¶
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()))
faccessat ¶
faccessat :: proc "c" (fd: FD, path: cstring, amode: bit_set[Mode_Flag_Bits; i32], flag: bit_set[AT_Flag_Bits; i32]) -> result ---
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.
fchown ¶
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)
fchownat ¶
fdatasync ¶
Forcec all currently queued I/O operations associated with the file indicated by file descriptor fildes to the synchronized I/O completion state.
fdopen ¶
Associate a stream with a file descriptor.
Returns:
nil (setting errno) on failure, the stream on success
fdopendir ¶
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.
fexecve ¶
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()))
fileno ¶
Map a stream pointer to a file descriptor.
Returns:
the file descriptor or -1 (setting errno) on failure
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)
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.
freeaddrinfo ¶
freeaddrinfo :: proc "c" (ai: ^addrinfo) ---
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.
fsync ¶
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.
ftello ¶
Return the file offset in a stream.
Returns:
the current file offset, -1 (setting errno) on error
gai_strerror ¶
gai_strerror :: proc "c" (ecode: Info_Errno) -> cstring ---
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...
getchar_unlocked ¶
getchar_unlocked :: proc "c" () -> i32 ---
getcwd ¶
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)
getdate ¶
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
getdelim ¶
Read a delimited record from the stream.
Returns:
the number of bytes written or -1 on failure/EOF
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
getgrgid ¶
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
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.
getgrnam ¶
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
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)
getgroups ¶
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)
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])
}
gethostid ¶
gethostid :: proc "c" () -> i64 ---
gethostname ¶
Returns the standard host name for the current machine.
Host names are limited to HOST_NAME_MAX bytes.
getline ¶
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)
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
getlogin_r ¶
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))
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 ---
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)
}
getopt ¶
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])
}
getpgid ¶
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
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...
}
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)
}
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)
}
getpwnam ¶
Searches the database for an entry with a matching name.
Returns:
nil (setting errno) on error, nil (not setting errno) on success.
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)
getpwuid ¶
Searches the database for an entry with a matching uid.
Returns:
nil (setting errno) on error, nil (not setting errno) on success.
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.
getrusage ¶
getrusage :: proc "c" (who: Which_Usage, rusage: ^rusage) -> result ---
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)
}
getsid ¶
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
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.
getsubopt ¶
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)
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.
gmtime_r ¶
Converts the time in seconds since epoch to a broken-down tm struct.
Returns:
nil (setting errno) on failure, the result pointer on success.
grantpt ¶
Changes the mode and ownership of the slave pseudo-terminal device associated with its master pseudo-terminal counterpart.
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
iconv_close ¶
Deallocates the conversion descriptor cd and all other associated resources allocated by iconv_open().
iconv_open ¶
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
if_freenameindex ¶
if_freenameindex :: proc "c" (ptr: ^if_nameindex_t) ---
if_indextoname ¶
Returns the name corresponding to the index.
ifname should be at least IF_NAMESIZE bytes in size.
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
inet_ntoa ¶
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.
inet_ntop ¶
Convert a numeric address into a text string suitable for presentation.
Returns nil
and sets errno
on failure.
inet_pton ¶
inet_pton :: proc "c" (af: AF, src: cstring, dst: rawptr, size: socklen_t) -> pton_result ---
initstate ¶
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
isatty ¶
Tests whether fildes is associated with a terminal device.
Returns:
false (setting errno) if fildes is invalid or not a terminal, true otherwise
jrand48 ¶
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)
kill ¶
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.
l64a ¶
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
lchown ¶
If path points to a symbolic link, the owner and group of the link itself is changed. Equivalent to chown on normal files.
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.
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.
listen ¶
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.
localtime_r ¶
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.
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))
}
}
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)
lseek ¶
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)
lstat ¶
Obtain information about a "file" at the given path.
Does not follow symlinks (will stat the symlink itself).
mkdtemp ¶
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
mknodat ¶
mkstemp ¶
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
mlockall ¶
mlockall :: proc "c" (flags: bit_set[Lock_Flag_Bits; i32]) -> result ---
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
mprotect ¶
mprotect :: proc "c" (addr: rawptr, len: uint, prot: bit_set[Prot_Flag_Bits; i32]) -> result ---
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)
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
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
msgsnd ¶
msync ¶
msync :: proc "c" (addr: rawptr, len: uint, flags: bit_set[Sync_Flags_Bits; i32]) -> result ---
munlockall ¶
munlockall :: proc "c" () -> result ---
nanosleep ¶
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
nice ¶
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)
nl_langinfo ¶
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))
}
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: ""
nrand48 ¶
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)
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")
}
open_memstream ¶
Open a dynamic memory buffer stream.
Returns:
nil (setting errno) on failure, the stream on success
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.
pathconf ¶
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
pipe ¶
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)
}
poll ¶
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.
popen ¶
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() */
}
posix_memalign ¶
Allocates size bytes aligned on a boundary specified by alignment, and shall return a pointer to the allocated memory in memptr.
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
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
psignal ¶
Writes a language-dependent message to stderror.
Example:
posix.psignal(.SIGSEGV, "that didn't go well")
that didn't go well: Segmentation fault
pthread_atfork ¶
pthread_atfork :: proc "c" (prepare: proc "c" (), parent: proc "c" (), child: proc "c" ()) -> Errno ---
pthread_attr_destroy ¶
pthread_attr_destroy :: proc "c" (attr: ^pthread_attr_t) -> Errno ---
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.
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).
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.
pthread_attr_getschedparam ¶
pthread_attr_getschedparam :: proc "c" (attr: ^pthread_attr_t, param: ^sched_param) -> Errno ---
pthread_attr_getschedpolicy ¶
pthread_attr_getschedpolicy :: proc "c" (attr: ^pthread_attr_t, policy: ^Sched_Policy) -> Errno ---
pthread_attr_getscope ¶
pthread_attr_getscope :: proc "c" (attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
pthread_attr_getstack ¶
pthread_attr_getstack :: proc "c" (attr: ^pthread_attr_t, stackaddr: ^[^]u8, stacksize: ^uint) -> Errno ---
pthread_attr_getstacksize ¶
pthread_attr_getstacksize :: proc "c" (attr: ^pthread_attr_t, stacksize: ^uint) -> Errno ---
pthread_attr_init ¶
pthread_attr_init :: proc "c" (attr: ^pthread_attr_t) -> Errno ---
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.
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).
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.
pthread_attr_setschedparam ¶
pthread_attr_setschedparam :: proc "c" (attr: ^pthread_attr_t, param: ^sched_param) -> Errno ---
pthread_attr_setschedpolicy ¶
pthread_attr_setschedpolicy :: proc "c" (attr: ^pthread_attr_t, policy: Sched_Policy) -> Errno ---
pthread_attr_setscope ¶
pthread_attr_setscope :: proc "c" (attr: ^pthread_attr_t, contentionscope: ^Thread_Scope) -> Errno ---
pthread_attr_setstack ¶
pthread_attr_setstack :: proc "c" (attr: ^pthread_attr_t, stackaddr: [^]u8, stacksize: uint) -> Errno ---
pthread_attr_setstacksize ¶
pthread_attr_setstacksize :: proc "c" (attr: ^pthread_attr_t, stacksize: uint) -> Errno ---
pthread_create ¶
pthread_exit ¶
pthread_exit :: proc "c" (value_ptr: rawptr) -> ! ---
Terminates the calling thread and make the given value available to any successfull join calls.
pthread_getconcurrency ¶
pthread_getconcurrency :: proc "c" () -> i32 ---
pthread_getschedparam ¶
pthread_getschedparam :: proc "c" (thread: pthread_t, policy: ^Sched_Policy, param: ^sched_param) -> Errno ---
pthread_getspecific ¶
pthread_getspecific :: proc "c" (key: pthread_key_t) -> rawptr ---
pthread_join ¶
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
}
pthread_key_create ¶
pthread_key_create :: proc "c" (key: ^pthread_key_t, destructor: proc "c" (value: rawptr) = nil) -> Errno ---
pthread_key_delete ¶
pthread_key_delete :: proc "c" (key: pthread_key_t) -> Errno ---
pthread_kill ¶
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.
pthread_setcancelstate ¶
pthread_setcancelstate :: proc "c" (state: Cancel_State, oldstate: ^Cancel_State) -> Errno ---
pthread_setcanceltype ¶
pthread_setcanceltype :: proc "c" (type: Cancel_Type, oldtype: ^Cancel_Type) -> Errno ---
pthread_setschedparam ¶
pthread_setschedparam :: proc "c" (thread: pthread_t, policy: Sched_Policy, param: ^sched_param) -> Errno ---
pthread_setspecific ¶
pthread_setspecific :: proc "c" (key: pthread_key_t, value: rawptr) -> Errno ---
pthread_sigmask ¶
Examine and change blocked signals.
Equivalent to sigprocmask(), without the restriction that the call be made in a single-threaded process.
pthread_testcancel ¶
pthread_testcancel :: proc "c" () ---
ptsname ¶
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
putenv ¶
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()))
}
rand_r ¶
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.
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.
readdir ¶
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)
}
readlink ¶
Read the contents of a symbolic link.
Returns:
the amount of bytes read or -1 (setting errno) on failure.
realpath ¶
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
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
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
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
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.
rmdir ¶
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)
}
sched_get_priority_max ¶
sched_get_priority_max :: proc "c" (policy: Sched_Policy) -> i32 ---
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
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 ¶
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.
seekdir ¶
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.
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.
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
semop ¶
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.
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
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
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
set_errno ¶
set_errno :: proc "contextless" (err: Errno) {…}
setenv ¶
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()))
}
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.
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.
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))
}
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
setpriority ¶
setpriority :: proc "c" (which: Which_Prio, who: id_t, value: i32) -> result ---
setprotoent ¶
setprotoent :: proc "c" (stayopen: b32) ---
setpwent ¶
setpwent :: proc "c" () ---
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
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.
setstate ¶
Sets the state array of the random number generator.
Returns:
the previous state array or nil on failure
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
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
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
sigaction ¶
sigaction :: proc "c" (sig: Signal, act: ^sigaction_t, oact: ^sigaction_t) -> result ---
sigaltstack ¶
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()))
}
siginterrupt ¶
Changes the restart behavior when a function is interrupted by the specified signal.
If flag is true, SA_RESTART is removed, added otherwise.
sigismember ¶
Test for a signal in a signal set.
Returns:
1 if it is a member, 0 if not, -1 (setting errno) on failure
siglongjmp ¶
siglongjmp :: proc "c" (env: ^sigjmp_buf, val: i32) -> ! ---
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
sigpause ¶
Removes sig from the signal mask of the calling process and suspend the calling process until a signal is received.
sigpending ¶
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.
sigsetjmp ¶
sigsetjmp :: proc "c" (env: ^sigjmp_buf, savemask: b32) -> i32 ---
sleep ¶
Suspend execution for an interval of time.
Returns:
the time left to sleep (may be > 0 in case of signals)
sockatmark ¶
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
socketpair ¶
sprintf ¶
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
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.
strerror_r ¶
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
strfmon ¶
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]))
$123,456.79
strsignal ¶
Map the signal number to an implementation-defined string.
Returns:
a string that may be invalidated by subsequent calls
sysconf ¶
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
tcgetsid ¶
Get the process group ID for the session leader for the controlling terminal.
Returns:
-1 (setting errno) on failure, the pid otherwise
tcsetattr ¶
tcsetattr :: proc "c" (fildes: FD, optional_actions: TC_Optional_Action, termios_p: ^termios) -> result ---
telldir ¶
The telldir() function shall obtain the current location associated with the directory stream specified by dirp.
tempnam ¶
Create a name for a temporary file.
Returns:
an allocated cstring that needs to be freed, nil on failure
times ¶
Get time accounting information.
Returns:
-1 (setting errno) on failure, the elapsed real time, since an arbitrary point in the past
ttyname ¶
Find the path name of a terminal.
Returns:
nil (setting errno) on failure, the name, which may be invalidated by subsequent calls on success
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)
["CET", "CEST"] true -3600
ulimit ¶
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.
umask ¶
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
uname ¶
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)
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, }
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.
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.
wait ¶
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
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
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
}
}
}
wordexp ¶
wordexp :: proc "c" (words: cstring, pwordexp: ^wordexp_t, flags: bit_set[WRDE_Flag_Bits; i32]) -> WRDE_Errno ---
wordfree ¶
wordfree :: proc "c" (pwordexp: ^wordexp_t) ---
Procedure Groups
Source Files
- arpa_inet.odin
- dirent.odin
- dlfcn.odin
- errno.odin
- fcntl.odin
- fnmatch.odin
- glob.odin
- grp.odin
- iconv.odin
- langinfo.odin
- libgen.odin
- limits.odin
- locale.odin
- monetary.odin
- net_if.odin
- netdb.odin
- netinet_in.odin
- netinet_tcp.odin
- poll.odin
- posix.odin
- pthread.odin
- pwd.odin
- sched.odin
- setjmp.odin
- setjmp_libc.odin
- signal.odin
- signal_libc.odin
- stdio.odin
- stdio_libc.odin
- stdlib.odin
- stdlib_libc.odin
- string.odin
- string_libc.odin
- sys_ipc.odin
- sys_mman.odin
- sys_msg.odin
- sys_resource.odin
- sys_select.odin
- sys_sem.odin
- sys_shm.odin
- sys_socket.odin
- sys_stat.odin
- sys_statvfs.odin
- sys_time.odin
- sys_times.odin
- sys_uio.odin
- sys_un.odin
- sys_utsname.odin
- sys_wait.odin
- termios.odin
- time.odin
- ulimit.odin
- unistd.odin
- unistd_libc.odin
- utime.odin
- wordexp.odin
Generation Information
Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-16 21:10:10.357883100 +0000 UTC