Skip to content

Commit 2f088a9

Browse files
Update _POSIX_THREAD_XX macro definitions (#494)
This is a follow-up to #356
1 parent 8876138 commit 2f088a9

4 files changed

Lines changed: 7 additions & 16 deletions

File tree

expected/wasm32-wasip1-threads/predefined-macros.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,12 +2182,9 @@
21822182
#define _POSIX_SYMLINK_MAX 255
21832183
#define _POSIX_SYMLOOP_MAX 8
21842184
#define _POSIX_THREADS _POSIX_VERSION
2185-
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
21862185
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
2187-
#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
21882186
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
21892187
#define _POSIX_THREAD_KEYS_MAX 128
2190-
#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
21912188
#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
21922189
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
21932190
#define _POSIX_THREAD_THREADS_MAX 64

expected/wasm32-wasip1/predefined-macros.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,14 +2147,8 @@
21472147
#define _POSIX_STREAM_MAX 8
21482148
#define _POSIX_SYMLINK_MAX 255
21492149
#define _POSIX_SYMLOOP_MAX 8
2150-
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
2151-
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
2152-
#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
21532150
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
21542151
#define _POSIX_THREAD_KEYS_MAX 128
2155-
#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
2156-
#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
2157-
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
21582152
#define _POSIX_THREAD_THREADS_MAX 64
21592153
#define _POSIX_TIMEOUTS _POSIX_VERSION
21602154
#define _POSIX_TIMERS _POSIX_VERSION

expected/wasm32-wasip2/predefined-macros.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,14 +2298,8 @@
22982298
#define _POSIX_STREAM_MAX 8
22992299
#define _POSIX_SYMLINK_MAX 255
23002300
#define _POSIX_SYMLOOP_MAX 8
2301-
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
2302-
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
2303-
#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
23042301
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
23052302
#define _POSIX_THREAD_KEYS_MAX 128
2306-
#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
2307-
#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
2308-
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
23092303
#define _POSIX_THREAD_THREADS_MAX 64
23102304
#define _POSIX_TIMEOUTS _POSIX_VERSION
23112305
#define _POSIX_TIMERS _POSIX_VERSION

libc-top-half/musl/include/unistd.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,19 @@ pid_t gettid(void);
338338

339339
#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
340340
#define _POSIX_THREADS _POSIX_VERSION
341-
#endif
342341
#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
343342
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
343+
#endif
344+
#if defined(__wasilibc_unmodified_upstream) /* wasi-libc doesn't provide pthread_attr_{get,set}stackaddr */
344345
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
346+
#endif
347+
#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
345348
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
349+
#endif
350+
#if defined(__wasilibc_unmodified_upstream) /* WASI has no scheduling control, and wasi-libc doesn't provide pthread_getcpuclockid */
346351
#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
347352
#define _POSIX_THREAD_CPUTIME _POSIX_VERSION
353+
#endif
348354
#define _POSIX_TIMERS _POSIX_VERSION
349355
#define _POSIX_TIMEOUTS _POSIX_VERSION
350356
#define _POSIX_MONOTONIC_CLOCK _POSIX_VERSION

0 commit comments

Comments
 (0)