wasm
This commit is contained in:
parent
47b135aca0
commit
f90881b03d
9824 changed files with 1706556 additions and 114 deletions
5
binlib/wasi-sysroot-28.0/VERSION
Normal file
5
binlib/wasi-sysroot-28.0/VERSION
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
28.0
|
||||
wasi-libc: d181bdd429f0
|
||||
llvm: 222fc11f2b8f
|
||||
llvm-version: 21.1.4
|
||||
config: f992bcc08219
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __wasilibc___errno_h
|
||||
#define __wasilibc___errno_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern _Thread_local int errno;
|
||||
|
||||
#define errno errno
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
#ifndef __wasilibc___errno_values_h
|
||||
#define __wasilibc___errno_values_h
|
||||
|
||||
#include <wasi/api.h>
|
||||
|
||||
#define E2BIG __WASI_ERRNO_2BIG
|
||||
#define EACCES __WASI_ERRNO_ACCES
|
||||
#define EADDRINUSE __WASI_ERRNO_ADDRINUSE
|
||||
#define EADDRNOTAVAIL __WASI_ERRNO_ADDRNOTAVAIL
|
||||
#define EAFNOSUPPORT __WASI_ERRNO_AFNOSUPPORT
|
||||
#define EAGAIN __WASI_ERRNO_AGAIN
|
||||
#define EALREADY __WASI_ERRNO_ALREADY
|
||||
#define EBADF __WASI_ERRNO_BADF
|
||||
#define EBADMSG __WASI_ERRNO_BADMSG
|
||||
#define EBUSY __WASI_ERRNO_BUSY
|
||||
#define ECANCELED __WASI_ERRNO_CANCELED
|
||||
#define ECHILD __WASI_ERRNO_CHILD
|
||||
#define ECONNABORTED __WASI_ERRNO_CONNABORTED
|
||||
#define ECONNREFUSED __WASI_ERRNO_CONNREFUSED
|
||||
#define ECONNRESET __WASI_ERRNO_CONNRESET
|
||||
#define EDEADLK __WASI_ERRNO_DEADLK
|
||||
#define EDESTADDRREQ __WASI_ERRNO_DESTADDRREQ
|
||||
#define EDOM __WASI_ERRNO_DOM
|
||||
#define EDQUOT __WASI_ERRNO_DQUOT
|
||||
#define EEXIST __WASI_ERRNO_EXIST
|
||||
#define EFAULT __WASI_ERRNO_FAULT
|
||||
#define EFBIG __WASI_ERRNO_FBIG
|
||||
#define EHOSTUNREACH __WASI_ERRNO_HOSTUNREACH
|
||||
#define EIDRM __WASI_ERRNO_IDRM
|
||||
#define EILSEQ __WASI_ERRNO_ILSEQ
|
||||
#define EINPROGRESS __WASI_ERRNO_INPROGRESS
|
||||
#define EINTR __WASI_ERRNO_INTR
|
||||
#define EINVAL __WASI_ERRNO_INVAL
|
||||
#define EIO __WASI_ERRNO_IO
|
||||
#define EISCONN __WASI_ERRNO_ISCONN
|
||||
#define EISDIR __WASI_ERRNO_ISDIR
|
||||
#define ELOOP __WASI_ERRNO_LOOP
|
||||
#define EMFILE __WASI_ERRNO_MFILE
|
||||
#define EMLINK __WASI_ERRNO_MLINK
|
||||
#define EMSGSIZE __WASI_ERRNO_MSGSIZE
|
||||
#define EMULTIHOP __WASI_ERRNO_MULTIHOP
|
||||
#define ENAMETOOLONG __WASI_ERRNO_NAMETOOLONG
|
||||
#define ENETDOWN __WASI_ERRNO_NETDOWN
|
||||
#define ENETRESET __WASI_ERRNO_NETRESET
|
||||
#define ENETUNREACH __WASI_ERRNO_NETUNREACH
|
||||
#define ENFILE __WASI_ERRNO_NFILE
|
||||
#define ENOBUFS __WASI_ERRNO_NOBUFS
|
||||
#define ENODEV __WASI_ERRNO_NODEV
|
||||
#define ENOENT __WASI_ERRNO_NOENT
|
||||
#define ENOEXEC __WASI_ERRNO_NOEXEC
|
||||
#define ENOLCK __WASI_ERRNO_NOLCK
|
||||
#define ENOLINK __WASI_ERRNO_NOLINK
|
||||
#define ENOMEM __WASI_ERRNO_NOMEM
|
||||
#define ENOMSG __WASI_ERRNO_NOMSG
|
||||
#define ENOPROTOOPT __WASI_ERRNO_NOPROTOOPT
|
||||
#define ENOSPC __WASI_ERRNO_NOSPC
|
||||
#define ENOSYS __WASI_ERRNO_NOSYS
|
||||
#define ENOTCONN __WASI_ERRNO_NOTCONN
|
||||
#define ENOTDIR __WASI_ERRNO_NOTDIR
|
||||
#define ENOTEMPTY __WASI_ERRNO_NOTEMPTY
|
||||
#define ENOTRECOVERABLE __WASI_ERRNO_NOTRECOVERABLE
|
||||
#define ENOTSOCK __WASI_ERRNO_NOTSOCK
|
||||
#define ENOTSUP __WASI_ERRNO_NOTSUP
|
||||
#define ENOTTY __WASI_ERRNO_NOTTY
|
||||
#define ENXIO __WASI_ERRNO_NXIO
|
||||
#define EOVERFLOW __WASI_ERRNO_OVERFLOW
|
||||
#define EOWNERDEAD __WASI_ERRNO_OWNERDEAD
|
||||
#define EPERM __WASI_ERRNO_PERM
|
||||
#define EPIPE __WASI_ERRNO_PIPE
|
||||
#define EPROTO __WASI_ERRNO_PROTO
|
||||
#define EPROTONOSUPPORT __WASI_ERRNO_PROTONOSUPPORT
|
||||
#define EPROTOTYPE __WASI_ERRNO_PROTOTYPE
|
||||
#define ERANGE __WASI_ERRNO_RANGE
|
||||
#define EROFS __WASI_ERRNO_ROFS
|
||||
#define ESPIPE __WASI_ERRNO_SPIPE
|
||||
#define ESRCH __WASI_ERRNO_SRCH
|
||||
#define ESTALE __WASI_ERRNO_STALE
|
||||
#define ETIMEDOUT __WASI_ERRNO_TIMEDOUT
|
||||
#define ETXTBSY __WASI_ERRNO_TXTBSY
|
||||
#define EXDEV __WASI_ERRNO_XDEV
|
||||
#define ENOTCAPABLE __WASI_ERRNO_NOTCAPABLE
|
||||
|
||||
#define EOPNOTSUPP ENOTSUP
|
||||
#define EWOULDBLOCK EAGAIN
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
#ifndef __wasilibc___fd_set_h
|
||||
#define __wasilibc___fd_set_h
|
||||
|
||||
#include <__typedef_fd_set.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static __inline void FD_CLR(int __fd, fd_set *__set) {
|
||||
size_t __n = __set->__nfds;
|
||||
for (int *__p = __set->__fds, *__e = __p + __n;
|
||||
__p < __e; ++__p)
|
||||
{
|
||||
if (*__p == __fd) {
|
||||
*__p = __e[-1];
|
||||
__set->__nfds = __n - 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static __inline
|
||||
#ifdef __cplusplus
|
||||
bool
|
||||
#else
|
||||
_Bool
|
||||
#endif
|
||||
FD_ISSET(int __fd, const fd_set *__set)
|
||||
{
|
||||
size_t __n = __set->__nfds;
|
||||
for (const int *__p = __set->__fds, *__e = __p + __n;
|
||||
__p < __e; ++__p)
|
||||
{
|
||||
if (*__p == __fd) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline void FD_SET(int __fd, fd_set *__set) {
|
||||
size_t __n = __set->__nfds;
|
||||
for (const int *__p = __set->__fds, *__e = __p + __n;
|
||||
__p < __e; ++__p)
|
||||
{
|
||||
if (*__p == __fd) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
__set->__nfds = __n + 1;
|
||||
__set->__fds[__n] = __fd;
|
||||
}
|
||||
|
||||
static __inline void FD_ZERO(fd_set *__set) {
|
||||
__set->__nfds = 0;
|
||||
}
|
||||
|
||||
static __inline void FD_COPY(const fd_set *__restrict __from,
|
||||
fd_set *__restrict __to) {
|
||||
size_t __n = __from->__nfds;
|
||||
__to->__nfds = __n;
|
||||
__builtin_memcpy(__to->__fds, __from->__fds, __n * sizeof(int));
|
||||
}
|
||||
|
||||
#define FD_CLR(fd, set) (FD_CLR((fd), (set)))
|
||||
#define FD_ISSET(fd, set) (FD_ISSET((fd), (set)))
|
||||
#define FD_SET(fd, set) (FD_SET((fd), (set)))
|
||||
#define FD_ZERO(set) (FD_ZERO((set)))
|
||||
#define FD_COPY(from, to) (FD_COPY((from), (to)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __wasilibc___function___isatty_h
|
||||
#define __wasilibc___function___isatty_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int __isatty(int fd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef __wasilibc___functions_malloc_h
|
||||
#define __wasilibc___functions_malloc_h
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void *malloc(size_t __size) __attribute__((__malloc__, __warn_unused_result__));
|
||||
void free(void *__ptr);
|
||||
void *calloc(size_t __nmemb, size_t __size) __attribute__((__malloc__, __warn_unused_result__));
|
||||
void *realloc(void *__ptr, size_t __size) __attribute__((__warn_unused_result__));
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
void *reallocarray(void *__ptr, size_t __nmemb, size_t __size) __attribute__((__warn_unused_result__));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __wasilibc___functions_memcpy_h
|
||||
#define __wasilibc___functions_memcpy_h
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void *memcpy(void *__restrict__ __dst, const void *__restrict__ __src, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1, 2)));
|
||||
void *memmove(void *__dst, const void *__src, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1, 2)));
|
||||
void *memset(void *__dst, int __c, size_t __n) __attribute__((__nothrow__, __leaf__, __nonnull__(1)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef __wasilibc___header_dirent_h
|
||||
#define __wasilibc___header_dirent_h
|
||||
|
||||
#include <wasi/api.h>
|
||||
|
||||
#define DT_BLK __WASI_FILETYPE_BLOCK_DEVICE
|
||||
#define DT_CHR __WASI_FILETYPE_CHARACTER_DEVICE
|
||||
#define DT_DIR __WASI_FILETYPE_DIRECTORY
|
||||
#define DT_FIFO __WASI_FILETYPE_SOCKET_STREAM
|
||||
#define DT_LNK __WASI_FILETYPE_SYMBOLIC_LINK
|
||||
#define DT_REG __WASI_FILETYPE_REGULAR_FILE
|
||||
#define DT_UNKNOWN __WASI_FILETYPE_UNKNOWN
|
||||
|
||||
// DT_SOCK is not supported in WASI Preview 1 (but will be in Preview 2). We
|
||||
// define it regardless so that libc++'s `<filesystem>` implementation builds.
|
||||
// The exact value is mostly arbitrary, but chosen so it doesn't conflict with
|
||||
// any of the existing `__WASI_FILETYPE_*` flags. We do not expect any new
|
||||
// flags to be added to WASI Preview 1, so that should be sufficient.
|
||||
#define DT_SOCK 20
|
||||
|
||||
#define IFTODT(x) (__wasilibc_iftodt(x))
|
||||
#define DTTOIF(x) (__wasilibc_dttoif(x))
|
||||
|
||||
#include <__struct_dirent.h>
|
||||
#include <__typedef_DIR.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int __wasilibc_iftodt(int x);
|
||||
int __wasilibc_dttoif(int x);
|
||||
|
||||
int closedir(DIR *);
|
||||
DIR *opendir(const char *);
|
||||
DIR *fdopendir(int);
|
||||
int fdclosedir(DIR *);
|
||||
struct dirent *readdir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
void seekdir(DIR *, long);
|
||||
long telldir(DIR *);
|
||||
DIR *opendirat(int, const char *);
|
||||
void rewinddir(DIR *);
|
||||
int scandirat(int, const char *, struct dirent ***,
|
||||
int (*)(const struct dirent *),
|
||||
int (*)(const struct dirent **, const struct dirent **));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef __wasilibc___header_fcntl_h
|
||||
#define __wasilibc___header_fcntl_h
|
||||
|
||||
#include <wasi/api.h>
|
||||
#include <__seek.h>
|
||||
#include <__mode_t.h>
|
||||
|
||||
#define O_APPEND __WASI_FDFLAGS_APPEND
|
||||
#define O_DSYNC __WASI_FDFLAGS_DSYNC
|
||||
#define O_NONBLOCK __WASI_FDFLAGS_NONBLOCK
|
||||
#define O_RSYNC __WASI_FDFLAGS_RSYNC
|
||||
#define O_SYNC __WASI_FDFLAGS_SYNC
|
||||
#define O_CREAT (__WASI_OFLAGS_CREAT << 12)
|
||||
#define O_DIRECTORY (__WASI_OFLAGS_DIRECTORY << 12)
|
||||
#define O_EXCL (__WASI_OFLAGS_EXCL << 12)
|
||||
#define O_TRUNC (__WASI_OFLAGS_TRUNC << 12)
|
||||
|
||||
#define O_NOFOLLOW (0x01000000)
|
||||
#define O_EXEC (0x02000000)
|
||||
#define O_RDONLY (0x04000000)
|
||||
#define O_SEARCH (0x08000000)
|
||||
#define O_WRONLY (0x10000000)
|
||||
|
||||
/*
|
||||
* O_CLOEXEC is defined to be zero, as WASI has no exec-style functions.
|
||||
*/
|
||||
#define O_CLOEXEC (0)
|
||||
|
||||
/*
|
||||
* O_TTY_INIT is defined to be zero, meaning that WASI implementations are
|
||||
* expected to always initialize a terminal the first time it's opened.
|
||||
*/
|
||||
#define O_TTY_INIT (0)
|
||||
|
||||
#define O_NOCTTY (0)
|
||||
|
||||
#define O_RDWR (O_RDONLY | O_WRONLY)
|
||||
#define O_ACCMODE (O_EXEC | O_RDWR | O_SEARCH)
|
||||
|
||||
#define POSIX_FADV_DONTNEED __WASI_ADVICE_DONTNEED
|
||||
#define POSIX_FADV_NOREUSE __WASI_ADVICE_NOREUSE
|
||||
#define POSIX_FADV_NORMAL __WASI_ADVICE_NORMAL
|
||||
#define POSIX_FADV_RANDOM __WASI_ADVICE_RANDOM
|
||||
#define POSIX_FADV_SEQUENTIAL __WASI_ADVICE_SEQUENTIAL
|
||||
#define POSIX_FADV_WILLNEED __WASI_ADVICE_WILLNEED
|
||||
|
||||
#define F_GETFD (1)
|
||||
#define F_SETFD (2)
|
||||
#define F_GETFL (3)
|
||||
#define F_SETFL (4)
|
||||
|
||||
#define FD_CLOEXEC (1)
|
||||
|
||||
#define AT_EACCESS (0x0)
|
||||
#define AT_SYMLINK_NOFOLLOW (0x1)
|
||||
#define AT_SYMLINK_FOLLOW (0x2)
|
||||
#define AT_REMOVEDIR (0x4)
|
||||
|
||||
#define AT_FDCWD (-2)
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
#ifndef __wasilibc___include_inttypes_h
|
||||
#define __wasilibc___include_inttypes_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define __need_wchar_t
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct { intmax_t quot, rem; } imaxdiv_t;
|
||||
|
||||
intmax_t imaxabs(intmax_t);
|
||||
imaxdiv_t imaxdiv(intmax_t, intmax_t);
|
||||
intmax_t strtoimax(const char *__restrict, char **__restrict, int);
|
||||
uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
|
||||
intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
||||
|
||||
#define PRId16 __INT16_FMTd__
|
||||
#define PRIi16 __INT16_FMTi__
|
||||
#define PRId32 __INT32_FMTd__
|
||||
#define PRIi32 __INT32_FMTi__
|
||||
#define PRId64 __INT64_FMTd__
|
||||
#define PRIi64 __INT64_FMTi__
|
||||
#define PRId8 __INT8_FMTd__
|
||||
#define PRIi8 __INT8_FMTi__
|
||||
#define PRIdMAX __INTMAX_FMTd__
|
||||
#define PRIiMAX __INTMAX_FMTi__
|
||||
#define PRIdPTR __INTPTR_FMTd__
|
||||
#define PRIiPTR __INTPTR_FMTi__
|
||||
#define PRIdFAST16 __INT_FAST16_FMTd__
|
||||
#define PRIiFAST16 __INT_FAST16_FMTi__
|
||||
#define PRIdFAST32 __INT_FAST32_FMTd__
|
||||
#define PRIiFAST32 __INT_FAST32_FMTi__
|
||||
#define PRIdFAST64 __INT_FAST64_FMTd__
|
||||
#define PRIiFAST64 __INT_FAST64_FMTi__
|
||||
#define PRIdFAST8 __INT_FAST8_FMTd__
|
||||
#define PRIiFAST8 __INT_FAST8_FMTi__
|
||||
#define PRIdLEAST16 __INT_LEAST16_FMTd__
|
||||
#define PRIiLEAST16 __INT_LEAST16_FMTi__
|
||||
#define PRIdLEAST32 __INT_LEAST32_FMTd__
|
||||
#define PRIiLEAST32 __INT_LEAST32_FMTi__
|
||||
#define PRIdLEAST64 __INT_LEAST64_FMTd__
|
||||
#define PRIiLEAST64 __INT_LEAST64_FMTi__
|
||||
#define PRIdLEAST8 __INT_LEAST8_FMTd__
|
||||
#define PRIiLEAST8 __INT_LEAST8_FMTi__
|
||||
#define PRIX16 __UINT16_FMTX__
|
||||
#define PRIo16 __UINT16_FMTo__
|
||||
#define PRIu16 __UINT16_FMTu__
|
||||
#define PRIx16 __UINT16_FMTx__
|
||||
#define PRIX32 __UINT32_FMTX__
|
||||
#define PRIo32 __UINT32_FMTo__
|
||||
#define PRIu32 __UINT32_FMTu__
|
||||
#define PRIx32 __UINT32_FMTx__
|
||||
#define PRIX64 __UINT64_FMTX__
|
||||
#define PRIo64 __UINT64_FMTo__
|
||||
#define PRIu64 __UINT64_FMTu__
|
||||
#define PRIx64 __UINT64_FMTx__
|
||||
#define PRIX8 __UINT8_FMTX__
|
||||
#define PRIo8 __UINT8_FMTo__
|
||||
#define PRIu8 __UINT8_FMTu__
|
||||
#define PRIx8 __UINT8_FMTx__
|
||||
#define PRIXMAX __UINTMAX_FMTX__
|
||||
#define PRIoMAX __UINTMAX_FMTo__
|
||||
#define PRIuMAX __UINTMAX_FMTu__
|
||||
#define PRIxMAX __UINTMAX_FMTx__
|
||||
#define PRIXPTR __UINTPTR_FMTX__
|
||||
#define PRIoPTR __UINTPTR_FMTo__
|
||||
#define PRIuPTR __UINTPTR_FMTu__
|
||||
#define PRIxPTR __UINTPTR_FMTx__
|
||||
#define PRIXFAST16 __UINT_FAST16_FMTX__
|
||||
#define PRIoFAST16 __UINT_FAST16_FMTo__
|
||||
#define PRIuFAST16 __UINT_FAST16_FMTu__
|
||||
#define PRIxFAST16 __UINT_FAST16_FMTx__
|
||||
#define PRIXFAST32 __UINT_FAST32_FMTX__
|
||||
#define PRIoFAST32 __UINT_FAST32_FMTo__
|
||||
#define PRIuFAST32 __UINT_FAST32_FMTu__
|
||||
#define PRIxFAST32 __UINT_FAST32_FMTx__
|
||||
#define PRIXFAST64 __UINT_FAST64_FMTX__
|
||||
#define PRIoFAST64 __UINT_FAST64_FMTo__
|
||||
#define PRIuFAST64 __UINT_FAST64_FMTu__
|
||||
#define PRIxFAST64 __UINT_FAST64_FMTx__
|
||||
#define PRIXFAST8 __UINT_FAST8_FMTX__
|
||||
#define PRIoFAST8 __UINT_FAST8_FMTo__
|
||||
#define PRIuFAST8 __UINT_FAST8_FMTu__
|
||||
#define PRIxFAST8 __UINT_FAST8_FMTx__
|
||||
#define PRIXLEAST16 __UINT_LEAST16_FMTX__
|
||||
#define PRIoLEAST16 __UINT_LEAST16_FMTo__
|
||||
#define PRIuLEAST16 __UINT_LEAST16_FMTu__
|
||||
#define PRIxLEAST16 __UINT_LEAST16_FMTx__
|
||||
#define PRIXLEAST32 __UINT_LEAST32_FMTX__
|
||||
#define PRIoLEAST32 __UINT_LEAST32_FMTo__
|
||||
#define PRIuLEAST32 __UINT_LEAST32_FMTu__
|
||||
#define PRIxLEAST32 __UINT_LEAST32_FMTx__
|
||||
#define PRIXLEAST64 __UINT_LEAST64_FMTX__
|
||||
#define PRIoLEAST64 __UINT_LEAST64_FMTo__
|
||||
#define PRIuLEAST64 __UINT_LEAST64_FMTu__
|
||||
#define PRIxLEAST64 __UINT_LEAST64_FMTx__
|
||||
#define PRIXLEAST8 __UINT_LEAST8_FMTX__
|
||||
#define PRIoLEAST8 __UINT_LEAST8_FMTo__
|
||||
#define PRIuLEAST8 __UINT_LEAST8_FMTu__
|
||||
#define PRIxLEAST8 __UINT_LEAST8_FMTx__
|
||||
|
||||
#define SCNd16 __INT16_FMTd__
|
||||
#define SCNi16 __INT16_FMTi__
|
||||
#define SCNd32 __INT32_FMTd__
|
||||
#define SCNi32 __INT32_FMTi__
|
||||
#define SCNd64 __INT64_FMTd__
|
||||
#define SCNi64 __INT64_FMTi__
|
||||
#define SCNd8 __INT8_FMTd__
|
||||
#define SCNi8 __INT8_FMTi__
|
||||
#define SCNdMAX __INTMAX_FMTd__
|
||||
#define SCNiMAX __INTMAX_FMTi__
|
||||
#define SCNdPTR __INTPTR_FMTd__
|
||||
#define SCNiPTR __INTPTR_FMTi__
|
||||
#define SCNdFAST16 __INT_FAST16_FMTd__
|
||||
#define SCNiFAST16 __INT_FAST16_FMTi__
|
||||
#define SCNdFAST32 __INT_FAST32_FMTd__
|
||||
#define SCNiFAST32 __INT_FAST32_FMTi__
|
||||
#define SCNdFAST64 __INT_FAST64_FMTd__
|
||||
#define SCNiFAST64 __INT_FAST64_FMTi__
|
||||
#define SCNdFAST8 __INT_FAST8_FMTd__
|
||||
#define SCNiFAST8 __INT_FAST8_FMTi__
|
||||
#define SCNdLEAST16 __INT_LEAST16_FMTd__
|
||||
#define SCNiLEAST16 __INT_LEAST16_FMTi__
|
||||
#define SCNdLEAST32 __INT_LEAST32_FMTd__
|
||||
#define SCNiLEAST32 __INT_LEAST32_FMTi__
|
||||
#define SCNdLEAST64 __INT_LEAST64_FMTd__
|
||||
#define SCNiLEAST64 __INT_LEAST64_FMTi__
|
||||
#define SCNdLEAST8 __INT_LEAST8_FMTd__
|
||||
#define SCNiLEAST8 __INT_LEAST8_FMTi__
|
||||
#define SCNo16 __UINT16_FMTo__
|
||||
#define SCNu16 __UINT16_FMTu__
|
||||
#define SCNx16 __UINT16_FMTx__
|
||||
#define SCNo32 __UINT32_FMTo__
|
||||
#define SCNu32 __UINT32_FMTu__
|
||||
#define SCNx32 __UINT32_FMTx__
|
||||
#define SCNo64 __UINT64_FMTo__
|
||||
#define SCNu64 __UINT64_FMTu__
|
||||
#define SCNx64 __UINT64_FMTx__
|
||||
#define SCNo8 __UINT8_FMTo__
|
||||
#define SCNu8 __UINT8_FMTu__
|
||||
#define SCNx8 __UINT8_FMTx__
|
||||
#define SCNoMAX __UINTMAX_FMTo__
|
||||
#define SCNuMAX __UINTMAX_FMTu__
|
||||
#define SCNxMAX __UINTMAX_FMTx__
|
||||
#define SCNoPTR __UINTPTR_FMTo__
|
||||
#define SCNuPTR __UINTPTR_FMTu__
|
||||
#define SCNxPTR __UINTPTR_FMTx__
|
||||
#define SCNoFAST16 __UINT_FAST16_FMTo__
|
||||
#define SCNuFAST16 __UINT_FAST16_FMTu__
|
||||
#define SCNxFAST16 __UINT_FAST16_FMTx__
|
||||
#define SCNoFAST32 __UINT_FAST32_FMTo__
|
||||
#define SCNuFAST32 __UINT_FAST32_FMTu__
|
||||
#define SCNxFAST32 __UINT_FAST32_FMTx__
|
||||
#define SCNoFAST64 __UINT_FAST64_FMTo__
|
||||
#define SCNuFAST64 __UINT_FAST64_FMTu__
|
||||
#define SCNxFAST64 __UINT_FAST64_FMTx__
|
||||
#define SCNoFAST8 __UINT_FAST8_FMTo__
|
||||
#define SCNuFAST8 __UINT_FAST8_FMTu__
|
||||
#define SCNxFAST8 __UINT_FAST8_FMTx__
|
||||
#define SCNoLEAST16 __UINT_LEAST16_FMTo__
|
||||
#define SCNuLEAST16 __UINT_LEAST16_FMTu__
|
||||
#define SCNxLEAST16 __UINT_LEAST16_FMTx__
|
||||
#define SCNoLEAST32 __UINT_LEAST32_FMTo__
|
||||
#define SCNuLEAST32 __UINT_LEAST32_FMTu__
|
||||
#define SCNxLEAST32 __UINT_LEAST32_FMTx__
|
||||
#define SCNoLEAST64 __UINT_LEAST64_FMTo__
|
||||
#define SCNuLEAST64 __UINT_LEAST64_FMTu__
|
||||
#define SCNxLEAST64 __UINT_LEAST64_FMTx__
|
||||
#define SCNoLEAST8 __UINT_LEAST8_FMTo__
|
||||
#define SCNuLEAST8 __UINT_LEAST8_FMTu__
|
||||
#define SCNxLEAST8 __UINT_LEAST8_FMTx__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __wasilibc___header_netinet_in_h
|
||||
#define __wasilibc___header_netinet_in_h
|
||||
|
||||
#include <__struct_in_addr.h>
|
||||
#include <__struct_in6_addr.h>
|
||||
#include <__struct_sockaddr_in.h>
|
||||
#include <__struct_sockaddr_in6.h>
|
||||
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_ICMP 1
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_UDP 17
|
||||
#define IPPROTO_IPV6 41
|
||||
#define IPPROTO_RAW 255
|
||||
|
||||
#define IN6ADDR_ANY_INIT { { \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00 \
|
||||
} }
|
||||
|
||||
#define IN6ADDR_LOOPBACK_INIT { { \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x01 \
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef __wasilibc___header_poll_h
|
||||
#define __wasilibc___header_poll_h
|
||||
|
||||
#include <__struct_pollfd.h>
|
||||
#include <__typedef_nfds_t.h>
|
||||
|
||||
#define POLLRDNORM 0x1
|
||||
#define POLLWRNORM 0x2
|
||||
|
||||
#define POLLIN POLLRDNORM
|
||||
#define POLLOUT POLLWRNORM
|
||||
|
||||
#define POLLERR 0x1000
|
||||
#define POLLHUP 0x2000
|
||||
#define POLLNVAL 0x4000
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int poll(struct pollfd[], nfds_t, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __wasilibc___header_stdlib_h
|
||||
#define __wasilibc___header_stdlib_h
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__functions_malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void abort(void) __attribute__((__noreturn__));
|
||||
void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
|
||||
void _Exit(int) __attribute__((__noreturn__));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __wasilibc___header_string_h
|
||||
#define __wasilibc___header_string_h
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__functions_memcpy.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
size_t strlen(const char *) __attribute__((__nothrow__, __leaf__, __pure__, __nonnull__(1)));
|
||||
char *strdup(const char *) __attribute__((__nothrow__, __nonnull__(1)));
|
||||
int strcmp(const char *, const char *) __attribute__((__nothrow__, __pure__, __nonnull__(1, 2)));
|
||||
void *memchr(const void *, int, size_t) __attribute__((__nothrow__, __pure__, __nonnull__(1)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __wasilibc___header_sys_ioctl_h
|
||||
#define __wasilibc___header_sys_ioctl_h
|
||||
|
||||
#define FIONREAD 1
|
||||
#define FIONBIO 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ioctl(int, int, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __wasilibc___header_sys_resource_h
|
||||
#define __wasilibc___header_sys_resource_h
|
||||
|
||||
#include <__struct_rusage.h>
|
||||
|
||||
#define RUSAGE_SELF 1
|
||||
#define RUSAGE_CHILDREN 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int getrusage(int who, struct rusage *usage);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
#ifndef __wasilibc___header_sys_socket_h
|
||||
#define __wasilibc___header_sys_socket_h
|
||||
|
||||
#include <__wasi_snapshot.h>
|
||||
#include <__struct_msghdr.h>
|
||||
#include <__struct_sockaddr.h>
|
||||
#include <__struct_sockaddr_storage.h>
|
||||
|
||||
#include <wasi/api.h>
|
||||
|
||||
#define SHUT_RD __WASI_SDFLAGS_RD
|
||||
#define SHUT_WR __WASI_SDFLAGS_WR
|
||||
#define SHUT_RDWR (SHUT_RD | SHUT_WR)
|
||||
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#define MSG_DONTWAIT 0x0040
|
||||
#define MSG_NOSIGNAL 0x4000
|
||||
#define MSG_PEEK 0x0002
|
||||
#define MSG_WAITALL 0x0100
|
||||
#define MSG_TRUNC 0x0020
|
||||
|
||||
#define SOL_IP 0
|
||||
#define SOL_TCP 6
|
||||
#define SOL_UDP 17
|
||||
#define SOL_IPV6 41
|
||||
|
||||
#define SOMAXCONN 128
|
||||
|
||||
#define SO_REUSEADDR 2
|
||||
#define SO_ERROR 4
|
||||
#define SO_SNDBUF 7
|
||||
#define SO_RCVBUF 8
|
||||
#define SO_KEEPALIVE 9
|
||||
#define SO_ACCEPTCONN 30
|
||||
#define SO_PROTOCOL 38
|
||||
#define SO_DOMAIN 39
|
||||
|
||||
#if __LONG_MAX == 0x7fffffff
|
||||
#define SO_RCVTIMEO 66
|
||||
#define SO_SNDTIMEO 67
|
||||
#else
|
||||
#define SO_RCVTIMEO 20
|
||||
#define SO_SNDTIMEO 21
|
||||
#endif
|
||||
|
||||
#else // __wasilibc_use_wasip2
|
||||
#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
|
||||
#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
|
||||
#define MSG_TRUNC __WASI_ROFLAGS_RECV_DATA_TRUNCATED
|
||||
#endif // __wasilibc_use_wasip2
|
||||
|
||||
#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
|
||||
#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM
|
||||
|
||||
#define SOCK_NONBLOCK (0x00004000)
|
||||
#define SOCK_CLOEXEC (0x00002000)
|
||||
|
||||
#define SOL_SOCKET 0x7fffffff
|
||||
|
||||
#define SO_TYPE 3
|
||||
|
||||
#define PF_UNSPEC 0
|
||||
#define PF_INET 1
|
||||
#define PF_INET6 2
|
||||
|
||||
#define AF_UNSPEC PF_UNSPEC
|
||||
#define AF_INET PF_INET
|
||||
#define AF_INET6 PF_INET6
|
||||
#define AF_UNIX 3
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef __wasilibc___header_sys_stat_h
|
||||
#define __wasilibc___header_sys_stat_h
|
||||
|
||||
#include <__struct_stat.h>
|
||||
|
||||
#define st_atime st_atim.tv_sec
|
||||
#define st_mtime st_mtim.tv_sec
|
||||
#define st_ctime st_ctim.tv_sec
|
||||
|
||||
#include <__mode_t.h>
|
||||
|
||||
#define UTIME_NOW (-1)
|
||||
#define UTIME_OMIT (-2)
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __wasilibc___header_time_h
|
||||
#define __wasilibc___header_time_h
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_time_t.h>
|
||||
#include <__struct_timespec.h>
|
||||
#include <__struct_tm.h>
|
||||
#include <__typedef_clockid_t.h>
|
||||
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#include <wasi/wasip2.h>
|
||||
#else
|
||||
#include <wasi/api.h>
|
||||
#endif
|
||||
|
||||
#define TIMER_ABSTIME __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME
|
||||
|
||||
extern const struct __clockid _CLOCK_MONOTONIC;
|
||||
#define CLOCK_MONOTONIC (&_CLOCK_MONOTONIC)
|
||||
extern const struct __clockid _CLOCK_REALTIME;
|
||||
#define CLOCK_REALTIME (&_CLOCK_REALTIME)
|
||||
|
||||
/*
|
||||
* TIME_UTC is the only standardized time base value.
|
||||
*/
|
||||
#define TIME_UTC 1
|
||||
|
||||
/*
|
||||
* Note that XSI specifies CLOCKS_PER_SEC to be 1000000, rather than
|
||||
* 1000000000; the clock API is providing more precision than XSI specifies.
|
||||
*/
|
||||
#define CLOCKS_PER_SEC ((clock_t)1000000000)
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef __wasilibc___header_unistd_h
|
||||
#define __wasilibc___header_unistd_h
|
||||
|
||||
struct stat;
|
||||
|
||||
#include <__seek.h>
|
||||
|
||||
#define F_OK (0)
|
||||
#define X_OK (1)
|
||||
#define W_OK (2)
|
||||
#define R_OK (4)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int close(int fd);
|
||||
int faccessat(int, const char *, int, int);
|
||||
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
|
||||
int renameat(int, const char *, int, const char *);
|
||||
int openat(int, const char *, int, ...);
|
||||
void *sbrk(intptr_t increment);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___macro_FD_SETSIZE_h
|
||||
#define __wasilibc___macro_FD_SETSIZE_h
|
||||
|
||||
#define FD_SETSIZE 1024
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __wasilibc___macro_PAGESIZE_h
|
||||
#define __wasilibc___macro_PAGESIZE_h
|
||||
|
||||
/*
|
||||
* Without custom-page-sizes proposal, the page size in WebAssembly
|
||||
* is fixed at 64 KiB.
|
||||
*
|
||||
* The LLVM versions with a support of custom-page-sizes proposal
|
||||
* provides __wasm_first_page_end global to allow page-size-agnostic
|
||||
* objects.
|
||||
*
|
||||
* If this ever needs to be a value outside the range of an `int`, the
|
||||
* `getpagesize` function which returns this value will need special
|
||||
* consideration. POSIX has deprecated `getpagesize` in favor of
|
||||
* `sysconf(_SC_PAGESIZE)` which does not have this problem.
|
||||
*/
|
||||
#if __clang_major__ >= 22
|
||||
extern char __wasm_first_page_end;
|
||||
#define PAGESIZE ((unsigned long)&__wasm_first_page_end)
|
||||
#else
|
||||
#define PAGESIZE (0x10000)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef __wasilibc___mode_t_h
|
||||
#define __wasilibc___mode_t_h
|
||||
|
||||
#define S_IFMT \
|
||||
(S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFREG | S_IFSOCK)
|
||||
#define S_IFBLK (0x6000)
|
||||
#define S_IFCHR (0x2000)
|
||||
#define S_IFDIR (0x4000)
|
||||
#define S_IFLNK (0xa000)
|
||||
#define S_IFREG (0x8000)
|
||||
#define S_IFSOCK (0xc000)
|
||||
#define S_IFIFO (0x1000)
|
||||
|
||||
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
|
||||
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
|
||||
#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
|
||||
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
|
||||
|
||||
#define S_IXOTH (0x1)
|
||||
#define S_IWOTH (0x2)
|
||||
#define S_IROTH (0x4)
|
||||
#define S_IRWXO (S_IXOTH | S_IWOTH | S_IROTH)
|
||||
#define S_IXGRP (0x8)
|
||||
#define S_IWGRP (0x10)
|
||||
#define S_IRGRP (0x20)
|
||||
#define S_IRWXG (S_IXGRP | S_IWGRP | S_IRGRP)
|
||||
#define S_IXUSR (0x40)
|
||||
#define S_IWUSR (0x80)
|
||||
#define S_IRUSR (0x100)
|
||||
#define S_IRWXU (S_IXUSR | S_IWUSR | S_IRUSR)
|
||||
#define S_ISVTX (0x200)
|
||||
#define S_ISGID (0x400)
|
||||
#define S_ISUID (0x800)
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __wasilibc___seek_h
|
||||
#define __wasilibc___seek_h
|
||||
|
||||
#include <wasi/api.h>
|
||||
|
||||
#define SEEK_CUR __WASI_WHENCE_CUR
|
||||
#define SEEK_END __WASI_WHENCE_END
|
||||
#define SEEK_SET __WASI_WHENCE_SET
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __wasilibc___struct_dirent_h
|
||||
#define __wasilibc___struct_dirent_h
|
||||
|
||||
#include <__typedef_ino_t.h>
|
||||
|
||||
#define _DIRENT_HAVE_D_TYPE
|
||||
|
||||
struct dirent {
|
||||
ino_t d_ino;
|
||||
unsigned char d_type;
|
||||
char d_name[];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __wasilibc___struct_in6_addr_h
|
||||
#define __wasilibc___struct_in6_addr_h
|
||||
|
||||
struct in6_addr {
|
||||
_Alignas(int32_t) unsigned char s6_addr[16];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __wasilibc___struct_in_addr_h
|
||||
#define __wasilibc___struct_in_addr_h
|
||||
|
||||
#include <__typedef_in_addr_t.h>
|
||||
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __wasilibc___struct_iovec_h
|
||||
#define __wasilibc___struct_iovec_h
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
struct iovec {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __wasilibc___struct_msghdr_h
|
||||
#define __wasilibc___struct_msghdr_h
|
||||
|
||||
#include <__typedef_socklen_t.h>
|
||||
|
||||
struct msghdr {
|
||||
void *msg_name;
|
||||
socklen_t msg_namelen;
|
||||
struct iovec *msg_iov;
|
||||
int msg_iovlen;
|
||||
void *msg_control;
|
||||
socklen_t msg_controllen;
|
||||
int msg_flags;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __wasilibc___struct_pollfd_h
|
||||
#define __wasilibc___struct_pollfd_h
|
||||
|
||||
struct pollfd {
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __wasilibc___struct_rusage_h
|
||||
#define __wasilibc___struct_rusage_h
|
||||
|
||||
#include <__struct_timeval.h>
|
||||
|
||||
/* TODO: Add more features here. */
|
||||
struct rusage {
|
||||
struct timeval ru_utime;
|
||||
struct timeval ru_stime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef __wasilibc___struct_sockaddr_h
|
||||
#define __wasilibc___struct_sockaddr_h
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr {
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sa_family;
|
||||
char sa_data[0];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __wasilibc___struct_sockaddr_in_h
|
||||
#define __wasilibc___struct_sockaddr_in_h
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
#include <__typedef_in_port_t.h>
|
||||
#include <__struct_in_addr.h>
|
||||
|
||||
struct sockaddr_in {
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __wasilibc___struct_sockaddr_in6_h
|
||||
#define __wasilibc___struct_sockaddr_in6_h
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
#include <__typedef_in_port_t.h>
|
||||
#include <__struct_in6_addr.h>
|
||||
|
||||
struct sockaddr_in6 {
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family;
|
||||
in_port_t sin6_port;
|
||||
unsigned sin6_flowinfo;
|
||||
struct in6_addr sin6_addr;
|
||||
unsigned sin6_scope_id;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef __wasilibc___struct_sockaddr_storage_h
|
||||
#define __wasilibc___struct_sockaddr_storage_h
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr_storage {
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family;
|
||||
char __ss_data[32];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __wasilibc___struct_sockaddr_un_h
|
||||
#define __wasilibc___struct_sockaddr_un_h
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr_un {
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef __wasilibc___struct_stat_h
|
||||
#define __wasilibc___struct_stat_h
|
||||
|
||||
#include <__typedef_dev_t.h>
|
||||
#include <__typedef_ino_t.h>
|
||||
#include <__typedef_nlink_t.h>
|
||||
#include <__typedef_mode_t.h>
|
||||
#include <__typedef_uid_t.h>
|
||||
#include <__typedef_gid_t.h>
|
||||
#include <__typedef_off_t.h>
|
||||
#include <__typedef_blksize_t.h>
|
||||
#include <__typedef_blkcnt_t.h>
|
||||
#include <__struct_timespec.h>
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
nlink_t st_nlink;
|
||||
|
||||
mode_t st_mode;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
unsigned int __pad0;
|
||||
dev_t st_rdev;
|
||||
off_t st_size;
|
||||
blksize_t st_blksize;
|
||||
blkcnt_t st_blocks;
|
||||
|
||||
struct timespec st_atim;
|
||||
struct timespec st_mtim;
|
||||
struct timespec st_ctim;
|
||||
long long __reserved[3];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef __wasilibc___struct_timespec_h
|
||||
#define __wasilibc___struct_timespec_h
|
||||
|
||||
#include <__typedef_time_t.h>
|
||||
|
||||
/* As specified in POSIX. */
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __wasilibc___struct_timeval_h
|
||||
#define __wasilibc___struct_timeval_h
|
||||
|
||||
#include <__typedef_time_t.h>
|
||||
#include <__typedef_suseconds_t.h>
|
||||
|
||||
/* As specified in POSIX. */
|
||||
struct timeval {
|
||||
time_t tv_sec;
|
||||
suseconds_t tv_usec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __wasilibc___struct_tm_h
|
||||
#define __wasilibc___struct_tm_h
|
||||
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
int __tm_gmtoff;
|
||||
const char *__tm_zone;
|
||||
int __tm_nsec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __wasilibc___struct_tms_h
|
||||
#define __wasilibc___struct_tms_h
|
||||
|
||||
#include <__typedef_clock_t.h>
|
||||
|
||||
struct tms {
|
||||
clock_t tms_utime;
|
||||
clock_t tms_stime;
|
||||
clock_t tms_cutime;
|
||||
clock_t tms_cstime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_DIR_h
|
||||
#define __wasilibc___typedef_DIR_h
|
||||
|
||||
typedef struct _DIR DIR;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_blkcnt_t_h
|
||||
#define __wasilibc___typedef_blkcnt_t_h
|
||||
|
||||
/* Define these as 64-bit signed integers to support files larger than 2 GiB. */
|
||||
typedef long long blkcnt_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_blksize_t_h
|
||||
#define __wasilibc___typedef_blksize_t_h
|
||||
|
||||
typedef long blksize_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_clock_t_h
|
||||
#define __wasilibc___typedef_clock_t_h
|
||||
|
||||
/* Define this as a 64-bit signed integer to avoid wraparounds. */
|
||||
typedef long long clock_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_clockid_t_h
|
||||
#define __wasilibc___typedef_clockid_t_h
|
||||
|
||||
typedef const struct __clockid *clockid_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_dev_t_h
|
||||
#define __wasilibc___typedef_dev_t_h
|
||||
|
||||
/* Define these as 64-bit integers to support billions of devices. */
|
||||
typedef unsigned long long dev_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef __wasilibc___typedef_fd_set_h
|
||||
#define __wasilibc___typedef_fd_set_h
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__macro_FD_SETSIZE.h>
|
||||
|
||||
typedef struct {
|
||||
size_t __nfds;
|
||||
int __fds[FD_SETSIZE];
|
||||
} fd_set;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_gid_t_h
|
||||
#define __wasilibc___typedef_gid_t_h
|
||||
|
||||
typedef unsigned gid_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_in_addr_t_h
|
||||
#define __wasilibc___typedef_in_addr_t_h
|
||||
|
||||
typedef unsigned in_addr_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_in_port_t_h
|
||||
#define __wasilibc___typedef_in_port_t_h
|
||||
|
||||
typedef unsigned short in_port_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_ino_t_h
|
||||
#define __wasilibc___typedef_ino_t_h
|
||||
|
||||
/* Define these as 64-bit integers to support billions of inodes. */
|
||||
typedef unsigned long long ino_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_mode_t_h
|
||||
#define __wasilibc___typedef_mode_t_h
|
||||
|
||||
typedef unsigned mode_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_nfds_t_h
|
||||
#define __wasilibc___typedef_nfds_t_h
|
||||
|
||||
typedef unsigned long nfds_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_nlink_t_h
|
||||
#define __wasilibc___typedef_nlink_t_h
|
||||
|
||||
/* Define these as 64-bit unsigned integers to support billions of links. */
|
||||
typedef unsigned long long nlink_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_off_t_h
|
||||
#define __wasilibc___typedef_off_t_h
|
||||
|
||||
/* Define these as 64-bit signed integers to support files larger than 2 GiB. */
|
||||
typedef long long off_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_sa_family_t_h
|
||||
#define __wasilibc___typedef_sa_family_t_h
|
||||
|
||||
typedef unsigned short sa_family_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_sigset_t_h
|
||||
#define __wasilibc___typedef_sigset_t_h
|
||||
|
||||
/* TODO: This is just a placeholder for now. Keep this in sync with musl. */
|
||||
typedef unsigned char sigset_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_socklen_t_h
|
||||
#define __wasilibc___typedef_socklen_t_h
|
||||
|
||||
typedef unsigned socklen_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_ssize_t_h
|
||||
#define __wasilibc___typedef_ssize_t_h
|
||||
|
||||
/* This is defined to be the same size as size_t. */
|
||||
typedef long ssize_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __wasilibc___typedef_suseconds_t_h
|
||||
#define __wasilibc___typedef_suseconds_t_h
|
||||
|
||||
/* Define this to be 64-bit as its main use is in struct timeval where the
|
||||
extra space would otherwise be padding. */
|
||||
typedef long long suseconds_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef __wasilibc___typedef_time_t_h
|
||||
#define __wasilibc___typedef_time_t_h
|
||||
|
||||
/* Define this as a 64-bit signed integer to avoid the 2038 bug. */
|
||||
typedef long long time_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __wasilibc___typedef_uid_t_h
|
||||
#define __wasilibc___typedef_uid_t_h
|
||||
|
||||
typedef unsigned uid_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/* This file is (practically) empty by default. The Makefile will replace it
|
||||
with a non-empty version that defines `__wasilibc_use_wasip2` if targeting
|
||||
`wasm32-wasip2`.
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef _ALLOCA_H
|
||||
#define _ALLOCA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_size_t
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
void *alloca(size_t);
|
||||
|
||||
#define alloca __builtin_alloca
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
25
binlib/wasi-sysroot-28.0/include/wasm32-wasi-threads/ar.h
Normal file
25
binlib/wasi-sysroot-28.0/include/wasm32-wasi-threads/ar.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef _AR_H
|
||||
#define _AR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ARMAG "!<arch>\n"
|
||||
#define SARMAG 8
|
||||
#define ARFMAG "`\n"
|
||||
|
||||
struct ar_hdr {
|
||||
char ar_name[16];
|
||||
char ar_date[12];
|
||||
char ar_uid[6], ar_gid[6];
|
||||
char ar_mode[8];
|
||||
char ar_size[10];
|
||||
char ar_fmag[2];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef _ARPA_FTP_H
|
||||
#define _ARPA_FTP_H
|
||||
#define PRELIM 1
|
||||
#define COMPLETE 2
|
||||
#define CONTINUE 3
|
||||
#define TRANSIENT 4
|
||||
#define ERROR 5
|
||||
#define TYPE_A 1
|
||||
#define TYPE_E 2
|
||||
#define TYPE_I 3
|
||||
#define TYPE_L 4
|
||||
#define FORM_N 1
|
||||
#define FORM_T 2
|
||||
#define FORM_C 3
|
||||
#define STRU_F 1
|
||||
#define STRU_R 2
|
||||
#define STRU_P 3
|
||||
#define MODE_S 1
|
||||
#define MODE_B 2
|
||||
#define MODE_C 3
|
||||
#define REC_ESC '\377'
|
||||
#define REC_EOR '\001'
|
||||
#define REC_EOF '\002'
|
||||
#define BLK_EOR 0x80
|
||||
#define BLK_EOF 0x40
|
||||
#define BLK_ERRORS 0x20
|
||||
#define BLK_RESTART 0x10
|
||||
#define BLK_BYTECOUNT 2
|
||||
#ifdef FTP_NAMES
|
||||
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
|
||||
char *strunames[] = {"0", "File", "Record", "Page" };
|
||||
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
|
||||
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef _ARPA_INET_H
|
||||
#define _ARPA_INET_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
uint32_t htonl(uint32_t);
|
||||
uint16_t htons(uint16_t);
|
||||
uint32_t ntohl(uint32_t);
|
||||
uint16_t ntohs(uint16_t);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no inet_addr */
|
||||
in_addr_t inet_addr (const char *);
|
||||
in_addr_t inet_network (const char *);
|
||||
char *inet_ntoa (struct in_addr);
|
||||
#endif
|
||||
int inet_pton (int, const char *__restrict, void *__restrict);
|
||||
const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
|
||||
|
||||
int inet_aton (const char *, struct in_addr *);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no inet_makeaddr */
|
||||
struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
|
||||
in_addr_t inet_lnaof(struct in_addr);
|
||||
in_addr_t inet_netof(struct in_addr);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,526 @@
|
|||
#ifndef _ARPA_NAMESER_H
|
||||
#define _ARPA_NAMESER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define __NAMESER 19991006
|
||||
#define NS_PACKETSZ 512
|
||||
#define NS_MAXDNAME 1025
|
||||
#define NS_MAXMSG 65535
|
||||
#define NS_MAXCDNAME 255
|
||||
#define NS_MAXLABEL 63
|
||||
#define NS_HFIXEDSZ 12
|
||||
#define NS_QFIXEDSZ 4
|
||||
#define NS_RRFIXEDSZ 10
|
||||
#define NS_INT32SZ 4
|
||||
#define NS_INT16SZ 2
|
||||
#define NS_INT8SZ 1
|
||||
#define NS_INADDRSZ 4
|
||||
#define NS_IN6ADDRSZ 16
|
||||
#define NS_CMPRSFLGS 0xc0
|
||||
#define NS_DEFAULTPORT 53
|
||||
|
||||
typedef enum __ns_sect {
|
||||
ns_s_qd = 0,
|
||||
ns_s_zn = 0,
|
||||
ns_s_an = 1,
|
||||
ns_s_pr = 1,
|
||||
ns_s_ns = 2,
|
||||
ns_s_ud = 2,
|
||||
ns_s_ar = 3,
|
||||
ns_s_max = 4
|
||||
} ns_sect;
|
||||
|
||||
typedef struct __ns_msg {
|
||||
const unsigned char *_msg, *_eom;
|
||||
uint16_t _id, _flags, _counts[ns_s_max];
|
||||
const unsigned char *_sections[ns_s_max];
|
||||
ns_sect _sect;
|
||||
int _rrnum;
|
||||
const unsigned char *_msg_ptr;
|
||||
} ns_msg;
|
||||
|
||||
struct _ns_flagdata { int mask, shift; };
|
||||
extern const struct _ns_flagdata _ns_flagdata[];
|
||||
|
||||
#define ns_msg_id(handle) ((handle)._id + 0)
|
||||
#define ns_msg_base(handle) ((handle)._msg + 0)
|
||||
#define ns_msg_end(handle) ((handle)._eom + 0)
|
||||
#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
|
||||
#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
|
||||
#define ns_msg_getflag(handle, flag) \
|
||||
(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
|
||||
|
||||
typedef struct __ns_rr {
|
||||
char name[NS_MAXDNAME];
|
||||
uint16_t type;
|
||||
uint16_t rr_class;
|
||||
uint32_t ttl;
|
||||
uint16_t rdlength;
|
||||
const unsigned char *rdata;
|
||||
} ns_rr;
|
||||
|
||||
#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
|
||||
#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
|
||||
#define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0))
|
||||
#define ns_rr_ttl(rr) ((rr).ttl + 0)
|
||||
#define ns_rr_rdlen(rr) ((rr).rdlength + 0)
|
||||
#define ns_rr_rdata(rr) ((rr).rdata + 0)
|
||||
|
||||
typedef enum __ns_flag {
|
||||
ns_f_qr,
|
||||
ns_f_opcode,
|
||||
ns_f_aa,
|
||||
ns_f_tc,
|
||||
ns_f_rd,
|
||||
ns_f_ra,
|
||||
ns_f_z,
|
||||
ns_f_ad,
|
||||
ns_f_cd,
|
||||
ns_f_rcode,
|
||||
ns_f_max
|
||||
} ns_flag;
|
||||
|
||||
typedef enum __ns_opcode {
|
||||
ns_o_query = 0,
|
||||
ns_o_iquery = 1,
|
||||
ns_o_status = 2,
|
||||
ns_o_notify = 4,
|
||||
ns_o_update = 5,
|
||||
ns_o_max = 6
|
||||
} ns_opcode;
|
||||
|
||||
typedef enum __ns_rcode {
|
||||
ns_r_noerror = 0,
|
||||
ns_r_formerr = 1,
|
||||
ns_r_servfail = 2,
|
||||
ns_r_nxdomain = 3,
|
||||
ns_r_notimpl = 4,
|
||||
ns_r_refused = 5,
|
||||
ns_r_yxdomain = 6,
|
||||
ns_r_yxrrset = 7,
|
||||
ns_r_nxrrset = 8,
|
||||
ns_r_notauth = 9,
|
||||
ns_r_notzone = 10,
|
||||
ns_r_max = 11,
|
||||
ns_r_badvers = 16,
|
||||
ns_r_badsig = 16,
|
||||
ns_r_badkey = 17,
|
||||
ns_r_badtime = 18
|
||||
} ns_rcode;
|
||||
|
||||
typedef enum __ns_update_operation {
|
||||
ns_uop_delete = 0,
|
||||
ns_uop_add = 1,
|
||||
ns_uop_max = 2
|
||||
} ns_update_operation;
|
||||
|
||||
struct ns_tsig_key {
|
||||
char name[NS_MAXDNAME], alg[NS_MAXDNAME];
|
||||
unsigned char *data;
|
||||
int len;
|
||||
};
|
||||
typedef struct ns_tsig_key ns_tsig_key;
|
||||
|
||||
struct ns_tcp_tsig_state {
|
||||
int counter;
|
||||
struct dst_key *key;
|
||||
void *ctx;
|
||||
unsigned char sig[NS_PACKETSZ];
|
||||
int siglen;
|
||||
};
|
||||
typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
|
||||
|
||||
#define NS_TSIG_FUDGE 300
|
||||
#define NS_TSIG_TCP_COUNT 100
|
||||
#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
|
||||
|
||||
#define NS_TSIG_ERROR_NO_TSIG -10
|
||||
#define NS_TSIG_ERROR_NO_SPACE -11
|
||||
#define NS_TSIG_ERROR_FORMERR -12
|
||||
|
||||
typedef enum __ns_type {
|
||||
ns_t_invalid = 0,
|
||||
ns_t_a = 1,
|
||||
ns_t_ns = 2,
|
||||
ns_t_md = 3,
|
||||
ns_t_mf = 4,
|
||||
ns_t_cname = 5,
|
||||
ns_t_soa = 6,
|
||||
ns_t_mb = 7,
|
||||
ns_t_mg = 8,
|
||||
ns_t_mr = 9,
|
||||
ns_t_null = 10,
|
||||
ns_t_wks = 11,
|
||||
ns_t_ptr = 12,
|
||||
ns_t_hinfo = 13,
|
||||
ns_t_minfo = 14,
|
||||
ns_t_mx = 15,
|
||||
ns_t_txt = 16,
|
||||
ns_t_rp = 17,
|
||||
ns_t_afsdb = 18,
|
||||
ns_t_x25 = 19,
|
||||
ns_t_isdn = 20,
|
||||
ns_t_rt = 21,
|
||||
ns_t_nsap = 22,
|
||||
ns_t_nsap_ptr = 23,
|
||||
ns_t_sig = 24,
|
||||
ns_t_key = 25,
|
||||
ns_t_px = 26,
|
||||
ns_t_gpos = 27,
|
||||
ns_t_aaaa = 28,
|
||||
ns_t_loc = 29,
|
||||
ns_t_nxt = 30,
|
||||
ns_t_eid = 31,
|
||||
ns_t_nimloc = 32,
|
||||
ns_t_srv = 33,
|
||||
ns_t_atma = 34,
|
||||
ns_t_naptr = 35,
|
||||
ns_t_kx = 36,
|
||||
ns_t_cert = 37,
|
||||
ns_t_a6 = 38,
|
||||
ns_t_dname = 39,
|
||||
ns_t_sink = 40,
|
||||
ns_t_opt = 41,
|
||||
ns_t_apl = 42,
|
||||
ns_t_ds = 43,
|
||||
ns_t_sshfp = 44,
|
||||
ns_t_ipseckey = 45,
|
||||
ns_t_rrsig = 46,
|
||||
ns_t_nsec = 47,
|
||||
ns_t_dnskey = 48,
|
||||
ns_t_dhcid = 49,
|
||||
ns_t_nsec3 = 50,
|
||||
ns_t_nsec3param = 51,
|
||||
ns_t_tlsa = 52,
|
||||
ns_t_smimea = 53,
|
||||
ns_t_hip = 55,
|
||||
ns_t_ninfo = 56,
|
||||
ns_t_rkey = 57,
|
||||
ns_t_talink = 58,
|
||||
ns_t_cds = 59,
|
||||
ns_t_cdnskey = 60,
|
||||
ns_t_openpgpkey = 61,
|
||||
ns_t_csync = 62,
|
||||
ns_t_spf = 99,
|
||||
ns_t_uinfo = 100,
|
||||
ns_t_uid = 101,
|
||||
ns_t_gid = 102,
|
||||
ns_t_unspec = 103,
|
||||
ns_t_nid = 104,
|
||||
ns_t_l32 = 105,
|
||||
ns_t_l64 = 106,
|
||||
ns_t_lp = 107,
|
||||
ns_t_eui48 = 108,
|
||||
ns_t_eui64 = 109,
|
||||
ns_t_tkey = 249,
|
||||
ns_t_tsig = 250,
|
||||
ns_t_ixfr = 251,
|
||||
ns_t_axfr = 252,
|
||||
ns_t_mailb = 253,
|
||||
ns_t_maila = 254,
|
||||
ns_t_any = 255,
|
||||
ns_t_zxfr = 256,
|
||||
ns_t_uri = 256,
|
||||
ns_t_caa = 257,
|
||||
ns_t_avc = 258,
|
||||
ns_t_ta = 32768,
|
||||
ns_t_dlv = 32769,
|
||||
ns_t_max = 65536
|
||||
} ns_type;
|
||||
|
||||
#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
|
||||
(t) == ns_t_mailb || (t) == ns_t_maila)
|
||||
#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
|
||||
#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
|
||||
#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
|
||||
#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
|
||||
(t) == ns_t_zxfr)
|
||||
|
||||
typedef enum __ns_class {
|
||||
ns_c_invalid = 0,
|
||||
ns_c_in = 1,
|
||||
ns_c_2 = 2,
|
||||
ns_c_chaos = 3,
|
||||
ns_c_hs = 4,
|
||||
ns_c_none = 254,
|
||||
ns_c_any = 255,
|
||||
ns_c_max = 65536
|
||||
} ns_class;
|
||||
|
||||
typedef enum __ns_key_types {
|
||||
ns_kt_rsa = 1,
|
||||
ns_kt_dh = 2,
|
||||
ns_kt_dsa = 3,
|
||||
ns_kt_private = 254
|
||||
} ns_key_types;
|
||||
|
||||
typedef enum __ns_cert_types {
|
||||
cert_t_pkix = 1,
|
||||
cert_t_spki = 2,
|
||||
cert_t_pgp = 3,
|
||||
cert_t_url = 253,
|
||||
cert_t_oid = 254
|
||||
} ns_cert_types;
|
||||
|
||||
#define NS_KEY_TYPEMASK 0xC000
|
||||
#define NS_KEY_TYPE_AUTH_CONF 0x0000
|
||||
#define NS_KEY_TYPE_CONF_ONLY 0x8000
|
||||
#define NS_KEY_TYPE_AUTH_ONLY 0x4000
|
||||
#define NS_KEY_TYPE_NO_KEY 0xC000
|
||||
#define NS_KEY_NO_AUTH 0x8000
|
||||
#define NS_KEY_NO_CONF 0x4000
|
||||
#define NS_KEY_RESERVED2 0x2000
|
||||
#define NS_KEY_EXTENDED_FLAGS 0x1000
|
||||
#define NS_KEY_RESERVED4 0x0800
|
||||
#define NS_KEY_RESERVED5 0x0400
|
||||
#define NS_KEY_NAME_TYPE 0x0300
|
||||
#define NS_KEY_NAME_USER 0x0000
|
||||
#define NS_KEY_NAME_ENTITY 0x0200
|
||||
#define NS_KEY_NAME_ZONE 0x0100
|
||||
#define NS_KEY_NAME_RESERVED 0x0300
|
||||
#define NS_KEY_RESERVED8 0x0080
|
||||
#define NS_KEY_RESERVED9 0x0040
|
||||
#define NS_KEY_RESERVED10 0x0020
|
||||
#define NS_KEY_RESERVED11 0x0010
|
||||
#define NS_KEY_SIGNATORYMASK 0x000F
|
||||
#define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
|
||||
NS_KEY_RESERVED4 | \
|
||||
NS_KEY_RESERVED5 | \
|
||||
NS_KEY_RESERVED8 | \
|
||||
NS_KEY_RESERVED9 | \
|
||||
NS_KEY_RESERVED10 | \
|
||||
NS_KEY_RESERVED11 )
|
||||
#define NS_KEY_RESERVED_BITMASK2 0xFFFF
|
||||
#define NS_ALG_MD5RSA 1
|
||||
#define NS_ALG_DH 2
|
||||
#define NS_ALG_DSA 3
|
||||
#define NS_ALG_DSS NS_ALG_DSA
|
||||
#define NS_ALG_EXPIRE_ONLY 253
|
||||
#define NS_ALG_PRIVATE_OID 254
|
||||
|
||||
#define NS_KEY_PROT_TLS 1
|
||||
#define NS_KEY_PROT_EMAIL 2
|
||||
#define NS_KEY_PROT_DNSSEC 3
|
||||
#define NS_KEY_PROT_IPSEC 4
|
||||
#define NS_KEY_PROT_ANY 255
|
||||
|
||||
#define NS_MD5RSA_MIN_BITS 512
|
||||
#define NS_MD5RSA_MAX_BITS 4096
|
||||
#define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
|
||||
#define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
|
||||
#define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8)
|
||||
#define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8)
|
||||
|
||||
#define NS_DSA_SIG_SIZE 41
|
||||
#define NS_DSA_MIN_SIZE 213
|
||||
#define NS_DSA_MAX_BYTES 405
|
||||
|
||||
#define NS_SIG_TYPE 0
|
||||
#define NS_SIG_ALG 2
|
||||
#define NS_SIG_LABELS 3
|
||||
#define NS_SIG_OTTL 4
|
||||
#define NS_SIG_EXPIR 8
|
||||
#define NS_SIG_SIGNED 12
|
||||
#define NS_SIG_FOOT 16
|
||||
#define NS_SIG_SIGNER 18
|
||||
#define NS_NXT_BITS 8
|
||||
#define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS)))
|
||||
#define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
|
||||
#define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS)))
|
||||
#define NS_NXT_MAX 127
|
||||
|
||||
#define NS_OPT_DNSSEC_OK 0x8000U
|
||||
#define NS_OPT_NSID 3
|
||||
|
||||
#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2))
|
||||
#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4))
|
||||
#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2)
|
||||
#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4)
|
||||
|
||||
unsigned ns_get16(const unsigned char *);
|
||||
unsigned long ns_get32(const unsigned char *);
|
||||
void ns_put16(unsigned, unsigned char *);
|
||||
void ns_put32(unsigned long, unsigned char *);
|
||||
|
||||
int ns_initparse(const unsigned char *, int, ns_msg *);
|
||||
int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
|
||||
int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
|
||||
int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t);
|
||||
|
||||
|
||||
#define __BIND 19950621
|
||||
|
||||
typedef struct {
|
||||
unsigned id :16;
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
unsigned qr: 1;
|
||||
unsigned opcode: 4;
|
||||
unsigned aa: 1;
|
||||
unsigned tc: 1;
|
||||
unsigned rd: 1;
|
||||
unsigned ra: 1;
|
||||
unsigned unused :1;
|
||||
unsigned ad: 1;
|
||||
unsigned cd: 1;
|
||||
unsigned rcode :4;
|
||||
#else
|
||||
unsigned rd :1;
|
||||
unsigned tc :1;
|
||||
unsigned aa :1;
|
||||
unsigned opcode :4;
|
||||
unsigned qr :1;
|
||||
unsigned rcode :4;
|
||||
unsigned cd: 1;
|
||||
unsigned ad: 1;
|
||||
unsigned unused :1;
|
||||
unsigned ra :1;
|
||||
#endif
|
||||
unsigned qdcount :16;
|
||||
unsigned ancount :16;
|
||||
unsigned nscount :16;
|
||||
unsigned arcount :16;
|
||||
} HEADER;
|
||||
|
||||
#define PACKETSZ NS_PACKETSZ
|
||||
#define MAXDNAME NS_MAXDNAME
|
||||
#define MAXCDNAME NS_MAXCDNAME
|
||||
#define MAXLABEL NS_MAXLABEL
|
||||
#define HFIXEDSZ NS_HFIXEDSZ
|
||||
#define QFIXEDSZ NS_QFIXEDSZ
|
||||
#define RRFIXEDSZ NS_RRFIXEDSZ
|
||||
#define INT32SZ NS_INT32SZ
|
||||
#define INT16SZ NS_INT16SZ
|
||||
#define INT8SZ NS_INT8SZ
|
||||
#define INADDRSZ NS_INADDRSZ
|
||||
#define IN6ADDRSZ NS_IN6ADDRSZ
|
||||
#define INDIR_MASK NS_CMPRSFLGS
|
||||
#define NAMESERVER_PORT NS_DEFAULTPORT
|
||||
|
||||
#define S_ZONE ns_s_zn
|
||||
#define S_PREREQ ns_s_pr
|
||||
#define S_UPDATE ns_s_ud
|
||||
#define S_ADDT ns_s_ar
|
||||
|
||||
#define QUERY ns_o_query
|
||||
#define IQUERY ns_o_iquery
|
||||
#define STATUS ns_o_status
|
||||
#define NS_NOTIFY_OP ns_o_notify
|
||||
#define NS_UPDATE_OP ns_o_update
|
||||
|
||||
#define NOERROR ns_r_noerror
|
||||
#define FORMERR ns_r_formerr
|
||||
#define SERVFAIL ns_r_servfail
|
||||
#define NXDOMAIN ns_r_nxdomain
|
||||
#define NOTIMP ns_r_notimpl
|
||||
#define REFUSED ns_r_refused
|
||||
#define YXDOMAIN ns_r_yxdomain
|
||||
#define YXRRSET ns_r_yxrrset
|
||||
#define NXRRSET ns_r_nxrrset
|
||||
#define NOTAUTH ns_r_notauth
|
||||
#define NOTZONE ns_r_notzone
|
||||
|
||||
#define DELETE ns_uop_delete
|
||||
#define ADD ns_uop_add
|
||||
|
||||
#define T_A ns_t_a
|
||||
#define T_NS ns_t_ns
|
||||
#define T_MD ns_t_md
|
||||
#define T_MF ns_t_mf
|
||||
#define T_CNAME ns_t_cname
|
||||
#define T_SOA ns_t_soa
|
||||
#define T_MB ns_t_mb
|
||||
#define T_MG ns_t_mg
|
||||
#define T_MR ns_t_mr
|
||||
#define T_NULL ns_t_null
|
||||
#define T_WKS ns_t_wks
|
||||
#define T_PTR ns_t_ptr
|
||||
#define T_HINFO ns_t_hinfo
|
||||
#define T_MINFO ns_t_minfo
|
||||
#define T_MX ns_t_mx
|
||||
#define T_TXT ns_t_txt
|
||||
#define T_RP ns_t_rp
|
||||
#define T_AFSDB ns_t_afsdb
|
||||
#define T_X25 ns_t_x25
|
||||
#define T_ISDN ns_t_isdn
|
||||
#define T_RT ns_t_rt
|
||||
#define T_NSAP ns_t_nsap
|
||||
#define T_NSAP_PTR ns_t_nsap_ptr
|
||||
#define T_SIG ns_t_sig
|
||||
#define T_KEY ns_t_key
|
||||
#define T_PX ns_t_px
|
||||
#define T_GPOS ns_t_gpos
|
||||
#define T_AAAA ns_t_aaaa
|
||||
#define T_LOC ns_t_loc
|
||||
#define T_NXT ns_t_nxt
|
||||
#define T_EID ns_t_eid
|
||||
#define T_NIMLOC ns_t_nimloc
|
||||
#define T_SRV ns_t_srv
|
||||
#define T_ATMA ns_t_atma
|
||||
#define T_NAPTR ns_t_naptr
|
||||
#define T_A6 ns_t_a6
|
||||
#define T_DNAME ns_t_dname
|
||||
#define T_DS ns_t_ds
|
||||
#define T_SSHFP ns_t_sshfp
|
||||
#define T_IPSECKEY ns_t_ipseckey
|
||||
#define T_RRSIG ns_t_rrsig
|
||||
#define T_NSEC ns_t_nsec
|
||||
#define T_DNSKEY ns_t_dnskey
|
||||
#define T_DHCID ns_t_dhcid
|
||||
#define T_NSEC3 ns_t_nsec3
|
||||
#define T_NSEC3PARAM ns_t_nsec3param
|
||||
#define T_TLSA ns_t_tlsa
|
||||
#define T_SMIMEA ns_t_smimea
|
||||
#define T_HIP ns_t_hip
|
||||
#define T_NINFO ns_t_ninfo
|
||||
#define T_RKEY ns_t_rkey
|
||||
#define T_TALINK ns_t_talink
|
||||
#define T_CDS ns_t_cds
|
||||
#define T_CDNSKEY ns_t_cdnskey
|
||||
#define T_OPENPGPKEY ns_t_openpgpkey
|
||||
#define T_CSYNC ns_t_csync
|
||||
#define T_SPF ns_t_spf
|
||||
#define T_UINFO ns_t_uinfo
|
||||
#define T_UID ns_t_uid
|
||||
#define T_GID ns_t_gid
|
||||
#define T_UNSPEC ns_t_unspec
|
||||
#define T_NID ns_t_nid
|
||||
#define T_L32 ns_t_l32
|
||||
#define T_L64 ns_t_l64
|
||||
#define T_LP ns_t_lp
|
||||
#define T_EUI48 ns_t_eui48
|
||||
#define T_EUI64 ns_t_eui64
|
||||
#define T_TKEY ns_t_tkey
|
||||
#define T_TSIG ns_t_tsig
|
||||
#define T_IXFR ns_t_ixfr
|
||||
#define T_AXFR ns_t_axfr
|
||||
#define T_MAILB ns_t_mailb
|
||||
#define T_MAILA ns_t_maila
|
||||
#define T_ANY ns_t_any
|
||||
#define T_URI ns_t_uri
|
||||
#define T_CAA ns_t_caa
|
||||
#define T_AVC ns_t_avc
|
||||
#define T_TA ns_t_ta
|
||||
#define T_DLV ns_t_dlv
|
||||
|
||||
#define C_IN ns_c_in
|
||||
#define C_CHAOS ns_c_chaos
|
||||
#define C_HS ns_c_hs
|
||||
#define C_NONE ns_c_none
|
||||
#define C_ANY ns_c_any
|
||||
|
||||
#define GETSHORT NS_GET16
|
||||
#define GETLONG NS_GET32
|
||||
#define PUTSHORT NS_PUT16
|
||||
#define PUTLONG NS_PUT32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#include <arpa/nameser.h>
|
||||
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
#ifndef _ARPA_TELNET_H
|
||||
#define _ARPA_TELNET_H
|
||||
|
||||
#define IAC 255
|
||||
#define DONT 254
|
||||
#define DO 253
|
||||
#define WONT 252
|
||||
#define WILL 251
|
||||
#define SB 250
|
||||
#define GA 249
|
||||
#define EL 248
|
||||
#define EC 247
|
||||
#define AYT 246
|
||||
#define AO 245
|
||||
#define IP 244
|
||||
#define BREAK 243
|
||||
#define DM 242
|
||||
#define NOP 241
|
||||
#define SE 240
|
||||
#define EOR 239
|
||||
#define ABORT 238
|
||||
#define SUSP 237
|
||||
#define xEOF 236
|
||||
|
||||
#define SYNCH 242
|
||||
|
||||
#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
|
||||
|
||||
#define TELCMD_FIRST xEOF
|
||||
#define TELCMD_LAST IAC
|
||||
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
|
||||
(unsigned int)(x) >= TELCMD_FIRST)
|
||||
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
|
||||
|
||||
#define TELOPT_BINARY 0
|
||||
#define TELOPT_ECHO 1
|
||||
#define TELOPT_RCP 2
|
||||
#define TELOPT_SGA 3
|
||||
#define TELOPT_NAMS 4
|
||||
#define TELOPT_STATUS 5
|
||||
#define TELOPT_TM 6
|
||||
#define TELOPT_RCTE 7
|
||||
#define TELOPT_NAOL 8
|
||||
#define TELOPT_NAOP 9
|
||||
#define TELOPT_NAOCRD 10
|
||||
#define TELOPT_NAOHTS 11
|
||||
#define TELOPT_NAOHTD 12
|
||||
#define TELOPT_NAOFFD 13
|
||||
#define TELOPT_NAOVTS 14
|
||||
#define TELOPT_NAOVTD 15
|
||||
#define TELOPT_NAOLFD 16
|
||||
#define TELOPT_XASCII 17
|
||||
#define TELOPT_LOGOUT 18
|
||||
#define TELOPT_BM 19
|
||||
#define TELOPT_DET 20
|
||||
#define TELOPT_SUPDUP 21
|
||||
#define TELOPT_SUPDUPOUTPUT 22
|
||||
#define TELOPT_SNDLOC 23
|
||||
#define TELOPT_TTYPE 24
|
||||
#define TELOPT_EOR 25
|
||||
#define TELOPT_TUID 26
|
||||
#define TELOPT_OUTMRK 27
|
||||
#define TELOPT_TTYLOC 28
|
||||
#define TELOPT_3270REGIME 29
|
||||
#define TELOPT_X3PAD 30
|
||||
#define TELOPT_NAWS 31
|
||||
#define TELOPT_TSPEED 32
|
||||
#define TELOPT_LFLOW 33
|
||||
#define TELOPT_LINEMODE 34
|
||||
#define TELOPT_XDISPLOC 35
|
||||
#define TELOPT_OLD_ENVIRON 36
|
||||
#define TELOPT_AUTHENTICATION 37/* Authenticate */
|
||||
#define TELOPT_ENCRYPT 38
|
||||
#define TELOPT_NEW_ENVIRON 39
|
||||
#define TELOPT_EXOPL 255
|
||||
|
||||
|
||||
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
|
||||
#ifdef TELOPTS
|
||||
char *telopts[NTELOPTS+1] = {
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
|
||||
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
|
||||
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
|
||||
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
|
||||
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
|
||||
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
|
||||
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
|
||||
"ENCRYPT", "NEW-ENVIRON",
|
||||
0,
|
||||
};
|
||||
#define TELOPT_FIRST TELOPT_BINARY
|
||||
#define TELOPT_LAST TELOPT_NEW_ENVIRON
|
||||
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
|
||||
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
|
||||
#endif
|
||||
|
||||
#define TELQUAL_IS 0
|
||||
#define TELQUAL_SEND 1
|
||||
#define TELQUAL_INFO 2
|
||||
#define TELQUAL_REPLY 2
|
||||
#define TELQUAL_NAME 3
|
||||
|
||||
#define LFLOW_OFF 0
|
||||
#define LFLOW_ON 1
|
||||
#define LFLOW_RESTART_ANY 2
|
||||
#define LFLOW_RESTART_XON 3
|
||||
|
||||
|
||||
#define LM_MODE 1
|
||||
#define LM_FORWARDMASK 2
|
||||
#define LM_SLC 3
|
||||
|
||||
#define MODE_EDIT 0x01
|
||||
#define MODE_TRAPSIG 0x02
|
||||
#define MODE_ACK 0x04
|
||||
#define MODE_SOFT_TAB 0x08
|
||||
#define MODE_LIT_ECHO 0x10
|
||||
|
||||
#define MODE_MASK 0x1f
|
||||
|
||||
#define MODE_FLOW 0x0100
|
||||
#define MODE_ECHO 0x0200
|
||||
#define MODE_INBIN 0x0400
|
||||
#define MODE_OUTBIN 0x0800
|
||||
#define MODE_FORCE 0x1000
|
||||
|
||||
#define SLC_SYNCH 1
|
||||
#define SLC_BRK 2
|
||||
#define SLC_IP 3
|
||||
#define SLC_AO 4
|
||||
#define SLC_AYT 5
|
||||
#define SLC_EOR 6
|
||||
#define SLC_ABORT 7
|
||||
#define SLC_EOF 8
|
||||
#define SLC_SUSP 9
|
||||
#define SLC_EC 10
|
||||
#define SLC_EL 11
|
||||
#define SLC_EW 12
|
||||
#define SLC_RP 13
|
||||
#define SLC_LNEXT 14
|
||||
#define SLC_XON 15
|
||||
#define SLC_XOFF 16
|
||||
#define SLC_FORW1 17
|
||||
#define SLC_FORW2 18
|
||||
|
||||
#define NSLC 18
|
||||
|
||||
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
|
||||
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
|
||||
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
|
||||
#ifdef SLC_NAMES
|
||||
char *slc_names[] = {
|
||||
SLC_NAMELIST
|
||||
};
|
||||
#else
|
||||
extern char *slc_names[];
|
||||
#define SLC_NAMES SLC_NAMELIST
|
||||
#endif
|
||||
|
||||
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
|
||||
#define SLC_NAME(x) slc_names[x]
|
||||
|
||||
#define SLC_NOSUPPORT 0
|
||||
#define SLC_CANTCHANGE 1
|
||||
#define SLC_VARIABLE 2
|
||||
#define SLC_DEFAULT 3
|
||||
#define SLC_LEVELBITS 0x03
|
||||
|
||||
#define SLC_FUNC 0
|
||||
#define SLC_FLAGS 1
|
||||
#define SLC_VALUE 2
|
||||
|
||||
#define SLC_ACK 0x80
|
||||
#define SLC_FLUSHIN 0x40
|
||||
#define SLC_FLUSHOUT 0x20
|
||||
|
||||
#define OLD_ENV_VAR 1
|
||||
#define OLD_ENV_VALUE 0
|
||||
#define NEW_ENV_VAR 0
|
||||
#define NEW_ENV_VALUE 1
|
||||
#define ENV_ESC 2
|
||||
#define ENV_USERVAR 3
|
||||
|
||||
#define AUTH_WHO_CLIENT 0
|
||||
#define AUTH_WHO_SERVER 1
|
||||
#define AUTH_WHO_MASK 1
|
||||
|
||||
#define AUTH_HOW_ONE_WAY 0
|
||||
#define AUTH_HOW_MUTUAL 2
|
||||
#define AUTH_HOW_MASK 2
|
||||
|
||||
#define AUTHTYPE_NULL 0
|
||||
#define AUTHTYPE_KERBEROS_V4 1
|
||||
#define AUTHTYPE_KERBEROS_V5 2
|
||||
#define AUTHTYPE_SPX 3
|
||||
#define AUTHTYPE_MINK 4
|
||||
#define AUTHTYPE_CNT 5
|
||||
|
||||
#define AUTHTYPE_TEST 99
|
||||
|
||||
#ifdef AUTH_NAMES
|
||||
char *authtype_names[] = {
|
||||
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
|
||||
};
|
||||
#else
|
||||
extern char *authtype_names[];
|
||||
#endif
|
||||
|
||||
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
|
||||
#define AUTHTYPE_NAME(x) authtype_names[x]
|
||||
|
||||
#define ENCRYPT_IS 0
|
||||
#define ENCRYPT_SUPPORT 1
|
||||
#define ENCRYPT_REPLY 2
|
||||
#define ENCRYPT_START 3
|
||||
#define ENCRYPT_END 4
|
||||
#define ENCRYPT_REQSTART 5
|
||||
#define ENCRYPT_REQEND 6
|
||||
#define ENCRYPT_ENC_KEYID 7
|
||||
#define ENCRYPT_DEC_KEYID 8
|
||||
#define ENCRYPT_CNT 9
|
||||
|
||||
#define ENCTYPE_ANY 0
|
||||
#define ENCTYPE_DES_CFB64 1
|
||||
#define ENCTYPE_DES_OFB64 2
|
||||
#define ENCTYPE_CNT 3
|
||||
|
||||
#ifdef ENCRYPT_NAMES
|
||||
char *encrypt_names[] = {
|
||||
"IS", "SUPPORT", "REPLY", "START", "END",
|
||||
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
|
||||
0,
|
||||
};
|
||||
char *enctype_names[] = {
|
||||
"ANY", "DES_CFB64", "DES_OFB64", 0,
|
||||
};
|
||||
#else
|
||||
extern char *encrypt_names[];
|
||||
extern char *enctype_names[];
|
||||
#endif
|
||||
|
||||
|
||||
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
|
||||
#define ENCRYPT_NAME(x) encrypt_names[x]
|
||||
|
||||
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
|
||||
#define ENCTYPE_NAME(x) enctype_names[x]
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef _ARPA_TFTP_H
|
||||
#define _ARPA_TFTP_H
|
||||
#define SEGSIZE 512
|
||||
#define RRQ 01
|
||||
#define WRQ 02
|
||||
#define DATA 03
|
||||
#define ACK 04
|
||||
#define ERROR 05
|
||||
struct tftphdr {
|
||||
short th_opcode;
|
||||
union {
|
||||
unsigned short tu_block;
|
||||
short tu_code;
|
||||
char tu_stuff[1];
|
||||
} th_u;
|
||||
char th_data[1];
|
||||
};
|
||||
#define th_block th_u.tu_block
|
||||
#define th_code th_u.tu_code
|
||||
#define th_stuff th_u.tu_stuff
|
||||
#define th_msg th_data
|
||||
#define EUNDEF 0
|
||||
#define ENOTFOUND 1
|
||||
#define EACCESS 2
|
||||
#define ENOSPACE 3
|
||||
#define EBADOP 4
|
||||
#define EBADID 5
|
||||
#define EEXISTS 6
|
||||
#define ENOUSER 7
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <features.h>
|
||||
|
||||
#undef assert
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define assert(x) (void)0
|
||||
#else
|
||||
#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
|
||||
#define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,460 @@
|
|||
#define _Addr long
|
||||
#define _Int64 long long
|
||||
#define _Reg long long
|
||||
|
||||
#define __BYTE_ORDER __BYTE_ORDER__
|
||||
|
||||
#define __LONG_MAX __LONG_MAX__
|
||||
|
||||
/*
|
||||
* Rather than define everything ourselves here in the musl layer, for
|
||||
* WASI, reference the definitions in the lower layers.
|
||||
*/
|
||||
|
||||
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
|
||||
#define __need_wchar_t
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_wchar_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
|
||||
#define __need_wint_t
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_wint_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
|
||||
typedef float float_t;
|
||||
#define __DEFINED_float_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
|
||||
typedef double double_t;
|
||||
#define __DEFINED_double_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
|
||||
#define __need_max_align_t
|
||||
#include <stddef.h>
|
||||
#define __DEFINED_max_align_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
|
||||
#include <__typedef_time_t.h>
|
||||
#define __DEFINED_time_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
|
||||
#include <__typedef_suseconds_t.h>
|
||||
#define __DEFINED_suseconds_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
|
||||
#include <__typedef_clockid_t.h>
|
||||
#define __DEFINED_clockid_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
|
||||
#include <__typedef_sigset_t.h>
|
||||
#define __DEFINED_sigset_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
|
||||
#include <__typedef_clock_t.h>
|
||||
#define __DEFINED_clock_t
|
||||
#endif
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __USE_TIME_BITS64 1
|
||||
|
||||
#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
|
||||
typedef unsigned _Addr size_t;
|
||||
#define __DEFINED_size_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
|
||||
typedef unsigned _Addr uintptr_t;
|
||||
#define __DEFINED_uintptr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
|
||||
typedef _Addr ptrdiff_t;
|
||||
#define __DEFINED_ptrdiff_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
|
||||
typedef _Addr ssize_t;
|
||||
#define __DEFINED_ssize_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
|
||||
typedef _Addr intptr_t;
|
||||
#define __DEFINED_intptr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
|
||||
typedef _Addr regoff_t;
|
||||
#define __DEFINED_regoff_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
|
||||
typedef _Reg register_t;
|
||||
#define __DEFINED_register_t
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
|
||||
typedef _Int64 time_t;
|
||||
#define __DEFINED_time_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
|
||||
typedef _Int64 suseconds_t;
|
||||
#define __DEFINED_suseconds_t
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
|
||||
#include <__typedef_time_t.h>
|
||||
#define __DEFINED_time_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
|
||||
#include <__typedef_suseconds_t.h>
|
||||
#define __DEFINED_suseconds_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
|
||||
typedef signed char int8_t;
|
||||
#define __DEFINED_int8_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
|
||||
typedef signed short int16_t;
|
||||
#define __DEFINED_int16_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
|
||||
typedef signed int int32_t;
|
||||
#define __DEFINED_int32_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
|
||||
typedef signed _Int64 int64_t;
|
||||
#define __DEFINED_int64_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
|
||||
typedef signed _Int64 intmax_t;
|
||||
#define __DEFINED_intmax_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
|
||||
typedef unsigned char uint8_t;
|
||||
#define __DEFINED_uint8_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
|
||||
typedef unsigned short uint16_t;
|
||||
#define __DEFINED_uint16_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
|
||||
typedef unsigned int uint32_t;
|
||||
#define __DEFINED_uint32_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
|
||||
typedef unsigned _Int64 uint64_t;
|
||||
#define __DEFINED_uint64_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
|
||||
typedef unsigned _Int64 u_int64_t;
|
||||
#define __DEFINED_u_int64_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
|
||||
typedef unsigned _Int64 uintmax_t;
|
||||
#define __DEFINED_uintmax_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
|
||||
typedef unsigned mode_t;
|
||||
#define __DEFINED_mode_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
|
||||
typedef unsigned _Reg nlink_t;
|
||||
#define __DEFINED_nlink_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
|
||||
typedef _Int64 off_t;
|
||||
#define __DEFINED_off_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
|
||||
typedef unsigned _Int64 ino_t;
|
||||
#define __DEFINED_ino_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
|
||||
typedef unsigned _Int64 dev_t;
|
||||
#define __DEFINED_dev_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
|
||||
typedef long blksize_t;
|
||||
#define __DEFINED_blksize_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
|
||||
typedef _Int64 blkcnt_t;
|
||||
#define __DEFINED_blkcnt_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
|
||||
typedef unsigned _Int64 fsblkcnt_t;
|
||||
#define __DEFINED_fsblkcnt_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
|
||||
typedef unsigned _Int64 fsfilcnt_t;
|
||||
#define __DEFINED_fsfilcnt_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
|
||||
typedef unsigned wint_t;
|
||||
#define __DEFINED_wint_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
|
||||
typedef unsigned long wctype_t;
|
||||
#define __DEFINED_wctype_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
|
||||
typedef void * timer_t;
|
||||
#define __DEFINED_timer_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
|
||||
typedef int clockid_t;
|
||||
#define __DEFINED_clockid_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
|
||||
typedef long clock_t;
|
||||
#define __DEFINED_clock_t
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
|
||||
struct timeval { time_t tv_sec; suseconds_t tv_usec; };
|
||||
#define __DEFINED_struct_timeval
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
|
||||
struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
|
||||
#define __DEFINED_struct_timespec
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <__struct_timeval.h>
|
||||
#include <__struct_timespec.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
|
||||
typedef int pid_t;
|
||||
#define __DEFINED_pid_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
|
||||
typedef unsigned id_t;
|
||||
#define __DEFINED_id_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
|
||||
typedef unsigned uid_t;
|
||||
#define __DEFINED_uid_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
|
||||
typedef unsigned gid_t;
|
||||
#define __DEFINED_gid_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
|
||||
typedef int key_t;
|
||||
#define __DEFINED_key_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
|
||||
typedef unsigned useconds_t;
|
||||
#define __DEFINED_useconds_t
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
|
||||
typedef unsigned long pthread_t;
|
||||
#define __DEFINED_pthread_t
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
|
||||
typedef struct __pthread * pthread_t;
|
||||
#define __DEFINED_pthread_t
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
|
||||
typedef int pthread_once_t;
|
||||
#define __DEFINED_pthread_once_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
|
||||
typedef unsigned pthread_key_t;
|
||||
#define __DEFINED_pthread_key_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
|
||||
typedef int pthread_spinlock_t;
|
||||
#define __DEFINED_pthread_spinlock_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
|
||||
typedef struct { unsigned __attr; } pthread_mutexattr_t;
|
||||
#define __DEFINED_pthread_mutexattr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
|
||||
typedef struct { unsigned __attr; } pthread_condattr_t;
|
||||
#define __DEFINED_pthread_condattr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
|
||||
typedef struct { unsigned __attr; } pthread_barrierattr_t;
|
||||
#define __DEFINED_pthread_barrierattr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
|
||||
typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
|
||||
#define __DEFINED_pthread_rwlockattr_t
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI doesn't need to define FILE as a complete type */
|
||||
#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
|
||||
struct _IO_FILE { char __x; };
|
||||
#define __DEFINED_struct__IO_FILE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
|
||||
typedef struct _IO_FILE FILE;
|
||||
#define __DEFINED_FILE
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
|
||||
typedef __builtin_va_list va_list;
|
||||
#define __DEFINED_va_list
|
||||
#endif
|
||||
|
||||
#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
|
||||
typedef __builtin_va_list __isoc_va_list;
|
||||
#define __DEFINED___isoc_va_list
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
|
||||
typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
|
||||
#define __DEFINED_mbstate_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
|
||||
typedef struct __locale_struct * locale_t;
|
||||
#define __DEFINED_locale_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
|
||||
typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
|
||||
#define __DEFINED_sigset_t
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
|
||||
struct iovec { void *iov_base; size_t iov_len; };
|
||||
#define __DEFINED_struct_iovec
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <__struct_iovec.h>
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
|
||||
struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
|
||||
#define __DEFINED_struct_winsize
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
|
||||
typedef unsigned socklen_t;
|
||||
#define __DEFINED_socklen_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
|
||||
typedef unsigned short sa_family_t;
|
||||
#define __DEFINED_sa_family_t
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
|
||||
typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
|
||||
#define __DEFINED_pthread_attr_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
|
||||
typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
|
||||
#define __DEFINED_pthread_mutex_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
|
||||
typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
|
||||
#define __DEFINED_mtx_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
|
||||
typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
|
||||
#define __DEFINED_pthread_cond_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
|
||||
typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
|
||||
#define __DEFINED_cnd_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
|
||||
typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
|
||||
#define __DEFINED_pthread_rwlock_t
|
||||
#endif
|
||||
|
||||
#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
|
||||
typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
|
||||
#define __DEFINED_pthread_barrier_t
|
||||
#endif
|
||||
|
||||
|
||||
#undef _Addr
|
||||
#undef _Int64
|
||||
#undef _Reg
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include <__struct_dirent.h>
|
||||
|
|
@ -0,0 +1 @@
|
|||
/* Use the WASI libc fcntl implementation bits. */
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#define FE_ALL_EXCEPT 0
|
||||
#define FE_TONEAREST 0
|
||||
|
||||
typedef unsigned long fexcept_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long __cw;
|
||||
} fenv_t;
|
||||
|
||||
#define FE_DFL_ENV ((const fenv_t *) -1)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
|
||||
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
|
||||
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
|
||||
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
|
||||
|
||||
#define LDBL_MANT_DIG 113
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
|
||||
#define LDBL_DIG 33
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
|
||||
#define DECIMAL_DIG 36
|
||||
|
|
@ -0,0 +1 @@
|
|||
/* Use the WASI libc ioctl implementation bits. */
|
||||
|
|
@ -0,0 +1 @@
|
|||
#define IPC_STAT 2
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include <__macro_PAGESIZE.h>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#define _POSIX_V6_ILP32_OFFBIG (1)
|
||||
#define _POSIX_V7_ILP32_OFFBIG (1)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#undef __WORDSIZE
|
||||
#define __WORDSIZE 64
|
||||
|
|
@ -0,0 +1 @@
|
|||
typedef unsigned long __jmp_buf[8];
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#ifdef _WASI_EMULATED_SIGNAL
|
||||
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGIOT SIGABRT
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPOLL 29
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define SIGUNUSED SIGSYS
|
||||
|
||||
#define _NSIG 65
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include <__struct_stat.h>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
|
||||
#define INTPTR_MIN INT32_MIN
|
||||
#define INTPTR_MAX INT32_MAX
|
||||
#define UINTPTR_MAX UINT32_MAX
|
||||
#define PTRDIFF_MIN INT32_MIN
|
||||
#define PTRDIFF_MAX INT32_MAX
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _BYTESWAP_H
|
||||
#define _BYTESWAP_H
|
||||
|
||||
#include <features.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static __inline uint16_t __bswap_16(uint16_t __x)
|
||||
{
|
||||
return __x<<8 | __x>>8;
|
||||
}
|
||||
|
||||
static __inline uint32_t __bswap_32(uint32_t __x)
|
||||
{
|
||||
return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
|
||||
}
|
||||
|
||||
static __inline uint64_t __bswap_64(uint64_t __x)
|
||||
{
|
||||
return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
|
||||
}
|
||||
|
||||
#define bswap_16(x) __bswap_16(x)
|
||||
#define bswap_32(x) __bswap_32(x)
|
||||
#define bswap_64(x) __bswap_64(x)
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ALGORITHM_ADJACENT_FIND_H
|
||||
#define _LIBCPP___ALGORITHM_ADJACENT_FIND_H
|
||||
|
||||
#include <__algorithm/comp.h>
|
||||
#include <__config>
|
||||
#include <__functional/identity.h>
|
||||
#include <__type_traits/invoke.h>
|
||||
#include <__utility/move.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Iter, class _Sent, class _Pred, class _Proj>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
|
||||
__adjacent_find(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
|
||||
if (__first == __last)
|
||||
return __first;
|
||||
|
||||
_Iter __i = __first;
|
||||
while (++__i != __last) {
|
||||
if (std::__invoke(__pred, std::__invoke(__proj, *__first), std::__invoke(__proj, *__i)))
|
||||
return __first;
|
||||
__first = __i;
|
||||
}
|
||||
return __i;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _BinaryPredicate>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
|
||||
__identity __proj;
|
||||
return std::__adjacent_find(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) {
|
||||
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to());
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_ADJACENT_FIND_H
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ALGORITHM_ALL_OF_H
|
||||
#define _LIBCPP___ALGORITHM_ALL_OF_H
|
||||
|
||||
#include <__config>
|
||||
#include <__functional/identity.h>
|
||||
#include <__type_traits/invoke.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Iter, class _Sent, class _Proj, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
|
||||
__all_of(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
|
||||
for (; __first != __last; ++__first) {
|
||||
if (!std::__invoke(__pred, std::__invoke(__proj, *__first)))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
__identity __proj;
|
||||
return std::__all_of(__first, __last, __pred, __proj);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_ALL_OF_H
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ALGORITHM_ANY_OF_H
|
||||
#define _LIBCPP___ALGORITHM_ANY_OF_H
|
||||
|
||||
#include <__config>
|
||||
#include <__functional/identity.h>
|
||||
#include <__type_traits/invoke.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Iter, class _Sent, class _Proj, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
|
||||
__any_of(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
|
||||
for (; __first != __last; ++__first) {
|
||||
if (std::__invoke(__pred, std::__invoke(__proj, *__first)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
__identity __proj;
|
||||
return std::__any_of(__first, __last, __pred, __proj);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_ANY_OF_H
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ALGORITHM_BINARY_SEARCH_H
|
||||
#define _LIBCPP___ALGORITHM_BINARY_SEARCH_H
|
||||
|
||||
#include <__algorithm/comp.h>
|
||||
#include <__algorithm/comp_ref_type.h>
|
||||
#include <__algorithm/lower_bound.h>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
|
||||
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
|
||||
return __first != __last && !__comp(__value, *__first);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
|
||||
return std::binary_search(__first, __last, __value, __less<>());
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_BINARY_SEARCH_H
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ALGORITHM_CLAMP_H
|
||||
#define _LIBCPP___ALGORITHM_CLAMP_H
|
||||
|
||||
#include <__algorithm/comp.h>
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
|
||||
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __hi,
|
||||
_Compare __comp) {
|
||||
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
|
||||
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
|
||||
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __hi) {
|
||||
return std::clamp(__v, __lo, __hi, __less<>());
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_CLAMP_H
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue