This commit is contained in:
Jorijn van der Graaf 2025-11-09 18:56:24 +01:00
commit f90881b03d
9824 changed files with 1706556 additions and 114 deletions

View file

@ -0,0 +1,2 @@
#include <dirent.h>
#define direct dirent

View file

@ -0,0 +1,2 @@
#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
#include <errno.h>

View file

@ -0,0 +1,26 @@
#ifndef _SYS_EVENTFD_H
#define _SYS_EVENTFD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <fcntl.h>
typedef uint64_t eventfd_t;
#define EFD_SEMAPHORE 1
#define EFD_CLOEXEC O_CLOEXEC
#define EFD_NONBLOCK O_NONBLOCK
int eventfd(unsigned int, int);
int eventfd_read(int, eventfd_t *);
int eventfd_write(int, eventfd_t);
#ifdef __cplusplus
}
#endif
#endif /* sys/eventfd.h */

View file

@ -0,0 +1,2 @@
#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
#include <fcntl.h>

View file

@ -0,0 +1,21 @@
#ifndef _SYS_FILE_H
#define _SYS_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
#define LOCK_SH 1
#define LOCK_EX 2
#define LOCK_NB 4
#define LOCK_UN 8
#define L_SET 0
#define L_INCR 1
#define L_XTND 2
int flock(int, int);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,124 @@
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
#ifdef __cplusplus
extern "C" {
#endif
#define __NEED_struct_winsize
#include <bits/alltypes.h>
#include <bits/ioctl.h>
#define N_TTY 0
#define N_SLIP 1
#define N_MOUSE 2
#define N_PPP 3
#define N_STRIP 4
#define N_AX25 5
#define N_X25 6
#define N_6PACK 7
#define N_MASC 8
#define N_R3964 9
#define N_PROFIBUS_FDL 10
#define N_IRDA 11
#define N_SMSBLOCK 12
#define N_HDLC 13
#define N_SYNC_PPP 14
#define N_HCI 15
#define N_GIGASET_M101 16
#define N_SLCAN 17
#define N_PPS 18
#define N_V253 19
#define N_CAIF 20
#define N_GSM0710 21
#define N_TI_WL 22
#define N_TRACESINK 23
#define N_TRACEROUTER 24
#define N_NCI 25
#define N_SPEAKUP 26
#define N_NULL 27
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32
#define TIOCPKT_IOCTL 64
#define TIOCSER_TEMT 1
#define SIOCADDRT 0x890B
#define SIOCDELRT 0x890C
#define SIOCRTMSG 0x890D
#define SIOCGIFNAME 0x8910
#define SIOCSIFLINK 0x8911
#define SIOCGIFCONF 0x8912
#define SIOCGIFFLAGS 0x8913
#define SIOCSIFFLAGS 0x8914
#define SIOCGIFADDR 0x8915
#define SIOCSIFADDR 0x8916
#define SIOCGIFDSTADDR 0x8917
#define SIOCSIFDSTADDR 0x8918
#define SIOCGIFBRDADDR 0x8919
#define SIOCSIFBRDADDR 0x891a
#define SIOCGIFNETMASK 0x891b
#define SIOCSIFNETMASK 0x891c
#define SIOCGIFMETRIC 0x891d
#define SIOCSIFMETRIC 0x891e
#define SIOCGIFMEM 0x891f
#define SIOCSIFMEM 0x8920
#define SIOCGIFMTU 0x8921
#define SIOCSIFMTU 0x8922
#define SIOCSIFNAME 0x8923
#define SIOCSIFHWADDR 0x8924
#define SIOCGIFENCAP 0x8925
#define SIOCSIFENCAP 0x8926
#define SIOCGIFHWADDR 0x8927
#define SIOCGIFSLAVE 0x8929
#define SIOCSIFSLAVE 0x8930
#define SIOCADDMULTI 0x8931
#define SIOCDELMULTI 0x8932
#define SIOCGIFINDEX 0x8933
#define SIOGIFINDEX SIOCGIFINDEX
#define SIOCSIFPFLAGS 0x8934
#define SIOCGIFPFLAGS 0x8935
#define SIOCDIFADDR 0x8936
#define SIOCSIFHWBROADCAST 0x8937
#define SIOCGIFCOUNT 0x8938
#define SIOCGIFBR 0x8940
#define SIOCSIFBR 0x8941
#define SIOCGIFTXQLEN 0x8942
#define SIOCSIFTXQLEN 0x8943
#define SIOCDARP 0x8953
#define SIOCGARP 0x8954
#define SIOCSARP 0x8955
#define SIOCDRARP 0x8960
#define SIOCGRARP 0x8961
#define SIOCSRARP 0x8962
#define SIOCGIFMAP 0x8970
#define SIOCSIFMAP 0x8971
#define SIOCADDDLCI 0x8980
#define SIOCDELDLCI 0x8981
#define SIOCDEVPRIVATE 0x89F0
#define SIOCPROTOPRIVATE 0x89E0
int ioctl (int, int, ...);
#ifdef __cplusplus
}
#endif
#else
#include <__header_sys_ioctl.h>
#endif
#endif

View file

