honeybadger

cosmopolitan libc

your build-once run-anywhere c library

Can I Use a System Call?

Cosmopolitan Libc wraps system calls to provide high-level access to binary kernel interfaces. Linux is the gold standard for our suppport. However, if your program works on Linux, then it might not work on other platforms depending on which functions you use. The following table should help illuminate the portability of functions.

Function Linux FreeBSD OpenBSD NetBSD MacOS Windows Metal Blink
read best best best best best ok good best
write best best best best best ok good best
pread best best best best best ok zipos best
pwrite best best best best best ok zipos best
readv best best best best best ok best best
writev best best best best best ok best best
preadv 2009+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+
pwritev 2009+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+ v2.1+
close best best best best best slow best best
fstatat best best best best best smudged best best
fstat best best best best best spotty best best
statfs best best best best best best fault enosys
fstatfs best best best best best best fault enosys
_Exit best best best best best best reset best
_Exit1 best best rc=0 rc=0 rc=0 best reset tdb
fork best best slow best best slow fault best
vfork best best fork best fork fork fault fork
clone careful thread thread thread thread thread enosys best
locks futex umtx futex sem_t select futex n/a futex
tls %fs %fs %fs %fs %gs %gs %fs best
pthread_create best best best best best best fault best
pthread_kill good good best good good incomplete fault best
pthread_cancel v2.2 v2.2 v2.2 v2.2 v2.2 good fault best
arch_prctl best best restricted best restricted forbidden best best
fsgsbase finally works forbidden forbidden forbidden broken best tbd
fopenat
O_RDONLY
best best best best best best zipos best
fopenat
O_RDWR
best best best best best best todo best
fopenat
O_TMPFILE
best einval einval einval einval einval einval einval
mmap
MAP_PRIVATE
best best best best best no cow best best
mmap
MAP_SHARED
best best yellow best best best best wip
mmap
MAP_STACK
fast+safe fast+safe safe safe safe faked safe wip
mmap
MAP_POPULATE
best best ignored ignored ignored ignored ignored no-op
mmap
MAP_CONCEAL
ignored best best best ignored ignored ignored ignored
brk simulated simulated simulated simulated simulated enosys simulated best
sbrk simulated simulated simulated simulated simulated enosys simulated best
poll best best best best best polling best good
select best best best best best polling fault wip
pselect best best best best best polling fault wip
ppoll best best best best non-atomic polling fault wip
lseek best best best best best best best best
pledge 2.6.23+ ignored best ignored ignored ignored fault ignored
unveil 5.13+ ignored best ignored ignored ignored fault ignored
msync best best best best best partial todo ignored
mprotect best best best best best best todo best
munmap best best best best best best best best
sigaction
ucontext_t
best best best best best best enosys best
sigprocmask best best best best best simulated no-op bestp
sigsuspend best best best best best simulated no-op best
sigpending best best best best best simulated no-op wip
clock_gettime
REALTIME
fastest good good good gettimeofday fastest enosys best
clock_gettime
MONOTONIC
fastest good good good rdtsc rdtsc enosys best
clock_getres kinda good good ok faked rdtsc enosys best
ioctl
TCGETS
best best best best best ok wip best
ioctl
TCSETS
best best best best best ok wip best
ioctl
TIOCGWINSZ
best best best best best good wip best
ioctl
FIOCLEX
best best best best best best wip wip
ioctl
FIONBIO
best best best best best best fault wip
ioctl
SIOCGIFCONF
best best best best best best fault ipv4
ioctl
SIOCGIFADDR
best best best best best best fault wip
ioctl
SIOCGIFNETMASK
best best best best best best fault wip
ioctl
SIOCGIFBRDADDR
best best best best best best fault wip
ioctl
SIOCGIFDSTADDR
best best best best best best fault wip
ioctl
SIOCGIFFLAGS
best best best best best best fault wip
openpty v2.0+ v2.1+ v2.1+ v2.1+ v2.1+ enosys enosys wip
ptsname v2.0+ v2.1+ hairy v2.1+ v2.1+ enosys enosys wip
flock good good good good good good fault wip
sync notest notest notest notest notest flush fault wip
fsync notest notest notest notest notest flush fault best
fdatasync notest notest notest notest notest flush fault best
sync_file_range notest fdatasync fdatasync fdatasync fdatasync fdatasync fault wip
copy_file_range 5.9+ 13+ enosys enosys enosys enosys fault wip
sendfile best best enosys enosys best best enosys wip
splice 5.9+ enosys enosys enosys enosys enosys fault wip
closefrom 5.9+ best best v2.2 enosys enosys enosys best
close_range 5.9+ 13+ enosys enosys enosys enosys enosys best
fadvise best best enosys best enosys most enosys wip
posix_fadvise best best enosys best enosys most enosys wip
truncate best best best best best best fault best
ftruncate best best best best best best enosys best
faccessat good best best best best best zipos best
pipe best best best best best best fault best
pipe2 2008+ best best best non-atomic best fault best
socketpair best best best best best best fault wip
getcwd best best best best best best fault best
chdir best best best best best hairy fault best
fchdir best best best best best hairy fault best
renameat best best best best best best fault best
mkdirat best best best best best best fault best
linkat best best best best best admin-only fault best
unlinkat best best best best best hairy fault best
readlinkat best best best best best best fault best
sched_yield best best best best select best no-op best
memfd_create best enosys enosys enosys enosys enosys fault wip
sys_mremap careful enosys enosys careful enosys enosys enosys wip
mincore best best enosys best best enosys fault wip
madvise best best best best best some fault ignored
dup best best best best best best fault best
dup2 best best best best best best fault best
dup3 2008+ non-atomic best best non-atomic best fault best
fcntl
F_DUPFD
best best best best best best fault best
fcntl
F_DUPFD_CLOEXEC
2008+ best best best best best fault best
fcntl
POSIX Locks
good good good good good ok fault wip
fcntl
OFD Locks
best none none none none none fault wip
fcntl
F_GETFL
best best best best best best fault best
fcntl
F_SETFL
best best best best best einval fault best
fcntl
F_GETFD
best best best best best best fault best
fcntl
F_SETFD
best best best best best best fault best
fcntl
F_NOTIFY
best einval einval einval einval einval fault wip
fcntl
F_FULLFSYNC
einval einval einval einval best einval fault einval
fcntl
F_GETPATH
einval einval einval best best einval fault einval
nanosleep best best best best micros millis enosys best
setitimer best best best best best kludge fault best
gettid best good good good good good fault best
getpid best best best best best best best best
getppid best best best best best slow best best
getuid best best best best best faked best best
getgid best best best best best faked best best
getrandom 2014+ sysctl getentropy sysctl getentropy SysFun036 rdrand best
getentropy v2.2 v2.2 v2.2 v2.2 v2.2 v2.2 v2.2 best
umask best best best best best no-op fault best
issetugid best best best best best best zero wip
setuid best best best best best no-op fault best
setgid best best best best best no-op fault best
setreuid best best best best best enosys fault wip
setregid best best best best best enosys fault wip
setresuid best best best faked faked enosys fault wip
setresgid best best best faked faked enosys fault wip
socket best best best best best best fault ipv4
bind best best best best best good fault best
connect best best best best best good fault best
accept best best best best best good fault best
accept4 2009+ best best best non-atomic good fault best
sendto best best best best best good fault wip
recvfrom best best best best best good fault wip
sendmsg good ok ok ok ok ok fault wip
recvmsg good ok ok ok ok ok fault wip
shutdown best best best best good best fault best
getsockname best best best best best best fault best
getpeername best best best best best best fault best
getsockopt best narrow narrow narrow narrow narrow fault some
setsockopt
SO_TYPE
best best best best best best fault tbd
setsockopt
SO_DEBUG
best best best best best best fault tbd
setsockopt
SO_ERROR
best best best best best best fault tbd
setsockopt
SO_BROADCAST
best best best best best best fault tbd
setsockopt
SO_REUSEADDR
best best best best best n/a fault tbd
setsockopt
SO_REUSEPORT
best unsure best best best best fault tbd
setsockopt
SO_KEEPALIVE
best best best best best best fault tbd
setsockopt
SO_ACCEPTCONN
best best best best best best fault tbd
setsockopt
SO_DONTROUTE
best best best best best best fault tbd
setsockopt
SO_SNDBUF
best best best best best best fault tbd
setsockopt
SO_RCVBUF
best best best best best best fault tbd
setsockopt
SO_SNDLOWAT
best best best best best best fault tbd
setsockopt
SO_RCVLOWAT
best best best best best best fault tbd
setsockopt
TCP_NODELAY
best best best best best best fault tbd
setsockopt
TCP_CORK
best best best best best best fault tbd
setsockopt
TCP_FASTOPEN
best best enopro enopro enopro best enosys tbd
setsockopt
TCP_QUICKACK
best enopro enopro enopro enopro enopro fault tbd
execve best best best best best kludge fault tbd
fexecve best best enosys enosys enosys enosys enosys tbd
wait4 best best best best best messy fault best
kill best best best best best limited fault best
tkill good good good good good incomplete fault best
tgkill good v2.2+ enosys enosys enosys enosys fault ok
sysinfo best partial partial partial partial partial enosys faked
uname best best best best best best enosys tbd
gethostname best best best best best best fault tbd
getdomainname best best best best best best fault tbd
fchmodat best best best best best enosys fault tbd
fchownat best best best best best enosys fault tbd
chroot works works works works works enosys fault tbd
mount notest notest notest notest notest enosys fault tbd
reboot notest notest notest notest notest notest fault tbd
utimes 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 enosys tbd
futimes 2008+ 1e-6 1e-6 1e-6 1e-6 1e-6 enosys tbd
utimensat 2008+ 1e-9 1e-9 1e-9 1e-6 1e-7 enosys tbd
futimens 2008+ 1e-9 1e-9 1e-9 1e-6 1e-7 fault tbd
setpriority v2.2 v2.2 v2.2 v2.2 v2.2 quantized fault tbd
getpriority v2.2 v2.2 v2.2 v2.2 v2.2 quantized fault tbd
sem_init best best best best best best fault tbd
sem_wait best best best ok good best fault tbd
sem_open best best best best best best fault tbd
pthread_setname_np best best enosys best enosys enosys fault tbd
pthread_getname_np best best enosys best enosys enosys fault tbd
pthread_setaffinity_np best best none broken none best fault tbd
pthread_getaffinity_np best best none broken none none fault tbd
sched_setaffinity best best none broken none best fault tbd
sched_getaffinity best best none broken none best fault tbd
sched_setscheduler best good none good none none fault no-op
sched_getscheduler best good none good none none fault no-op
sched_setparam best good none good none none fault no-op
sched_getparam best good none good none none fault no-op
sched_get_priority_max best best none best none none fault no-op
sched_get_priority_min best best none best none none fault no-op
sched_rr_get_interval best best none none none none fault enosys
epoll best enosys enosys enosys enosys wepoll fault enosys
clock cgt cgt cgt cgt getrusage gpt fault cgt
getrusage some best best best best some fault best
setrlimit best ok ok ok ok RLIMIT_AS fault best
opendir best best best best best best fault good
getlogin_r getenv sys sys sys sys sys enoent tbd
login_tty best best best best best enosys enosys tbd