Skip to content

Commit 3f4c43b

Browse files
jedisct1alexrp
authored andcommitted
Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5
1 parent bf6ee7c commit 3f4c43b

File tree

126 files changed

+863
-8334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+863
-8334
lines changed

lib/libc/include/wasm-wasi-musl/__errno.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
extern "C" {
66
#endif
77

8-
#ifdef __cplusplus
9-
extern thread_local int errno;
10-
#else
118
extern _Thread_local int errno;
12-
#endif
139

1410
#define errno errno
1511

1612
#ifdef __cplusplus
1713
}
1814
#endif
19-
2015
#endif

lib/libc/include/wasm-wasi-musl/__header_dirent.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@
1111
#define DT_REG __WASI_FILETYPE_REGULAR_FILE
1212
#define DT_UNKNOWN __WASI_FILETYPE_UNKNOWN
1313

14+
// DT_SOCK is not supported in WASI Preview 1 (but will be in Preview 2). We
15+
// define it regardless so that libc++'s `<filesystem>` implementation builds.
16+
// The exact value is mostly arbitrary, but chosen so it doesn't conflict with
17+
// any of the existing `__WASI_FILETYPE_*` flags. We do not expect any new
18+
// flags to be added to WASI Preview 1, so that should be sufficient.
19+
#define DT_SOCK 20
20+
1421
#define IFTODT(x) (__wasilibc_iftodt(x))
1522
#define DTTOIF(x) (__wasilibc_dttoif(x))
1623

17-
int __wasilibc_iftodt(int x);
18-
int __wasilibc_dttoif(int x);
19-
2024
#include <__struct_dirent.h>
2125
#include <__typedef_DIR.h>
2226

2327
#ifdef __cplusplus
2428
extern "C" {
2529
#endif
2630

31+
int __wasilibc_iftodt(int x);
32+
int __wasilibc_dttoif(int x);
33+
2734
int closedir(DIR *);
2835
DIR *opendir(const char *);
2936
DIR *fdopendir(int);

lib/libc/include/wasm-wasi-musl/__header_sys_socket.h

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __wasilibc___header_sys_socket_h
22
#define __wasilibc___header_sys_socket_h
33

4+
#include <__wasi_snapshot.h>
45
#include <__struct_msghdr.h>
56
#include <__struct_sockaddr.h>
67
#include <__struct_sockaddr_storage.h>
@@ -11,9 +12,42 @@
1112
#define SHUT_WR __WASI_SDFLAGS_WR
1213
#define SHUT_RDWR (SHUT_RD | SHUT_WR)
1314

15+
#ifdef __wasilibc_use_wasip2
16+
#define MSG_DONTWAIT 0x0040
17+
#define MSG_NOSIGNAL 0x4000
18+
#define MSG_PEEK 0x0002
19+
#define MSG_WAITALL 0x0100
20+
#define MSG_TRUNC 0x0020
21+
22+
#define SOL_IP 0
23+
#define SOL_TCP 6
24+
#define SOL_UDP 17
25+
#define SOL_IPV6 41
26+
27+
#define SOMAXCONN 128
28+
29+
#define SO_REUSEADDR 2
30+
#define SO_ERROR 4
31+
#define SO_SNDBUF 7
32+
#define SO_RCVBUF 8
33+
#define SO_KEEPALIVE 9
34+
#define SO_ACCEPTCONN 30
35+
#define SO_PROTOCOL 38
36+
#define SO_DOMAIN 39
37+
38+
#if __LONG_MAX == 0x7fffffff
39+
#define SO_RCVTIMEO 66
40+
#define SO_SNDTIMEO 67
41+
#else
42+
#define SO_RCVTIMEO 20
43+
#define SO_SNDTIMEO 21
44+
#endif
45+
46+
#else // __wasilibc_use_wasip2
1447
#define MSG_PEEK __WASI_RIFLAGS_RECV_PEEK
1548
#define MSG_WAITALL __WASI_RIFLAGS_RECV_WAITALL
16-
#define MSG_TRUNC __WASI_RIFLAGS_RECV_DATA_TRUNCATED
49+
#define MSG_TRUNC __WASI_ROFLAGS_RECV_DATA_TRUNCATED
50+
#endif // __wasilibc_use_wasip2
1751

1852
#define SOCK_DGRAM __WASI_FILETYPE_SOCKET_DGRAM
1953
#define SOCK_STREAM __WASI_FILETYPE_SOCKET_STREAM
@@ -25,9 +59,13 @@
2559

2660
#define SO_TYPE 3
2761

28-
#define AF_UNSPEC 0
29-
#define AF_INET 1
30-
#define AF_INET6 2
62+
#define PF_UNSPEC 0
63+
#define PF_INET 1
64+
#define PF_INET6 2
65+
66+
#define AF_UNSPEC PF_UNSPEC
67+
#define AF_INET PF_INET
68+
#define AF_INET6 PF_INET6
3169
#define AF_UNIX 3
3270

3371
#ifdef __cplusplus

lib/libc/include/wasm-wasi-musl/__mode_t.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define S_IFLNK (0xa000)
1010
#define S_IFREG (0x8000)
1111
#define S_IFSOCK (0xc000)
12-
#define S_IFIFO (0xc000)
12+
#define S_IFIFO (0x1000)
1313

1414
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
1515
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)