@ -0,0 +1,157 @@
#ifndef _WASI_EMULATED_MMAN
#error "WASI lacks a true mmap; to enable minimal mmap emulation, \
compile with -D_WASI_EMULATED_MMAN and link with -lwasi-emulated-mman"
#else
#ifndef _SYS_MMAN_H
#define _SYS_MMAN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_mode_t
#define __NEED_size_t
#define __NEED_off_t
#if defined(_GNU_SOURCE)
#define __NEED_ssize_t
#endif
#include <bits/alltypes.h>
#define MAP_FAILED ((void *) -1)
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_SHARED_VALIDATE 0x03
#define MAP_TYPE 0x0f
#define MAP_FIXED 0x10
#define MAP_ANON 0x20
#define MAP_ANONYMOUS MAP_ANON
#define MAP_NORESERVE 0x4000
#define MAP_GROWSDOWN 0x0100
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
#define MAP_POPULATE 0x8000
#define MAP_NONBLOCK 0x10000
#define MAP_STACK 0x20000
#define MAP_HUGETLB 0x40000
#define MAP_SYNC 0x80000
#define MAP_FIXED_NOREPLACE 0x100000
#define MAP_FILE 0
#define MAP_HUGE_SHIFT 26
#define MAP_HUGE_MASK 0x3f
#define MAP_HUGE_16KB (14 << 26)
#define MAP_HUGE_64KB (16 << 26)
#define MAP_HUGE_512KB (19 << 26)
#define MAP_HUGE_1MB (20 << 26)
#define MAP_HUGE_2MB (21 << 26)
#define MAP_HUGE_8MB (23 << 26)
#define MAP_HUGE_16MB (24 << 26)
#define MAP_HUGE_32MB (25 << 26)
#define MAP_HUGE_256MB (28 << 26)
#define MAP_HUGE_512MB (29 << 26)
#define MAP_HUGE_1GB (30 << 26)
#define MAP_HUGE_2GB (31 << 26)
#define MAP_HUGE_16GB (34U << 26)
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
#define PROT_EXEC 4
#define PROT_GROWSDOWN 0x01000000
#define PROT_GROWSUP 0x02000000
#define MS_ASYNC 1
#define MS_INVALIDATE 2
#define MS_SYNC 4
#define MCL_CURRENT 1
#define MCL_FUTURE 2
#define MCL_ONFAULT 4
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define POSIX_MADV_SEQUENTIAL 2
#define POSIX_MADV_WILLNEED 3
#define POSIX_MADV_DONTNEED 4
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define MADV_NORMAL 0
#define MADV_RANDOM 1
#define MADV_SEQUENTIAL 2
#define MADV_WILLNEED 3
#define MADV_DONTNEED 4
#define MADV_FREE 8
#define MADV_REMOVE 9
#define MADV_DONTFORK 10
#define MADV_DOFORK 11
#define MADV_MERGEABLE 12
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
#define MADV_DONTDUMP 16
#define MADV_DODUMP 17
#define MADV_WIPEONFORK 18
#define MADV_KEEPONFORK 19
#define MADV_COLD 20
#define MADV_PAGEOUT 21
#define MADV_HWPOISON 100
#define MADV_SOFT_OFFLINE 101
#endif
#ifdef _GNU_SOURCE
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define MREMAP_DONTUNMAP 4
#define MLOCK_ONFAULT 0x01
#define MFD_CLOEXEC 0x0001U
#define MFD_ALLOW_SEALING 0x0002U
#define MFD_HUGETLB 0x0004U
#endif
#include <bits/mman.h>
void *mmap (void *, size_t, int, int, int, off_t);
int munmap (void *, size_t);
int mprotect (void *, size_t, int);
int msync (void *, size_t, int);
int posix_madvise (void *, size_t, int);
int mlock (const void *, size_t);
int munlock (const void *, size_t);
int mlockall (int);
int munlockall (void);
#ifdef _GNU_SOURCE
void *mremap (void *, size_t, size_t, int, ...);
int remap_file_pages (void *, size_t, int, size_t, int);
int memfd_create (const char *, unsigned);
int mlock2 (const void *, size_t, unsigned);
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int madvise (void *, size_t, int);
int mincore (void *, size_t, unsigned char *);
#endif
int shm_open (const char *, int, mode_t);
int shm_unlink (const char *);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define mmap64 mmap
#define off64_t off_t
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -0,0 +1,37 @@
#ifndef _SYS_PARAM_H
#define _SYS_PARAM_H
#define MAXSYMLINKS 20
#define MAXHOSTNAMELEN 64
#define MAXNAMLEN 255
#define MAXPATHLEN 4096
#define NBBY 8
#define NGROUPS 32
#define CANBSIZ 255
#define NOFILE 256
#define NCARGS 131072
#define DEV_BSIZE 512
#define NOGROUP (-1)
#undef MIN
#undef MAX
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))
#define setbit(x,i) __bitop(x,i,|=)
#define clrbit(x,i) __bitop(x,i,&=~)
#define isset(x,i) __bitop(x,i,&)
#define isclr(x,i) !isset(x,i)
#define howmany(n,d) (((n)+((d)-1))/(d))
#define roundup(n,d) (howmany(n,d)*(d))
#define powerof2(n) !(((n)-1) & (n))
#if defined(__wasilibc_unmodified_upstream) || defined(_WASI_EMULATED_PROCESS_CLOCKS)
#include <sys/resource.h>
#endif
#include <endian.h>
#include <limits.h>
#endif

View file

@ -0,0 +1,2 @@
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
#include <poll.h>

View file

@ -0,0 +1,27 @@
#ifndef _SYS_RANDOM_H
#define _SYS_RANDOM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no getrandom, but it does have getentropy */
#define __NEED_size_t
#define __NEED_ssize_t
#include <bits/alltypes.h>
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
#define GRND_INSECURE 0x0004
ssize_t getrandom(void *, size_t, unsigned);
#else
#define __NEED_size_t
#include <bits/alltypes.h>
int getentropy(void *, size_t);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,9 @@
#ifndef _SYS_REG_H
#define _SYS_REG_H
#include <limits.h>
#include <unistd.h>
#include <bits/reg.h>
#endif

