[LTP] [PATCH 1/3] rt_tgsigqueueinfo01: Use siginfo_t portable members
Petr Vorel
petr.vorel@gmail.com
Fri Nov 15 00:48:36 CET 2024
POSIX API for siginfo_t expect simple struct members (see man
sigaction(2)). Most of the implementations (including glibc, uclibc,
musl, bionic) combine many fields into union due optimisation. To
achieve POSIX API compatibility implementations provide definitions
to access members.
Depending on glibc/uclibc specific internal implementation was wrong.
eea3ba496b attempt to add bionic support. To get musl (or whatever libc)
support do what should have been done from the beginning: use portable
members.
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
.../rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c b/testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c
index bee6a62713..2f603be945 100644
--- a/testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c
+++ b/testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c
@@ -25,12 +25,6 @@
#include "tst_test.h"
#include "lapi/syscalls.h"
-#ifndef __ANDROID__
-#define SI_SIGVAL si_sigval
-#else
-#define SI_SIGVAL _sigval
-#endif
-
static char sigval_send[] = "rt_tgsigqueueinfo data";
static volatile int signum_rcv;
static char *sigval_rcv;
@@ -39,7 +33,7 @@ static void sigusr1_handler(int signum, siginfo_t *uinfo,
void *p LTP_ATTRIBUTE_UNUSED)
{
signum_rcv = signum;
- sigval_rcv = uinfo->_sifields._rt.SI_SIGVAL.sival_ptr;
+ sigval_rcv = uinfo->si_ptr;
}
void *send_rcv_func(void *arg)
@@ -51,7 +45,7 @@ void *send_rcv_func(void *arg)
uinfo.si_errno = 0;
uinfo.si_code = SI_QUEUE;
- uinfo._sifields._rt.SI_SIGVAL.sival_ptr = sigval_send;
+ uinfo.si_ptr = sigval_send;
TEST(tst_syscall(__NR_rt_tgsigqueueinfo, getpid(),
syscall(__NR_gettid), SIGUSR1, &uinfo));
@@ -113,7 +107,7 @@ static void verify_signal_parent_thread(void)
uinfo.si_errno = 0;
uinfo.si_code = SI_QUEUE;
- uinfo._sifields._rt.SI_SIGVAL.sival_ptr = sigval_send;
+ uinfo.si_ptr = sigval_send;
TEST(tst_syscall(__NR_rt_tgsigqueueinfo, getpid(),
tid, SIGUSR1, &uinfo));
@@ -130,7 +124,7 @@ void *sender_func(void *arg)
uinfo.si_errno = 0;
uinfo.si_code = SI_QUEUE;
- uinfo._sifields._rt.SI_SIGVAL.sival_ptr = sigval_send;
+ uinfo.si_ptr = sigval_send;
TEST(tst_syscall(__NR_rt_tgsigqueueinfo, getpid(),
*tid, SIGUSR1, &uinfo));
--
2.45.2
More information about the ltp
mailing list