lib/libc/include/wasm-wasi-musl/__struct_sockaddr.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#ifndef __wasilibc___struct_sockaddr_h
22
#define __wasilibc___struct_sockaddr_h
33

4-
#define __need_STDDEF_H_misc
5-
#include <stddef.h>
6-
74
#include <__typedef_sa_family_t.h>
85

96
struct sockaddr {

lib/libc/include/wasm-wasi-musl/__struct_sockaddr_in.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#ifndef __wasilibc___struct_sockaddr_in_h
22
#define __wasilibc___struct_sockaddr_in_h
33

4-
#define __need_STDDEF_H_misc
5-
#include <stddef.h>
6-
74
#include <__typedef_sa_family_t.h>
85
#include <__typedef_in_port_t.h>
96
#include <__struct_in_addr.h>
107

118
struct sockaddr_in {
12-
_Alignas(max_align_t) sa_family_t sin_family;
9+
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin_family;
1310
in_port_t sin_port;
1411
struct in_addr sin_addr;
1512
};

lib/libc/include/wasm-wasi-musl/__struct_sockaddr_in6.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#ifndef __wasilibc___struct_sockaddr_in6_h
22
#define __wasilibc___struct_sockaddr_in6_h
33

4-
#define __need_STDDEF_H_misc
5-
#include <stddef.h>
6-
74
#include <__typedef_sa_family_t.h>
85
#include <__typedef_in_port_t.h>
96
#include <__struct_in6_addr.h>
107

118
struct sockaddr_in6 {
12-
_Alignas(max_align_t) sa_family_t sin6_family;
9+
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sin6_family;
1310
in_port_t sin6_port;
1411
unsigned sin6_flowinfo;
1512
struct in6_addr sin6_addr;

lib/libc/include/wasm-wasi-musl/__struct_sockaddr_storage.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#ifndef __wasilibc___struct_sockaddr_storage_h
22
#define __wasilibc___struct_sockaddr_storage_h
33

4-
#define __need_STDDEF_H_misc
5-
#include <stddef.h>
6-
74
#include <__typedef_sa_family_t.h>
85

96
struct sockaddr_storage {
10-
_Alignas(max_align_t) sa_family_t ss_family;
7+
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t ss_family;
118
char __ss_data[32];
129
};
1310

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#ifndef __wasilibc___struct_sockaddr_un_h
22
#define __wasilibc___struct_sockaddr_un_h
33

4-
#define __need_STDDEF_H_misc
5-
#include <stddef.h>
6-
74
#include <__typedef_sa_family_t.h>
85

96
struct sockaddr_un {
10-
_Alignas(max_align_t) sa_family_t sun_family;
7+
__attribute__((aligned(__BIGGEST_ALIGNMENT__))) sa_family_t sun_family;
118
};
129

1310
#endif

lib/libc/include/wasm-wasi-musl/__wasi_snapshot.h

Whitespace-only changes.

0 commit comments

Comments
 (0)