View file

@ -0,0 +1,126 @@
#ifndef _WASI_EMULATED_PROCESS_CLOCKS
#error WASI lacks process-associated clocks; to enable emulation of the `getrusage` function using \
the wall clock, which isn't sensitive to whether the program is running or suspended, \
compile with -D_WASI_EMULATED_PROCESS_CLOCKS and link with -lwasi-emulated-process-clocks
#else
#ifndef _SYS_RESOURCE_H
#define _SYS_RESOURCE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#include <sys/time.h>
#define __NEED_id_t
#ifdef _GNU_SOURCE
#define __NEED_pid_t
#endif
#include <bits/alltypes.h>
#include <bits/resource.h>
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
typedef unsigned long long rlim_t;
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
struct rusage {
struct timeval ru_utime;
struct timeval ru_stime;
/* linux extentions, but useful */
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
/* room for more... */
long __reserved[16];
};
int getrlimit (int, struct rlimit *);
int setrlimit (int, const struct rlimit *);
int getrusage (int, struct rusage *);
int getpriority (int, id_t);
int setpriority (int, id_t, int);
#ifdef _GNU_SOURCE
int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
#define prlimit64 prlimit
#endif
#define PRIO_MIN (-20)
#define PRIO_MAX 20
#define PRIO_PROCESS 0
#define PRIO_PGRP 1
#define PRIO_USER 2
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN (-1)
#define RUSAGE_THREAD 1
#define RLIM_INFINITY (~0ULL)
#define RLIM_SAVED_CUR RLIM_INFINITY
#define RLIM_SAVED_MAX RLIM_INFINITY
#define RLIMIT_CPU 0
#define RLIMIT_FSIZE 1
#define RLIMIT_DATA 2
#define RLIMIT_STACK 3
#define RLIMIT_CORE 4
#ifndef RLIMIT_RSS
#define RLIMIT_RSS 5
#define RLIMIT_NPROC 6
#define RLIMIT_NOFILE 7
#define RLIMIT_MEMLOCK 8
#define RLIMIT_AS 9
#endif
#define RLIMIT_LOCKS 10
#define RLIMIT_SIGPENDING 11
#define RLIMIT_MSGQUEUE 12
#define RLIMIT_NICE 13
#define RLIMIT_RTPRIO 14
#define RLIMIT_RTTIME 15
#define RLIMIT_NLIMITS 16
#define RLIM_NLIMITS RLIMIT_NLIMITS
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define RLIM64_INFINITY RLIM_INFINITY
#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
#define getrlimit64 getrlimit
#define setrlimit64 setrlimit
#define rlimit64 rlimit
#define rlim64_t rlim_t
#endif
#else
#include <__header_sys_resource.h>
#endif
#if _REDIR_TIME64
__REDIR(getrusage, __getrusage_time64);
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -0,0 +1,54 @@
#ifndef _SYS_SELECT_H
#define _SYS_SELECT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_size_t
#define __NEED_time_t
#define __NEED_suseconds_t
#define __NEED_struct_timeval
#define __NEED_struct_timespec
#define __NEED_sigset_t
#include <bits/alltypes.h>
#define FD_SETSIZE 1024
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
typedef unsigned long fd_mask;
#endif
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
typedef struct {
unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
} fd_set;
#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
#define FD_SET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
#define FD_CLR(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
#else
#include <__fd_set.h>
#endif
int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define NFDBITS (8*(int)sizeof(long))
#endif
#endif
#if _REDIR_TIME64
__REDIR(select, __select_time64);
__REDIR(pselect, __pselect_time64);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,2 @@
#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
#include <signal.h>

View file

