diff options
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/Makefile | 6 | ||||
| -rw-r--r-- | lib/libc/quad/Symbol.map | 1 | ||||
| -rw-r--r-- | lib/libc/riscv/string/Makefile.inc | 1 | ||||
| -rw-r--r-- | lib/libc/stdlib/cxa_thread_atexit_impl.c | 4 | ||||
| -rw-r--r-- | lib/libc/tests/stdlib/system_test.c | 38 |
5 files changed, 30 insertions, 20 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 56818e07aa96..fd546dfcef61 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -190,12 +190,6 @@ SUBDIR.${MK_TESTS}+= tests .include <bsd.lib.mk> -.if (${LIBC_ARCH} == amd64 || ${LIBC_ARCH} == i386) && \ - ${.TARGETS:Mall} == all && \ - defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" -.error ${LIBC_ARCH} libc requires linker ifunc support -.endif - .if !defined(_SKIP_BUILD) # We need libutil.h, get it directly to avoid # recording a build dependency diff --git a/lib/libc/quad/Symbol.map b/lib/libc/quad/Symbol.map index c28f9a180704..251814cb238f 100644 --- a/lib/libc/quad/Symbol.map +++ b/lib/libc/quad/Symbol.map @@ -50,4 +50,5 @@ FBSD_1.0 { __udivdi3; __umoddi3; __xordi3; +#endif }; diff --git a/lib/libc/riscv/string/Makefile.inc b/lib/libc/riscv/string/Makefile.inc index 6dae6b2cb62d..ce965833cb27 100644 --- a/lib/libc/riscv/string/Makefile.inc +++ b/lib/libc/riscv/string/Makefile.inc @@ -5,6 +5,5 @@ MDSRCS+= \ memcpy.S \ memset.S \ strlen.S \ - strnlen.S \ strchrnul.S \ strrchr.S diff --git a/lib/libc/stdlib/cxa_thread_atexit_impl.c b/lib/libc/stdlib/cxa_thread_atexit_impl.c index 3123bd12dca8..3d742d90fb44 100644 --- a/lib/libc/stdlib/cxa_thread_atexit_impl.c +++ b/lib/libc/stdlib/cxa_thread_atexit_impl.c @@ -119,9 +119,9 @@ walk_cb_nocall(struct cxa_thread_dtor *dtor __unused) static void cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *)) { - struct cxa_thread_dtor *dtor, *tdtor; + struct cxa_thread_dtor *dtor; - LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) { + while ((dtor = LIST_FIRST(&dtors)) != NULL) { LIST_REMOVE(dtor, entry); cb(dtor); free(dtor); diff --git a/lib/libc/tests/stdlib/system_test.c b/lib/libc/tests/stdlib/system_test.c index b6a31583d52d..9e556f257791 100644 --- a/lib/libc/tests/stdlib/system_test.c +++ b/lib/libc/tests/stdlib/system_test.c @@ -92,6 +92,12 @@ system_thread(void *arg) return ((void *)(intptr_t)system(cmd)); } +static inline int +sigcmpset(const sigset_t *a, const sigset_t *b) +{ + return (memcmp(a, b, sizeof(sigset_t))); +} + ATF_TC(system_concurrent); ATF_TC_HEAD(system_concurrent, tc) { @@ -99,7 +105,8 @@ ATF_TC_HEAD(system_concurrent, tc) } ATF_TC_BODY(system_concurrent, tc) { -#define N 3 + enum { N = 3 }; + struct sigaction sigint, sigquit, sigact; sigset_t normset, sigset; pthread_t thr[N]; char fn[8]; @@ -119,8 +126,10 @@ ATF_TC_BODY(system_concurrent, tc) ATF_REQUIRE_EQ(0, symlink(fn, fn)); } - /* Get the current and expected signal mask */ - sigprocmask(0, NULL, &normset); + /* Save the current signal dispositions */ + ATF_REQUIRE_EQ(0, sigaction(SIGINT, NULL, &sigint)); + ATF_REQUIRE_EQ(0, sigaction(SIGQUIT, NULL, &sigquit)); + ATF_REQUIRE_EQ(0, sigprocmask(0, NULL, &normset)); /* Spawn threads which block on these files */ for (int i = 0; i < N; i++) { @@ -140,10 +149,12 @@ ATF_TC_BODY(system_concurrent, tc) /* Release the locks */ for (int i = 0; i < N; i++) { /* Check the signal dispositions */ - ATF_CHECK_EQ(SIG_IGN, signal(SIGINT, SIG_IGN)); - ATF_CHECK_EQ(SIG_IGN, signal(SIGQUIT, SIG_IGN)); + ATF_REQUIRE_EQ(0, sigaction(SIGINT, NULL, &sigact)); + ATF_CHECK_EQ(SIG_IGN, sigact.sa_handler); + ATF_REQUIRE_EQ(0, sigaction(SIGQUIT, NULL, &sigact)); + ATF_CHECK_EQ(SIG_IGN, sigact.sa_handler); #ifndef PROCMASK_IS_THREADMASK - sigprocmask(0, NULL, &sigset); + ATF_REQUIRE_EQ(0, sigprocmask(0, NULL, &sigset)); ATF_CHECK(sigismember(&sigset, SIGCHLD)); #endif @@ -156,11 +167,16 @@ ATF_TC_BODY(system_concurrent, tc) } /* Check the signal dispositions */ - ATF_CHECK_EQ(SIG_DFL, signal(SIGINT, SIG_DFL)); - ATF_CHECK_EQ(SIG_DFL, signal(SIGQUIT, SIG_DFL)); - sigprocmask(0, NULL, &sigset); - ATF_CHECK_EQ(0, memcmp(&sigset, &normset, sizeof(sigset_t))); -#undef N + ATF_REQUIRE_EQ(0, sigaction(SIGINT, NULL, &sigact)); + ATF_CHECK_EQ(sigint.sa_handler, sigact.sa_handler); + ATF_CHECK_EQ(sigint.sa_flags, sigact.sa_flags); + ATF_CHECK_EQ(0, sigcmpset(&sigint.sa_mask, &sigact.sa_mask)); + ATF_REQUIRE_EQ(0, sigaction(SIGQUIT, NULL, &sigact)); + ATF_CHECK_EQ(sigquit.sa_handler, sigact.sa_handler); + ATF_CHECK_EQ(sigquit.sa_flags, sigact.sa_flags); + ATF_CHECK_EQ(0, sigcmpset(&sigquit.sa_mask, &sigact.sa_mask)); + ATF_REQUIRE_EQ(0, sigprocmask(0, NULL, &sigset)); + ATF_CHECK_EQ(0, sigcmpset(&sigset, &normset)); } ATF_TP_ADD_TCS(tp) |
