Skip to content

Commit

Permalink
More updates. Disable __pthread_key_atfork.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Dec 11, 2024
1 parent e47ccc8 commit 4776399
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions expected/wasm32-wasip1-threads/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1950,18 +1950,35 @@
#define T_AFSDB ns_t_afsdb
#define T_ANY ns_t_any
#define T_ATMA ns_t_atma
#define T_AVC ns_t_avc
#define T_AXFR ns_t_axfr
#define T_CAA ns_t_caa
#define T_CDNSKEY ns_t_cdnskey
#define T_CDS ns_t_cds
#define T_CNAME ns_t_cname
#define T_CSYNC ns_t_csync
#define T_DHCID ns_t_dhcid
#define T_DLV ns_t_dlv
#define T_DNAME ns_t_dname
#define T_DNSKEY ns_t_dnskey
#define T_DS ns_t_ds
#define T_EID ns_t_eid
#define T_EUI48 ns_t_eui48
#define T_EUI64 ns_t_eui64
#define T_FMT 0x2002A
#define T_FMT_AMPM 0x2002B
#define T_GID ns_t_gid
#define T_GPOS ns_t_gpos
#define T_HINFO ns_t_hinfo
#define T_HIP ns_t_hip
#define T_IPSECKEY ns_t_ipseckey
#define T_ISDN ns_t_isdn
#define T_IXFR ns_t_ixfr
#define T_KEY ns_t_key
#define T_L32 ns_t_l32
#define T_L64 ns_t_l64
#define T_LOC ns_t_loc
#define T_LP ns_t_lp
#define T_MAILA ns_t_maila
#define T_MAILB ns_t_mailb
#define T_MB ns_t_mb
Expand All @@ -1972,21 +1989,40 @@
#define T_MR ns_t_mr
#define T_MX ns_t_mx
#define T_NAPTR ns_t_naptr
#define T_NID ns_t_nid
#define T_NIMLOC ns_t_nimloc
#define T_NINFO ns_t_ninfo
#define T_NS ns_t_ns
#define T_NSAP ns_t_nsap
#define T_NSAP_PTR ns_t_nsap_ptr
#define T_NSEC ns_t_nsec
#define T_NSEC3 ns_t_nsec3
#define T_NSEC3PARAM ns_t_nsec3param
#define T_NULL ns_t_null
#define T_NXT ns_t_nxt
#define T_OPENPGPKEY ns_t_openpgpkey
#define T_PTR ns_t_ptr
#define T_PX ns_t_px
#define T_RKEY ns_t_rkey
#define T_RP ns_t_rp
#define T_RRSIG ns_t_rrsig
#define T_RT ns_t_rt
#define T_SIG ns_t_sig
#define T_SMIMEA ns_t_smimea
#define T_SOA ns_t_soa
#define T_SPF ns_t_spf
#define T_SRV ns_t_srv
#define T_SSHFP ns_t_sshfp
#define T_TA ns_t_ta
#define T_TALINK ns_t_talink
#define T_TKEY ns_t_tkey
#define T_TLSA ns_t_tlsa
#define T_TSIG ns_t_tsig
#define T_TXT ns_t_txt
#define T_UID ns_t_uid
#define T_UINFO ns_t_uinfo
#define T_UNSPEC ns_t_unspec
#define T_URI ns_t_uri
#define T_WKS ns_t_wks
#define T_X25 ns_t_x25
#define UCHAR_MAX 255
Expand Down Expand Up @@ -2092,6 +2128,8 @@
#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145
#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146
#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147
#define _CS_POSIX_V7_THREADS_CFLAGS 1150
#define _CS_POSIX_V7_THREADS_LDFLAGS 1151
#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5
#define _CS_V6_ENV 1148
#define _CS_V7_ENV 1149
Expand Down Expand Up @@ -2290,6 +2328,7 @@
#define _SC_MEMLOCK_RANGE 18
#define _SC_MEMORY_PROTECTION 19
#define _SC_MESSAGE_PASSING 20
#define _SC_MINSIGSTKSZ 249
#define _SC_MONOTONIC_CLOCK 149
#define _SC_MQ_OPEN_MAX 27
#define _SC_MQ_PRIO_MAX 28
Expand Down Expand Up @@ -2317,6 +2356,7 @@
#define _SC_SHARED_MEMORY_OBJECTS 22
#define _SC_SHELL 157
#define _SC_SIGQUEUE_MAX 34
#define _SC_SIGSTKSZ 250
#define _SC_SPAWN 159
#define _SC_SPIN_LOCKS 154
#define _SC_SPORADIC_SERVER 160
Expand Down
1 change: 0 additions & 1 deletion expected/wasm32-wasip1/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ __pthread_cond_timedwait
__pthread_create
__pthread_detach
__pthread_join
__pthread_key_atfork
__pthread_key_create
__pthread_key_delete
__pthread_mutex_consistent
Expand Down
1 change: 0 additions & 1 deletion expected/wasm32-wasip2/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ __pthread_cond_timedwait
__pthread_create
__pthread_detach
__pthread_join
__pthread_key_atfork
__pthread_key_create
__pthread_key_delete
__pthread_mutex_consistent
Expand Down
2 changes: 2 additions & 0 deletions libc-top-half/musl/src/thread/pthread_key_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ static void dummy_0(void)
weak_alias(dummy_0, __tl_lock);
weak_alias(dummy_0, __tl_unlock);

#ifdef __wasilibc_unmodified_upstream // WASI lacks fork
void __pthread_key_atfork(int who)
{
if (who<0) __pthread_rwlock_rdlock(&key_lock);
else if (!who) __pthread_rwlock_unlock(&key_lock);
else key_lock = (pthread_rwlock_t)PTHREAD_RWLOCK_INITIALIZER;
}
#endif

int __pthread_key_create(pthread_key_t *k, void (*dtor)(void *))
{
Expand Down

0 comments on commit 4776399

Please sign in to comment.