@ -0,0 +1,454 @@
#ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H
#include <__wasi_snapshot.h>
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
#else
#include <__header_sys_socket.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_socklen_t
#define __NEED_sa_family_t
#define __NEED_size_t
#define __NEED_ssize_t
#define __NEED_uid_t
#define __NEED_pid_t
#define __NEED_gid_t
#define __NEED_struct_iovec
#include <bits/alltypes.h>
#include <bits/socket.h>
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int __pad1;
#endif
int msg_iovlen;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int __pad1;
#endif
void *msg_control;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int __pad2;
#endif
socklen_t msg_controllen;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int __pad2;
#endif
int msg_flags;
};
struct cmsghdr {
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
int __pad1;
#endif
socklen_t cmsg_len;
#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
int __pad1;
#endif
int cmsg_level;
int cmsg_type;
};
#else
#include <__struct_msghdr.h>
#endif
#ifdef _GNU_SOURCE
struct ucred {
pid_t pid;
uid_t uid;
gid_t gid;
};
struct mmsghdr {
struct msghdr msg_hdr;
unsigned int msg_len;
};
struct timespec;
int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
#endif
struct linger {
int l_onoff;
int l_linger;
};
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#ifndef SOCK_STREAM
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#endif
#define SOCK_RAW 3
#define SOCK_RDM 4
#define SOCK_SEQPACKET 5
#define SOCK_DCCP 6
#define SOCK_PACKET 10
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 02000000
#define SOCK_NONBLOCK 04000
#endif
#define PF_UNSPEC 0
#define PF_LOCAL 1
#define PF_UNIX PF_LOCAL
#define PF_FILE PF_LOCAL
#define PF_INET 2
#define PF_AX25 3
#define PF_IPX 4
#define PF_APPLETALK 5
#define PF_NETROM 6
#define PF_BRIDGE 7
#define PF_ATMPVC 8
#define PF_X25 9
#define PF_INET6 10
#define PF_ROSE 11
#define PF_DECnet 12
#define PF_NETBEUI 13
#define PF_SECURITY 14
#define PF_KEY 15
#define PF_NETLINK 16
#define PF_ROUTE PF_NETLINK
#define PF_PACKET 17
#define PF_ASH 18
#define PF_ECONET 19
#define PF_ATMSVC 20
#define PF_RDS 21
#define PF_SNA 22
#define PF_IRDA 23
#define PF_PPPOX 24
#define PF_WANPIPE 25
#define PF_LLC 26
#define PF_IB 27
#define PF_MPLS 28
#define PF_CAN 29
#define PF_TIPC 30
#define PF_BLUETOOTH 31
#define PF_IUCV 32
#define PF_RXRPC 33
#define PF_ISDN 34
#define PF_PHONET 35
#define PF_IEEE802154 36
#define PF_CAIF 37
#define PF_ALG 38
#define PF_NFC 39
#define PF_VSOCK 40
#define PF_KCM 41
#define PF_QIPCRTR 42
#define PF_SMC 43
#define PF_XDP 44
#define PF_MAX 45
#define AF_UNSPEC PF_UNSPEC
#define AF_LOCAL PF_LOCAL
#define AF_UNIX AF_LOCAL
#define AF_FILE AF_LOCAL
#define AF_INET PF_INET
#define AF_AX25 PF_AX25
#define AF_IPX PF_IPX
#define AF_APPLETALK PF_APPLETALK
#define AF_NETROM PF_NETROM
#define AF_BRIDGE PF_BRIDGE
#define AF_ATMPVC PF_ATMPVC
#define AF_X25 PF_X25
#define AF_INET6 PF_INET6
#define AF_ROSE PF_ROSE
#define AF_DECnet PF_DECnet
#define AF_NETBEUI PF_NETBEUI
#define AF_SECURITY PF_SECURITY
#define AF_KEY PF_KEY
#define AF_NETLINK PF_NETLINK
#define AF_ROUTE PF_ROUTE
#define AF_PACKET PF_PACKET
#define AF_ASH PF_ASH
#define AF_ECONET PF_ECONET
#define AF_ATMSVC PF_ATMSVC
#define AF_RDS PF_RDS
#define AF_SNA PF_SNA
#define AF_IRDA PF_IRDA
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
#define AF_LLC PF_LLC
#define AF_IB PF_IB
#define AF_MPLS PF_MPLS
#define AF_CAN PF_CAN
#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
#define AF_ISDN PF_ISDN
#define AF_PHONET PF_PHONET
#define AF_IEEE802154 PF_IEEE802154
#define AF_CAIF PF_CAIF
#define AF_ALG PF_ALG
#define AF_NFC PF_NFC
#define AF_VSOCK PF_VSOCK
#define AF_KCM PF_KCM
#define AF_QIPCRTR PF_QIPCRTR
#define AF_SMC PF_SMC
#define AF_XDP PF_XDP
#define AF_MAX PF_MAX
#ifndef SO_DEBUG
#define SO_DEBUG 1
#define SO_REUSEADDR 2
#define SO_TYPE 3
#define SO_ERROR 4
#define SO_DONTROUTE 5
#define SO_BROADCAST 6
#define SO_SNDBUF 7
#define SO_RCVBUF 8
#define SO_KEEPALIVE 9
#define SO_OOBINLINE 10
#define SO_NO_CHECK 11
#define SO_PRIORITY 12
#define SO_LINGER 13
#define SO_BSDCOMPAT 14
#define SO_REUSEPORT 15
#define SO_PASSCRED 16
#define SO_PEERCRED 17
#define SO_RCVLOWAT 18
#define SO_SNDLOWAT 19
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
#define SO_SNDBUFFORCE 32
#define SO_RCVBUFFORCE 33
#define SO_PROTOCOL 38
#define SO_DOMAIN 39
#endif
#ifndef SO_RCVTIMEO
#if __LONG_MAX == 0x7fffffff
#define SO_RCVTIMEO 66
#define SO_SNDTIMEO 67
#else
#define SO_RCVTIMEO 20
#define SO_SNDTIMEO 21
#endif
#endif
#ifndef SO_TIMESTAMP
#if __LONG_MAX == 0x7fffffff
#define SO_TIMESTAMP 63
#define SO_TIMESTAMPNS 64
#define SO_TIMESTAMPING 65
#else
#define SO_TIMESTAMP 29
#define SO_TIMESTAMPNS 35
#define SO_TIMESTAMPING 37
#endif
#endif
#define SO_SECURITY_AUTHENTICATION 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define SO_SECURITY_ENCRYPTION_NETWORK 24
#define SO_BINDTODEVICE 25
#define SO_ATTACH_FILTER 26
#define SO_DETACH_FILTER 27
#define SO_GET_FILTER SO_ATTACH_FILTER
#define SO_PEERNAME 28
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PASSSEC 34
#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
#define SO_MARK 36
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 40
#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS
#define SO_PEEK_OFF 42
#define SO_NOFCS 43
#define SO_LOCK_FILTER 44
#define SO_SELECT_ERR_QUEUE 45
#define SO_BUSY_POLL 46
#define SO_MAX_PACING_RATE 47
#define SO_BPF_EXTENSIONS 48
#define SO_INCOMING_CPU 49
#define SO_ATTACH_BPF 50
#define SO_DETACH_BPF SO_DETACH_FILTER
#define SO_ATTACH_REUSEPORT_CBPF 51
#define SO_ATTACH_REUSEPORT_EBPF 52
#define SO_CNX_ADVICE 53
#define SCM_TIMESTAMPING_OPT_STATS 54
#define SO_MEMINFO 55
#define SO_INCOMING_NAPI_ID 56
#define SO_COOKIE 57
#define SCM_TIMESTAMPING_PKTINFO 58
#define SO_PEERGROUPS 59
#define SO_ZEROCOPY 60
#define SO_TXTIME 61
#define SCM_TXTIME SO_TXTIME
#define SO_BINDTOIFINDEX 62
#define SO_DETACH_REUSEPORT_BPF 68
#define SO_PREFER_BUSY_POLL 69
#define SO_BUSY_POLL_BUDGET 70
#ifndef SOL_SOCKET
#define SOL_SOCKET 1
#endif
#define SOL_IP 0
#define SOL_IPV6 41
#define SOL_ICMPV6 58
#define SOL_RAW 255
#define SOL_DECNET 261
#define SOL_X25 262
#define SOL_PACKET 263
#define SOL_ATM 264
#define SOL_AAL 265
#define SOL_IRDA 266
#define SOL_NETBEUI 267
#define SOL_LLC 268
#define SOL_DCCP 269
#define SOL_NETLINK 270
#define SOL_TIPC 271
#define SOL_RXRPC 272
#define SOL_PPPOL2TP 273
#define SOL_BLUETOOTH 274
#define SOL_PNPIPE 275
#define SOL_RDS 276
#define SOL_IUCV 277
#define SOL_CAIF 278
#define SOL_ALG 279
#define SOL_NFC 280
#define SOL_KCM 281
#define SOL_TLS 282
#define SOL_XDP 283
#define SOMAXCONN 128
#define MSG_OOB 0x0001
#define MSG_PEEK 0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_CTRUNC 0x0008
#define MSG_PROXY 0x0010
#define MSG_TRUNC 0x0020
#define MSG_DONTWAIT 0x0040
#define MSG_EOR 0x0080
#define MSG_WAITALL 0x0100
#define MSG_FIN 0x0200
#define MSG_SYN 0x0400
#define MSG_CONFIRM 0x0800
#define MSG_RST 0x1000
#define MSG_ERRQUEUE 0x2000
#define MSG_NOSIGNAL 0x4000
#define MSG_MORE 0x8000
#define MSG_WAITFORONE 0x10000
#define MSG_BATCH 0x40000
#define MSG_ZEROCOPY 0x4000000
#define MSG_FASTOPEN 0x20000000
#define MSG_CMSG_CLOEXEC 0x40000000
#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
#define SCM_RIGHTS 0x01
#define SCM_CREDENTIALS 0x02
#endif
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
};
#else
#include <__struct_sockaddr.h>
#endif
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
struct sockaddr_storage {
sa_family_t ss_family;
char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
unsigned long __ss_align;
};
#else
#include <__struct_sockaddr_storage.h>
#endif
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
int socket (int, int, int);
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no socketpair */
int socketpair (int, int, int, int [2]);
#endif
int shutdown (int, int);
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
int connect (int, const struct sockaddr *, socklen_t);
int bind (int, const struct sockaddr *, socklen_t);
int listen (int, int);
#endif
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
#endif
ssize_t send (int, const void *, size_t, int);
ssize_t recv (int, void *, size_t, int);
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no sendmsg/recvmsg */
ssize_t sendmsg (int, const struct msghdr *, int);
ssize_t recvmsg (int, struct msghdr *, int);
#endif
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
int setsockopt (int, int, int, const void *, socklen_t);
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no sockatmark */
int sockatmark (int);
#endif
#if _REDIR_TIME64
#ifdef _GNU_SOURCE
__REDIR(recvmmsg, __recvmmsg_time64);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,198 @@
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_dev_t
#define __NEED_ino_t
#define __NEED_mode_t
#define __NEED_nlink_t
#define __NEED_uid_t
#define __NEED_gid_t
#define __NEED_off_t
#define __NEED_time_t
#define __NEED_blksize_t
#define __NEED_blkcnt_t
#define __NEED_struct_timespec
#ifdef _GNU_SOURCE
#define __NEED_int64_t
#define __NEED_uint64_t
#define __NEED_uint32_t
#define __NEED_uint16_t
#endif
#include <bits/alltypes.h>
#include <bits/stat.h>
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
#define S_IFMT 0170000
#define S_IFDIR 0040000
#define S_IFCHR 0020000
#define S_IFBLK 0060000
#define S_IFREG 0100000
#define S_IFIFO 0010000
#define S_IFLNK 0120000
#define S_IFSOCK 0140000
#define S_TYPEISMQ(buf) 0
#define S_TYPEISSEM(buf) 0
#define S_TYPEISSHM(buf) 0
#define S_TYPEISTMO(buf) 0
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#ifndef S_IRUSR
#define S_ISUID 04000
#define S_ISGID 02000
#define S_ISVTX 01000
#define S_IRUSR 0400
#define S_IWUSR 0200
#define S_IXUSR 0100
#define S_IRWXU 0700
#define S_IRGRP 0040
#define S_IWGRP 0020
#define S_IXGRP 0010
#define S_IRWXG 0070
#define S_IROTH 0004
#define S_IWOTH 0002
#define S_IXOTH 0001
#define S_IRWXO 0007
#endif
#define UTIME_NOW 0x3fffffff
#define UTIME_OMIT 0x3ffffffe
#else
#include <__header_sys_stat.h>
#endif
int stat(const char *__restrict, struct stat *__restrict);
int fstat(int, struct stat *);
int lstat(const char *__restrict, struct stat *__restrict);
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
int chmod(const char *, mode_t);
int fchmod(int, mode_t);
int fchmodat(int, const char *, mode_t, int);
#ifdef __wasilibc_unmodified_upstream /* WASI has no umask */
mode_t umask(mode_t);
#endif
int mkdir(const char *, mode_t);
#ifdef __wasilibc_unmodified_upstream /* WASI has no fifo */
int mkfifo(const char *, mode_t);
#endif
int mkdirat(int, const char *, mode_t);
#ifdef __wasilibc_unmodified_upstream /* WASI has no fifo */
int mkfifoat(int, const char *, mode_t);
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no mknod */
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
int mknod(const char *, mode_t, dev_t);
int mknodat(int, const char *, mode_t, dev_t);
#endif
#endif
int futimens(int, const struct timespec [2]);
int utimensat(int, const char *, const struct timespec [2], int);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#ifdef __wasilibc_unmodified_upstream /* WASI has no chmod */
int lchmod(const char *, mode_t);
#endif
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no statx */
#if defined(_GNU_SOURCE)
#define STATX_TYPE 1U
#define STATX_MODE 2U
#define STATX_NLINK 4U
#define STATX_UID 8U
#define STATX_GID 0x10U
#define STATX_ATIME 0x20U
#define STATX_MTIME 0x40U
#define STATX_CTIME 0x80U
#define STATX_INO 0x100U
#define STATX_SIZE 0x200U
#define STATX_BLOCKS 0x400U
#define STATX_BASIC_STATS 0x7ffU
#define STATX_BTIME 0x800U
#define STATX_ALL 0xfffU
struct statx_timestamp {
int64_t tv_sec;
uint32_t tv_nsec, __pad;
};
struct statx {
uint32_t stx_mask;
uint32_t stx_blksize;
uint64_t stx_attributes;
uint32_t stx_nlink;
uint32_t stx_uid;
uint32_t stx_gid;
uint16_t stx_mode;
uint16_t __pad0[1];
uint64_t stx_ino;
uint64_t stx_size;
uint64_t stx_blocks;
uint64_t stx_attributes_mask;
struct statx_timestamp stx_atime;
struct statx_timestamp stx_btime;
struct statx_timestamp stx_ctime;
struct statx_timestamp stx_mtime;
uint32_t stx_rdev_major;
uint32_t stx_rdev_minor;
uint32_t stx_dev_major;
uint32_t stx_dev_minor;
uint64_t __pad1[14];
};
int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
#endif
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define stat64 stat
#define fstat64 fstat
#define lstat64 lstat
#define fstatat64 fstatat
#define blkcnt64_t blkcnt_t
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#define ino64_t ino_t
#define off64_t off_t
#endif
#if _REDIR_TIME64
__REDIR(stat, __stat_time64);
__REDIR(fstat, __fstat_time64);
__REDIR(lstat, __lstat_time64);
__REDIR(fstatat, __fstatat_time64);
__REDIR(futimens, __futimens_time64);
__REDIR(utimensat, __utimensat_time64);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,57 @@
#ifndef _SYS_STATVFS_H
#define _SYS_STATVFS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_fsblkcnt_t
#define __NEED_fsfilcnt_t
#include <bits/alltypes.h>
struct statvfs {
unsigned long f_bsize, f_frsize;
fsblkcnt_t f_blocks, f_bfree, f_bavail;
fsfilcnt_t f_files, f_ffree, f_favail;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned long f_fsid;
unsigned :8*(2*sizeof(int)-sizeof(long));
#else
unsigned :8*(2*sizeof(int)-sizeof(long));
unsigned long f_fsid;
#endif
unsigned long f_flag, f_namemax;
unsigned int f_type;
int __reserved[5];
};
int statvfs (const char *__restrict, struct statvfs *__restrict);
int fstatvfs (int, struct statvfs *);
#define ST_RDONLY 1
#define ST_NOSUID 2
#define ST_NODEV 4
#define ST_NOEXEC 8
#define ST_SYNCHRONOUS 16
#define ST_MANDLOCK 64
#define ST_WRITE 128
#define ST_APPEND 256
#define ST_IMMUTABLE 512
#define ST_NOATIME 1024
#define ST_NODIRATIME 2048
#define ST_RELATIME 4096
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define statvfs64 statvfs
#define fstatvfs64 fstatvfs
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1 @@
#include <stropts.h>

View file

@ -0,0 +1,10 @@
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H
#ifdef __wasilibc_unmodified_upstream /* WASI has no syscall */
#include <bits/syscall.h>
#else
/* The generic syscall funtion is not yet implemented. */
#endif
#endif

View file

@ -0,0 +1,36 @@
#ifndef _SYS_SYSINFO_H
#define _SYS_SYSINFO_H
#ifdef __cplusplus
extern "C" {
#endif
#define SI_LOAD_SHIFT 16
struct sysinfo {
unsigned long uptime;
unsigned long loads[3];
unsigned long totalram;
unsigned long freeram;
unsigned long sharedram;
unsigned long bufferram;
unsigned long totalswap;
unsigned long freeswap;
unsigned short procs, pad;
unsigned long totalhigh;
unsigned long freehigh;
unsigned mem_unit;
char __reserved[256];
};
int sysinfo (struct sysinfo *);
int get_nprocs_conf (void);
int get_nprocs (void);
long get_phys_pages (void);
long get_avphys_pages (void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,84 @@
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#include <sys/select.h>
int gettimeofday (struct timeval *__restrict, void *__restrict);
#ifdef __wasilibc_unmodified_upstream /* WASI has no getitimer */
#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
int getitimer (int, struct itimerval *);
int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
#endif
int utimes (const char *, const struct timeval [2]);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
#ifdef __wasilibc_unmodified_upstream /* WASI libc doesn't build the legacy functions */
int futimes(int, const struct timeval [2]);
#endif
int futimesat(int, const char *, const struct timeval [2]);
#ifdef __wasilibc_unmodified_upstream /* WASI libc doesn't build the legacy functions */
int lutimes(const char *, const struct timeval [2]);
#endif
#ifdef __wasilibc_unmodified_upstream /* WASI has no way to set the time */
int settimeofday(const struct timeval *, const struct timezone *);
int adjtime (const struct timeval *, struct timeval *);
#endif
#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
((a)->tv_usec -= 1000000, (a)->tv_sec++) )
#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
((a)->tv_usec += 1000000, (a)->tv_sec--) )
#endif
#if defined(_GNU_SOURCE)
#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
(ts)->tv_sec = (tv)->tv_sec, \
(ts)->tv_nsec = (tv)->tv_usec * 1000, \
(void)0 )
#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
(tv)->tv_sec = (ts)->tv_sec, \
(tv)->tv_usec = (ts)->tv_nsec / 1000, \
(void)0 )
#endif
#if _REDIR_TIME64
__REDIR(gettimeofday, __gettimeofday_time64);
__REDIR(getitimer, __getitimer_time64);
__REDIR(setitimer, __setitimer_time64);
__REDIR(utimes, __utimes_time64);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
__REDIR(futimes, __futimes_time64);
__REDIR(futimesat, __futimesat_time64);
__REDIR(lutimes, __lutimes_time64);
__REDIR(settimeofday, __settimeofday_time64);
__REDIR(adjtime, __adjtime64);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,28 @@
#ifndef _SYS_TIMEB_H
#define _SYS_TIMEB_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_time_t
#include <bits/alltypes.h>
struct timeb {
time_t time;
unsigned short millitm;
short timezone, dstflag;
};
int ftime(struct timeb *);
#if _REDIR_TIME64
__REDIR(ftime, __ftime64);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,34 @@
#ifndef _WASI_EMULATED_PROCESS_CLOCKS
#error WASI lacks process-associated clocks; to enable emulation of the `times` function using \
the wall clock, which isn't sensitive to whether the program is running or suspended, \
compile with -D_WASI_EMULATED_PROCESS_CLOCKS and link with -lwasi-emulated-process-clocks
#else
#ifndef _SYS_TIMES_H
#define _SYS_TIMES_H
#ifdef __cplusplus
extern "C" {
#endif
#define __NEED_clock_t
#include <bits/alltypes.h>
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
};
#else
#include <__struct_tms.h>
#endif
clock_t times (struct tms *);
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -0,0 +1,103 @@
#ifndef _SYS_TIMEX_H
#define _SYS_TIMEX_H
#ifdef __cplusplus
extern "C" {
#endif
#define __NEED_clockid_t
#include <bits/alltypes.h>
#include <sys/time.h>
struct ntptimeval {
struct timeval time;
long maxerror, esterror;
};
struct timex {
unsigned modes;
long offset, freq, maxerror, esterror;
int status;
long constant, precision, tolerance;
struct timeval time;
long tick, ppsfreq, jitter;
int shift;
long stabil, jitcnt, calcnt, errcnt, stbcnt;
int tai;
int __padding[11];
};
#define ADJ_OFFSET 0x0001
#define ADJ_FREQUENCY 0x0002
#define ADJ_MAXERROR 0x0004
#define ADJ_ESTERROR 0x0008
#define ADJ_STATUS 0x0010
#define ADJ_TIMECONST 0x0020
#define ADJ_TAI 0x0080
#define ADJ_SETOFFSET 0x0100
#define ADJ_MICRO 0x1000
#define ADJ_NANO 0x2000
#define ADJ_TICK 0x4000
#define ADJ_OFFSET_SINGLESHOT 0x8001
#define ADJ_OFFSET_SS_READ 0xa001
#define MOD_OFFSET ADJ_OFFSET
#define MOD_FREQUENCY ADJ_FREQUENCY
#define MOD_MAXERROR ADJ_MAXERROR
#define MOD_ESTERROR ADJ_ESTERROR
#define MOD_STATUS ADJ_STATUS
#define MOD_TIMECONST ADJ_TIMECONST
#define MOD_CLKB ADJ_TICK
#define MOD_CLKA ADJ_OFFSET_SINGLESHOT
#define MOD_TAI ADJ_TAI
#define MOD_MICRO ADJ_MICRO
#define MOD_NANO ADJ_NANO
#define STA_PLL 0x0001
#define STA_PPSFREQ 0x0002
#define STA_PPSTIME 0x0004
#define STA_FLL 0x0008
#define STA_INS 0x0010
#define STA_DEL 0x0020
#define STA_UNSYNC 0x0040
#define STA_FREQHOLD 0x0080
#define STA_PPSSIGNAL 0x0100
#define STA_PPSJITTER 0x0200
#define STA_PPSWANDER 0x0400
#define STA_PPSERROR 0x0800
#define STA_CLOCKERR 0x1000
#define STA_NANO 0x2000
#define STA_MODE 0x4000
#define STA_CLK 0x8000
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
#define TIME_OK 0
#define TIME_INS 1
#define TIME_DEL 2
#define TIME_OOP 3
#define TIME_WAIT 4
#define TIME_ERROR 5
#define TIME_BAD TIME_ERROR
#define MAXTC 6
int adjtimex(struct timex *);
int clock_adjtime(clockid_t, struct timex *);
#if _REDIR_TIME64
__REDIR(adjtimex, __adjtimex_time64);
__REDIR(clock_adjtime, __clock_adjtime64);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,34 @@
#ifndef _SYS_TTYDEFAULTS_H
#define _SYS_TTYDEFAULTS_H
#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
#define TTYDEF_SPEED (B9600)
#define CTRL(x) ((x)&037)
#define CEOF CTRL('d')
#define CEOL '\0'
#define CSTATUS '\0'
#define CERASE 0177
#define CINTR CTRL('c')
#define CKILL CTRL('u')
#define CMIN 1
#define CQUIT 034
#define CSUSP CTRL('z')
#define CTIME 0
#define CDSUSP CTRL('y')
#define CSTART CTRL('q')
#define CSTOP CTRL('s')
#define CLNEXT CTRL('v')
#define CDISCARD CTRL('o')
#define CWERASE CTRL('w')
#define CREPRINT CTRL('r')
#define CEOT CEOF
#define CBRK CEOL
#define CRPRNT CREPRINT
#define CFLUSH CDISCARD
#endif

View file

@ -0,0 +1,85 @@
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_ino_t
#define __NEED_dev_t
#define __NEED_uid_t
#define __NEED_gid_t
#define __NEED_mode_t
#define __NEED_nlink_t
#define __NEED_off_t
#define __NEED_pid_t
#define __NEED_size_t
#define __NEED_ssize_t
#define __NEED_time_t
#define __NEED_timer_t
#define __NEED_clockid_t
#define __NEED_blkcnt_t
#define __NEED_fsblkcnt_t
#define __NEED_fsfilcnt_t
#define __NEED_id_t
#define __NEED_key_t
#define __NEED_clock_t
#define __NEED_suseconds_t
#define __NEED_blksize_t
#define __NEED_pthread_t
#define __NEED_pthread_attr_t
#define __NEED_pthread_mutexattr_t
#define __NEED_pthread_condattr_t
#define __NEED_pthread_rwlockattr_t
#define __NEED_pthread_barrierattr_t
#define __NEED_pthread_mutex_t
#define __NEED_pthread_cond_t
#define __NEED_pthread_rwlock_t
#define __NEED_pthread_barrier_t
#define __NEED_pthread_spinlock_t
#define __NEED_pthread_key_t
#define __NEED_pthread_once_t
#define __NEED_useconds_t
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_int8_t
#define __NEED_int16_t
#define __NEED_int32_t
#define __NEED_int64_t
#define __NEED_u_int64_t
#define __NEED_register_t
#endif
#include <bits/alltypes.h>
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned u_int32_t;
typedef char *caddr_t;
typedef unsigned char u_char;
typedef unsigned short u_short, ushort;
typedef unsigned u_int, uint;
typedef unsigned long u_long, ulong;
typedef long long quad_t;
typedef unsigned long long u_quad_t;
#include <endian.h>
#include <sys/select.h>
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define blkcnt64_t blkcnt_t
#define fsblkcnt64_t fsblkcnt_t
#define fsfilcnt64_t fsfilcnt_t
#define ino64_t ino_t
#define off64_t off_t
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,57 @@
#ifndef _SYS_UIO_H
#define _SYS_UIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_size_t
#define __NEED_ssize_t
#define __NEED_struct_iovec
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_off_t
#endif
#ifdef _GNU_SOURCE
#define __NEED_pid_t
#endif
#include <bits/alltypes.h>
#define UIO_MAXIOV 1024
ssize_t readv (int, const struct iovec *, int);
ssize_t writev (int, const struct iovec *, int);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
ssize_t preadv (int, const struct iovec *, int, off_t);
ssize_t pwritev (int, const struct iovec *, int, off_t);
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define preadv64 preadv
#define pwritev64 pwritev
#define off64_t off_t
#endif
#endif
#ifdef __wasilibc_unmodified_upstream // Wasm doesn't have these Linux-specific functions
#ifdef _GNU_SOURCE
ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
#define RWF_HIPRI 0x00000001
#define RWF_DSYNC 0x00000002
#define RWF_SYNC 0x00000004
#define RWF_NOWAIT 0x00000008
#define RWF_APPEND 0x00000010
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,39 @@
#ifndef _SYS_UN_H
#define _SYS_UN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
#define __NEED_sa_family_t
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define __NEED_size_t
#endif
#include <bits/alltypes.h>
#ifdef __wasilibc_unmodified_upstream /* WASI has no UNIX-domain sockets */
struct sockaddr_un {
sa_family_t sun_family;
char sun_path[108];
};
#else
#include <__struct_sockaddr_un.h>
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#ifdef __wasilibc_unmodified_upstream /* Declare strlen with the same attributes as <string.h> uses */
size_t strlen(const char *);
#else
size_t strlen(const char *) __attribute__((__nothrow__, __leaf__, __pure__, __nonnull__(1)));
#endif
#define SUN_LEN(s) (2+strlen((s)->sun_path))
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,29 @@
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <features.h>
struct utsname {
char sysname[65];
char nodename[65];
char release[65];
char version[65];
char machine[65];
#ifdef _GNU_SOURCE
char domainname[65];
#else
char __domainname[65];
#endif
};
int uname (struct utsname *);
#ifdef __cplusplus
}
#endif
#endif