mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 13:30:45 +00:00
Merge pull request #19614 from jedisct1/wasi-libc-update
Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5
This commit is contained in:
commit
1a1389c513
5
lib/libc/include/wasm-wasi-musl/__errno.h
vendored
5
lib/libc/include/wasm-wasi-musl/__errno.h
vendored
@ -5,16 +5,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern thread_local int errno;
|
||||
#else
|
||||
extern _Thread_local int errno;
|
||||
#endif
|
||||
|
||||
#define errno errno
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -11,12 +11,16 @@
|
||||
#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))
|
||||
|
||||
int __wasilibc_iftodt(int x);
|
||||
int __wasilibc_dttoif(int x);
|
||||
|
||||
#include <__struct_dirent.h>
|
||||
#include <__typedef_DIR.h>
|
||||
|
||||
@ -24,6 +28,9 @@ int __wasilibc_dttoif(int x);
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int __wasilibc_iftodt(int x);
|
||||
int __wasilibc_dttoif(int x);
|
||||
|
||||
int closedir(DIR *);
|
||||
DIR *opendir(const char *);
|
||||
DIR *fdopendir(int);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#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>
|
||||
@ -11,9 +12,42 @@
|
||||
#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_RIFLAGS_RECV_DATA_TRUNCATED
|
||||
#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
|
||||
@ -25,9 +59,13 @@
|
||||
|
||||
#define SO_TYPE 3
|
||||
|
||||
#define AF_UNSPEC 0
|
||||
#define AF_INET 1
|
||||
#define AF_INET6 2
|
||||
#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
|
||||
|
||||
2
lib/libc/include/wasm-wasi-musl/__mode_t.h
vendored
2
lib/libc/include/wasm-wasi-musl/__mode_t.h
vendored
@ -9,7 +9,7 @@
|
||||
#define S_IFLNK (0xa000)
|
||||
#define S_IFREG (0x8000)
|
||||
#define S_IFSOCK (0xc000)
|
||||
#define S_IFIFO (0xc000)
|
||||
#define S_IFIFO (0x1000)
|
||||
|
||||
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
|
||||
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#ifndef __wasilibc___struct_sockaddr_h
|
||||
#define __wasilibc___struct_sockaddr_h
|
||||
|
||||
#define __need_STDDEF_H_misc
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr {
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
#ifndef __wasilibc___struct_sockaddr_in_h
|
||||
#define __wasilibc___struct_sockaddr_in_h
|
||||
|
||||
#define __need_STDDEF_H_misc
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
#include <__typedef_in_port_t.h>
|
||||
#include <__struct_in_addr.h>
|
||||
|
||||
struct sockaddr_in {
|
||||
_Alignas(max_align_t) sa_family_t sin_family;
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
};
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
#ifndef __wasilibc___struct_sockaddr_in6_h
|
||||
#define __wasilibc___struct_sockaddr_in6_h
|
||||
|
||||
#define __need_STDDEF_H_misc
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
#include <__typedef_in_port_t.h>
|
||||
#include <__struct_in6_addr.h>
|
||||
|
||||
struct sockaddr_in6 {
|
||||
_Alignas(max_align_t) sa_family_t sin6_family;
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family;
|
||||
in_port_t sin6_port;
|
||||
unsigned sin6_flowinfo;
|
||||
struct in6_addr sin6_addr;
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
#ifndef __wasilibc___struct_sockaddr_storage_h
|
||||
#define __wasilibc___struct_sockaddr_storage_h
|
||||
|
||||
#define __need_STDDEF_H_misc
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr_storage {
|
||||
_Alignas(max_align_t) sa_family_t ss_family;
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family;
|
||||
char __ss_data[32];
|
||||
};
|
||||
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
#ifndef __wasilibc___struct_sockaddr_un_h
|
||||
#define __wasilibc___struct_sockaddr_un_h
|
||||
|
||||
#define __need_STDDEF_H_misc
|
||||
#include <stddef.h>
|
||||
|
||||
#include <__typedef_sa_family_t.h>
|
||||
|
||||
struct sockaddr_un {
|
||||
_Alignas(max_align_t) sa_family_t sun_family;
|
||||
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
0
lib/libc/include/wasm-wasi-musl/__wasi_snapshot.h
vendored
Normal file
0
lib/libc/include/wasm-wasi-musl/__wasi_snapshot.h
vendored
Normal file
1
lib/libc/include/wasm-wasi-musl/bits/setjmp.h
vendored
Normal file
1
lib/libc/include/wasm-wasi-musl/bits/setjmp.h
vendored
Normal file
@ -0,0 +1 @@
|
||||
typedef unsigned long __jmp_buf[8];
|
||||
56
lib/libc/include/wasm-wasi-musl/dlfcn.h
vendored
Normal file
56
lib/libc/include/wasm-wasi-musl/dlfcn.h
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef _DLFCN_H
|
||||
#define _DLFCN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define RTLD_LAZY 1
|
||||
#define RTLD_NOW 2
|
||||
#define RTLD_NOLOAD 4
|
||||
#define RTLD_NODELETE 4096
|
||||
#define RTLD_GLOBAL 256
|
||||
#ifdef __wasilibc_unmodified_upstream
|
||||
#define RTLD_LOCAL 0
|
||||
#else
|
||||
/* For WASI, we give `RTLD_LOCAL` a non-zero value, avoiding ambiguity and
|
||||
* allowing us to defer the decision of whether `RTLD_LOCAL` or `RTLD_GLOBAL`
|
||||
* should be the default when neither is specified.
|
||||
*/
|
||||
#define RTLD_LOCAL 8
|
||||
#endif
|
||||
|
||||
#define RTLD_NEXT ((void *)-1)
|
||||
#define RTLD_DEFAULT ((void *)0)
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream
|
||||
#define RTLD_DI_LINKMAP 2
|
||||
#endif
|
||||
|
||||
int dlclose(void *);
|
||||
char *dlerror(void);
|
||||
void *dlopen(const char *, int);
|
||||
void *dlsym(void *__restrict, const char *__restrict);
|
||||
|
||||
#if defined(__wasilibc_unmodified_upstream) && (defined(_GNU_SOURCE) || defined(_BSD_SOURCE))
|
||||
typedef struct {
|
||||
const char *dli_fname;
|
||||
void *dli_fbase;
|
||||
const char *dli_sname;
|
||||
void *dli_saddr;
|
||||
} Dl_info;
|
||||
int dladdr(const void *, Dl_info *);
|
||||
int dlinfo(void *, int, void *);
|
||||
#endif
|
||||
|
||||
#if _REDIR_TIME64
|
||||
__REDIR(dlsym, __dlsym_time64);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
55
lib/libc/include/wasm-wasi-musl/setjmp.h
vendored
Normal file
55
lib/libc/include/wasm-wasi-musl/setjmp.h
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#ifndef __wasilibc_unmodified_upstream
|
||||
/* WASI has no setjmp */
|
||||
#if !defined(__wasm_exception_handling__)
|
||||
#error Setjmp/longjmp support requires Exception handling support, which is [not yet standardized](https://github.com/WebAssembly/proposals?tab=readme-ov-file#phase-3---implementation-phase-cg--wg). To enable it, compile with `-mllvm -wasm-enable-sjlj` and use an engine that implements the Exception handling proposal.
|
||||
#endif
|
||||
#endif
|
||||
#include <bits/setjmp.h>
|
||||
|
||||
typedef struct __jmp_buf_tag {
|
||||
__jmp_buf __jb;
|
||||
unsigned long __fl;
|
||||
unsigned long __ss[128/sizeof(long)];
|
||||
} jmp_buf[1];
|
||||
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
|
||||
#define __setjmp_attr __attribute__((__returns_twice__))
|
||||
#else
|
||||
#define __setjmp_attr
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
||||
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
||||
|| defined(_BSD_SOURCE)
|
||||
typedef jmp_buf sigjmp_buf;
|
||||
int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
|
||||
_Noreturn void siglongjmp (sigjmp_buf, int);
|
||||
#endif
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
||||
|| defined(_BSD_SOURCE)
|
||||
int _setjmp (jmp_buf) __setjmp_attr;
|
||||
_Noreturn void _longjmp (jmp_buf, int);
|
||||
#endif
|
||||
|
||||
int setjmp (jmp_buf) __setjmp_attr;
|
||||
_Noreturn void longjmp (jmp_buf, int);
|
||||
|
||||
#define setjmp setjmp
|
||||
|
||||
#undef __setjmp_attr
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
2
lib/libc/include/wasm-wasi-musl/stdlib.h
vendored
2
lib/libc/include/wasm-wasi-musl/stdlib.h
vendored
@ -128,9 +128,7 @@ int rand_r (unsigned *);
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
||||
|| defined(_BSD_SOURCE)
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no absolute paths */
|
||||
char *realpath (const char *__restrict, char *__restrict);
|
||||
#endif
|
||||
long int random (void);
|
||||
void srandom (unsigned int);
|
||||
char *initstate (unsigned int, char *, size_t);
|
||||
|
||||
18
lib/libc/include/wasm-wasi-musl/sys/socket.h
vendored
18
lib/libc/include/wasm-wasi-musl/sys/socket.h
vendored
@ -1,5 +1,8 @@
|
||||
#ifndef _SYS_SOCKET_H
|
||||
#define _SYS_SOCKET_H
|
||||
|
||||
#include <__wasi_snapshot.h>
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
#else
|
||||
#include <__header_sys_socket.h>
|
||||
@ -395,30 +398,33 @@ struct sockaddr_storage {
|
||||
#include <__struct_sockaddr_storage.h>
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no socket/socketpair */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int socket (int, int, int);
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no socketpair */
|
||||
int socketpair (int, int, int, int [2]);
|
||||
#endif
|
||||
|
||||
int shutdown (int, int);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no bind/connect/listen/accept */
|
||||
int bind (int, const struct sockaddr *, socklen_t);
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int connect (int, const struct sockaddr *, socklen_t);
|
||||
int bind (int, const struct sockaddr *, socklen_t);
|
||||
int listen (int, int);
|
||||
#endif
|
||||
|
||||
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no getsockname/getpeername */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
#endif
|
||||
|
||||
ssize_t send (int, const void *, size_t, int);
|
||||
ssize_t recv (int, void *, size_t, int);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no sendto/recvfrom */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
#endif
|
||||
@ -428,7 +434,7 @@ ssize_t recvmsg (int, struct msghdr *, int);
|
||||
#endif
|
||||
|
||||
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no setsockopt */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int setsockopt (int, int, int, const void *, socklen_t);
|
||||
#endif
|
||||
|
||||
|
||||
2
lib/libc/include/wasm-wasi-musl/sys/stat.h
vendored
2
lib/libc/include/wasm-wasi-musl/sys/stat.h
vendored
@ -78,11 +78,9 @@ int stat(const char *__restrict, struct stat *__restrict);
|
||||
int fstat(int, struct stat *);
|
||||
int lstat(const char *__restrict, struct stat *__restrict);
|
||||
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no chmod */
|
||||
int chmod(const char *, mode_t);
|
||||
int fchmod(int, mode_t);
|
||||
int fchmodat(int, const char *, mode_t, int);
|
||||
#endif
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no umask */
|
||||
mode_t umask(mode_t);
|
||||
#endif
|
||||
|
||||
56
lib/libc/include/wasm-wasi-musl/sys/statvfs.h
vendored
Normal file
56
lib/libc/include/wasm-wasi-musl/sys/statvfs.h
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef _SYS_STATVFS_H
|
||||
#define _SYS_STATVFS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_fsblkcnt_t
|
||||
#define __NEED_fsfilcnt_t
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct statvfs {
|
||||
unsigned long f_bsize, f_frsize;
|
||||
fsblkcnt_t f_blocks, f_bfree, f_bavail;
|
||||
fsfilcnt_t f_files, f_ffree, f_favail;
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned long f_fsid;
|
||||
unsigned :8*(2*sizeof(int)-sizeof(long));
|
||||
#else
|
||||
unsigned :8*(2*sizeof(int)-sizeof(long));
|
||||
unsigned long f_fsid;
|
||||
#endif
|
||||
unsigned long f_flag, f_namemax;
|
||||
int __reserved[6];
|
||||
};
|
||||
|
||||
int statvfs (const char *__restrict, struct statvfs *__restrict);
|
||||
int fstatvfs (int, struct statvfs *);
|
||||
|
||||
#define ST_RDONLY 1
|
||||
#define ST_NOSUID 2
|
||||
#define ST_NODEV 4
|
||||
#define ST_NOEXEC 8
|
||||
#define ST_SYNCHRONOUS 16
|
||||
#define ST_MANDLOCK 64
|
||||
#define ST_WRITE 128
|
||||
#define ST_APPEND 256
|
||||
#define ST_IMMUTABLE 512
|
||||
#define ST_NOATIME 1024
|
||||
#define ST_NODIRATIME 2048
|
||||
#define ST_RELATIME 4096
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define statvfs64 statvfs
|
||||
#define fstatvfs64 fstatvfs
|
||||
#define fsblkcnt64_t fsblkcnt_t
|
||||
#define fsfilcnt64_t fsfilcnt_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
2
lib/libc/include/wasm-wasi-musl/unistd.h
vendored
2
lib/libc/include/wasm-wasi-musl/unistd.h
vendored
@ -336,7 +336,9 @@ pid_t gettid(void);
|
||||
#endif
|
||||
#define _POSIX_VDISABLE 0
|
||||
|
||||
#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
|
||||
#define _POSIX_THREADS _POSIX_VERSION
|
||||
#endif
|
||||
#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
|
||||
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
|
||||
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
|
||||
|
||||
10
lib/libc/include/wasm-wasi-musl/wasi/libc.h
vendored
10
lib/libc/include/wasm-wasi-musl/wasi/libc.h
vendored
@ -11,6 +11,16 @@ extern "C" {
|
||||
struct stat;
|
||||
struct timespec;
|
||||
|
||||
/// Populate libc's preopen tables. This is normally done automatically
|
||||
/// just before it's needed, however if you call `__wasi_fd_renumber` or
|
||||
/// `__wasi_fd_close` directly, and you need the preopens to be accurate
|
||||
/// afterward, you should call this before doing so.
|
||||
void __wasilibc_populate_preopens(void);
|
||||
|
||||
/// Reset the preopens table to an uninitialized state, forcing it to be
|
||||
/// reinitialized next time it is needed.
|
||||
void __wasilibc_reset_preopens(void);
|
||||
|
||||
/// Register the given pre-opened file descriptor under the given path.
|
||||
///
|
||||
/// This function does not take ownership of `prefix` (it makes its own copy).
|
||||
|
||||
15
lib/libc/wasi/emmalloc/emmalloc.c
vendored
15
lib/libc/wasi/emmalloc/emmalloc.c
vendored
@ -56,7 +56,7 @@
|
||||
|
||||
// Defind by the linker to have the address of the start of the heap.
|
||||
extern unsigned char __heap_base;
|
||||
extern unsigned char __heap_end __attribute__((__weak__));
|
||||
extern unsigned char __heap_end;
|
||||
|
||||
// Behavior of right shifting a signed integer is compiler implementation defined.
|
||||
static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation requires that right-shifting a signed integer produces a sign-extending (arithmetic) shift!");
|
||||
@ -66,7 +66,7 @@ static_assert((((int32_t)0x80000000U) >> 31) == -1, "This malloc implementation
|
||||
#define MALLOC_ALIGNMENT alignof(max_align_t)
|
||||
static_assert(alignof(max_align_t) == 16, "max_align_t must be correct");
|
||||
|
||||
#define EMMALLOC_EXPORT __attribute__((__weak__))
|
||||
#define EMMALLOC_EXPORT __attribute__((weak))
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
@ -546,12 +546,13 @@ static bool claim_more_memory(size_t numBytes)
|
||||
// If this is the first time we're called, see if we can use
|
||||
// the initial heap memory set up by wasm-ld.
|
||||
if (!listOfAllRegions) {
|
||||
unsigned char *heap_base = &__heap_base;
|
||||
unsigned char *heap_end = &__heap_end;
|
||||
if (heap_end == NULL)
|
||||
heap_end = sbrk(0);
|
||||
|
||||
if (numBytes <= (size_t)(heap_end - &__heap_base)) {
|
||||
startPtr = &__heap_base;
|
||||
if (heap_end < heap_base) {
|
||||
__builtin_trap();
|
||||
}
|
||||
if (numBytes <= (size_t)(heap_end - heap_base)) {
|
||||
startPtr = heap_base;
|
||||
endPtr = heap_end;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include <poll.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
||||
static int poll_wasip1(struct pollfd *fds, size_t nfds, int timeout) {
|
||||
// Construct events for poll().
|
||||
size_t maxevents = 2 * nfds + 1;
|
||||
__wasi_subscription_t subscriptions[maxevents];
|
||||
@ -127,3 +127,48 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#include <wasi/descriptor_table.h>
|
||||
|
||||
int poll_wasip2(struct pollfd *fds, size_t nfds, int timeout);
|
||||
|
||||
int poll(struct pollfd* fds, nfds_t nfds, int timeout)
|
||||
{
|
||||
bool found_socket = false;
|
||||
bool found_non_socket = false;
|
||||
for (size_t i = 0; i < nfds; ++i) {
|
||||
descriptor_table_entry_t* entry;
|
||||
if (descriptor_table_get_ref(fds[i].fd, &entry)) {
|
||||
found_socket = true;
|
||||
} else {
|
||||
found_non_socket = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_socket) {
|
||||
if (found_non_socket) {
|
||||
// We currently don't support polling a mix of non-sockets and
|
||||
// sockets here (though you can do it by using the host APIs
|
||||
// directly), and we probably won't until we've migrated entirely to
|
||||
// WASI 0.2.
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return poll_wasip2(fds, nfds, timeout);
|
||||
} else if (found_non_socket) {
|
||||
return poll_wasip1(fds, nfds, timeout);
|
||||
} else if (timeout >= 0) {
|
||||
return poll_wasip2(fds, nfds, timeout);
|
||||
} else {
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#else // not __wasilibc_use_wasip2
|
||||
int poll(struct pollfd* fds, nfds_t nfds, int timeout)
|
||||
{
|
||||
return poll_wasip1(fds, nfds, timeout);
|
||||
}
|
||||
#endif // not __wasilibc_use_wasip2
|
||||
|
||||
@ -4,11 +4,66 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <wasi/api.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <wasi/api.h>
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#include <wasi/descriptor_table.h>
|
||||
#endif
|
||||
|
||||
int ioctl(int fildes, int request, ...) {
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
descriptor_table_entry_t *entry;
|
||||
if (descriptor_table_get_ref(fildes, &entry)) {
|
||||
switch (entry->tag) {
|
||||
case DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET: {
|
||||
tcp_socket_t *socket = &entry->tcp_socket;
|
||||
switch (request) {
|
||||
case FIONBIO: {
|
||||
va_list ap;
|
||||
va_start(ap, request);
|
||||
socket->blocking = *va_arg(ap, const int *) ==
|
||||
0;
|
||||
va_end(ap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
// TODO wasi-sockets: anything else we should support?
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
case DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET: {
|
||||
udp_socket_t *socket = &entry->udp_socket;
|
||||
switch (request) {
|
||||
case FIONBIO: {
|
||||
va_list ap;
|
||||
va_start(ap, request);
|
||||
socket->blocking = *va_arg(ap, const int *) ==
|
||||
0;
|
||||
va_end(ap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
// TODO wasi-sockets: anything else we should support?
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
errno = ENOPROTOOPT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif // __wasilibc_use_wasip2
|
||||
|
||||
switch (request) {
|
||||
case FIONREAD: {
|
||||
// Poll the file descriptor to determine how many bytes can be read.
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#include <wasi/api.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
|
||||
int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
|
||||
fd_set *restrict errorfds, const struct timespec *restrict timeout,
|
||||
@ -33,93 +34,66 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds,
|
||||
if (writefds == NULL)
|
||||
writefds = ∅
|
||||
|
||||
// Determine the maximum number of events.
|
||||
size_t maxevents = readfds->__nfds + writefds->__nfds + 1;
|
||||
__wasi_subscription_t subscriptions[maxevents];
|
||||
size_t nsubscriptions = 0;
|
||||
|
||||
// Convert the readfds set.
|
||||
struct pollfd poll_fds[readfds->__nfds + writefds->__nfds];
|
||||
size_t poll_nfds = 0;
|
||||
|
||||
for (size_t i = 0; i < readfds->__nfds; ++i) {
|
||||
int fd = readfds->__fds[i];
|
||||
if (fd < nfds) {
|
||||
__wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
|
||||
*subscription = (__wasi_subscription_t){
|
||||
.userdata = fd,
|
||||
.u.tag = __WASI_EVENTTYPE_FD_READ,
|
||||
.u.u.fd_read.file_descriptor = fd,
|
||||
};
|
||||
poll_fds[poll_nfds++] = (struct pollfd){
|
||||
.fd = fd,
|
||||
.events = POLLRDNORM,
|
||||
.revents = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the writefds set.
|
||||
|
||||
for (size_t i = 0; i < writefds->__nfds; ++i) {
|
||||
int fd = writefds->__fds[i];
|
||||
if (fd < nfds) {
|
||||
__wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
|
||||
*subscription = (__wasi_subscription_t){
|
||||
.userdata = fd,
|
||||
.u.tag = __WASI_EVENTTYPE_FD_WRITE,
|
||||
.u.u.fd_write.file_descriptor = fd,
|
||||
poll_fds[poll_nfds++] = (struct pollfd){
|
||||
.fd = fd,
|
||||
.events = POLLWRNORM,
|
||||
.revents = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Create extra event for the timeout.
|
||||
if (timeout != NULL) {
|
||||
__wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
|
||||
*subscription = (__wasi_subscription_t){
|
||||
.u.tag = __WASI_EVENTTYPE_CLOCK,
|
||||
.u.u.clock.id = __WASI_CLOCKID_REALTIME,
|
||||
};
|
||||
if (!timespec_to_timestamp_clamp(timeout, &subscription->u.u.clock.timeout)) {
|
||||
int poll_timeout;
|
||||
if (timeout) {
|
||||
uint64_t timeout_u64;
|
||||
if (!timespec_to_timestamp_clamp(timeout, &timeout_u64) ) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute poll().
|
||||
size_t nevents;
|
||||
__wasi_event_t events[nsubscriptions];
|
||||
__wasi_errno_t error =
|
||||
__wasi_poll_oneoff(subscriptions, events, nsubscriptions, &nevents);
|
||||
if (error != 0) {
|
||||
// WASI's poll requires at least one subscription, or else it returns
|
||||
// `EINVAL`. Since a `pselect` with nothing to wait for is valid in POSIX,
|
||||
// return `ENOTSUP` to indicate that we don't support that case.
|
||||
//
|
||||
// Wasm has no signal handling, so if none of the user-provided `pollfd`
|
||||
// elements, nor the timeout, led us to producing even one subscription
|
||||
// to wait for, there would be no way for the poll to wake up. WASI
|
||||
// returns `EINVAL` in this case, but for users of `poll`, `ENOTSUP` is
|
||||
// more likely to be understood.
|
||||
if (nsubscriptions == 0)
|
||||
errno = ENOTSUP;
|
||||
else
|
||||
errno = error;
|
||||
// Convert nanoseconds to milliseconds:
|
||||
timeout_u64 /= 1000000;
|
||||
|
||||
if (timeout_u64 > INT_MAX) {
|
||||
timeout_u64 = INT_MAX;
|
||||
}
|
||||
|
||||
poll_timeout = (int) timeout_u64;
|
||||
} else {
|
||||
poll_timeout = -1;
|
||||
};
|
||||
|
||||
if (poll(poll_fds, poll_nfds, poll_timeout) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Test for EBADF.
|
||||
for (size_t i = 0; i < nevents; ++i) {
|
||||
const __wasi_event_t *event = &events[i];
|
||||
if ((event->type == __WASI_EVENTTYPE_FD_READ ||
|
||||
event->type == __WASI_EVENTTYPE_FD_WRITE) &&
|
||||
event->error == __WASI_ERRNO_BADF) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear and set entries in the result sets.
|
||||
FD_ZERO(readfds);
|
||||
FD_ZERO(writefds);
|
||||
for (size_t i = 0; i < nevents; ++i) {
|
||||
const __wasi_event_t *event = &events[i];
|
||||
if (event->type == __WASI_EVENTTYPE_FD_READ) {
|
||||
readfds->__fds[readfds->__nfds++] = event->userdata;
|
||||
} else if (event->type == __WASI_EVENTTYPE_FD_WRITE) {
|
||||
writefds->__fds[writefds->__nfds++] = event->userdata;
|
||||
for (size_t i = 0; i < poll_nfds; ++i) {
|
||||
struct pollfd* pollfd = poll_fds + i;
|
||||
if ((pollfd->revents & POLLRDNORM) != 0) {
|
||||
readfds->__fds[readfds->__nfds++] = pollfd->fd;
|
||||
}
|
||||
if ((pollfd->revents & POLLWRNORM) != 0) {
|
||||
writefds->__fds[writefds->__nfds++] = pollfd->fd;
|
||||
}
|
||||
}
|
||||
|
||||
return readfds->__nfds + writefds->__nfds;
|
||||
}
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
#include <wasi/api.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int close(int fildes) {
|
||||
__wasi_errno_t error = __wasi_fd_close(fildes);
|
||||
if (error != 0) {
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -20,18 +20,18 @@ void _start(void) {
|
||||
static volatile _Atomic int started = 0;
|
||||
int expected = 0;
|
||||
if (!atomic_compare_exchange_strong(&started, &expected, 1)) {
|
||||
__builtin_trap();
|
||||
__builtin_trap();
|
||||
}
|
||||
#else
|
||||
static volatile int started = 0;
|
||||
if (started != 0) {
|
||||
__builtin_trap();
|
||||
__builtin_trap();
|
||||
}
|
||||
started = 1;
|
||||
#endif
|
||||
|
||||
#ifdef _REENTRANT
|
||||
__wasi_init_tp();
|
||||
__wasi_init_tp();
|
||||
#endif
|
||||
|
||||
// The linker synthesizes this to call constructors.
|
||||
|
||||
127
lib/libc/wasi/libc-bottom-half/headers/private/wasi/descriptor_table.h
vendored
Normal file
127
lib/libc/wasi/libc-bottom-half/headers/private/wasi/descriptor_table.h
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
#ifndef DESCRIPTOR_TABLE_H
|
||||
#define DESCRIPTOR_TABLE_H
|
||||
|
||||
#include <wasi/wasip2.h>
|
||||
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} tcp_socket_state_unbound_t;
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} tcp_socket_state_bound_t;
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} tcp_socket_state_connecting_t;
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} tcp_socket_state_listening_t;
|
||||
|
||||
typedef struct {
|
||||
streams_own_input_stream_t input;
|
||||
poll_own_pollable_t input_pollable;
|
||||
streams_own_output_stream_t output;
|
||||
poll_own_pollable_t output_pollable;
|
||||
} tcp_socket_state_connected_t;
|
||||
|
||||
typedef struct {
|
||||
network_error_code_t error_code;
|
||||
} tcp_socket_state_connect_failed_t;
|
||||
|
||||
// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
|
||||
typedef struct {
|
||||
enum {
|
||||
TCP_SOCKET_STATE_UNBOUND,
|
||||
TCP_SOCKET_STATE_BOUND,
|
||||
TCP_SOCKET_STATE_CONNECTING,
|
||||
TCP_SOCKET_STATE_CONNECTED,
|
||||
TCP_SOCKET_STATE_CONNECT_FAILED,
|
||||
TCP_SOCKET_STATE_LISTENING,
|
||||
} tag;
|
||||
union {
|
||||
tcp_socket_state_unbound_t unbound;
|
||||
tcp_socket_state_bound_t bound;
|
||||
tcp_socket_state_connecting_t connecting;
|
||||
tcp_socket_state_connected_t connected;
|
||||
tcp_socket_state_connect_failed_t connect_failed;
|
||||
tcp_socket_state_listening_t listening;
|
||||
};
|
||||
} tcp_socket_state_t;
|
||||
|
||||
typedef struct {
|
||||
tcp_own_tcp_socket_t socket;
|
||||
poll_own_pollable_t socket_pollable;
|
||||
bool blocking;
|
||||
bool fake_nodelay;
|
||||
bool fake_reuseaddr;
|
||||
network_ip_address_family_t family;
|
||||
tcp_socket_state_t state;
|
||||
} tcp_socket_t;
|
||||
|
||||
typedef struct {
|
||||
udp_own_incoming_datagram_stream_t incoming;
|
||||
poll_own_pollable_t incoming_pollable;
|
||||
udp_own_outgoing_datagram_stream_t outgoing;
|
||||
poll_own_pollable_t outgoing_pollable;
|
||||
} udp_socket_streams_t;
|
||||
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} udp_socket_state_unbound_t;
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} udp_socket_state_bound_nostreams_t;
|
||||
|
||||
typedef struct {
|
||||
udp_socket_streams_t streams; // Streams have no remote_address
|
||||
} udp_socket_state_bound_streaming_t;
|
||||
|
||||
typedef struct {
|
||||
udp_socket_streams_t streams; // Streams have a remote_address
|
||||
} udp_socket_state_connected_t;
|
||||
|
||||
// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
|
||||
// The "bound" state is split up into two distinct tags:
|
||||
// - "bound_nostreams": Bound, but no datagram streams set up (yet). That will be done the first time send or recv is called.
|
||||
// - "bound_streaming": Bound with active streams.
|
||||
typedef struct {
|
||||
enum {
|
||||
UDP_SOCKET_STATE_UNBOUND,
|
||||
UDP_SOCKET_STATE_BOUND_NOSTREAMS,
|
||||
UDP_SOCKET_STATE_BOUND_STREAMING,
|
||||
UDP_SOCKET_STATE_CONNECTED,
|
||||
} tag;
|
||||
union {
|
||||
udp_socket_state_unbound_t unbound;
|
||||
udp_socket_state_bound_nostreams_t bound_nostreams;
|
||||
udp_socket_state_bound_streaming_t bound_streaming;
|
||||
udp_socket_state_connected_t connected;
|
||||
};
|
||||
} udp_socket_state_t;
|
||||
|
||||
typedef struct {
|
||||
udp_own_udp_socket_t socket;
|
||||
poll_own_pollable_t socket_pollable;
|
||||
bool blocking;
|
||||
network_ip_address_family_t family;
|
||||
udp_socket_state_t state;
|
||||
} udp_socket_t;
|
||||
|
||||
// This is a tagged union. When adding/removing/renaming cases, be sure to keep the tag and union definitions in sync.
|
||||
typedef struct {
|
||||
enum {
|
||||
DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET,
|
||||
DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET,
|
||||
} tag;
|
||||
union {
|
||||
tcp_socket_t tcp_socket;
|
||||
udp_socket_t udp_socket;
|
||||
};
|
||||
} descriptor_table_entry_t;
|
||||
|
||||
bool descriptor_table_insert(descriptor_table_entry_t entry, int *fd);
|
||||
|
||||
bool descriptor_table_get_ref(int fd, descriptor_table_entry_t **entry);
|
||||
|
||||
bool descriptor_table_remove(int fd, descriptor_table_entry_t *entry);
|
||||
|
||||
#endif
|
||||
53
lib/libc/wasi/libc-bottom-half/headers/private/wasi/sockets_utils.h
vendored
Normal file
53
lib/libc/wasi/libc-bottom-half/headers/private/wasi/sockets_utils.h
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef __wasi_sockets_utils_h
|
||||
#define __wasi_sockets_utils_h
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <wasi/descriptor_table.h>
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
OUTPUT_SOCKADDR_NULL,
|
||||
OUTPUT_SOCKADDR_V4,
|
||||
OUTPUT_SOCKADDR_V6,
|
||||
} tag;
|
||||
union {
|
||||
struct {
|
||||
int dummy;
|
||||
} null;
|
||||
struct {
|
||||
struct sockaddr_in *addr;
|
||||
socklen_t *addrlen;
|
||||
} v4;
|
||||
struct {
|
||||
struct sockaddr_in6 *addr;
|
||||
socklen_t *addrlen;
|
||||
} v6;
|
||||
};
|
||||
} output_sockaddr_t;
|
||||
|
||||
network_borrow_network_t __wasi_sockets_utils__borrow_network();
|
||||
int __wasi_sockets_utils__map_error(network_error_code_t wasi_error);
|
||||
bool __wasi_sockets_utils__parse_address(
|
||||
network_ip_address_family_t expected_family,
|
||||
const struct sockaddr *address, socklen_t len,
|
||||
network_ip_socket_address_t *result, int *error);
|
||||
bool __wasi_sockets_utils__output_addr_validate(
|
||||
network_ip_address_family_t expected_family, struct sockaddr *addr,
|
||||
socklen_t *addrlen, output_sockaddr_t *result);
|
||||
void __wasi_sockets_utils__output_addr_write(
|
||||
const network_ip_socket_address_t input, output_sockaddr_t *output);
|
||||
int __wasi_sockets_utils__posix_family(network_ip_address_family_t wasi_family);
|
||||
network_ip_socket_address_t
|
||||
__wasi_sockets_utils__any_addr(network_ip_address_family_t family);
|
||||
int __wasi_sockets_utils__tcp_bind(tcp_socket_t *socket,
|
||||
network_ip_socket_address_t *address);
|
||||
int __wasi_sockets_utils__udp_bind(udp_socket_t *socket,
|
||||
network_ip_socket_address_t *address);
|
||||
bool __wasi_sockets_utils__stream(udp_socket_t *socket,
|
||||
network_ip_socket_address_t *remote_address,
|
||||
udp_socket_streams_t *result,
|
||||
network_error_code_t *error);
|
||||
void __wasi_sockets_utils__drop_streams(udp_socket_streams_t streams);
|
||||
|
||||
#endif
|
||||
@ -30,13 +30,13 @@ static void core_handler(int sig) {
|
||||
|
||||
_Noreturn
|
||||
static void terminate_handler(int sig) {
|
||||
fprintf(stderr, "Program recieved termination signal: %s\n", strsignal(sig));
|
||||
fprintf(stderr, "Program received termination signal: %s\n", strsignal(sig));
|
||||
abort();
|
||||
}
|
||||
|
||||
_Noreturn
|
||||
static void stop_handler(int sig) {
|
||||
fprintf(stderr, "Program recieved stop signal: %s\n", strsignal(sig));
|
||||
fprintf(stderr, "Program received stop signal: %s\n", strsignal(sig));
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
int __wasilibc_main(int argc, char *argv[]) asm("main");
|
||||
|
||||
// The user's `main` function, expecting arguments.
|
||||
//
|
||||
// Note that we make this a weak symbol so that it will have a
|
||||
// `WASM_SYM_BINDING_WEAK` flag in libc.so, which tells the dynamic linker that
|
||||
// it need not be defined (e.g. in reactor-style apps with no main function).
|
||||
// See also the TODO comment on `__main_void` below.
|
||||
__attribute__((__weak__, nodebug))
|
||||
int __main_argc_argv(int argc, char *argv[]) {
|
||||
return __wasilibc_main(argc, argv);
|
||||
@ -13,6 +18,11 @@ int __main_argc_argv(int argc, char *argv[]) {
|
||||
// If the user's `main` function expects arguments, the compiler will rename
|
||||
// it to `__main_argc_argv`, and this version will get linked in, which
|
||||
// initializes the argument data and calls `__main_argc_argv`.
|
||||
//
|
||||
// TODO: Ideally this function would be defined in a crt*.o file and linked in
|
||||
// as necessary by the Clang driver. However, moving it to crt1-command.c
|
||||
// breaks `--no-gc-sections`, so we'll probably need to create a new file
|
||||
// (e.g. crt0.o or crtend.o) and teach Clang to use it when needed.
|
||||
__attribute__((__weak__, nodebug))
|
||||
int __main_void(void) {
|
||||
__wasi_errno_t err;
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int __wasilibc_fd_renumber(int fd, int newfd) {
|
||||
// Scan the preopen fds before making any changes.
|
||||
__wasilibc_populate_preopens();
|
||||
|
||||
__wasi_errno_t error = __wasi_fd_renumber(fd, newfd);
|
||||
if (error != 0) {
|
||||
errno = error;
|
||||
@ -11,3 +14,97 @@ int __wasilibc_fd_renumber(int fd, int newfd) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
#include <wasi/descriptor_table.h>
|
||||
|
||||
void drop_tcp_socket(tcp_socket_t socket) {
|
||||
switch (socket.state.tag) {
|
||||
case TCP_SOCKET_STATE_UNBOUND:
|
||||
case TCP_SOCKET_STATE_BOUND:
|
||||
case TCP_SOCKET_STATE_CONNECTING:
|
||||
case TCP_SOCKET_STATE_LISTENING:
|
||||
case TCP_SOCKET_STATE_CONNECT_FAILED:
|
||||
// No additional resources to drop.
|
||||
break;
|
||||
case TCP_SOCKET_STATE_CONNECTED: {
|
||||
tcp_socket_state_connected_t connection = socket.state.connected;
|
||||
|
||||
poll_pollable_drop_own(connection.input_pollable);
|
||||
poll_pollable_drop_own(connection.output_pollable);
|
||||
streams_input_stream_drop_own(connection.input);
|
||||
streams_output_stream_drop_own(connection.output);
|
||||
break;
|
||||
}
|
||||
default: /* unreachable */ abort();
|
||||
}
|
||||
|
||||
poll_pollable_drop_own(socket.socket_pollable);
|
||||
tcp_tcp_socket_drop_own(socket.socket);
|
||||
}
|
||||
|
||||
void drop_udp_socket_streams(udp_socket_streams_t streams) {
|
||||
poll_pollable_drop_own(streams.incoming_pollable);
|
||||
poll_pollable_drop_own(streams.outgoing_pollable);
|
||||
udp_incoming_datagram_stream_drop_own(streams.incoming);
|
||||
udp_outgoing_datagram_stream_drop_own(streams.outgoing);
|
||||
}
|
||||
|
||||
void drop_udp_socket(udp_socket_t socket) {
|
||||
switch (socket.state.tag) {
|
||||
case UDP_SOCKET_STATE_UNBOUND:
|
||||
case UDP_SOCKET_STATE_BOUND_NOSTREAMS:
|
||||
// No additional resources to drop.
|
||||
break;
|
||||
case UDP_SOCKET_STATE_BOUND_STREAMING:
|
||||
drop_udp_socket_streams(socket.state.bound_streaming.streams);
|
||||
break;
|
||||
case UDP_SOCKET_STATE_CONNECTED: {
|
||||
drop_udp_socket_streams(socket.state.connected.streams);
|
||||
break;
|
||||
}
|
||||
default: /* unreachable */ abort();
|
||||
}
|
||||
|
||||
poll_pollable_drop_own(socket.socket_pollable);
|
||||
udp_udp_socket_drop_own(socket.socket);
|
||||
}
|
||||
#endif // __wasilibc_use_wasip2
|
||||
|
||||
int close(int fd) {
|
||||
// Scan the preopen fds before making any changes.
|
||||
__wasilibc_populate_preopens();
|
||||
|
||||
#ifdef __wasilibc_use_wasip2
|
||||
descriptor_table_entry_t entry;
|
||||
if (descriptor_table_remove(fd, &entry)) {
|
||||
|
||||
switch (entry.tag)
|
||||
{
|
||||
case DESCRIPTOR_TABLE_ENTRY_TCP_SOCKET:
|
||||
drop_tcp_socket(entry.tcp_socket);
|
||||
break;
|
||||
case DESCRIPTOR_TABLE_ENTRY_UDP_SOCKET:
|
||||
drop_udp_socket(entry.udp_socket);
|
||||
break;
|
||||
default: /* unreachable */ abort();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // __wasilibc_use_wasip2
|
||||
|
||||
__wasi_errno_t error = __wasi_fd_close(fd);
|
||||
if (error != 0) {
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weak void __wasilibc_populate_preopens(void) {
|
||||
// This version does nothing. It may be overridden by a version which does
|
||||
// something if `__wasilibc_find_abspath` or `__wasilibc_find_relpath` are
|
||||
// used.
|
||||
}
|
||||
|
||||
41
lib/libc/wasi/libc-bottom-half/sources/posix.c
vendored
41
lib/libc/wasi/libc-bottom-half/sources/posix.c
vendored
@ -6,6 +6,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <wasi/libc.h>
|
||||
@ -310,6 +311,46 @@ int rename(const char *old, const char *new) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int chmod(const char *path, mode_t mode) {
|
||||
// TODO: We plan to support this eventually in WASI, but not yet.
|
||||
// Meanwhile, we provide a stub so that libc++'s `<filesystem>`
|
||||
// implementation will build unmodified.
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fchmod(int fd, mode_t mode) {
|
||||
// TODO: We plan to support this eventually in WASI, but not yet.
|
||||
// Meanwhile, we provide a stub so that libc++'s `<filesystem>`
|
||||
// implementation will build unmodified.
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fchmodat(int fd, const char *path, mode_t mode, int flag) {
|
||||
// TODO: We plan to support this eventually in WASI, but not yet.
|
||||
// Meanwhile, we provide a stub so that libc++'s `<filesystem>`
|
||||
// implementation will build unmodified.
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int statvfs(const char *__restrict path, struct statvfs *__restrict buf) {
|
||||
// TODO: We plan to support this eventually in WASI, but not yet.
|
||||
// Meanwhile, we provide a stub so that libc++'s `<filesystem>`
|
||||
// implementation will build unmodified.
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fstatvfs(int fd, struct statvfs *buf) {
|
||||
// TODO: We plan to support this eventually in WASI, but not yet.
|
||||
// Meanwhile, we provide a stub so that libc++'s `<filesystem>`
|
||||
// implementation will build unmodified.
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Like `access`, but with `faccessat`'s flags argument.
|
||||
int
|
||||
__wasilibc_access(const char *path, int mode, int flags)
|
||||
|
||||
@ -25,6 +25,7 @@ typedef struct preopen {
|
||||
} preopen;
|
||||
|
||||
/// A simple growable array of `preopen`.
|
||||
static _Atomic _Bool preopens_populated = false;
|
||||
static preopen *preopens;
|
||||
static size_t num_preopens;
|
||||
static size_t preopen_capacity;
|
||||
@ -100,12 +101,9 @@ static const char *strip_prefixes(const char *path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
/// Register the given preopened file descriptor under the given path.
|
||||
///
|
||||
/// This function takes ownership of `prefix`.
|
||||
static int internal_register_preopened_fd(__wasi_fd_t fd, const char *relprefix) {
|
||||
LOCK(lock);
|
||||
|
||||
/// Similar to `internal_register_preopened_fd_unlocked` but does not
|
||||
/// take a lock.
|
||||
static int internal_register_preopened_fd_unlocked(__wasi_fd_t fd, const char *relprefix) {
|
||||
// Check preconditions.
|
||||
assert_invariants();
|
||||
assert(fd != AT_FDCWD);
|
||||
@ -113,22 +111,32 @@ static int internal_register_preopened_fd(__wasi_fd_t fd, const char *relprefix)
|
||||
assert(relprefix != NULL);
|
||||
|
||||
if (num_preopens == preopen_capacity && resize() != 0) {
|
||||
UNLOCK(lock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *prefix = strdup(strip_prefixes(relprefix));
|
||||
if (prefix == NULL) {
|
||||
UNLOCK(lock);
|
||||
return -1;
|
||||
}
|
||||
preopens[num_preopens++] = (preopen) { prefix, fd, };
|
||||
|
||||
assert_invariants();
|
||||
UNLOCK(lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Register the given preopened file descriptor under the given path.
|
||||
///
|
||||
/// This function takes ownership of `prefix`.
|
||||
static int internal_register_preopened_fd(__wasi_fd_t fd, const char *relprefix) {
|
||||
LOCK(lock);
|
||||
|
||||
int r = internal_register_preopened_fd_unlocked(fd, relprefix);
|
||||
|
||||
UNLOCK(lock);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// Are the `prefix_len` bytes pointed to by `prefix` a prefix of `path`?
|
||||
static bool prefix_matches(const char *prefix, size_t prefix_len, const char *path) {
|
||||
// Allow an empty string as a prefix of any relative path.
|
||||
@ -152,6 +160,8 @@ static bool prefix_matches(const char *prefix, size_t prefix_len, const char *pa
|
||||
|
||||
// See the documentation in libc.h
|
||||
int __wasilibc_register_preopened_fd(int fd, const char *prefix) {
|
||||
__wasilibc_populate_preopens();
|
||||
|
||||
return internal_register_preopened_fd((__wasi_fd_t)fd, prefix);
|
||||
}
|
||||
|
||||
@ -172,6 +182,8 @@ int __wasilibc_find_relpath(const char *path,
|
||||
int __wasilibc_find_abspath(const char *path,
|
||||
const char **abs_prefix,
|
||||
const char **relative_path) {
|
||||
__wasilibc_populate_preopens();
|
||||
|
||||
// Strip leading `/` characters, the prefixes we're mataching won't have
|
||||
// them.
|
||||
while (*path == '/')
|
||||
@ -219,13 +231,21 @@ int __wasilibc_find_abspath(const char *path,
|
||||
return fd;
|
||||
}
|
||||
|
||||
/// This is referenced by weak reference from crt1.c and lives in the same
|
||||
/// source file as `__wasilibc_find_relpath` so that it's linked in when it's
|
||||
/// needed.
|
||||
// Concerning the 51 -- see the comment by the constructor priority in
|
||||
// libc-bottom-half/sources/environ.c.
|
||||
__attribute__((constructor(51)))
|
||||
static void __wasilibc_populate_preopens(void) {
|
||||
void __wasilibc_populate_preopens(void) {
|
||||
// Fast path: If the preopens are already initialized, do nothing.
|
||||
if (preopens_populated) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOCK(lock);
|
||||
|
||||
// Check whether another thread initialized the preopens already.
|
||||
if (preopens_populated) {
|
||||
UNLOCK(lock);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip stdin, stdout, and stderr, and count up until we reach an invalid
|
||||
// file descriptor.
|
||||
for (__wasi_fd_t fd = 3; fd != 0; ++fd) {
|
||||
@ -241,7 +261,7 @@ static void __wasilibc_populate_preopens(void) {
|
||||
if (prefix == NULL)
|
||||
goto software;
|
||||
|
||||
// TODO: Remove the cast on `path` once the witx is updated with
|
||||
// TODO: Remove the cast on `prefix` once the witx is updated with
|
||||
// char8 support.
|
||||
ret = __wasi_fd_prestat_dir_name(fd, (uint8_t *)prefix,
|
||||
prestat.u.dir.pr_name_len);
|
||||
@ -249,7 +269,7 @@ static void __wasilibc_populate_preopens(void) {
|
||||
goto oserr;
|
||||
prefix[prestat.u.dir.pr_name_len] = '\0';
|
||||
|
||||
if (internal_register_preopened_fd(fd, prefix) != 0)
|
||||
if (internal_register_preopened_fd_unlocked(fd, prefix) != 0)
|
||||
goto software;
|
||||
free(prefix);
|
||||
|
||||
@ -260,9 +280,34 @@ static void __wasilibc_populate_preopens(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Preopens are now initialized.
|
||||
preopens_populated = true;
|
||||
|
||||
UNLOCK(lock);
|
||||
|
||||
return;
|
||||
oserr:
|
||||
_Exit(EX_OSERR);
|
||||
software:
|
||||
_Exit(EX_SOFTWARE);
|
||||
}
|
||||
|
||||
void __wasilibc_reset_preopens(void) {
|
||||
LOCK(lock);
|
||||
|
||||
if (num_preopens) {
|
||||
for (int i = 0; i < num_preopens; ++i) {
|
||||
free((void*) preopens[i].prefix);
|
||||
}
|
||||
free(preopens);
|
||||
}
|
||||
|
||||
preopens_populated = false;
|
||||
preopens = NULL;
|
||||
num_preopens = 0;
|
||||
preopen_capacity = 0;
|
||||
|
||||
assert_invariants();
|
||||
|
||||
UNLOCK(lock);
|
||||
}
|
||||
|
||||
1
lib/libc/wasi/libc-top-half/musl/.mailmap
vendored
1
lib/libc/wasi/libc-top-half/musl/.mailmap
vendored
@ -1 +0,0 @@
|
||||
Ada Worcester <oss@ada.pikhq.com> <josiahw@gmail.com>
|
||||
1
lib/libc/wasi/libc-top-half/musl/arch/wasm32/bits/setjmp.h
vendored
Normal file
1
lib/libc/wasi/libc-top-half/musl/arch/wasm32/bits/setjmp.h
vendored
Normal file
@ -0,0 +1 @@
|
||||
typedef unsigned long __jmp_buf[8];
|
||||
73
lib/libc/wasi/libc-top-half/musl/include/aio.h
vendored
73
lib/libc/wasi/libc-top-half/musl/include/aio.h
vendored
@ -1,73 +0,0 @@
|
||||
#ifndef _AIO_H
|
||||
#define _AIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#define __NEED_ssize_t
|
||||
#define __NEED_off_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct aiocb {
|
||||
int aio_fildes, aio_lio_opcode, aio_reqprio;
|
||||
volatile void *aio_buf;
|
||||
size_t aio_nbytes;
|
||||
struct sigevent aio_sigevent;
|
||||
void *__td;
|
||||
int __lock[2];
|
||||
volatile int __err;
|
||||
ssize_t __ret;
|
||||
off_t aio_offset;
|
||||
void *__next, *__prev;
|
||||
char __dummy4[32-2*sizeof(void *)];
|
||||
};
|
||||
|
||||
#define AIO_CANCELED 0
|
||||
#define AIO_NOTCANCELED 1
|
||||
#define AIO_ALLDONE 2
|
||||
|
||||
#define LIO_READ 0
|
||||
#define LIO_WRITE 1
|
||||
#define LIO_NOP 2
|
||||
|
||||
#define LIO_WAIT 0
|
||||
#define LIO_NOWAIT 1
|
||||
|
||||
int aio_read(struct aiocb *);
|
||||
int aio_write(struct aiocb *);
|
||||
int aio_error(const struct aiocb *);
|
||||
ssize_t aio_return(struct aiocb *);
|
||||
int aio_cancel(int, struct aiocb *);
|
||||
int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
|
||||
int aio_fsync(int, struct aiocb *);
|
||||
|
||||
int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define aiocb64 aiocb
|
||||
#define aio_read64 aio_read
|
||||
#define aio_write64 aio_write
|
||||
#define aio_error64 aio_error
|
||||
#define aio_return64 aio_return
|
||||
#define aio_cancel64 aio_cancel
|
||||
#define aio_suspend64 aio_suspend
|
||||
#define aio_fsync64 aio_fsync
|
||||
#define lio_listio64 lio_listio
|
||||
#define off64_t off_t
|
||||
#endif
|
||||
|
||||
#if _REDIR_TIME64
|
||||
__REDIR(aio_suspend, __aio_suspend_time64);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,118 +0,0 @@
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#define __BIG_ENDIAN 4321
|
||||
#define __USE_TIME_BITS64 1
|
||||
|
||||
TYPEDEF unsigned _Addr size_t;
|
||||
TYPEDEF unsigned _Addr uintptr_t;
|
||||
TYPEDEF _Addr ptrdiff_t;
|
||||
TYPEDEF _Addr ssize_t;
|
||||
TYPEDEF _Addr intptr_t;
|
||||
TYPEDEF _Addr regoff_t;
|
||||
TYPEDEF _Reg register_t;
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
TYPEDEF _Int64 time_t;
|
||||
TYPEDEF _Int64 suseconds_t;
|
||||
#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
|
||||
|
||||
TYPEDEF signed char int8_t;
|
||||
TYPEDEF signed short int16_t;
|
||||
TYPEDEF signed int int32_t;
|
||||
TYPEDEF signed _Int64 int64_t;
|
||||
TYPEDEF signed _Int64 intmax_t;
|
||||
TYPEDEF unsigned char uint8_t;
|
||||
TYPEDEF unsigned short uint16_t;
|
||||
TYPEDEF unsigned int uint32_t;
|
||||
TYPEDEF unsigned _Int64 uint64_t;
|
||||
TYPEDEF unsigned _Int64 u_int64_t;
|
||||
TYPEDEF unsigned _Int64 uintmax_t;
|
||||
|
||||
TYPEDEF unsigned mode_t;
|
||||
TYPEDEF unsigned _Reg nlink_t;
|
||||
TYPEDEF _Int64 off_t;
|
||||
TYPEDEF unsigned _Int64 ino_t;
|
||||
TYPEDEF unsigned _Int64 dev_t;
|
||||
TYPEDEF long blksize_t;
|
||||
TYPEDEF _Int64 blkcnt_t;
|
||||
TYPEDEF unsigned _Int64 fsblkcnt_t;
|
||||
TYPEDEF unsigned _Int64 fsfilcnt_t;
|
||||
|
||||
TYPEDEF unsigned wint_t;
|
||||
TYPEDEF unsigned long wctype_t;
|
||||
|
||||
TYPEDEF void * timer_t;
|
||||
TYPEDEF int clockid_t;
|
||||
TYPEDEF long clock_t;
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
STRUCT timeval { time_t tv_sec; suseconds_t tv_usec; };
|
||||
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); };
|
||||
#else
|
||||
#include <__struct_timeval.h>
|
||||
#include <__struct_timespec.h>
|
||||
#endif
|
||||
|
||||
TYPEDEF int pid_t;
|
||||
TYPEDEF unsigned id_t;
|
||||
TYPEDEF unsigned uid_t;
|
||||
TYPEDEF unsigned gid_t;
|
||||
TYPEDEF int key_t;
|
||||
TYPEDEF unsigned useconds_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
TYPEDEF unsigned long pthread_t;
|
||||
#else
|
||||
TYPEDEF struct __pthread * pthread_t;
|
||||
#endif
|
||||
TYPEDEF int pthread_once_t;
|
||||
TYPEDEF unsigned pthread_key_t;
|
||||
TYPEDEF int pthread_spinlock_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_mutexattr_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_condattr_t;
|
||||
TYPEDEF struct { unsigned __attr; } pthread_barrierattr_t;
|
||||
TYPEDEF struct { unsigned __attr[2]; } pthread_rwlockattr_t;
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI doesn't need to define FILE as a complete type */
|
||||
STRUCT _IO_FILE { char __x; };
|
||||
#endif
|
||||
TYPEDEF struct _IO_FILE FILE;
|
||||
|
||||
TYPEDEF __builtin_va_list va_list;
|
||||
TYPEDEF __builtin_va_list __isoc_va_list;
|
||||
|
||||
TYPEDEF struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
|
||||
|
||||
TYPEDEF struct __locale_struct * locale_t;
|
||||
|
||||
TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
STRUCT iovec { void *iov_base; size_t iov_len; };
|
||||
#else
|
||||
#include <__struct_iovec.h>
|
||||
#endif
|
||||
|
||||
STRUCT winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
|
||||
|
||||
TYPEDEF unsigned socklen_t;
|
||||
TYPEDEF unsigned short sa_family_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;
|
||||
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;
|
||||
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;
|
||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
|
||||
TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_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;
|
||||
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;
|
||||
|
||||
#undef _Addr
|
||||
#undef _Int64
|
||||
#undef _Reg
|
||||
12
lib/libc/wasi/libc-top-half/musl/include/dlfcn.h
vendored
12
lib/libc/wasi/libc-top-half/musl/include/dlfcn.h
vendored
@ -12,19 +12,29 @@ extern "C" {
|
||||
#define RTLD_NOLOAD 4
|
||||
#define RTLD_NODELETE 4096
|
||||
#define RTLD_GLOBAL 256
|
||||
#ifdef __wasilibc_unmodified_upstream
|
||||
#define RTLD_LOCAL 0
|
||||
#else
|
||||
/* For WASI, we give `RTLD_LOCAL` a non-zero value, avoiding ambiguity and
|
||||
* allowing us to defer the decision of whether `RTLD_LOCAL` or `RTLD_GLOBAL`
|
||||
* should be the default when neither is specified.
|
||||
*/
|
||||
#define RTLD_LOCAL 8
|
||||
#endif
|
||||
|
||||
#define RTLD_NEXT ((void *)-1)
|
||||
#define RTLD_DEFAULT ((void *)0)
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream
|
||||
#define RTLD_DI_LINKMAP 2
|
||||
#endif
|
||||
|
||||
int dlclose(void *);
|
||||
char *dlerror(void);
|
||||
void *dlopen(const char *, int);
|
||||
void *dlsym(void *__restrict, const char *__restrict);
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#if defined(__wasilibc_unmodified_upstream) && (defined(_GNU_SOURCE) || defined(_BSD_SOURCE))
|
||||
typedef struct {
|
||||
const char *dli_fname;
|
||||
void *dli_fbase;
|
||||
|
||||
3296
lib/libc/wasi/libc-top-half/musl/include/elf.h
vendored
3296
lib/libc/wasi/libc-top-half/musl/include/elf.h
vendored
File diff suppressed because it is too large
Load Diff
53
lib/libc/wasi/libc-top-half/musl/include/grp.h
vendored
53
lib/libc/wasi/libc-top-half/musl/include/grp.h
vendored
@ -1,53 +0,0 @@
|
||||
#ifndef _GRP_H
|
||||
#define _GRP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_gid_t
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __NEED_FILE
|
||||
#endif
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct group {
|
||||
char *gr_name;
|
||||
char *gr_passwd;
|
||||
gid_t gr_gid;
|
||||
char **gr_mem;
|
||||
};
|
||||
|
||||
struct group *getgrgid(gid_t);
|
||||
struct group *getgrnam(const char *);
|
||||
|
||||
int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
|
||||
int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
struct group *getgrent(void);
|
||||
void endgrent(void);
|
||||
void setgrent(void);
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
struct group *fgetgrent(FILE *);
|
||||
int putgrent(const struct group *, FILE *);
|
||||
#endif
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
int getgrouplist(const char *, gid_t, gid_t *, int *);
|
||||
int setgroups(size_t, const gid_t *);
|
||||
int initgroups(const char *, gid_t);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1 +0,0 @@
|
||||
#include <utmp.h>
|
||||
@ -1,33 +0,0 @@
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#define __fa(n) __attribute__ ((__format_arg__ (n)))
|
||||
#else
|
||||
#define __fa(n)
|
||||
#endif
|
||||
|
||||
char *gettext(const char *) __fa(1);
|
||||
char *dgettext(const char *, const char *) __fa(2);
|
||||
char *dcgettext(const char *, const char *, int) __fa(2);
|
||||
char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
|
||||
char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
|
||||
char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
|
||||
char *textdomain(const char *);
|
||||
char *bindtextdomain (const char *, const char *);
|
||||
char *bind_textdomain_codeset(const char *, const char *);
|
||||
|
||||
#undef __fa
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
53
lib/libc/wasi/libc-top-half/musl/include/link.h
vendored
53
lib/libc/wasi/libc-top-half/musl/include/link.h
vendored
@ -1,53 +0,0 @@
|
||||
#ifndef _LINK_H
|
||||
#define _LINK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#define __NEED_size_t
|
||||
#define __NEED_uint32_t
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#if UINTPTR_MAX > 0xffffffff
|
||||
#define ElfW(type) Elf64_ ## type
|
||||
#else
|
||||
#define ElfW(type) Elf32_ ## type
|
||||
#endif
|
||||
|
||||
#include <bits/link.h>
|
||||
|
||||
struct dl_phdr_info {
|
||||
ElfW(Addr) dlpi_addr;
|
||||
const char *dlpi_name;
|
||||
const ElfW(Phdr) *dlpi_phdr;
|
||||
ElfW(Half) dlpi_phnum;
|
||||
unsigned long long int dlpi_adds;
|
||||
unsigned long long int dlpi_subs;
|
||||
size_t dlpi_tls_modid;
|
||||
void *dlpi_tls_data;
|
||||
};
|
||||
|
||||
struct link_map {
|
||||
ElfW(Addr) l_addr;
|
||||
char *l_name;
|
||||
ElfW(Dyn) *l_ld;
|
||||
struct link_map *l_next, *l_prev;
|
||||
};
|
||||
|
||||
struct r_debug {
|
||||
int r_version;
|
||||
struct link_map *r_map;
|
||||
ElfW(Addr) r_brk;
|
||||
enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
|
||||
ElfW(Addr) r_ldbase;
|
||||
};
|
||||
|
||||
int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,43 +0,0 @@
|
||||
#ifndef _MNTENT_H
|
||||
#define _MNTENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_FILE
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define MOUNTED "/etc/mtab"
|
||||
|
||||
#define MNTTYPE_IGNORE "ignore"
|
||||
#define MNTTYPE_NFS "nfs"
|
||||
#define MNTTYPE_SWAP "swap"
|
||||
#define MNTOPT_DEFAULTS "defaults"
|
||||
#define MNTOPT_RO "ro"
|
||||
#define MNTOPT_RW "rw"
|
||||
#define MNTOPT_SUID "suid"
|
||||
#define MNTOPT_NOSUID "nosuid"
|
||||
#define MNTOPT_NOAUTO "noauto"
|
||||
|
||||
struct mntent {
|
||||
char *mnt_fsname;
|
||||
char *mnt_dir;
|
||||
char *mnt_type;
|
||||
char *mnt_opts;
|
||||
int mnt_freq;
|
||||
int mnt_passno;
|
||||
};
|
||||
|
||||
FILE *setmntent(const char *, const char *);
|
||||
int endmntent(FILE *);
|
||||
struct mntent *getmntent(FILE *);
|
||||
struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
|
||||
int addmntent(FILE *, const struct mntent *);
|
||||
char *hasmntopt(const struct mntent *, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,55 +0,0 @@
|
||||
#ifndef _NET_ETHERNET_H
|
||||
#define _NET_ETHERNET_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
struct ether_addr {
|
||||
uint8_t ether_addr_octet[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct ether_header {
|
||||
uint8_t ether_dhost[ETH_ALEN];
|
||||
uint8_t ether_shost[ETH_ALEN];
|
||||
uint16_t ether_type;
|
||||
};
|
||||
|
||||
#define ETHERTYPE_PUP 0x0200
|
||||
#define ETHERTYPE_SPRITE 0x0500
|
||||
#define ETHERTYPE_IP 0x0800
|
||||
#define ETHERTYPE_ARP 0x0806
|
||||
#define ETHERTYPE_REVARP 0x8035
|
||||
#define ETHERTYPE_AT 0x809B
|
||||
#define ETHERTYPE_AARP 0x80F3
|
||||
#define ETHERTYPE_VLAN 0x8100
|
||||
#define ETHERTYPE_IPX 0x8137
|
||||
#define ETHERTYPE_IPV6 0x86dd
|
||||
#define ETHERTYPE_LOOPBACK 0x9000
|
||||
|
||||
|
||||
#define ETHER_ADDR_LEN ETH_ALEN
|
||||
#define ETHER_TYPE_LEN 2
|
||||
#define ETHER_CRC_LEN 4
|
||||
#define ETHER_HDR_LEN ETH_HLEN
|
||||
#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN)
|
||||
#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN)
|
||||
|
||||
#define ETHER_IS_VALID_LEN(foo) \
|
||||
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
|
||||
|
||||
#define ETHERTYPE_TRAIL 0x1000
|
||||
#define ETHERTYPE_NTRAILER 16
|
||||
|
||||
#define ETHERMTU ETH_DATA_LEN
|
||||
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
141
lib/libc/wasi/libc-top-half/musl/include/net/if.h
vendored
141
lib/libc/wasi/libc-top-half/musl/include/net/if.h
vendored
@ -1,141 +0,0 @@
|
||||
#ifndef _NET_IF_H
|
||||
#define _NET_IF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define IF_NAMESIZE 16
|
||||
|
||||
struct if_nameindex {
|
||||
unsigned int if_index;
|
||||
char *if_name;
|
||||
};
|
||||
|
||||
unsigned int if_nametoindex (const char *);
|
||||
char *if_indextoname (unsigned int, char *);
|
||||
struct if_nameindex *if_nameindex (void);
|
||||
void if_freenameindex (struct if_nameindex *);
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define IFF_UP 0x1
|
||||
#define IFF_BROADCAST 0x2
|
||||
#define IFF_DEBUG 0x4
|
||||
#define IFF_LOOPBACK 0x8
|
||||
#define IFF_POINTOPOINT 0x10
|
||||
#define IFF_NOTRAILERS 0x20
|
||||
#define IFF_RUNNING 0x40
|
||||
#define IFF_NOARP 0x80
|
||||
#define IFF_PROMISC 0x100
|
||||
#define IFF_ALLMULTI 0x200
|
||||
#define IFF_MASTER 0x400
|
||||
#define IFF_SLAVE 0x800
|
||||
#define IFF_MULTICAST 0x1000
|
||||
#define IFF_PORTSEL 0x2000
|
||||
#define IFF_AUTOMEDIA 0x4000
|
||||
#define IFF_DYNAMIC 0x8000
|
||||
#define IFF_LOWER_UP 0x10000
|
||||
#define IFF_DORMANT 0x20000
|
||||
#define IFF_ECHO 0x40000
|
||||
#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
|
||||
IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
|
||||
|
||||
struct ifaddr {
|
||||
struct sockaddr ifa_addr;
|
||||
union {
|
||||
struct sockaddr ifu_broadaddr;
|
||||
struct sockaddr ifu_dstaddr;
|
||||
} ifa_ifu;
|
||||
struct iface *ifa_ifp;
|
||||
struct ifaddr *ifa_next;
|
||||
};
|
||||
|
||||
#define ifa_broadaddr ifa_ifu.ifu_broadaddr
|
||||
#define ifa_dstaddr ifa_ifu.ifu_dstaddr
|
||||
|
||||
struct ifmap {
|
||||
unsigned long int mem_start;
|
||||
unsigned long int mem_end;
|
||||
unsigned short int base_addr;
|
||||
unsigned char irq;
|
||||
unsigned char dma;
|
||||
unsigned char port;
|
||||
};
|
||||
|
||||
#define IFHWADDRLEN 6
|
||||
#define IFNAMSIZ IF_NAMESIZE
|
||||
|
||||
struct ifreq {
|
||||
union {
|
||||
char ifrn_name[IFNAMSIZ];
|
||||
} ifr_ifrn;
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
struct sockaddr ifru_netmask;
|
||||
struct sockaddr ifru_hwaddr;
|
||||
short int ifru_flags;
|
||||
int ifru_ivalue;
|
||||
int ifru_mtu;
|
||||
struct ifmap ifru_map;
|
||||
char ifru_slave[IFNAMSIZ];
|
||||
char ifru_newname[IFNAMSIZ];
|
||||
char *ifru_data;
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
#define ifr_name ifr_ifrn.ifrn_name
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr
|
||||
#define ifr_addr ifr_ifru.ifru_addr
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr
|
||||
#define ifr_netmask ifr_ifru.ifru_netmask
|
||||
#define ifr_flags ifr_ifru.ifru_flags
|
||||
#define ifr_metric ifr_ifru.ifru_ivalue
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu
|
||||
#define ifr_map ifr_ifru.ifru_map
|
||||
#define ifr_slave ifr_ifru.ifru_slave
|
||||
#define ifr_data ifr_ifru.ifru_data
|
||||
#define ifr_ifindex ifr_ifru.ifru_ivalue
|
||||
#define ifr_bandwidth ifr_ifru.ifru_ivalue
|
||||
#define ifr_qlen ifr_ifru.ifru_ivalue
|
||||
#define ifr_newname ifr_ifru.ifru_newname
|
||||
#define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
|
||||
#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
|
||||
#define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
|
||||
|
||||
struct ifconf {
|
||||
int ifc_len;
|
||||
union {
|
||||
char *ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
};
|
||||
|
||||
#define ifc_buf ifc_ifcu.ifcu_buf
|
||||
#define ifc_req ifc_ifcu.ifcu_req
|
||||
#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
|
||||
|
||||
#define __UAPI_DEF_IF_IFCONF 0
|
||||
#define __UAPI_DEF_IF_IFMAP 0
|
||||
#define __UAPI_DEF_IF_IFNAMSIZ 0
|
||||
#define __UAPI_DEF_IF_IFREQ 0
|
||||
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
|
||||
#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,142 +0,0 @@
|
||||
/* Nonstandard header */
|
||||
#ifndef _NET_IF_ARP_H
|
||||
#define _NET_IF_ARP_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define MAX_ADDR_LEN 7
|
||||
|
||||
#define ARPOP_REQUEST 1
|
||||
#define ARPOP_REPLY 2
|
||||
#define ARPOP_RREQUEST 3
|
||||
#define ARPOP_RREPLY 4
|
||||
#define ARPOP_InREQUEST 8
|
||||
#define ARPOP_InREPLY 9
|
||||
#define ARPOP_NAK 10
|
||||
|
||||
struct arphdr {
|
||||
uint16_t ar_hrd;
|
||||
uint16_t ar_pro;
|
||||
uint8_t ar_hln;
|
||||
uint8_t ar_pln;
|
||||
uint16_t ar_op;
|
||||
};
|
||||
|
||||
|
||||
#define ARPHRD_NETROM 0
|
||||
#define ARPHRD_ETHER 1
|
||||
#define ARPHRD_EETHER 2
|
||||
#define ARPHRD_AX25 3
|
||||
#define ARPHRD_PRONET 4
|
||||
#define ARPHRD_CHAOS 5
|
||||
#define ARPHRD_IEEE802 6
|
||||
#define ARPHRD_ARCNET 7
|
||||
#define ARPHRD_APPLETLK 8
|
||||
#define ARPHRD_DLCI 15
|
||||
#define ARPHRD_ATM 19
|
||||
#define ARPHRD_METRICOM 23
|
||||
#define ARPHRD_IEEE1394 24
|
||||
#define ARPHRD_EUI64 27
|
||||
#define ARPHRD_INFINIBAND 32
|
||||
#define ARPHRD_SLIP 256
|
||||
#define ARPHRD_CSLIP 257
|
||||
#define ARPHRD_SLIP6 258
|
||||
#define ARPHRD_CSLIP6 259
|
||||
#define ARPHRD_RSRVD 260
|
||||
#define ARPHRD_ADAPT 264
|
||||
#define ARPHRD_ROSE 270
|
||||
#define ARPHRD_X25 271
|
||||
#define ARPHRD_HWX25 272
|
||||
#define ARPHRD_CAN 280
|
||||
#define ARPHRD_PPP 512
|
||||
#define ARPHRD_CISCO 513
|
||||
#define ARPHRD_HDLC ARPHRD_CISCO
|
||||
#define ARPHRD_LAPB 516
|
||||
#define ARPHRD_DDCMP 517
|
||||
#define ARPHRD_RAWHDLC 518
|
||||
#define ARPHRD_RAWIP 519
|
||||
|
||||
#define ARPHRD_TUNNEL 768
|
||||
#define ARPHRD_TUNNEL6 769
|
||||
#define ARPHRD_FRAD 770
|
||||
#define ARPHRD_SKIP 771
|
||||
#define ARPHRD_LOOPBACK 772
|
||||
#define ARPHRD_LOCALTLK 773
|
||||
#define ARPHRD_FDDI 774
|
||||
#define ARPHRD_BIF 775
|
||||
#define ARPHRD_SIT 776
|
||||
#define ARPHRD_IPDDP 777
|
||||
#define ARPHRD_IPGRE 778
|
||||
#define ARPHRD_PIMREG 779
|
||||
#define ARPHRD_HIPPI 780
|
||||
#define ARPHRD_ASH 781
|
||||
#define ARPHRD_ECONET 782
|
||||
#define ARPHRD_IRDA 783
|
||||
#define ARPHRD_FCPP 784
|
||||
#define ARPHRD_FCAL 785
|
||||
#define ARPHRD_FCPL 786
|
||||
#define ARPHRD_FCFABRIC 787
|
||||
#define ARPHRD_IEEE802_TR 800
|
||||
#define ARPHRD_IEEE80211 801
|
||||
#define ARPHRD_IEEE80211_PRISM 802
|
||||
#define ARPHRD_IEEE80211_RADIOTAP 803
|
||||
#define ARPHRD_IEEE802154 804
|
||||
#define ARPHRD_IEEE802154_MONITOR 805
|
||||
#define ARPHRD_PHONET 820
|
||||
#define ARPHRD_PHONET_PIPE 821
|
||||
#define ARPHRD_CAIF 822
|
||||
#define ARPHRD_IP6GRE 823
|
||||
#define ARPHRD_NETLINK 824
|
||||
#define ARPHRD_6LOWPAN 825
|
||||
#define ARPHRD_VSOCKMON 826
|
||||
|
||||
#define ARPHRD_VOID 0xFFFF
|
||||
#define ARPHRD_NONE 0xFFFE
|
||||
|
||||
struct arpreq {
|
||||
struct sockaddr arp_pa;
|
||||
struct sockaddr arp_ha;
|
||||
int arp_flags;
|
||||
struct sockaddr arp_netmask;
|
||||
char arp_dev[16];
|
||||
};
|
||||
|
||||
struct arpreq_old {
|
||||
struct sockaddr arp_pa;
|
||||
struct sockaddr arp_ha;
|
||||
int arp_flags;
|
||||
struct sockaddr arp_netmask;
|
||||
};
|
||||
|
||||
#define ATF_COM 0x02
|
||||
#define ATF_PERM 0x04
|
||||
#define ATF_PUBL 0x08
|
||||
#define ATF_USETRAILERS 0x10
|
||||
#define ATF_NETMASK 0x20
|
||||
#define ATF_DONTPUB 0x40
|
||||
#define ATF_MAGIC 0x80
|
||||
|
||||
#define ARPD_UPDATE 0x01
|
||||
#define ARPD_LOOKUP 0x02
|
||||
#define ARPD_FLUSH 0x03
|
||||
|
||||
struct arpd_request {
|
||||
unsigned short req;
|
||||
uint32_t ip;
|
||||
unsigned long dev;
|
||||
unsigned long stamp;
|
||||
unsigned long updated;
|
||||
unsigned char ha[MAX_ADDR_LEN];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
124
lib/libc/wasi/libc-top-half/musl/include/net/route.h
vendored
124
lib/libc/wasi/libc-top-half/musl/include/net/route.h
vendored
@ -1,124 +0,0 @@
|
||||
#ifndef _NET_ROUTE_H
|
||||
#define _NET_ROUTE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
|
||||
struct rtentry {
|
||||
unsigned long int rt_pad1;
|
||||
struct sockaddr rt_dst;
|
||||
struct sockaddr rt_gateway;
|
||||
struct sockaddr rt_genmask;
|
||||
unsigned short int rt_flags;
|
||||
short int rt_pad2;
|
||||
unsigned long int rt_pad3;
|
||||
unsigned char rt_tos;
|
||||
unsigned char rt_class;
|
||||
short int rt_pad4[sizeof(long)/2-1];
|
||||
short int rt_metric;
|
||||
char *rt_dev;
|
||||
unsigned long int rt_mtu;
|
||||
unsigned long int rt_window;
|
||||
unsigned short int rt_irtt;
|
||||
};
|
||||
|
||||
#define rt_mss rt_mtu
|
||||
|
||||
|
||||
struct in6_rtmsg {
|
||||
struct in6_addr rtmsg_dst;
|
||||
struct in6_addr rtmsg_src;
|
||||
struct in6_addr rtmsg_gateway;
|
||||
uint32_t rtmsg_type;
|
||||
uint16_t rtmsg_dst_len;
|
||||
uint16_t rtmsg_src_len;
|
||||
uint32_t rtmsg_metric;
|
||||
unsigned long int rtmsg_info;
|
||||
uint32_t rtmsg_flags;
|
||||
int rtmsg_ifindex;
|
||||
};
|
||||
|
||||
|
||||
#define RTF_UP 0x0001
|
||||
#define RTF_GATEWAY 0x0002
|
||||
|
||||
#define RTF_HOST 0x0004
|
||||
#define RTF_REINSTATE 0x0008
|
||||
#define RTF_DYNAMIC 0x0010
|
||||
#define RTF_MODIFIED 0x0020
|
||||
#define RTF_MTU 0x0040
|
||||
#define RTF_MSS RTF_MTU
|
||||
#define RTF_WINDOW 0x0080
|
||||
#define RTF_IRTT 0x0100
|
||||
#define RTF_REJECT 0x0200
|
||||
#define RTF_STATIC 0x0400
|
||||
#define RTF_XRESOLVE 0x0800
|
||||
#define RTF_NOFORWARD 0x1000
|
||||
#define RTF_THROW 0x2000
|
||||
#define RTF_NOPMTUDISC 0x4000
|
||||
|
||||
#define RTF_DEFAULT 0x00010000
|
||||
#define RTF_ALLONLINK 0x00020000
|
||||
#define RTF_ADDRCONF 0x00040000
|
||||
|
||||
#define RTF_LINKRT 0x00100000
|
||||
#define RTF_NONEXTHOP 0x00200000
|
||||
|
||||
#define RTF_CACHE 0x01000000
|
||||
#define RTF_FLOW 0x02000000
|
||||
#define RTF_POLICY 0x04000000
|
||||
|
||||
#define RTCF_VALVE 0x00200000
|
||||
#define RTCF_MASQ 0x00400000
|
||||
#define RTCF_NAT 0x00800000
|
||||
#define RTCF_DOREDIRECT 0x01000000
|
||||
#define RTCF_LOG 0x02000000
|
||||
#define RTCF_DIRECTSRC 0x04000000
|
||||
|
||||
#define RTF_LOCAL 0x80000000
|
||||
#define RTF_INTERFACE 0x40000000
|
||||
#define RTF_MULTICAST 0x20000000
|
||||
#define RTF_BROADCAST 0x10000000
|
||||
#define RTF_NAT 0x08000000
|
||||
|
||||
#define RTF_ADDRCLASSMASK 0xF8000000
|
||||
#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23)
|
||||
|
||||
#define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK)
|
||||
|
||||
#define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \
|
||||
== (RTF_LOCAL|RTF_INTERFACE))
|
||||
|
||||
#define RT_CLASS_UNSPEC 0
|
||||
#define RT_CLASS_DEFAULT 253
|
||||
|
||||
#define RT_CLASS_MAIN 254
|
||||
#define RT_CLASS_LOCAL 255
|
||||
#define RT_CLASS_MAX 255
|
||||
|
||||
|
||||
#define RTMSG_ACK NLMSG_ACK
|
||||
#define RTMSG_OVERRUN NLMSG_OVERRUN
|
||||
|
||||
#define RTMSG_NEWDEVICE 0x11
|
||||
#define RTMSG_DELDEVICE 0x12
|
||||
#define RTMSG_NEWROUTE 0x21
|
||||
#define RTMSG_DELROUTE 0x22
|
||||
#define RTMSG_NEWRULE 0x31
|
||||
#define RTMSG_DELRULE 0x32
|
||||
#define RTMSG_CONTROL 0x40
|
||||
|
||||
#define RTMSG_AR_FAILED 0x51
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
156
lib/libc/wasi/libc-top-half/musl/include/netdb.h
vendored
156
lib/libc/wasi/libc-top-half/musl/include/netdb.h
vendored
@ -1,156 +0,0 @@
|
||||
#ifndef _NETDB_H
|
||||
#define _NETDB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define __NEED_size_t
|
||||
#include <bits/alltypes.h>
|
||||
#endif
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
char *ai_canonname;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
|
||||
#define AI_PASSIVE 0x01
|
||||
#define AI_CANONNAME 0x02
|
||||
#define AI_NUMERICHOST 0x04
|
||||
#define AI_V4MAPPED 0x08
|
||||
#define AI_ALL 0x10
|
||||
#define AI_ADDRCONFIG 0x20
|
||||
#define AI_NUMERICSERV 0x400
|
||||
|
||||
|
||||
#define NI_NUMERICHOST 0x01
|
||||
#define NI_NUMERICSERV 0x02
|
||||
#define NI_NOFQDN 0x04
|
||||
#define NI_NAMEREQD 0x08
|
||||
#define NI_DGRAM 0x10
|
||||
#define NI_NUMERICSCOPE 0x100
|
||||
|
||||
#define EAI_BADFLAGS -1
|
||||
#define EAI_NONAME -2
|
||||
#define EAI_AGAIN -3
|
||||
#define EAI_FAIL -4
|
||||
#define EAI_FAMILY -6
|
||||
#define EAI_SOCKTYPE -7
|
||||
#define EAI_SERVICE -8
|
||||
#define EAI_MEMORY -10
|
||||
#define EAI_SYSTEM -11
|
||||
#define EAI_OVERFLOW -12
|
||||
|
||||
int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
|
||||
void freeaddrinfo (struct addrinfo *);
|
||||
int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
|
||||
const char *gai_strerror(int);
|
||||
|
||||
|
||||
/* Legacy functions follow (marked OBsolete in SUS) */
|
||||
|
||||
struct netent {
|
||||
char *n_name;
|
||||
char **n_aliases;
|
||||
int n_addrtype;
|
||||
uint32_t n_net;
|
||||
};
|
||||
|
||||
struct hostent {
|
||||
char *h_name;
|
||||
char **h_aliases;
|
||||
int h_addrtype;
|
||||
int h_length;
|
||||
char **h_addr_list;
|
||||
};
|
||||
#define h_addr h_addr_list[0]
|
||||
|
||||
struct servent {
|
||||
char *s_name;
|
||||
char **s_aliases;
|
||||
int s_port;
|
||||
char *s_proto;
|
||||
};
|
||||
|
||||
struct protoent {
|
||||
char *p_name;
|
||||
char **p_aliases;
|
||||
int p_proto;
|
||||
};
|
||||
|
||||
void sethostent (int);
|
||||
void endhostent (void);
|
||||
struct hostent *gethostent (void);
|
||||
|
||||
void setnetent (int);
|
||||
void endnetent (void);
|
||||
struct netent *getnetent (void);
|
||||
struct netent *getnetbyaddr (uint32_t, int);
|
||||
struct netent *getnetbyname (const char *);
|
||||
|
||||
void setservent (int);
|
||||
void endservent (void);
|
||||
struct servent *getservent (void);
|
||||
struct servent *getservbyname (const char *, const char *);
|
||||
struct servent *getservbyport (int, const char *);
|
||||
|
||||
void setprotoent (int);
|
||||
void endprotoent (void);
|
||||
struct protoent *getprotoent (void);
|
||||
struct protoent *getprotobyname (const char *);
|
||||
struct protoent *getprotobynumber (int);
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
|
||||
|| (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
|
||||
|| (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
|
||||
struct hostent *gethostbyname (const char *);
|
||||
struct hostent *gethostbyaddr (const void *, socklen_t, int);
|
||||
#ifdef __GNUC__
|
||||
__attribute__((const))
|
||||
#endif
|
||||
int *__h_errno_location(void);
|
||||
#define h_errno (*__h_errno_location())
|
||||
#define HOST_NOT_FOUND 1
|
||||
#define TRY_AGAIN 2
|
||||
#define NO_RECOVERY 3
|
||||
#define NO_DATA 4
|
||||
#define NO_ADDRESS NO_DATA
|
||||
#endif
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
void herror(const char *);
|
||||
const char *hstrerror(int);
|
||||
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
|
||||
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
|
||||
struct hostent *gethostbyname2(const char *, int);
|
||||
int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
|
||||
int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
|
||||
int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
|
||||
#define EAI_NODATA -5
|
||||
#define EAI_ADDRFAMILY -9
|
||||
#define EAI_INPROGRESS -100
|
||||
#define EAI_CANCELED -101
|
||||
#define EAI_NOTCANCELED -102
|
||||
#define EAI_ALLDONE -103
|
||||
#define EAI_INTR -104
|
||||
#define EAI_IDN_ENCODE -105
|
||||
#define NI_MAXHOST 255
|
||||
#define NI_MAXSERV 32
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,22 +0,0 @@
|
||||
#ifndef _NETINET_ETHER_H
|
||||
#define _NETINET_ETHER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
char *ether_ntoa (const struct ether_addr *);
|
||||
struct ether_addr *ether_aton (const char *);
|
||||
char *ether_ntoa_r (const struct ether_addr *, char *);
|
||||
struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
|
||||
int ether_line(const char *, struct ether_addr *, char *);
|
||||
int ether_ntohost(char *, const struct ether_addr *);
|
||||
int ether_hostton(const char *, struct ether_addr *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,149 +0,0 @@
|
||||
#ifndef _NETINET_IF_ETHER_H
|
||||
#define _NETINET_IF_ETHER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define ETH_ALEN 6
|
||||
#define ETH_TLEN 2
|
||||
#define ETH_HLEN 14
|
||||
#define ETH_ZLEN 60
|
||||
#define ETH_DATA_LEN 1500
|
||||
#define ETH_FRAME_LEN 1514
|
||||
#define ETH_FCS_LEN 4
|
||||
#define ETH_MIN_MTU 68
|
||||
#define ETH_MAX_MTU 0xFFFFU
|
||||
|
||||
#define ETH_P_LOOP 0x0060
|
||||
#define ETH_P_PUP 0x0200
|
||||
#define ETH_P_PUPAT 0x0201
|
||||
#define ETH_P_TSN 0x22F0
|
||||
#define ETH_P_ERSPAN2 0x22EB
|
||||
#define ETH_P_IP 0x0800
|
||||
#define ETH_P_X25 0x0805
|
||||
#define ETH_P_ARP 0x0806
|
||||
#define ETH_P_BPQ 0x08FF
|
||||
#define ETH_P_IEEEPUP 0x0a00
|
||||
#define ETH_P_IEEEPUPAT 0x0a01
|
||||
#define ETH_P_BATMAN 0x4305
|
||||
#define ETH_P_DEC 0x6000
|
||||
#define ETH_P_DNA_DL 0x6001
|
||||
#define ETH_P_DNA_RC 0x6002
|
||||
#define ETH_P_DNA_RT 0x6003
|
||||
#define ETH_P_LAT 0x6004
|
||||
#define ETH_P_DIAG 0x6005
|
||||
#define ETH_P_CUST 0x6006
|
||||
#define ETH_P_SCA 0x6007
|
||||
#define ETH_P_TEB 0x6558
|
||||
#define ETH_P_RARP 0x8035
|
||||
#define ETH_P_ATALK 0x809B
|
||||
#define ETH_P_AARP 0x80F3
|
||||
#define ETH_P_8021Q 0x8100
|
||||
#define ETH_P_IPX 0x8137
|
||||
#define ETH_P_IPV6 0x86DD
|
||||
#define ETH_P_PAUSE 0x8808
|
||||
#define ETH_P_SLOW 0x8809
|
||||
#define ETH_P_WCCP 0x883E
|
||||
#define ETH_P_MPLS_UC 0x8847
|
||||
#define ETH_P_MPLS_MC 0x8848
|
||||
#define ETH_P_ATMMPOA 0x884c
|
||||
#define ETH_P_PPP_DISC 0x8863
|
||||
#define ETH_P_PPP_SES 0x8864
|
||||
#define ETH_P_LINK_CTL 0x886c
|
||||
#define ETH_P_ATMFATE 0x8884
|
||||
#define ETH_P_PAE 0x888E
|
||||
#define ETH_P_AOE 0x88A2
|
||||
#define ETH_P_8021AD 0x88A8
|
||||
#define ETH_P_802_EX1 0x88B5
|
||||
#define ETH_P_ERSPAN 0x88BE
|
||||
#define ETH_P_PREAUTH 0x88C7
|
||||
#define ETH_P_TIPC 0x88CA
|
||||
#define ETH_P_LLDP 0x88CC
|
||||
#define ETH_P_MRP 0x88E3
|
||||
#define ETH_P_MACSEC 0x88E5
|
||||
#define ETH_P_8021AH 0x88E7
|
||||
#define ETH_P_MVRP 0x88F5
|
||||
#define ETH_P_1588 0x88F7
|
||||
#define ETH_P_NCSI 0x88F8
|
||||
#define ETH_P_PRP 0x88FB
|
||||
#define ETH_P_CFM 0x8902
|
||||
#define ETH_P_FCOE 0x8906
|
||||
#define ETH_P_TDLS 0x890D
|
||||
#define ETH_P_FIP 0x8914
|
||||
#define ETH_P_IBOE 0x8915
|
||||
#define ETH_P_80221 0x8917
|
||||
#define ETH_P_HSR 0x892F
|
||||
#define ETH_P_NSH 0x894F
|
||||
#define ETH_P_LOOPBACK 0x9000
|
||||
#define ETH_P_QINQ1 0x9100
|
||||
#define ETH_P_QINQ2 0x9200
|
||||
#define ETH_P_QINQ3 0x9300
|
||||
#define ETH_P_EDSA 0xDADA
|
||||
#define ETH_P_DSA_8021Q 0xDADB
|
||||
#define ETH_P_IFE 0xED3E
|
||||
#define ETH_P_AF_IUCV 0xFBFB
|
||||
|
||||
#define ETH_P_802_3_MIN 0x0600
|
||||
|
||||
#define ETH_P_802_3 0x0001
|
||||
#define ETH_P_AX25 0x0002
|
||||
#define ETH_P_ALL 0x0003
|
||||
#define ETH_P_802_2 0x0004
|
||||
#define ETH_P_SNAP 0x0005
|
||||
#define ETH_P_DDCMP 0x0006
|
||||
#define ETH_P_WAN_PPP 0x0007
|
||||
#define ETH_P_PPP_MP 0x0008
|
||||
#define ETH_P_LOCALTALK 0x0009
|
||||
#define ETH_P_CAN 0x000C
|
||||
#define ETH_P_CANFD 0x000D
|
||||
#define ETH_P_PPPTALK 0x0010
|
||||
#define ETH_P_TR_802_2 0x0011
|
||||
#define ETH_P_MOBITEX 0x0015
|
||||
#define ETH_P_CONTROL 0x0016
|
||||
#define ETH_P_IRDA 0x0017
|
||||
#define ETH_P_ECONET 0x0018
|
||||
#define ETH_P_HDLC 0x0019
|
||||
#define ETH_P_ARCNET 0x001A
|
||||
#define ETH_P_DSA 0x001B
|
||||
#define ETH_P_TRAILER 0x001C
|
||||
#define ETH_P_PHONET 0x00F5
|
||||
#define ETH_P_IEEE802154 0x00F6
|
||||
#define ETH_P_CAIF 0x00F7
|
||||
#define ETH_P_XDSA 0x00F8
|
||||
#define ETH_P_MAP 0x00F9
|
||||
|
||||
struct ethhdr {
|
||||
uint8_t h_dest[ETH_ALEN];
|
||||
uint8_t h_source[ETH_ALEN];
|
||||
uint16_t h_proto;
|
||||
};
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
struct ether_arp {
|
||||
struct arphdr ea_hdr;
|
||||
uint8_t arp_sha[ETH_ALEN];
|
||||
uint8_t arp_spa[4];
|
||||
uint8_t arp_tha[ETH_ALEN];
|
||||
uint8_t arp_tpa[4];
|
||||
};
|
||||
#define arp_hrd ea_hdr.ar_hrd
|
||||
#define arp_pro ea_hdr.ar_pro
|
||||
#define arp_hln ea_hdr.ar_hln
|
||||
#define arp_pln ea_hdr.ar_pln
|
||||
#define arp_op ea_hdr.ar_op
|
||||
|
||||
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
|
||||
do { \
|
||||
(enaddr)[0] = 0x01; \
|
||||
(enaddr)[1] = 0x00; \
|
||||
(enaddr)[2] = 0x5e; \
|
||||
(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
|
||||
(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
|
||||
(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
|
||||
} while(0)
|
||||
|
||||
#define __UAPI_DEF_ETHHDR 0
|
||||
|
||||
#endif
|
||||
31
lib/libc/wasi/libc-top-half/musl/include/paths.h
vendored
31
lib/libc/wasi/libc-top-half/musl/include/paths.h
vendored
@ -1,31 +0,0 @@
|
||||
#ifndef _PATHS_H
|
||||
#define _PATHS_H
|
||||
|
||||
#define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
|
||||
#define _PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
|
||||
#define _PATH_BSHELL "/bin/sh"
|
||||
#define _PATH_CONSOLE "/dev/console"
|
||||
#define _PATH_DEVNULL "/dev/null"
|
||||
#define _PATH_KLOG "/proc/kmsg"
|
||||
#define _PATH_LASTLOG "/var/log/lastlog"
|
||||
#define _PATH_MAILDIR "/var/mail"
|
||||
#define _PATH_MAN "/usr/share/man"
|
||||
#define _PATH_MNTTAB "/etc/fstab"
|
||||
#define _PATH_MOUNTED "/etc/mtab"
|
||||
#define _PATH_NOLOGIN "/etc/nologin"
|
||||
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
|
||||
#define _PATH_SHADOW "/etc/shadow"
|
||||
#define _PATH_SHELLS "/etc/shells"
|
||||
#define _PATH_TTY "/dev/tty"
|
||||
#define _PATH_UTMP "/dev/null/utmp"
|
||||
#define _PATH_VI "/usr/bin/vi"
|
||||
#define _PATH_WTMP "/dev/null/wtmp"
|
||||
|
||||
#define _PATH_DEV "/dev/"
|
||||
#define _PATH_TMP "/tmp/"
|
||||
#define _PATH_VARDB "/var/lib/misc/"
|
||||
#define _PATH_VARRUN "/var/run/"
|
||||
#define _PATH_VARTMP "/var/tmp/"
|
||||
|
||||
#endif
|
||||
250
lib/libc/wasi/libc-top-half/musl/include/pthread.h
vendored
250
lib/libc/wasi/libc-top-half/musl/include/pthread.h
vendored
@ -1,250 +0,0 @@
|
||||
#ifndef _PTHREAD_H
|
||||
#define _PTHREAD_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_time_t
|
||||
#define __NEED_clockid_t
|
||||
#define __NEED_struct_timespec
|
||||
#define __NEED_sigset_t
|
||||
#define __NEED_pthread_t
|
||||
#define __NEED_pthread_attr_t
|
||||
#define __NEED_pthread_mutexattr_t
|
||||
#define __NEED_pthread_condattr_t
|
||||
#define __NEED_pthread_rwlockattr_t
|
||||
#define __NEED_pthread_barrierattr_t
|
||||
#define __NEED_pthread_mutex_t
|
||||
#define __NEED_pthread_cond_t
|
||||
#define __NEED_pthread_rwlock_t
|
||||
#define __NEED_pthread_barrier_t
|
||||
#define __NEED_pthread_spinlock_t
|
||||
#define __NEED_pthread_key_t
|
||||
#define __NEED_pthread_once_t
|
||||
#define __NEED_size_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <time.h>
|
||||
|
||||
#define PTHREAD_CREATE_JOINABLE 0
|
||||
#define PTHREAD_CREATE_DETACHED 1
|
||||
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
#define PTHREAD_MUTEX_DEFAULT 0
|
||||
#define PTHREAD_MUTEX_RECURSIVE 1
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 2
|
||||
|
||||
#define PTHREAD_MUTEX_STALLED 0
|
||||
#define PTHREAD_MUTEX_ROBUST 1
|
||||
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
|
||||
#define PTHREAD_INHERIT_SCHED 0
|
||||
#define PTHREAD_EXPLICIT_SCHED 1
|
||||
|
||||
#define PTHREAD_SCOPE_SYSTEM 0
|
||||
#define PTHREAD_SCOPE_PROCESS 1
|
||||
|
||||
#define PTHREAD_PROCESS_PRIVATE 0
|
||||
#define PTHREAD_PROCESS_SHARED 1
|
||||
|
||||
|
||||
#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
|
||||
#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
|
||||
#define PTHREAD_COND_INITIALIZER {{{0}}}
|
||||
#define PTHREAD_ONCE_INIT 0
|
||||
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
#define PTHREAD_CANCEL_MASKED 2
|
||||
|
||||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||
|
||||
#define PTHREAD_CANCELED ((void *)-1)
|
||||
|
||||
|
||||
#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
|
||||
|
||||
|
||||
#define PTHREAD_NULL ((pthread_t)0)
|
||||
|
||||
|
||||
int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
|
||||
int pthread_detach(pthread_t);
|
||||
#ifdef __wasilibc_unmodified_upstream
|
||||
_Noreturn void pthread_exit(void *);
|
||||
#endif
|
||||
int pthread_join(pthread_t, void **);
|
||||
|
||||
#ifdef __GNUC__
|
||||
__attribute__((const))
|
||||
#endif
|
||||
pthread_t pthread_self(void);
|
||||
|
||||
int pthread_equal(pthread_t, pthread_t);
|
||||
#ifndef __cplusplus
|
||||
#define pthread_equal(x,y) ((x)==(y))
|
||||
#endif
|
||||
|
||||
int pthread_setcancelstate(int, int *);
|
||||
int pthread_setcanceltype(int, int *);
|
||||
void pthread_testcancel(void);
|
||||
int pthread_cancel(pthread_t);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no CPU scheduling support. */
|
||||
int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
|
||||
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
|
||||
#endif
|
||||
int pthread_setschedprio(pthread_t, int);
|
||||
|
||||
int pthread_once(pthread_once_t *, void (*)(void));
|
||||
|
||||
int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
|
||||
int pthread_mutex_lock(pthread_mutex_t *);
|
||||
int pthread_mutex_unlock(pthread_mutex_t *);
|
||||
int pthread_mutex_trylock(pthread_mutex_t *);
|
||||
int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
|
||||
int pthread_mutex_destroy(pthread_mutex_t *);
|
||||
int pthread_mutex_consistent(pthread_mutex_t *);
|
||||
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
|
||||
|
||||
int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
|
||||
int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
|
||||
int pthread_cond_broadcast(pthread_cond_t *);
|
||||
int pthread_cond_signal(pthread_cond_t *);
|
||||
|
||||
int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
|
||||
int pthread_rwlock_destroy(pthread_rwlock_t *);
|
||||
int pthread_rwlock_rdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
|
||||
int pthread_rwlock_wrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *);
|
||||
|
||||
int pthread_spin_init(pthread_spinlock_t *, int);
|
||||
int pthread_spin_destroy(pthread_spinlock_t *);
|
||||
int pthread_spin_lock(pthread_spinlock_t *);
|
||||
int pthread_spin_trylock(pthread_spinlock_t *);
|
||||
int pthread_spin_unlock(pthread_spinlock_t *);
|
||||
|
||||
int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
|
||||
int pthread_barrier_destroy(pthread_barrier_t *);
|
||||
int pthread_barrier_wait(pthread_barrier_t *);
|
||||
|
||||
int pthread_key_create(pthread_key_t *, void (*)(void *));
|
||||
int pthread_key_delete(pthread_key_t);
|
||||
void *pthread_getspecific(pthread_key_t);
|
||||
int pthread_setspecific(pthread_key_t, const void *);
|
||||
|
||||
int pthread_attr_init(pthread_attr_t *);
|
||||
int pthread_attr_destroy(pthread_attr_t *);
|
||||
|
||||
int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
|
||||
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
|
||||
int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
|
||||
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
|
||||
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
|
||||
int pthread_attr_setdetachstate(pthread_attr_t *, int);
|
||||
int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
|
||||
int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
|
||||
int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
|
||||
int pthread_attr_setscope(pthread_attr_t *, int);
|
||||
int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
|
||||
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no CPU scheduling support. */
|
||||
int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
|
||||
int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
|
||||
#endif
|
||||
int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
|
||||
int pthread_attr_setinheritsched(pthread_attr_t *, int);
|
||||
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
|
||||
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
|
||||
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
|
||||
int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
|
||||
int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
||||
|
||||
int pthread_condattr_init(pthread_condattr_t *);
|
||||
int pthread_condattr_destroy(pthread_condattr_t *);
|
||||
int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
|
||||
int pthread_condattr_setpshared(pthread_condattr_t *, int);
|
||||
int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
|
||||
int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
|
||||
|
||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
|
||||
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
|
||||
|
||||
int pthread_barrierattr_destroy(pthread_barrierattr_t *);
|
||||
int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
|
||||
int pthread_barrierattr_init(pthread_barrierattr_t *);
|
||||
int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
|
||||
|
||||
int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
|
||||
|
||||
int pthread_getconcurrency(void);
|
||||
int pthread_setconcurrency(int);
|
||||
|
||||
int pthread_getcpuclockid(pthread_t, clockid_t *);
|
||||
|
||||
struct __ptcb {
|
||||
void (*__f)(void *);
|
||||
void *__x;
|
||||
struct __ptcb *__next;
|
||||
};
|
||||
|
||||
void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
|
||||
void _pthread_cleanup_pop(struct __ptcb *, int);
|
||||
|
||||
#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
|
||||
#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
struct cpu_set_t;
|
||||
int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
|
||||
int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
|
||||
int pthread_getattr_np(pthread_t, pthread_attr_t *);
|
||||
int pthread_setname_np(pthread_t, const char *);
|
||||
int pthread_getname_np(pthread_t, char *, size_t);
|
||||
int pthread_getattr_default_np(pthread_attr_t *);
|
||||
int pthread_setattr_default_np(const pthread_attr_t *);
|
||||
int pthread_tryjoin_np(pthread_t, void **);
|
||||
int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
|
||||
#endif
|
||||
|
||||
#if _REDIR_TIME64
|
||||
__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
|
||||
__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
|
||||
__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
|
||||
__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
|
||||
#ifdef _GNU_SOURCE
|
||||
__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
18
lib/libc/wasi/libc-top-half/musl/include/pty.h
vendored
18
lib/libc/wasi/libc-top-half/musl/include/pty.h
vendored
@ -1,18 +0,0 @@
|
||||
#ifndef _PTY_H
|
||||
#define _PTY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
|
||||
int forkpty(int *, char *, const struct termios *, const struct winsize *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
50
lib/libc/wasi/libc-top-half/musl/include/pwd.h
vendored
50
lib/libc/wasi/libc-top-half/musl/include/pwd.h
vendored
@ -1,50 +0,0 @@
|
||||
#ifndef _PWD_H
|
||||
#define _PWD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_uid_t
|
||||
#define __NEED_gid_t
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __NEED_FILE
|
||||
#endif
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct passwd {
|
||||
char *pw_name;
|
||||
char *pw_passwd;
|
||||
uid_t pw_uid;
|
||||
gid_t pw_gid;
|
||||
char *pw_gecos;
|
||||
char *pw_dir;
|
||||
char *pw_shell;
|
||||
};
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
void setpwent (void);
|
||||
void endpwent (void);
|
||||
struct passwd *getpwent (void);
|
||||
#endif
|
||||
|
||||
struct passwd *getpwuid (uid_t);
|
||||
struct passwd *getpwnam (const char *);
|
||||
int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
|
||||
int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
struct passwd *fgetpwent(FILE *);
|
||||
int putpwent(const struct passwd *, FILE *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
142
lib/libc/wasi/libc-top-half/musl/include/resolv.h
vendored
142
lib/libc/wasi/libc-top-half/musl/include/resolv.h
vendored
@ -1,142 +0,0 @@
|
||||
#ifndef _RESOLV_H
|
||||
#define _RESOLV_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAXNS 3
|
||||
#define MAXDFLSRCH 3
|
||||
#define MAXDNSRCH 6
|
||||
#define LOCALDOMAINPARTS 2
|
||||
|
||||
#define RES_TIMEOUT 5
|
||||
#define MAXRESOLVSORT 10
|
||||
#define RES_MAXNDOTS 15
|
||||
#define RES_MAXRETRANS 30
|
||||
#define RES_MAXRETRY 5
|
||||
#define RES_DFLRETRY 2
|
||||
#define RES_MAXTIME 65535
|
||||
|
||||
/* unused; purely for broken apps */
|
||||
typedef struct __res_state {
|
||||
int retrans;
|
||||
int retry;
|
||||
unsigned long options;
|
||||
int nscount;
|
||||
struct sockaddr_in nsaddr_list[MAXNS];
|
||||
# define nsaddr nsaddr_list[0]
|
||||
unsigned short id;
|
||||
char *dnsrch[MAXDNSRCH+1];
|
||||
char defdname[256];
|
||||
unsigned long pfcode;
|
||||
unsigned ndots:4;
|
||||
unsigned nsort:4;
|
||||
unsigned ipv6_unavail:1;
|
||||
unsigned unused:23;
|
||||
struct {
|
||||
struct in_addr addr;
|
||||
uint32_t mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
void *qhook;
|
||||
void *rhook;
|
||||
int res_h_errno;
|
||||
int _vcsock;
|
||||
unsigned _flags;
|
||||
union {
|
||||
char pad[52];
|
||||
struct {
|
||||
uint16_t nscount;
|
||||
uint16_t nsmap[MAXNS];
|
||||
int nssocks[MAXNS];
|
||||
uint16_t nscount6;
|
||||
uint16_t nsinit;
|
||||
struct sockaddr_in6 *nsaddrs[MAXNS];
|
||||
unsigned int _initstamp[2];
|
||||
} _ext;
|
||||
} _u;
|
||||
} *res_state;
|
||||
|
||||
#define __RES 19960801
|
||||
|
||||
#ifndef _PATH_RESCONF
|
||||
#define _PATH_RESCONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
||||
struct res_sym {
|
||||
int number;
|
||||
char *name;
|
||||
char *humanname;
|
||||
};
|
||||
|
||||
#define RES_F_VC 0x00000001
|
||||
#define RES_F_CONN 0x00000002
|
||||
#define RES_F_EDNS0ERR 0x00000004
|
||||
|
||||
#define RES_EXHAUSTIVE 0x00000001
|
||||
|
||||
#define RES_INIT 0x00000001
|
||||
#define RES_DEBUG 0x00000002
|
||||
#define RES_AAONLY 0x00000004
|
||||
#define RES_USEVC 0x00000008
|
||||
#define RES_PRIMARY 0x00000010
|
||||
#define RES_IGNTC 0x00000020
|
||||
#define RES_RECURSE 0x00000040
|
||||
#define RES_DEFNAMES 0x00000080
|
||||
#define RES_STAYOPEN 0x00000100
|
||||
#define RES_DNSRCH 0x00000200
|
||||
#define RES_INSECURE1 0x00000400
|
||||
#define RES_INSECURE2 0x00000800
|
||||
#define RES_NOALIASES 0x00001000
|
||||
#define RES_USE_INET6 0x00002000
|
||||
#define RES_ROTATE 0x00004000
|
||||
#define RES_NOCHECKNAME 0x00008000
|
||||
#define RES_KEEPTSIG 0x00010000
|
||||
#define RES_BLAST 0x00020000
|
||||
#define RES_USEBSTRING 0x00040000
|
||||
#define RES_NOIP6DOTINT 0x00080000
|
||||
#define RES_USE_EDNS0 0x00100000
|
||||
#define RES_SNGLKUP 0x00200000
|
||||
#define RES_SNGLKUPREOP 0x00400000
|
||||
#define RES_USE_DNSSEC 0x00800000
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
|
||||
|
||||
#define RES_PRF_STATS 0x00000001
|
||||
#define RES_PRF_UPDATE 0x00000002
|
||||
#define RES_PRF_CLASS 0x00000004
|
||||
#define RES_PRF_CMD 0x00000008
|
||||
#define RES_PRF_QUES 0x00000010
|
||||
#define RES_PRF_ANS 0x00000020
|
||||
#define RES_PRF_AUTH 0x00000040
|
||||
#define RES_PRF_ADD 0x00000080
|
||||
#define RES_PRF_HEAD1 0x00000100
|
||||
#define RES_PRF_HEAD2 0x00000200
|
||||
#define RES_PRF_TTLID 0x00000400
|
||||
#define RES_PRF_HEADX 0x00000800
|
||||
#define RES_PRF_QUERY 0x00001000
|
||||
#define RES_PRF_REPLY 0x00002000
|
||||
#define RES_PRF_INIT 0x00004000
|
||||
|
||||
struct __res_state *__res_state(void);
|
||||
#define _res (*__res_state())
|
||||
|
||||
int res_init(void);
|
||||
int res_query(const char *, int, int, unsigned char *, int);
|
||||
int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
|
||||
int res_search(const char *, int, int, unsigned char *, int);
|
||||
int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
|
||||
int res_send(const unsigned char *, int, unsigned char *, int);
|
||||
int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
|
||||
int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
|
||||
int dn_skipname(const unsigned char *, const unsigned char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
150
lib/libc/wasi/libc-top-half/musl/include/scsi/scsi.h
vendored
150
lib/libc/wasi/libc-top-half/musl/include/scsi/scsi.h
vendored
@ -1,150 +0,0 @@
|
||||
#ifndef _SCSI_SCSI_H
|
||||
#define _SCSI_SCSI_H
|
||||
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define REZERO_UNIT 0x01
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define FORMAT_UNIT 0x04
|
||||
#define READ_BLOCK_LIMITS 0x05
|
||||
#define REASSIGN_BLOCKS 0x07
|
||||
#define READ_6 0x08
|
||||
#define WRITE_6 0x0a
|
||||
#define SEEK_6 0x0b
|
||||
#define READ_REVERSE 0x0f
|
||||
#define WRITE_FILEMARKS 0x10
|
||||
#define SPACE 0x11
|
||||
#define INQUIRY 0x12
|
||||
#define RECOVER_BUFFERED_DATA 0x14
|
||||
#define MODE_SELECT 0x15
|
||||
#define RESERVE 0x16
|
||||
#define RELEASE 0x17
|
||||
#define COPY 0x18
|
||||
#define ERASE 0x19
|
||||
#define MODE_SENSE 0x1a
|
||||
#define START_STOP 0x1b
|
||||
#define RECEIVE_DIAGNOSTIC 0x1c
|
||||
#define SEND_DIAGNOSTIC 0x1d
|
||||
#define ALLOW_MEDIUM_REMOVAL 0x1e
|
||||
#define SET_WINDOW 0x24
|
||||
#define READ_CAPACITY 0x25
|
||||
#define READ_10 0x28
|
||||
#define WRITE_10 0x2a
|
||||
#define SEEK_10 0x2b
|
||||
#define WRITE_VERIFY 0x2e
|
||||
#define VERIFY 0x2f
|
||||
#define SEARCH_HIGH 0x30
|
||||
#define SEARCH_EQUAL 0x31
|
||||
#define SEARCH_LOW 0x32
|
||||
#define SET_LIMITS 0x33
|
||||
#define PRE_FETCH 0x34
|
||||
#define READ_POSITION 0x34
|
||||
#define SYNCHRONIZE_CACHE 0x35
|
||||
#define LOCK_UNLOCK_CACHE 0x36
|
||||
#define READ_DEFECT_DATA 0x37
|
||||
#define MEDIUM_SCAN 0x38
|
||||
#define COMPARE 0x39
|
||||
#define COPY_VERIFY 0x3a
|
||||
#define WRITE_BUFFER 0x3b
|
||||
#define READ_BUFFER 0x3c
|
||||
#define UPDATE_BLOCK 0x3d
|
||||
#define READ_LONG 0x3e
|
||||
#define WRITE_LONG 0x3f
|
||||
#define CHANGE_DEFINITION 0x40
|
||||
#define WRITE_SAME 0x41
|
||||
#define READ_TOC 0x43
|
||||
#define LOG_SELECT 0x4c
|
||||
#define LOG_SENSE 0x4d
|
||||
#define MODE_SELECT_10 0x55
|
||||
#define RESERVE_10 0x56
|
||||
#define RELEASE_10 0x57
|
||||
#define MODE_SENSE_10 0x5a
|
||||
#define PERSISTENT_RESERVE_IN 0x5e
|
||||
#define PERSISTENT_RESERVE_OUT 0x5f
|
||||
#define MOVE_MEDIUM 0xa5
|
||||
#define READ_12 0xa8
|
||||
#define WRITE_12 0xaa
|
||||
#define WRITE_VERIFY_12 0xae
|
||||
#define SEARCH_HIGH_12 0xb0
|
||||
#define SEARCH_EQUAL_12 0xb1
|
||||
#define SEARCH_LOW_12 0xb2
|
||||
#define READ_ELEMENT_STATUS 0xb8
|
||||
#define SEND_VOLUME_TAG 0xb6
|
||||
#define WRITE_LONG_2 0xea
|
||||
#define GOOD 0x00
|
||||
#define CHECK_CONDITION 0x01
|
||||
#define CONDITION_GOOD 0x02
|
||||
#define BUSY 0x04
|
||||
#define INTERMEDIATE_GOOD 0x08
|
||||
#define INTERMEDIATE_C_GOOD 0x0a
|
||||
#define RESERVATION_CONFLICT 0x0c
|
||||
#define COMMAND_TERMINATED 0x11
|
||||
#define QUEUE_FULL 0x14
|
||||
#define STATUS_MASK 0x3e
|
||||
#define NO_SENSE 0x00
|
||||
#define RECOVERED_ERROR 0x01
|
||||
#define NOT_READY 0x02
|
||||
#define MEDIUM_ERROR 0x03
|
||||
#define HARDWARE_ERROR 0x04
|
||||
#define ILLEGAL_REQUEST 0x05
|
||||
#define UNIT_ATTENTION 0x06
|
||||
#define DATA_PROTECT 0x07
|
||||
#define BLANK_CHECK 0x08
|
||||
#define COPY_ABORTED 0x0a
|
||||
#define ABORTED_COMMAND 0x0b
|
||||
#define VOLUME_OVERFLOW 0x0d
|
||||
#define MISCOMPARE 0x0e
|
||||
#define TYPE_DISK 0x00
|
||||
#define TYPE_TAPE 0x01
|
||||
#define TYPE_PROCESSOR 0x03
|
||||
#define TYPE_WORM 0x04
|
||||
#define TYPE_ROM 0x05
|
||||
#define TYPE_SCANNER 0x06
|
||||
#define TYPE_MOD 0x07
|
||||
#define TYPE_MEDIUM_CHANGER 0x08
|
||||
#define TYPE_ENCLOSURE 0x0d
|
||||
#define TYPE_NO_LUN 0x7f
|
||||
#define COMMAND_COMPLETE 0x00
|
||||
#define EXTENDED_MESSAGE 0x01
|
||||
#define EXTENDED_MODIFY_DATA_POINTER 0x00
|
||||
#define EXTENDED_SDTR 0x01
|
||||
#define EXTENDED_EXTENDED_IDENTIFY 0x02
|
||||
#define EXTENDED_WDTR 0x03
|
||||
#define SAVE_POINTERS 0x02
|
||||
#define RESTORE_POINTERS 0x03
|
||||
#define DISCONNECT 0x04
|
||||
#define INITIATOR_ERROR 0x05
|
||||
#define ABORT 0x06
|
||||
#define MESSAGE_REJECT 0x07
|
||||
#define NOP 0x08
|
||||
#define MSG_PARITY_ERROR 0x09
|
||||
#define LINKED_CMD_COMPLETE 0x0a
|
||||
#define LINKED_FLG_CMD_COMPLETE 0x0b
|
||||
#define BUS_DEVICE_RESET 0x0c
|
||||
#define INITIATE_RECOVERY 0x0f
|
||||
#define RELEASE_RECOVERY 0x10
|
||||
#define SIMPLE_QUEUE_TAG 0x20
|
||||
#define HEAD_OF_QUEUE_TAG 0x21
|
||||
#define ORDERED_QUEUE_TAG 0x22
|
||||
#define SCSI_IOCTL_GET_IDLUN 0x5382
|
||||
#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
|
||||
#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
|
||||
#define SCSI_IOCTL_PROBE_HOST 0x5385
|
||||
#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
|
||||
|
||||
struct ccs_modesel_head {
|
||||
unsigned char _r1;
|
||||
unsigned char medium;
|
||||
unsigned char _r2;
|
||||
unsigned char block_desc_length;
|
||||
unsigned char density;
|
||||
unsigned char number_blocks_hi;
|
||||
unsigned char number_blocks_med;
|
||||
unsigned char number_blocks_lo;
|
||||
unsigned char _r3;
|
||||
unsigned char block_length_hi;
|
||||
unsigned char block_length_med;
|
||||
unsigned char block_length_lo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#ifndef _SCSI_IOCTL_H
|
||||
#define _SCSI_IOCTL_H
|
||||
#define SCSI_IOCTL_SEND_COMMAND 1
|
||||
#define SCSI_IOCTL_TEST_UNIT_READY 2
|
||||
#define SCSI_IOCTL_BENCHMARK_COMMAND 3
|
||||
#define SCSI_IOCTL_SYNC 4
|
||||
#define SCSI_IOCTL_START_UNIT 5
|
||||
#define SCSI_IOCTL_STOP_UNIT 6
|
||||
#define SCSI_IOCTL_DOORLOCK 0x5380
|
||||
#define SCSI_IOCTL_DOORUNLOCK 0x5381
|
||||
#endif
|
||||
129
lib/libc/wasi/libc-top-half/musl/include/scsi/sg.h
vendored
129
lib/libc/wasi/libc-top-half/musl/include/scsi/sg.h
vendored
@ -1,129 +0,0 @@
|
||||
#ifndef _SCSI_SG_H
|
||||
#define _SCSI_SG_H
|
||||
|
||||
#define SG_DXFER_NONE -1
|
||||
#define SG_DXFER_TO_DEV -2
|
||||
#define SG_DXFER_FROM_DEV -3
|
||||
#define SG_DXFER_TO_FROM_DEV -4
|
||||
#define SG_FLAG_DIRECT_IO 1
|
||||
#define SG_FLAG_LUN_INHIBIT 2
|
||||
#define SG_FLAG_NO_DXFER 0x10000
|
||||
#define SG_INFO_OK_MASK 0x1
|
||||
#define SG_INFO_OK 0x0
|
||||
#define SG_INFO_CHECK 0x1
|
||||
#define SG_INFO_DIRECT_IO_MASK 0x6
|
||||
#define SG_INFO_INDIRECT_IO 0x0
|
||||
#define SG_INFO_DIRECT_IO 0x2
|
||||
#define SG_INFO_MIXED_IO 0x4
|
||||
#define SG_EMULATED_HOST 0x2203
|
||||
#define SG_SET_TRANSFORM 0x2204
|
||||
#define SG_GET_TRANSFORM 0x2205
|
||||
#define SG_SET_RESERVED_SIZE 0x2275
|
||||
#define SG_GET_RESERVED_SIZE 0x2272
|
||||
#define SG_GET_SCSI_ID 0x2276
|
||||
#define SG_SET_FORCE_LOW_DMA 0x2279
|
||||
#define SG_GET_LOW_DMA 0x227a
|
||||
#define SG_SET_FORCE_PACK_ID 0x227b
|
||||
#define SG_GET_PACK_ID 0x227c
|
||||
#define SG_GET_NUM_WAITING 0x227d
|
||||
#define SG_GET_SG_TABLESIZE 0x227F
|
||||
#define SG_GET_VERSION_NUM 0x2282
|
||||
#define SG_SCSI_RESET 0x2284
|
||||
#define SG_SCSI_RESET_NOTHING 0
|
||||
#define SG_SCSI_RESET_DEVICE 1
|
||||
#define SG_SCSI_RESET_BUS 2
|
||||
#define SG_SCSI_RESET_HOST 3
|
||||
#define SG_IO 0x2285
|
||||
#define SG_GET_REQUEST_TABLE 0x2286
|
||||
#define SG_SET_KEEP_ORPHAN 0x2287
|
||||
#define SG_GET_KEEP_ORPHAN 0x2288
|
||||
#define SG_SCATTER_SZ (8 * 4096)
|
||||
#define SG_DEFAULT_RETRIES 1
|
||||
#define SG_DEF_FORCE_LOW_DMA 0
|
||||
#define SG_DEF_FORCE_PACK_ID 0
|
||||
#define SG_DEF_KEEP_ORPHAN 0
|
||||
#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
|
||||
#define SG_MAX_QUEUE 16
|
||||
#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
|
||||
#define SG_MAX_SENSE 16
|
||||
#define SG_SET_TIMEOUT 0x2201
|
||||
#define SG_GET_TIMEOUT 0x2202
|
||||
#define SG_GET_COMMAND_Q 0x2270
|
||||
#define SG_SET_COMMAND_Q 0x2271
|
||||
#define SG_SET_DEBUG 0x227e
|
||||
#define SG_NEXT_CMD_LEN 0x2283
|
||||
#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
|
||||
#define SG_DEF_COMMAND_Q 0
|
||||
#define SG_DEF_UNDERRUN_FLAG 0
|
||||
|
||||
typedef struct sg_iovec {
|
||||
void *iov_base;
|
||||
unsigned long iov_len;
|
||||
} sg_iovec_t;
|
||||
|
||||
typedef struct sg_io_hdr {
|
||||
int interface_id;
|
||||
int dxfer_direction;
|
||||
unsigned char cmd_len;
|
||||
unsigned char mx_sb_len;
|
||||
unsigned short iovec_count;
|
||||
unsigned dxfer_len;
|
||||
void *dxferp;
|
||||
unsigned char *cmdp;
|
||||
unsigned char *sbp;
|
||||
unsigned timeout;
|
||||
unsigned flags;
|
||||
int pack_id;
|
||||
void *usr_ptr;
|
||||
unsigned char status;
|
||||
unsigned char masked_status;
|
||||
unsigned char msg_status;
|
||||
unsigned char sb_len_wr;
|
||||
unsigned short host_status;
|
||||
unsigned short driver_status;
|
||||
int resid;
|
||||
unsigned int duration;
|
||||
unsigned int info;
|
||||
} sg_io_hdr_t;
|
||||
|
||||
struct sg_scsi_id {
|
||||
int host_no;
|
||||
int channel;
|
||||
int scsi_id;
|
||||
int lun;
|
||||
int scsi_type;
|
||||
short h_cmd_per_lun;
|
||||
short d_queue_depth;
|
||||
int unused[2];
|
||||
};
|
||||
|
||||
typedef struct sg_req_info {
|
||||
char req_state;
|
||||
char orphan;
|
||||
char sg_io_owned;
|
||||
char problem;
|
||||
int pack_id;
|
||||
void *usr_ptr;
|
||||
unsigned duration;
|
||||
int unused;
|
||||
} sg_req_info_t;
|
||||
|
||||
typedef struct sg_io_hdr Sg_io_hdr;
|
||||
typedef struct sg_io_vec Sg_io_vec;
|
||||
typedef struct sg_scsi_id Sg_scsi_id;
|
||||
typedef struct sg_req_info Sg_req_info;
|
||||
|
||||
struct sg_header {
|
||||
int pack_len;
|
||||
int reply_len;
|
||||
int pack_id;
|
||||
int result;
|
||||
unsigned twelve_byte:1;
|
||||
unsigned target_status:5;
|
||||
unsigned host_status:8;
|
||||
unsigned driver_status:8;
|
||||
unsigned other_flags:10;
|
||||
unsigned char sense_buffer[SG_MAX_SENSE];
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -7,7 +7,12 @@ extern "C" {
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no setjmp */
|
||||
#ifndef __wasilibc_unmodified_upstream
|
||||
/* WASI has no setjmp */
|
||||
#if !defined(__wasm_exception_handling__)
|
||||
#error Setjmp/longjmp support requires Exception handling support, which is [not yet standardized](https://github.com/WebAssembly/proposals?tab=readme-ov-file#phase-3---implementation-phase-cg--wg). To enable it, compile with `-mllvm -wasm-enable-sjlj` and use an engine that implements the Exception handling proposal.
|
||||
#endif
|
||||
#endif
|
||||
#include <bits/setjmp.h>
|
||||
|
||||
typedef struct __jmp_buf_tag {
|
||||
@ -40,9 +45,6 @@ int setjmp (jmp_buf) __setjmp_attr;
|
||||
_Noreturn void longjmp (jmp_buf, int);
|
||||
|
||||
#define setjmp setjmp
|
||||
#else
|
||||
#warning setjmp is not yet implemented for WASI
|
||||
#endif
|
||||
|
||||
#undef __setjmp_attr
|
||||
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
#ifndef _SHADOW_H
|
||||
#define _SHADOW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_FILE
|
||||
#define __NEED_size_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define SHADOW "/etc/shadow"
|
||||
|
||||
struct spwd {
|
||||
char *sp_namp;
|
||||
char *sp_pwdp;
|
||||
long sp_lstchg;
|
||||
long sp_min;
|
||||
long sp_max;
|
||||
long sp_warn;
|
||||
long sp_inact;
|
||||
long sp_expire;
|
||||
unsigned long sp_flag;
|
||||
};
|
||||
|
||||
void setspent(void);
|
||||
void endspent(void);
|
||||
struct spwd *getspent(void);
|
||||
struct spwd *fgetspent(FILE *);
|
||||
struct spwd *sgetspent(const char *);
|
||||
int putspent(const struct spwd *, FILE *);
|
||||
|
||||
struct spwd *getspnam(const char *);
|
||||
int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
|
||||
|
||||
int lckpwdf(void);
|
||||
int ulckpwdf(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
83
lib/libc/wasi/libc-top-half/musl/include/spawn.h
vendored
83
lib/libc/wasi/libc-top-half/musl/include/spawn.h
vendored
@ -1,83 +0,0 @@
|
||||
#ifndef _SPAWN_H
|
||||
#define _SPAWN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_mode_t
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_sigset_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
struct sched_param;
|
||||
|
||||
#define POSIX_SPAWN_RESETIDS 1
|
||||
#define POSIX_SPAWN_SETPGROUP 2
|
||||
#define POSIX_SPAWN_SETSIGDEF 4
|
||||
#define POSIX_SPAWN_SETSIGMASK 8
|
||||
#define POSIX_SPAWN_SETSCHEDPARAM 16
|
||||
#define POSIX_SPAWN_SETSCHEDULER 32
|
||||
#define POSIX_SPAWN_USEVFORK 64
|
||||
#define POSIX_SPAWN_SETSID 128
|
||||
|
||||
typedef struct {
|
||||
int __flags;
|
||||
pid_t __pgrp;
|
||||
sigset_t __def, __mask;
|
||||
int __prio, __pol;
|
||||
void *__fn;
|
||||
char __pad[64-sizeof(void *)];
|
||||
} posix_spawnattr_t;
|
||||
|
||||
typedef struct {
|
||||
int __pad0[2];
|
||||
void *__actions;
|
||||
int __pad[16];
|
||||
} posix_spawn_file_actions_t;
|
||||
|
||||
int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
|
||||
const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
|
||||
int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
|
||||
const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
|
||||
|
||||
int posix_spawnattr_init(posix_spawnattr_t *);
|
||||
int posix_spawnattr_destroy(posix_spawnattr_t *);
|
||||
|
||||
int posix_spawnattr_setflags(posix_spawnattr_t *, short);
|
||||
int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
|
||||
|
||||
int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
|
||||
int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
|
||||
|
||||
int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
|
||||
int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
|
||||
|
||||
int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
|
||||
int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
|
||||
|
||||
int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
|
||||
int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
|
||||
int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
|
||||
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
|
||||
|
||||
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
|
||||
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
|
||||
|
||||
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
|
||||
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
|
||||
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
|
||||
|
||||
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
|
||||
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
|
||||
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,21 +0,0 @@
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_va_list
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define va_start(v,l) __builtin_va_start(v,l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v,l) __builtin_va_arg(v,l)
|
||||
#define va_copy(d,s) __builtin_va_copy(d,s)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,27 +0,0 @@
|
||||
#ifndef _STDDEF_H
|
||||
#define _STDDEF_H
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#define NULL nullptr
|
||||
#elif defined(__cplusplus)
|
||||
#define NULL 0L
|
||||
#else
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
#define __NEED_ptrdiff_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_wchar_t
|
||||
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
|
||||
#define __NEED_max_align_t
|
||||
#endif
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#if __GNUC__ > 3
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
#else
|
||||
#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -128,9 +128,7 @@ int rand_r (unsigned *);
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
||||
|| defined(_BSD_SOURCE)
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no absolute paths */
|
||||
char *realpath (const char *__restrict, char *__restrict);
|
||||
#endif
|
||||
long int random (void);
|
||||
void srandom (unsigned int);
|
||||
char *initstate (unsigned int, char *, size_t);
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
#ifndef _SYS_ACCT_H
|
||||
#define _SYS_ACCT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define ACCT_COMM 16
|
||||
|
||||
typedef uint16_t comp_t;
|
||||
|
||||
struct acct {
|
||||
char ac_flag;
|
||||
uint16_t ac_uid;
|
||||
uint16_t ac_gid;
|
||||
uint16_t ac_tty;
|
||||
uint32_t ac_btime;
|
||||
comp_t ac_utime;
|
||||
comp_t ac_stime;
|
||||
comp_t ac_etime;
|
||||
comp_t ac_mem;
|
||||
comp_t ac_io;
|
||||
comp_t ac_rw;
|
||||
comp_t ac_minflt;
|
||||
comp_t ac_majflt;
|
||||
comp_t ac_swaps;
|
||||
uint32_t ac_exitcode;
|
||||
char ac_comm[ACCT_COMM+1];
|
||||
char ac_pad[10];
|
||||
};
|
||||
|
||||
|
||||
struct acct_v3 {
|
||||
char ac_flag;
|
||||
char ac_version;
|
||||
uint16_t ac_tty;
|
||||
uint32_t ac_exitcode;
|
||||
uint32_t ac_uid;
|
||||
uint32_t ac_gid;
|
||||
uint32_t ac_pid;
|
||||
uint32_t ac_ppid;
|
||||
uint32_t ac_btime;
|
||||
float ac_etime;
|
||||
comp_t ac_utime;
|
||||
comp_t ac_stime;
|
||||
comp_t ac_mem;
|
||||
comp_t ac_io;
|
||||
comp_t ac_rw;
|
||||
comp_t ac_minflt;
|
||||
comp_t ac_majflt;
|
||||
comp_t ac_swaps;
|
||||
char ac_comm[ACCT_COMM];
|
||||
};
|
||||
|
||||
#define AFORK 1
|
||||
#define ASU 2
|
||||
#define ACORE 8
|
||||
#define AXSIG 16
|
||||
#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
|
||||
#define AHZ 100
|
||||
|
||||
int acct(const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,17 +0,0 @@
|
||||
#ifndef _SYS_AUXV_H
|
||||
#define _SYS_AUXV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <bits/hwcap.h>
|
||||
|
||||
unsigned long getauxval(unsigned long);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,22 +0,0 @@
|
||||
#ifndef _SYS_CACHECTL_H
|
||||
#define _SYS_CACHECTL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ICACHE (1<<0)
|
||||
#define DCACHE (1<<1)
|
||||
#define BCACHE (ICACHE|DCACHE)
|
||||
#define CACHEABLE 0
|
||||
#define UNCACHEABLE 1
|
||||
|
||||
int cachectl(void *, int, int);
|
||||
int cacheflush(void *, int, int);
|
||||
int _flush_cache(void *, int, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,69 +0,0 @@
|
||||
#ifndef _SYS_EPOLL_H
|
||||
#define _SYS_EPOLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define __NEED_sigset_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define EPOLL_CLOEXEC O_CLOEXEC
|
||||
#define EPOLL_NONBLOCK O_NONBLOCK
|
||||
|
||||
enum EPOLL_EVENTS { __EPOLL_DUMMY };
|
||||
#define EPOLLIN 0x001
|
||||
#define EPOLLPRI 0x002
|
||||
#define EPOLLOUT 0x004
|
||||
#define EPOLLRDNORM 0x040
|
||||
#define EPOLLNVAL 0x020
|
||||
#define EPOLLRDBAND 0x080
|
||||
#define EPOLLWRNORM 0x100
|
||||
#define EPOLLWRBAND 0x200
|
||||
#define EPOLLMSG 0x400
|
||||
#define EPOLLERR 0x008
|
||||
#define EPOLLHUP 0x010
|
||||
#define EPOLLRDHUP 0x2000
|
||||
#define EPOLLEXCLUSIVE (1U<<28)
|
||||
#define EPOLLWAKEUP (1U<<29)
|
||||
#define EPOLLONESHOT (1U<<30)
|
||||
#define EPOLLET (1U<<31)
|
||||
|
||||
#define EPOLL_CTL_ADD 1
|
||||
#define EPOLL_CTL_DEL 2
|
||||
#define EPOLL_CTL_MOD 3
|
||||
|
||||
typedef union epoll_data {
|
||||
void *ptr;
|
||||
int fd;
|
||||
uint32_t u32;
|
||||
uint64_t u64;
|
||||
} epoll_data_t;
|
||||
|
||||
struct epoll_event {
|
||||
uint32_t events;
|
||||
epoll_data_t data;
|
||||
}
|
||||
#ifdef __x86_64__
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
int epoll_create(int);
|
||||
int epoll_create1(int);
|
||||
int epoll_ctl(int, int, int, struct epoll_event *);
|
||||
int epoll_wait(int, struct epoll_event *, int, int);
|
||||
int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* sys/epoll.h */
|
||||
@ -1,111 +0,0 @@
|
||||
#ifndef _FANOTIFY_H
|
||||
#define _FANOTIFY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/statfs.h>
|
||||
|
||||
struct fanotify_event_metadata {
|
||||
unsigned event_len;
|
||||
unsigned char vers;
|
||||
unsigned char reserved;
|
||||
unsigned short metadata_len;
|
||||
unsigned long long mask
|
||||
#ifdef __GNUC__
|
||||
__attribute__((__aligned__(8)))
|
||||
#endif
|
||||
;
|
||||
int fd;
|
||||
int pid;
|
||||
};
|
||||
|
||||
struct fanotify_event_info_header {
|
||||
unsigned char info_type;
|
||||
unsigned char pad;
|
||||
unsigned short len;
|
||||
};
|
||||
|
||||
struct fanotify_event_info_fid {
|
||||
struct fanotify_event_info_header hdr;
|
||||
fsid_t fsid;
|
||||
unsigned char handle[];
|
||||
};
|
||||
|
||||
struct fanotify_response {
|
||||
int fd;
|
||||
unsigned response;
|
||||
};
|
||||
|
||||
#define FAN_ACCESS 0x01
|
||||
#define FAN_MODIFY 0x02
|
||||
#define FAN_ATTRIB 0x04
|
||||
#define FAN_CLOSE_WRITE 0x08
|
||||
#define FAN_CLOSE_NOWRITE 0x10
|
||||
#define FAN_OPEN 0x20
|
||||
#define FAN_MOVED_FROM 0x40
|
||||
#define FAN_MOVED_TO 0x80
|
||||
#define FAN_CREATE 0x100
|
||||
#define FAN_DELETE 0x200
|
||||
#define FAN_DELETE_SELF 0x400
|
||||
#define FAN_MOVE_SELF 0x800
|
||||
#define FAN_OPEN_EXEC 0x1000
|
||||
#define FAN_Q_OVERFLOW 0x4000
|
||||
#define FAN_OPEN_PERM 0x10000
|
||||
#define FAN_ACCESS_PERM 0x20000
|
||||
#define FAN_OPEN_EXEC_PERM 0x40000
|
||||
#define FAN_DIR_MODIFY 0x00080000
|
||||
#define FAN_EVENT_ON_CHILD 0x08000000
|
||||
#define FAN_ONDIR 0x40000000
|
||||
#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
|
||||
#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
|
||||
#define FAN_CLOEXEC 0x01
|
||||
#define FAN_NONBLOCK 0x02
|
||||
#define FAN_CLASS_NOTIF 0
|
||||
#define FAN_CLASS_CONTENT 0x04
|
||||
#define FAN_CLASS_PRE_CONTENT 0x08
|
||||
#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
|
||||
#define FAN_UNLIMITED_QUEUE 0x10
|
||||
#define FAN_UNLIMITED_MARKS 0x20
|
||||
#define FAN_ENABLE_AUDIT 0x40
|
||||
#define FAN_REPORT_TID 0x100
|
||||
#define FAN_REPORT_FID 0x200
|
||||
#define FAN_REPORT_DIR_FID 0x00000400
|
||||
#define FAN_REPORT_NAME 0x00000800
|
||||
#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
|
||||
#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
|
||||
#define FAN_MARK_ADD 0x01
|
||||
#define FAN_MARK_REMOVE 0x02
|
||||
#define FAN_MARK_DONT_FOLLOW 0x04
|
||||
#define FAN_MARK_ONLYDIR 0x08
|
||||
#define FAN_MARK_IGNORED_MASK 0x20
|
||||
#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
|
||||
#define FAN_MARK_FLUSH 0x80
|
||||
#define FAN_MARK_INODE 0x00
|
||||
#define FAN_MARK_MOUNT 0x10
|
||||
#define FAN_MARK_FILESYSTEM 0x100
|
||||
#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
|
||||
#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
|
||||
#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
|
||||
#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
|
||||
#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
|
||||
#define FANOTIFY_METADATA_VERSION 3
|
||||
#define FAN_EVENT_INFO_TYPE_FID 1
|
||||
#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
|
||||
#define FAN_EVENT_INFO_TYPE_DFID 3
|
||||
#define FAN_ALLOW 0x01
|
||||
#define FAN_DENY 0x02
|
||||
#define FAN_AUDIT 0x10
|
||||
#define FAN_NOFD -1
|
||||
#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
|
||||
#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
|
||||
#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
|
||||
|
||||
int fanotify_init(unsigned, unsigned);
|
||||
int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,20 +0,0 @@
|
||||
#ifndef _SYS_FSUID_H
|
||||
#define _SYS_FSUID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_uid_t
|
||||
#define __NEED_gid_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
int setfsuid(uid_t);
|
||||
int setfsgid(gid_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,58 +0,0 @@
|
||||
#ifndef _SYS_INOTIFY_H
|
||||
#define _SYS_INOTIFY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
struct inotify_event {
|
||||
int wd;
|
||||
uint32_t mask, cookie, len;
|
||||
char name[];
|
||||
};
|
||||
|
||||
#define IN_CLOEXEC O_CLOEXEC
|
||||
#define IN_NONBLOCK O_NONBLOCK
|
||||
|
||||
#define IN_ACCESS 0x00000001
|
||||
#define IN_MODIFY 0x00000002
|
||||
#define IN_ATTRIB 0x00000004
|
||||
#define IN_CLOSE_WRITE 0x00000008
|
||||
#define IN_CLOSE_NOWRITE 0x00000010
|
||||
#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
|
||||
#define IN_OPEN 0x00000020
|
||||
#define IN_MOVED_FROM 0x00000040
|
||||
#define IN_MOVED_TO 0x00000080
|
||||
#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO)
|
||||
#define IN_CREATE 0x00000100
|
||||
#define IN_DELETE 0x00000200
|
||||
#define IN_DELETE_SELF 0x00000400
|
||||
#define IN_MOVE_SELF 0x00000800
|
||||
#define IN_ALL_EVENTS 0x00000fff
|
||||
|
||||
#define IN_UNMOUNT 0x00002000
|
||||
#define IN_Q_OVERFLOW 0x00004000
|
||||
#define IN_IGNORED 0x00008000
|
||||
|
||||
#define IN_ONLYDIR 0x01000000
|
||||
#define IN_DONT_FOLLOW 0x02000000
|
||||
#define IN_EXCL_UNLINK 0x04000000
|
||||
#define IN_MASK_CREATE 0x10000000
|
||||
#define IN_MASK_ADD 0x20000000
|
||||
|
||||
#define IN_ISDIR 0x40000000
|
||||
#define IN_ONESHOT 0x80000000
|
||||
|
||||
int inotify_init(void);
|
||||
int inotify_init1(int);
|
||||
int inotify_add_watch(int, const char *, uint32_t);
|
||||
int inotify_rm_watch(int, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,17 +0,0 @@
|
||||
#ifndef _SYS_IO_H
|
||||
#define _SYS_IO_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <bits/io.h>
|
||||
|
||||
int iopl(int);
|
||||
int ioperm(unsigned long, unsigned long, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,42 +0,0 @@
|
||||
#ifndef _SYS_IPC_H
|
||||
#define _SYS_IPC_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_uid_t
|
||||
#define __NEED_gid_t
|
||||
#define __NEED_mode_t
|
||||
#define __NEED_key_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define __ipc_perm_key __key
|
||||
#define __ipc_perm_seq __seq
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define __key key
|
||||
#define __seq seq
|
||||
#endif
|
||||
|
||||
#include <bits/ipc.h>
|
||||
#include <bits/ipcstat.h>
|
||||
|
||||
#define IPC_CREAT 01000
|
||||
#define IPC_EXCL 02000
|
||||
#define IPC_NOWAIT 04000
|
||||
|
||||
#define IPC_RMID 0
|
||||
#define IPC_SET 1
|
||||
#define IPC_INFO 3
|
||||
|
||||
#define IPC_PRIVATE ((key_t) 0)
|
||||
|
||||
key_t ftok (const char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1 +0,0 @@
|
||||
#include <bits/kd.h>
|
||||
@ -1,14 +0,0 @@
|
||||
#ifndef _SYS_KLOG_H
|
||||
#define _SYS_KLOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int klogctl (int, char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,21 +0,0 @@
|
||||
#ifndef _SYS_MEMBARRIER_H
|
||||
#define _SYS_MEMBARRIER_H
|
||||
|
||||
#define MEMBARRIER_CMD_QUERY 0
|
||||
#define MEMBARRIER_CMD_GLOBAL 1
|
||||
#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
|
||||
#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
|
||||
#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
|
||||
#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
|
||||
#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
|
||||
#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
|
||||
#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
|
||||
#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
|
||||
|
||||
#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
|
||||
|
||||
#define MEMBARRIER_CMD_FLAG_CPU 1
|
||||
|
||||
int membarrier(int, int);
|
||||
|
||||
#endif
|
||||
@ -1,75 +0,0 @@
|
||||
#ifndef _SYS_MOUNT_H
|
||||
#define _SYS_MOUNT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define BLKROSET _IO(0x12, 93)
|
||||
#define BLKROGET _IO(0x12, 94)
|
||||
#define BLKRRPART _IO(0x12, 95)
|
||||
#define BLKGETSIZE _IO(0x12, 96)
|
||||
#define BLKFLSBUF _IO(0x12, 97)
|
||||
#define BLKRASET _IO(0x12, 98)
|
||||
#define BLKRAGET _IO(0x12, 99)
|
||||
#define BLKFRASET _IO(0x12,100)
|
||||
#define BLKFRAGET _IO(0x12,101)
|
||||
#define BLKSECTSET _IO(0x12,102)
|
||||
#define BLKSECTGET _IO(0x12,103)
|
||||
#define BLKSSZGET _IO(0x12,104)
|
||||
#define BLKBSZGET _IOR(0x12,112,size_t)
|
||||
#define BLKBSZSET _IOW(0x12,113,size_t)
|
||||
#define BLKGETSIZE64 _IOR(0x12,114,size_t)
|
||||
|
||||
#define MS_RDONLY 1
|
||||
#define MS_NOSUID 2
|
||||
#define MS_NODEV 4
|
||||
#define MS_NOEXEC 8
|
||||
#define MS_SYNCHRONOUS 16
|
||||
#define MS_REMOUNT 32
|
||||
#define MS_MANDLOCK 64
|
||||
#define MS_DIRSYNC 128
|
||||
#define MS_NOSYMFOLLOW 256
|
||||
#define MS_NOATIME 1024
|
||||
#define MS_NODIRATIME 2048
|
||||
#define MS_BIND 4096
|
||||
#define MS_MOVE 8192
|
||||
#define MS_REC 16384
|
||||
#define MS_SILENT 32768
|
||||
#define MS_POSIXACL (1<<16)
|
||||
#define MS_UNBINDABLE (1<<17)
|
||||
#define MS_PRIVATE (1<<18)
|
||||
#define MS_SLAVE (1<<19)
|
||||
#define MS_SHARED (1<<20)
|
||||
#define MS_RELATIME (1<<21)
|
||||
#define MS_KERNMOUNT (1<<22)
|
||||
#define MS_I_VERSION (1<<23)
|
||||
#define MS_STRICTATIME (1<<24)
|
||||
#define MS_LAZYTIME (1<<25)
|
||||
#define MS_NOREMOTELOCK (1<<27)
|
||||
#define MS_NOSEC (1<<28)
|
||||
#define MS_BORN (1<<29)
|
||||
#define MS_ACTIVE (1<<30)
|
||||
#define MS_NOUSER (1U<<31)
|
||||
|
||||
#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
|
||||
|
||||
#define MS_MGC_VAL 0xc0ed0000
|
||||
#define MS_MGC_MSK 0xffff0000
|
||||
|
||||
#define MNT_FORCE 1
|
||||
#define MNT_DETACH 2
|
||||
#define MNT_EXPIRE 4
|
||||
#define UMOUNT_NOFOLLOW 8
|
||||
|
||||
int mount(const char *, const char *, const char *, unsigned long, const void *);
|
||||
int umount(const char *);
|
||||
int umount2(const char *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,53 +0,0 @@
|
||||
#ifndef _SYS_MSG_H
|
||||
#define _SYS_MSG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_key_t
|
||||
#define __NEED_time_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_ssize_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
typedef unsigned long msgqnum_t;
|
||||
typedef unsigned long msglen_t;
|
||||
|
||||
#include <bits/msg.h>
|
||||
|
||||
#define __msg_cbytes msg_cbytes
|
||||
|
||||
#define MSG_NOERROR 010000
|
||||
#define MSG_EXCEPT 020000
|
||||
|
||||
#define MSG_STAT (11 | (IPC_STAT & 0x100))
|
||||
#define MSG_INFO 12
|
||||
#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
|
||||
|
||||
struct msginfo {
|
||||
int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
|
||||
unsigned short msgseg;
|
||||
};
|
||||
|
||||
int msgctl (int, int, struct msqid_ds *);
|
||||
int msgget (key_t, int);
|
||||
ssize_t msgrcv (int, void *, size_t, long, int);
|
||||
int msgsnd (int, const void *, size_t, int);
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
struct msgbuf {
|
||||
long mtype;
|
||||
char mtext[1];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
188
lib/libc/wasi/libc-top-half/musl/include/sys/mtio.h
vendored
188
lib/libc/wasi/libc-top-half/musl/include/sys/mtio.h
vendored
@ -1,188 +0,0 @@
|
||||
#ifndef _SYS_MTIO_H
|
||||
#define _SYS_MTIO_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
struct mtop {
|
||||
short mt_op;
|
||||
int mt_count;
|
||||
};
|
||||
|
||||
#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
|
||||
#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
|
||||
#define _IOT_mtpos _IOT_SIMPLE (long)
|
||||
#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
|
||||
|
||||
|
||||
#define MTRESET 0
|
||||
#define MTFSF 1
|
||||
#define MTBSF 2
|
||||
#define MTFSR 3
|
||||
#define MTBSR 4
|
||||
#define MTWEOF 5
|
||||
#define MTREW 6
|
||||
#define MTOFFL 7
|
||||
#define MTNOP 8
|
||||
#define MTRETEN 9
|
||||
#define MTBSFM 10
|
||||
#define MTFSFM 11
|
||||
#define MTEOM 12
|
||||
#define MTERASE 13
|
||||
#define MTRAS1 14
|
||||
#define MTRAS2 15
|
||||
#define MTRAS3 16
|
||||
#define MTSETBLK 20
|
||||
#define MTSETDENSITY 21
|
||||
#define MTSEEK 22
|
||||
#define MTTELL 23
|
||||
#define MTSETDRVBUFFER 24
|
||||
#define MTFSS 25
|
||||
#define MTBSS 26
|
||||
#define MTWSM 27
|
||||
#define MTLOCK 28
|
||||
#define MTUNLOCK 29
|
||||
#define MTLOAD 30
|
||||
#define MTUNLOAD 31
|
||||
#define MTCOMPRESSION 32
|
||||
#define MTSETPART 33
|
||||
#define MTMKPART 34
|
||||
|
||||
struct mtget {
|
||||
long mt_type;
|
||||
long mt_resid;
|
||||
long mt_dsreg;
|
||||
long mt_gstat;
|
||||
long mt_erreg;
|
||||
int mt_fileno;
|
||||
int mt_blkno;
|
||||
};
|
||||
|
||||
#define MT_ISUNKNOWN 0x01
|
||||
#define MT_ISQIC02 0x02
|
||||
#define MT_ISWT5150 0x03
|
||||
#define MT_ISARCHIVE_5945L2 0x04
|
||||
#define MT_ISCMSJ500 0x05
|
||||
#define MT_ISTDC3610 0x06
|
||||
#define MT_ISARCHIVE_VP60I 0x07
|
||||
#define MT_ISARCHIVE_2150L 0x08
|
||||
#define MT_ISARCHIVE_2060L 0x09
|
||||
#define MT_ISARCHIVESC499 0x0A
|
||||
#define MT_ISQIC02_ALL_FEATURES 0x0F
|
||||
#define MT_ISWT5099EEN24 0x11
|
||||
#define MT_ISTEAC_MT2ST 0x12
|
||||
#define MT_ISEVEREX_FT40A 0x32
|
||||
#define MT_ISDDS1 0x51
|
||||
#define MT_ISDDS2 0x52
|
||||
#define MT_ISSCSI1 0x71
|
||||
#define MT_ISSCSI2 0x72
|
||||
#define MT_ISFTAPE_UNKNOWN 0x800000
|
||||
#define MT_ISFTAPE_FLAG 0x800000
|
||||
|
||||
struct mt_tape_info {
|
||||
long t_type;
|
||||
char *t_name;
|
||||
};
|
||||
|
||||
#define MT_TAPE_INFO \
|
||||
{ \
|
||||
{MT_ISUNKNOWN, "Unknown type of tape device"}, \
|
||||
{MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
|
||||
{MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
|
||||
{MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
|
||||
{MT_ISCMSJ500, "CMS Jumbo 500"}, \
|
||||
{MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
|
||||
{MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
|
||||
{MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
|
||||
{MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
|
||||
{MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
|
||||
{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
|
||||
{MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
|
||||
{MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
|
||||
{MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
|
||||
{MT_ISSCSI1, "Generic SCSI-1 tape"}, \
|
||||
{MT_ISSCSI2, "Generic SCSI-2 tape"}, \
|
||||
{0, 0} \
|
||||
}
|
||||
|
||||
struct mtpos {
|
||||
long mt_blkno;
|
||||
};
|
||||
|
||||
struct mtconfiginfo {
|
||||
long mt_type;
|
||||
long ifc_type;
|
||||
unsigned short irqnr;
|
||||
unsigned short dmanr;
|
||||
unsigned short port;
|
||||
unsigned long debug;
|
||||
unsigned have_dens:1;
|
||||
unsigned have_bsf:1;
|
||||
unsigned have_fsr:1;
|
||||
unsigned have_bsr:1;
|
||||
unsigned have_eod:1;
|
||||
unsigned have_seek:1;
|
||||
unsigned have_tell:1;
|
||||
unsigned have_ras1:1;
|
||||
unsigned have_ras2:1;
|
||||
unsigned have_ras3:1;
|
||||
unsigned have_qfa:1;
|
||||
unsigned pad1:5;
|
||||
char reserved[10];
|
||||
};
|
||||
|
||||
#define MTIOCTOP _IOW('m', 1, struct mtop)
|
||||
#define MTIOCGET _IOR('m', 2, struct mtget)
|
||||
#define MTIOCPOS _IOR('m', 3, struct mtpos)
|
||||
|
||||
#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo)
|
||||
#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo)
|
||||
|
||||
#define GMT_EOF(x) ((x) & 0x80000000)
|
||||
#define GMT_BOT(x) ((x) & 0x40000000)
|
||||
#define GMT_EOT(x) ((x) & 0x20000000)
|
||||
#define GMT_SM(x) ((x) & 0x10000000)
|
||||
#define GMT_EOD(x) ((x) & 0x08000000)
|
||||
#define GMT_WR_PROT(x) ((x) & 0x04000000)
|
||||
#define GMT_ONLINE(x) ((x) & 0x01000000)
|
||||
#define GMT_D_6250(x) ((x) & 0x00800000)
|
||||
#define GMT_D_1600(x) ((x) & 0x00400000)
|
||||
#define GMT_D_800(x) ((x) & 0x00200000)
|
||||
#define GMT_DR_OPEN(x) ((x) & 0x00040000)
|
||||
#define GMT_IM_REP_EN(x) ((x) & 0x00010000)
|
||||
|
||||
#define MT_ST_BLKSIZE_SHIFT 0
|
||||
#define MT_ST_BLKSIZE_MASK 0xffffff
|
||||
#define MT_ST_DENSITY_SHIFT 24
|
||||
#define MT_ST_DENSITY_MASK 0xff000000
|
||||
#define MT_ST_SOFTERR_SHIFT 0
|
||||
#define MT_ST_SOFTERR_MASK 0xffff
|
||||
#define MT_ST_OPTIONS 0xf0000000
|
||||
#define MT_ST_BOOLEANS 0x10000000
|
||||
#define MT_ST_SETBOOLEANS 0x30000000
|
||||
#define MT_ST_CLEARBOOLEANS 0x40000000
|
||||
#define MT_ST_WRITE_THRESHOLD 0x20000000
|
||||
#define MT_ST_DEF_BLKSIZE 0x50000000
|
||||
#define MT_ST_DEF_OPTIONS 0x60000000
|
||||
#define MT_ST_BUFFER_WRITES 0x1
|
||||
#define MT_ST_ASYNC_WRITES 0x2
|
||||
#define MT_ST_READ_AHEAD 0x4
|
||||
#define MT_ST_DEBUGGING 0x8
|
||||
#define MT_ST_TWO_FM 0x10
|
||||
#define MT_ST_FAST_MTEOM 0x20
|
||||
#define MT_ST_AUTO_LOCK 0x40
|
||||
#define MT_ST_DEF_WRITES 0x80
|
||||
#define MT_ST_CAN_BSR 0x100
|
||||
#define MT_ST_NO_BLKLIMS 0x200
|
||||
#define MT_ST_CAN_PARTITIONS 0x400
|
||||
#define MT_ST_SCSI2LOGICAL 0x800
|
||||
#define MT_ST_CLEAR_DEFAULT 0xfffff
|
||||
#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000)
|
||||
#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000)
|
||||
#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000)
|
||||
#define MT_ST_HPLOADER_OFFSET 10000
|
||||
#ifndef DEFTAPE
|
||||
# define DEFTAPE "/dev/tape"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,49 +0,0 @@
|
||||
#ifndef _PERSONALITY_H
|
||||
#define _PERSONALITY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UNAME26 0x0020000
|
||||
#define ADDR_NO_RANDOMIZE 0x0040000
|
||||
#define FDPIC_FUNCPTRS 0x0080000
|
||||
#define MMAP_PAGE_ZERO 0x0100000
|
||||
#define ADDR_COMPAT_LAYOUT 0x0200000
|
||||
#define READ_IMPLIES_EXEC 0x0400000
|
||||
#define ADDR_LIMIT_32BIT 0x0800000
|
||||
#define SHORT_INODE 0x1000000
|
||||
#define WHOLE_SECONDS 0x2000000
|
||||
#define STICKY_TIMEOUTS 0x4000000
|
||||
#define ADDR_LIMIT_3GB 0x8000000
|
||||
|
||||
#define PER_LINUX 0
|
||||
#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
|
||||
#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
|
||||
#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
|
||||
#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
|
||||
#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
|
||||
#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
|
||||
#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
|
||||
#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
|
||||
#define PER_BSD 6
|
||||
#define PER_SUNOS (6 | STICKY_TIMEOUTS)
|
||||
#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
|
||||
#define PER_LINUX32 8
|
||||
#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
|
||||
#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
|
||||
#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
|
||||
#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
|
||||
#define PER_RISCOS 0xc
|
||||
#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
|
||||
#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
|
||||
#define PER_OSF4 0xf
|
||||
#define PER_HPUX 0x10
|
||||
#define PER_MASK 0xff
|
||||
|
||||
int personality(unsigned long);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
186
lib/libc/wasi/libc-top-half/musl/include/sys/prctl.h
vendored
186
lib/libc/wasi/libc-top-half/musl/include/sys/prctl.h
vendored
@ -1,186 +0,0 @@
|
||||
#ifndef _SYS_PRCTL_H
|
||||
#define _SYS_PRCTL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PR_SET_PDEATHSIG 1
|
||||
#define PR_GET_PDEATHSIG 2
|
||||
#define PR_GET_DUMPABLE 3
|
||||
#define PR_SET_DUMPABLE 4
|
||||
#define PR_GET_UNALIGN 5
|
||||
#define PR_SET_UNALIGN 6
|
||||
#define PR_UNALIGN_NOPRINT 1
|
||||
#define PR_UNALIGN_SIGBUS 2
|
||||
#define PR_GET_KEEPCAPS 7
|
||||
#define PR_SET_KEEPCAPS 8
|
||||
#define PR_GET_FPEMU 9
|
||||
#define PR_SET_FPEMU 10
|
||||
#define PR_FPEMU_NOPRINT 1
|
||||
#define PR_FPEMU_SIGFPE 2
|
||||
#define PR_GET_FPEXC 11
|
||||
#define PR_SET_FPEXC 12
|
||||
#define PR_FP_EXC_SW_ENABLE 0x80
|
||||
#define PR_FP_EXC_DIV 0x010000
|
||||
#define PR_FP_EXC_OVF 0x020000
|
||||
#define PR_FP_EXC_UND 0x040000
|
||||
#define PR_FP_EXC_RES 0x080000
|
||||
#define PR_FP_EXC_INV 0x100000
|
||||
#define PR_FP_EXC_DISABLED 0
|
||||
#define PR_FP_EXC_NONRECOV 1
|
||||
#define PR_FP_EXC_ASYNC 2
|
||||
#define PR_FP_EXC_PRECISE 3
|
||||
#define PR_GET_TIMING 13
|
||||
#define PR_SET_TIMING 14
|
||||
#define PR_TIMING_STATISTICAL 0
|
||||
#define PR_TIMING_TIMESTAMP 1
|
||||
#define PR_SET_NAME 15
|
||||
#define PR_GET_NAME 16
|
||||
#define PR_GET_ENDIAN 19
|
||||
#define PR_SET_ENDIAN 20
|
||||
#define PR_ENDIAN_BIG 0
|
||||
#define PR_ENDIAN_LITTLE 1
|
||||
#define PR_ENDIAN_PPC_LITTLE 2
|
||||
#define PR_GET_SECCOMP 21
|
||||
#define PR_SET_SECCOMP 22
|
||||
#define PR_CAPBSET_READ 23
|
||||
#define PR_CAPBSET_DROP 24
|
||||
#define PR_GET_TSC 25
|
||||
#define PR_SET_TSC 26
|
||||
#define PR_TSC_ENABLE 1
|
||||
#define PR_TSC_SIGSEGV 2
|
||||
#define PR_GET_SECUREBITS 27
|
||||
#define PR_SET_SECUREBITS 28
|
||||
#define PR_SET_TIMERSLACK 29
|
||||
#define PR_GET_TIMERSLACK 30
|
||||
|
||||
#define PR_TASK_PERF_EVENTS_DISABLE 31
|
||||
#define PR_TASK_PERF_EVENTS_ENABLE 32
|
||||
|
||||
#define PR_MCE_KILL 33
|
||||
#define PR_MCE_KILL_CLEAR 0
|
||||
#define PR_MCE_KILL_SET 1
|
||||
#define PR_MCE_KILL_LATE 0
|
||||
#define PR_MCE_KILL_EARLY 1
|
||||
#define PR_MCE_KILL_DEFAULT 2
|
||||
#define PR_MCE_KILL_GET 34
|
||||
|
||||
#define PR_SET_MM 35
|
||||
#define PR_SET_MM_START_CODE 1
|
||||
#define PR_SET_MM_END_CODE 2
|
||||
#define PR_SET_MM_START_DATA 3
|
||||
#define PR_SET_MM_END_DATA 4
|
||||
#define PR_SET_MM_START_STACK 5
|
||||
#define PR_SET_MM_START_BRK 6
|
||||
#define PR_SET_MM_BRK 7
|
||||
#define PR_SET_MM_ARG_START 8
|
||||
#define PR_SET_MM_ARG_END 9
|
||||
#define PR_SET_MM_ENV_START 10
|
||||
#define PR_SET_MM_ENV_END 11
|
||||
#define PR_SET_MM_AUXV 12
|
||||
#define PR_SET_MM_EXE_FILE 13
|
||||
#define PR_SET_MM_MAP 14
|
||||
#define PR_SET_MM_MAP_SIZE 15
|
||||
|
||||
struct prctl_mm_map {
|
||||
uint64_t start_code;
|
||||
uint64_t end_code;
|
||||
uint64_t start_data;
|
||||
uint64_t end_data;
|
||||
uint64_t start_brk;
|
||||
uint64_t brk;
|
||||
uint64_t start_stack;
|
||||
uint64_t arg_start;
|
||||
uint64_t arg_end;
|
||||
uint64_t env_start;
|
||||
uint64_t env_end;
|
||||
uint64_t *auxv;
|
||||
uint32_t auxv_size;
|
||||
uint32_t exe_fd;
|
||||
};
|
||||
|
||||
#define PR_SET_PTRACER 0x59616d61
|
||||
#define PR_SET_PTRACER_ANY (-1UL)
|
||||
|
||||
#define PR_SET_CHILD_SUBREAPER 36
|
||||
#define PR_GET_CHILD_SUBREAPER 37
|
||||
|
||||
#define PR_SET_NO_NEW_PRIVS 38
|
||||
#define PR_GET_NO_NEW_PRIVS 39
|
||||
|
||||
#define PR_GET_TID_ADDRESS 40
|
||||
|
||||
#define PR_SET_THP_DISABLE 41
|
||||
#define PR_GET_THP_DISABLE 42
|
||||
|
||||
#define PR_MPX_ENABLE_MANAGEMENT 43
|
||||
#define PR_MPX_DISABLE_MANAGEMENT 44
|
||||
|
||||
#define PR_SET_FP_MODE 45
|
||||
#define PR_GET_FP_MODE 46
|
||||
#define PR_FP_MODE_FR (1 << 0)
|
||||
#define PR_FP_MODE_FRE (1 << 1)
|
||||
|
||||
#define PR_CAP_AMBIENT 47
|
||||
#define PR_CAP_AMBIENT_IS_SET 1
|
||||
#define PR_CAP_AMBIENT_RAISE 2
|
||||
#define PR_CAP_AMBIENT_LOWER 3
|
||||
#define PR_CAP_AMBIENT_CLEAR_ALL 4
|
||||
|
||||
#define PR_SVE_SET_VL 50
|
||||
#define PR_SVE_SET_VL_ONEXEC (1 << 18)
|
||||
#define PR_SVE_GET_VL 51
|
||||
#define PR_SVE_VL_LEN_MASK 0xffff
|
||||
#define PR_SVE_VL_INHERIT (1 << 17)
|
||||
|
||||
#define PR_GET_SPECULATION_CTRL 52
|
||||
#define PR_SET_SPECULATION_CTRL 53
|
||||
#define PR_SPEC_STORE_BYPASS 0
|
||||
#define PR_SPEC_INDIRECT_BRANCH 1
|
||||
#define PR_SPEC_NOT_AFFECTED 0
|
||||
#define PR_SPEC_PRCTL (1UL << 0)
|
||||
#define PR_SPEC_ENABLE (1UL << 1)
|
||||
#define PR_SPEC_DISABLE (1UL << 2)
|
||||
#define PR_SPEC_FORCE_DISABLE (1UL << 3)
|
||||
#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
|
||||
|
||||
#define PR_PAC_RESET_KEYS 54
|
||||
#define PR_PAC_APIAKEY (1UL << 0)
|
||||
#define PR_PAC_APIBKEY (1UL << 1)
|
||||
#define PR_PAC_APDAKEY (1UL << 2)
|
||||
#define PR_PAC_APDBKEY (1UL << 3)
|
||||
#define PR_PAC_APGAKEY (1UL << 4)
|
||||
|
||||
#define PR_SET_TAGGED_ADDR_CTRL 55
|
||||
#define PR_GET_TAGGED_ADDR_CTRL 56
|
||||
#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
|
||||
#define PR_MTE_TCF_SHIFT 1
|
||||
#define PR_MTE_TCF_NONE (0UL << 1)
|
||||
#define PR_MTE_TCF_SYNC (1UL << 1)
|
||||
#define PR_MTE_TCF_ASYNC (2UL << 1)
|
||||
#define PR_MTE_TCF_MASK (3UL << 1)
|
||||
#define PR_MTE_TAG_SHIFT 3
|
||||
#define PR_MTE_TAG_MASK (0xffffUL << 3)
|
||||
|
||||
#define PR_SET_IO_FLUSHER 57
|
||||
#define PR_GET_IO_FLUSHER 58
|
||||
|
||||
#define PR_SET_SYSCALL_USER_DISPATCH 59
|
||||
#define PR_SYS_DISPATCH_OFF 0
|
||||
#define PR_SYS_DISPATCH_ON 1
|
||||
#define SYSCALL_DISPATCH_FILTER_ALLOW 0
|
||||
#define SYSCALL_DISPATCH_FILTER_BLOCK 1
|
||||
|
||||
#define PR_PAC_SET_ENABLED_KEYS 60
|
||||
#define PR_PAC_GET_ENABLED_KEYS 61
|
||||
|
||||
int prctl (int, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,63 +0,0 @@
|
||||
#ifndef _SYS_PROCFS_H
|
||||
#define _SYS_PROCFS_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
struct elf_siginfo {
|
||||
int si_signo;
|
||||
int si_code;
|
||||
int si_errno;
|
||||
};
|
||||
|
||||
struct elf_prstatus {
|
||||
struct elf_siginfo pr_info;
|
||||
short int pr_cursig;
|
||||
unsigned long int pr_sigpend;
|
||||
unsigned long int pr_sighold;
|
||||
pid_t pr_pid;
|
||||
pid_t pr_ppid;
|
||||
pid_t pr_pgrp;
|
||||
pid_t pr_sid;
|
||||
struct {
|
||||
long tv_sec, tv_usec;
|
||||
} pr_utime, pr_stime, pr_cutime, pr_cstime;
|
||||
elf_gregset_t pr_reg;
|
||||
int pr_fpvalid;
|
||||
};
|
||||
|
||||
#define ELF_PRARGSZ 80
|
||||
|
||||
struct elf_prpsinfo {
|
||||
char pr_state;
|
||||
char pr_sname;
|
||||
char pr_zomb;
|
||||
char pr_nice;
|
||||
unsigned long int pr_flag;
|
||||
#if UINTPTR_MAX == 0xffffffff
|
||||
unsigned short int pr_uid;
|
||||
unsigned short int pr_gid;
|
||||
#else
|
||||
unsigned int pr_uid;
|
||||
unsigned int pr_gid;
|
||||
#endif
|
||||
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
|
||||
char pr_fname[16];
|
||||
char pr_psargs[ELF_PRARGSZ];
|
||||
};
|
||||
|
||||
typedef void *psaddr_t;
|
||||
typedef elf_gregset_t prgregset_t;
|
||||
typedef elf_fpregset_t prfpregset_t;
|
||||
typedef pid_t lwpid_t;
|
||||
typedef struct elf_prstatus prstatus_t;
|
||||
typedef struct elf_prpsinfo prpsinfo_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,147 +0,0 @@
|
||||
#ifndef _SYS_PTRACE_H
|
||||
#define _SYS_PTRACE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define PTRACE_TRACEME 0
|
||||
#define PT_TRACE_ME PTRACE_TRACEME
|
||||
|
||||
#define PTRACE_PEEKTEXT 1
|
||||
#define PTRACE_PEEKDATA 2
|
||||
#define PTRACE_PEEKUSER 3
|
||||
#define PTRACE_POKETEXT 4
|
||||
#define PTRACE_POKEDATA 5
|
||||
#define PTRACE_POKEUSER 6
|
||||
#define PTRACE_CONT 7
|
||||
#define PTRACE_KILL 8
|
||||
#define PTRACE_SINGLESTEP 9
|
||||
#define PTRACE_GETREGS 12
|
||||
#define PTRACE_SETREGS 13
|
||||
#define PTRACE_GETFPREGS 14
|
||||
#define PTRACE_SETFPREGS 15
|
||||
#define PTRACE_ATTACH 16
|
||||
#define PTRACE_DETACH 17
|
||||
#define PTRACE_GETFPXREGS 18
|
||||
#define PTRACE_SETFPXREGS 19
|
||||
#define PTRACE_SYSCALL 24
|
||||
#define PTRACE_SETOPTIONS 0x4200
|
||||
#define PTRACE_GETEVENTMSG 0x4201
|
||||
#define PTRACE_GETSIGINFO 0x4202
|
||||
#define PTRACE_SETSIGINFO 0x4203
|
||||
#define PTRACE_GETREGSET 0x4204
|
||||
#define PTRACE_SETREGSET 0x4205
|
||||
#define PTRACE_SEIZE 0x4206
|
||||
#define PTRACE_INTERRUPT 0x4207
|
||||
#define PTRACE_LISTEN 0x4208
|
||||
#define PTRACE_PEEKSIGINFO 0x4209
|
||||
#define PTRACE_GETSIGMASK 0x420a
|
||||
#define PTRACE_SETSIGMASK 0x420b
|
||||
#define PTRACE_SECCOMP_GET_FILTER 0x420c
|
||||
#define PTRACE_SECCOMP_GET_METADATA 0x420d
|
||||
#define PTRACE_GET_SYSCALL_INFO 0x420e
|
||||
#define PTRACE_GET_RSEQ_CONFIGURATION 0x420f
|
||||
|
||||
#define PT_READ_I PTRACE_PEEKTEXT
|
||||
#define PT_READ_D PTRACE_PEEKDATA
|
||||
#define PT_READ_U PTRACE_PEEKUSER
|
||||
#define PT_WRITE_I PTRACE_POKETEXT
|
||||
#define PT_WRITE_D PTRACE_POKEDATA
|
||||
#define PT_WRITE_U PTRACE_POKEUSER
|
||||
#define PT_CONTINUE PTRACE_CONT
|
||||
#define PT_KILL PTRACE_KILL
|
||||
#define PT_STEP PTRACE_SINGLESTEP
|
||||
#define PT_GETREGS PTRACE_GETREGS
|
||||
#define PT_SETREGS PTRACE_SETREGS
|
||||
#define PT_GETFPREGS PTRACE_GETFPREGS
|
||||
#define PT_SETFPREGS PTRACE_SETFPREGS
|
||||
#define PT_ATTACH PTRACE_ATTACH
|
||||
#define PT_DETACH PTRACE_DETACH
|
||||
#define PT_GETFPXREGS PTRACE_GETFPXREGS
|
||||
#define PT_SETFPXREGS PTRACE_SETFPXREGS
|
||||
#define PT_SYSCALL PTRACE_SYSCALL
|
||||
#define PT_SETOPTIONS PTRACE_SETOPTIONS
|
||||
#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
|
||||
#define PT_GETSIGINFO PTRACE_GETSIGINFO
|
||||
#define PT_SETSIGINFO PTRACE_SETSIGINFO
|
||||
|
||||
#define PTRACE_O_TRACESYSGOOD 0x00000001
|
||||
#define PTRACE_O_TRACEFORK 0x00000002
|
||||
#define PTRACE_O_TRACEVFORK 0x00000004
|
||||
#define PTRACE_O_TRACECLONE 0x00000008
|
||||
#define PTRACE_O_TRACEEXEC 0x00000010
|
||||
#define PTRACE_O_TRACEVFORKDONE 0x00000020
|
||||
#define PTRACE_O_TRACEEXIT 0x00000040
|
||||
#define PTRACE_O_TRACESECCOMP 0x00000080
|
||||
#define PTRACE_O_EXITKILL 0x00100000
|
||||
#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
|
||||
#define PTRACE_O_MASK 0x003000ff
|
||||
|
||||
#define PTRACE_EVENT_FORK 1
|
||||
#define PTRACE_EVENT_VFORK 2
|
||||
#define PTRACE_EVENT_CLONE 3
|
||||
#define PTRACE_EVENT_EXEC 4
|
||||
#define PTRACE_EVENT_VFORK_DONE 5
|
||||
#define PTRACE_EVENT_EXIT 6
|
||||
#define PTRACE_EVENT_SECCOMP 7
|
||||
#define PTRACE_EVENT_STOP 128
|
||||
|
||||
#define PTRACE_PEEKSIGINFO_SHARED 1
|
||||
|
||||
#define PTRACE_SYSCALL_INFO_NONE 0
|
||||
#define PTRACE_SYSCALL_INFO_ENTRY 1
|
||||
#define PTRACE_SYSCALL_INFO_EXIT 2
|
||||
#define PTRACE_SYSCALL_INFO_SECCOMP 3
|
||||
|
||||
#include <bits/ptrace.h>
|
||||
|
||||
struct __ptrace_peeksiginfo_args {
|
||||
uint64_t off;
|
||||
uint32_t flags;
|
||||
int32_t nr;
|
||||
};
|
||||
|
||||
struct __ptrace_seccomp_metadata {
|
||||
uint64_t filter_off;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
struct __ptrace_syscall_info {
|
||||
uint8_t op;
|
||||
uint8_t __pad[3];
|
||||
uint32_t arch;
|
||||
uint64_t instruction_pointer;
|
||||
uint64_t stack_pointer;
|
||||
union {
|
||||
struct {
|
||||
uint64_t nr;
|
||||
uint64_t args[6];
|
||||
} entry;
|
||||
struct {
|
||||
int64_t rval;
|
||||
uint8_t is_error;
|
||||
} exit;
|
||||
struct {
|
||||
uint64_t nr;
|
||||
uint64_t args[6];
|
||||
uint32_t ret_data;
|
||||
} seccomp;
|
||||
};
|
||||
};
|
||||
|
||||
struct __ptrace_rseq_configuration {
|
||||
uint64_t rseq_abi_pointer;
|
||||
uint32_t rseq_abi_size;
|
||||
uint32_t signature;
|
||||
uint32_t flags;
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
long ptrace(int, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
102
lib/libc/wasi/libc-top-half/musl/include/sys/quota.h
vendored
102
lib/libc/wasi/libc-top-half/musl/include/sys/quota.h
vendored
@ -1,102 +0,0 @@
|
||||
#ifndef _SYS_QUOTA_H
|
||||
#define _SYS_QUOTA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define _LINUX_QUOTA_VERSION 2
|
||||
|
||||
#define dbtob(num) ((num) << 10)
|
||||
#define btodb(num) ((num) >> 10)
|
||||
#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
|
||||
|
||||
#define MAX_IQ_TIME 604800
|
||||
#define MAX_DQ_TIME 604800
|
||||
|
||||
#define MAXQUOTAS 2
|
||||
#define USRQUOTA 0
|
||||
#define GRPQUOTA 1
|
||||
|
||||
#define INITQFNAMES { "user", "group", "undefined" };
|
||||
|
||||
#define QUOTAFILENAME "quota"
|
||||
#define QUOTAGROUP "staff"
|
||||
|
||||
#define NR_DQHASH 43
|
||||
#define NR_DQUOTS 256
|
||||
|
||||
#define SUBCMDMASK 0x00ff
|
||||
#define SUBCMDSHIFT 8
|
||||
#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
|
||||
|
||||
#define Q_SYNC 0x800001
|
||||
#define Q_QUOTAON 0x800002
|
||||
#define Q_QUOTAOFF 0x800003
|
||||
#define Q_GETFMT 0x800004
|
||||
#define Q_GETINFO 0x800005
|
||||
#define Q_SETINFO 0x800006
|
||||
#define Q_GETQUOTA 0x800007
|
||||
#define Q_SETQUOTA 0x800008
|
||||
|
||||
#define QFMT_VFS_OLD 1
|
||||
#define QFMT_VFS_V0 2
|
||||
#define QFMT_OCFS2 3
|
||||
#define QFMT_VFS_V1 4
|
||||
|
||||
#define QIF_BLIMITS 1
|
||||
#define QIF_SPACE 2
|
||||
#define QIF_ILIMITS 4
|
||||
#define QIF_INODES 8
|
||||
#define QIF_BTIME 16
|
||||
#define QIF_ITIME 32
|
||||
#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
|
||||
#define QIF_USAGE (QIF_SPACE | QIF_INODES)
|
||||
#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
|
||||
#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
|
||||
|
||||
struct dqblk {
|
||||
uint64_t dqb_bhardlimit;
|
||||
uint64_t dqb_bsoftlimit;
|
||||
uint64_t dqb_curspace;
|
||||
uint64_t dqb_ihardlimit;
|
||||
uint64_t dqb_isoftlimit;
|
||||
uint64_t dqb_curinodes;
|
||||
uint64_t dqb_btime;
|
||||
uint64_t dqb_itime;
|
||||
uint32_t dqb_valid;
|
||||
};
|
||||
|
||||
#define dq_bhardlimit dq_dqb.dqb_bhardlimit
|
||||
#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
|
||||
#define dq_curspace dq_dqb.dqb_curspace
|
||||
#define dq_valid dq_dqb.dqb_valid
|
||||
#define dq_ihardlimit dq_dqb.dqb_ihardlimit
|
||||
#define dq_isoftlimit dq_dqb.dqb_isoftlimit
|
||||
#define dq_curinodes dq_dqb.dqb_curinodes
|
||||
#define dq_btime dq_dqb.dqb_btime
|
||||
#define dq_itime dq_dqb.dqb_itime
|
||||
|
||||
#define dqoff(UID) ((long long)(UID) * sizeof (struct dqblk))
|
||||
|
||||
#define IIF_BGRACE 1
|
||||
#define IIF_IGRACE 2
|
||||
#define IIF_FLAGS 4
|
||||
#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
|
||||
|
||||
struct dqinfo {
|
||||
uint64_t dqi_bgrace;
|
||||
uint64_t dqi_igrace;
|
||||
uint32_t dqi_flags;
|
||||
uint32_t dqi_valid;
|
||||
};
|
||||
|
||||
int quotactl(int, const char *, int, char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,20 +0,0 @@
|
||||
#ifndef _SYS_REBOOT_H
|
||||
#define _SYS_REBOOT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RB_AUTOBOOT 0x01234567
|
||||
#define RB_HALT_SYSTEM 0xcdef0123
|
||||
#define RB_ENABLE_CAD 0x89abcdef
|
||||
#define RB_DISABLE_CAD 0
|
||||
#define RB_POWER_OFF 0x4321fedc
|
||||
#define RB_SW_SUSPEND 0xd000fce2
|
||||
#define RB_KEXEC 0x45584543
|
||||
|
||||
int reboot(int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,72 +0,0 @@
|
||||
#ifndef _SYS_SEM_H
|
||||
#define _SYS_SEM_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_size_t
|
||||
#define __NEED_pid_t
|
||||
#define __NEED_time_t
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __NEED_struct_timespec
|
||||
#endif
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#define SEM_UNDO 0x1000
|
||||
#define GETPID 11
|
||||
#define GETVAL 12
|
||||
#define GETALL 13
|
||||
#define GETNCNT 14
|
||||
#define GETZCNT 15
|
||||
#define SETVAL 16
|
||||
#define SETALL 17
|
||||
|
||||
#include <bits/sem.h>
|
||||
|
||||
#define _SEM_SEMUN_UNDEFINED 1
|
||||
|
||||
#define SEM_STAT (18 | (IPC_STAT & 0x100))
|
||||
#define SEM_INFO 19
|
||||
#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
|
||||
|
||||
struct seminfo {
|
||||
int semmap;
|
||||
int semmni;
|
||||
int semmns;
|
||||
int semmnu;
|
||||
int semmsl;
|
||||
int semopm;
|
||||
int semume;
|
||||
int semusz;
|
||||
int semvmx;
|
||||
int semaem;
|
||||
};
|
||||
|
||||
struct sembuf {
|
||||
unsigned short sem_num;
|
||||
short sem_op;
|
||||
short sem_flg;
|
||||
};
|
||||
|
||||
int semctl(int, int, int, ...);
|
||||
int semget(key_t, int, int);
|
||||
int semop(int, struct sembuf *, size_t);
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
|
||||
#endif
|
||||
|
||||
#if _REDIR_TIME64
|
||||
#ifdef _GNU_SOURCE
|
||||
__REDIR(semtimedop, __semtimedop_time64);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,22 +0,0 @@
|
||||
#ifndef _SYS_SENDFILE_H
|
||||
#define _SYS_SENDFILE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ssize_t sendfile(int, int, off_t *, size_t);
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define sendfile64 sendfile
|
||||
#define off64_t off_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,70 +0,0 @@
|
||||
#ifndef _SYS_SHM_H
|
||||
#define _SYS_SHM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __NEED_time_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_pid_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __used_ids used_ids
|
||||
#define __swap_attempts swap_attempts
|
||||
#define __swap_successes swap_successes
|
||||
#endif
|
||||
|
||||
#include <bits/shm.h>
|
||||
|
||||
#define SHM_R 0400
|
||||
#define SHM_W 0200
|
||||
|
||||
#define SHM_RDONLY 010000
|
||||
#define SHM_RND 020000
|
||||
#define SHM_REMAP 040000
|
||||
#define SHM_EXEC 0100000
|
||||
|
||||
#define SHM_LOCK 11
|
||||
#define SHM_UNLOCK 12
|
||||
#define SHM_STAT (13 | (IPC_STAT & 0x100))
|
||||
#define SHM_INFO 14
|
||||
#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
|
||||
#define SHM_DEST 01000
|
||||
#define SHM_LOCKED 02000
|
||||
#define SHM_HUGETLB 04000
|
||||
#define SHM_NORESERVE 010000
|
||||
|
||||
#define SHM_HUGE_SHIFT 26
|
||||
#define SHM_HUGE_MASK 0x3f
|
||||
#define SHM_HUGE_64KB (16 << 26)
|
||||
#define SHM_HUGE_512KB (19 << 26)
|
||||
#define SHM_HUGE_1MB (20 << 26)
|
||||
#define SHM_HUGE_2MB (21 << 26)
|
||||
#define SHM_HUGE_8MB (23 << 26)
|
||||
#define SHM_HUGE_16MB (24 << 26)
|
||||
#define SHM_HUGE_32MB (25 << 26)
|
||||
#define SHM_HUGE_256MB (28 << 26)
|
||||
#define SHM_HUGE_512MB (29 << 26)
|
||||
#define SHM_HUGE_1GB (30 << 26)
|
||||
#define SHM_HUGE_2GB (31 << 26)
|
||||
#define SHM_HUGE_16GB (34U << 26)
|
||||
|
||||
typedef unsigned long shmatt_t;
|
||||
|
||||
void *shmat(int, const void *, int);
|
||||
int shmctl(int, int, struct shmid_ds *);
|
||||
int shmdt(const void *);
|
||||
int shmget(key_t, size_t, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,49 +0,0 @@
|
||||
#ifndef _SYS_SIGNALFD_H
|
||||
#define _SYS_SIGNALFD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define __NEED_sigset_t
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define SFD_CLOEXEC O_CLOEXEC
|
||||
#define SFD_NONBLOCK O_NONBLOCK
|
||||
|
||||
int signalfd(int, const sigset_t *, int);
|
||||
|
||||
struct signalfd_siginfo {
|
||||
uint32_t ssi_signo;
|
||||
int32_t ssi_errno;
|
||||
int32_t ssi_code;
|
||||
uint32_t ssi_pid;
|
||||
uint32_t ssi_uid;
|
||||
int32_t ssi_fd;
|
||||
uint32_t ssi_tid;
|
||||
uint32_t ssi_band;
|
||||
uint32_t ssi_overrun;
|
||||
uint32_t ssi_trapno;
|
||||
int32_t ssi_status;
|
||||
int32_t ssi_int;
|
||||
uint64_t ssi_ptr;
|
||||
uint64_t ssi_utime;
|
||||
uint64_t ssi_stime;
|
||||
uint64_t ssi_addr;
|
||||
uint16_t ssi_addr_lsb;
|
||||
uint16_t __pad2;
|
||||
int32_t ssi_syscall;
|
||||
uint64_t ssi_call_addr;
|
||||
uint32_t ssi_arch;
|
||||
uint8_t __pad[128-14*4-5*8-2*2];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,5 +1,8 @@
|
||||
#ifndef _SYS_SOCKET_H
|
||||
#define _SYS_SOCKET_H
|
||||
|
||||
#include <__wasi_snapshot.h>
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */
|
||||
#else
|
||||
#include <__header_sys_socket.h>
|
||||
@ -395,30 +398,33 @@ struct sockaddr_storage {
|
||||
#include <__struct_sockaddr_storage.h>
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no socket/socketpair */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int socket (int, int, int);
|
||||
#endif
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no socketpair */
|
||||
int socketpair (int, int, int, int [2]);
|
||||
#endif
|
||||
|
||||
int shutdown (int, int);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no bind/connect/listen/accept */
|
||||
int bind (int, const struct sockaddr *, socklen_t);
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int connect (int, const struct sockaddr *, socklen_t);
|
||||
int bind (int, const struct sockaddr *, socklen_t);
|
||||
int listen (int, int);
|
||||
#endif
|
||||
|
||||
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
|
||||
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no getsockname/getpeername */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
#endif
|
||||
|
||||
ssize_t send (int, const void *, size_t, int);
|
||||
ssize_t recv (int, void *, size_t, int);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no sendto/recvfrom */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
|
||||
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
|
||||
#endif
|
||||
@ -428,7 +434,7 @@ ssize_t recvmsg (int, struct msghdr *, int);
|
||||
#endif
|
||||
|
||||
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no setsockopt */
|
||||
#if (defined __wasilibc_unmodified_upstream) || (defined __wasilibc_use_wasip2)
|
||||
int setsockopt (int, int, int, const void *, socklen_t);
|
||||
#endif
|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
#include <bits/soundcard.h>
|
||||
@ -78,11 +78,9 @@ int stat(const char *__restrict, struct stat *__restrict);
|
||||
int fstat(int, struct stat *);
|
||||
int lstat(const char *__restrict, struct stat *__restrict);
|
||||
int fstatat(int, const char *__restrict, struct stat *__restrict, int);
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no chmod */
|
||||
int chmod(const char *, mode_t);
|
||||
int fchmod(int, mode_t);
|
||||
int fchmodat(int, const char *, mode_t, int);
|
||||
#endif
|
||||
#ifdef __wasilibc_unmodified_upstream /* WASI has no umask */
|
||||
mode_t umask(mode_t);
|
||||
#endif
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
#ifndef _SYS_STATFS_H
|
||||
#define _SYS_STATFS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
typedef struct __fsid_t {
|
||||
int __val[2];
|
||||
} fsid_t;
|
||||
|
||||
#include <bits/statfs.h>
|
||||
|
||||
int statfs (const char *, struct statfs *);
|
||||
int fstatfs (int, struct statfs *);
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define statfs64 statfs
|
||||
#define fstatfs64 fstatfs
|
||||
#define fsblkcnt64_t fsblkcnt_t
|
||||
#define fsfilcnt64_t fsfilcnt_t
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,21 +0,0 @@
|
||||
#ifndef _SYS_SWAP_H
|
||||
#define _SYS_SWAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define SWAP_FLAG_PREFER 0x8000
|
||||
#define SWAP_FLAG_PRIO_MASK 0x7fff
|
||||
#define SWAP_FLAG_PRIO_SHIFT 0
|
||||
#define SWAP_FLAG_DISCARD 0x10000
|
||||
|
||||
int swapon (const char *, int);
|
||||
int swapoff (const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1 +0,0 @@
|
||||
#include <syslog.h>
|
||||
@ -1,15 +0,0 @@
|
||||
#ifndef _SYS_SYSMACROS_H
|
||||
#define _SYS_SYSMACROS_H
|
||||
|
||||
#define major(x) \
|
||||
((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
|
||||
#define minor(x) \
|
||||
((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
|
||||
|
||||
#define makedev(x,y) ( \
|
||||
(((x)&0xfffff000ULL) << 32) | \
|
||||
(((x)&0x00000fffULL) << 8) | \
|
||||
(((y)&0xffffff00ULL) << 12) | \
|
||||
(((y)&0x000000ffULL)) )
|
||||
|
||||
#endif
|
||||
@ -1,2 +0,0 @@
|
||||
#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
|
||||
#include <termios.h>
|
||||
@ -1,32 +0,0 @@
|
||||
#ifndef _SYS_TIMERFD_H
|
||||
#define _SYS_TIMERFD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define TFD_NONBLOCK O_NONBLOCK
|
||||
#define TFD_CLOEXEC O_CLOEXEC
|
||||
|
||||
#define TFD_TIMER_ABSTIME 1
|
||||
#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
|
||||
|
||||
struct itimerspec;
|
||||
|
||||
int timerfd_create(int, int);
|
||||
int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
|
||||
int timerfd_gettime(int, struct itimerspec *);
|
||||
|
||||
#if _REDIR_TIME64
|
||||
__REDIR(timerfd_settime, __timerfd_settime64);
|
||||
__REDIR(timerfd_gettime, __timerfd_gettime64);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1 +0,0 @@
|
||||
#include <ucontext.h>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user