Skip to contentSkip to conversation

Port rt_tgsigqueueinfo01 to musl

PATCH In review Petr Vorel 4 participants 7 messages Nov 14, 2024 – Dec 3, 2024

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover Port rt_tgsigqueueinfo01 to musl

Petr Vorel (3):
rt_tgsigqueueinfo01: Use siginfo_t portable members
rt_tgsigqueueinfo01: Convert doc to docparse ci/alpine.sh: Update list of incompatible tests

 ci/alpine.sh                                  |  3 +--
 .../rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c   | 22 +++++++------------
 2 files changed, 9 insertions(+), 16 deletions(-)
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 1/3 rt_tgsigqueueinfo01: Use siginfo_t portable members

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.

---
 .../rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c        | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c +4 -10
index bee6a62713..2f603be945 100644
@@ -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));
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Re: [LTP] [PATCH 1/3] rt_tgsigqueueinfo01: Use siginfo_t portable members

Hi Cyril, Jan,

Quoted 2 lines

Hi!
Looks good to me, for the whole patchset:

merged. Thanks for your review!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 1/3
#4 lore raw

Re: [LTP] [PATCH 1/3] rt_tgsigqueueinfo01: Use siginfo_t portable members

In reply to Petr Vorel
Quoted 7 lines · Petr Vorel

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.

Quoted 6 lines

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.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#5 lore raw

PATCH 2/3 rt_tgsigqueueinfo01: Convert doc to docparse

In reply to Petr Vorel
---
 .../syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c +4 -4
index 2f603be945..9e45f35f78 100644
@@ -1,17 +1,17 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2019 Linaro Limited. All rights reserved.
+ * Copyright (c) Linux Test Project, 2019-2024
  * Author: Sumit Garg <[email protected]>
  */
 
-/*
- * Test rt_tgsigqueueinfo
- *
- * This tests the rt_tgsigqueueinfo() syscall. It sends the signal and data
+/*\
+ * Basic test for rt_tgsigqueueinfo(2) syscall. It sends the signal and data
  * to the single thread specified by the combination of tgid, a thread group
  * ID, and tid, a thread in that thread group.
  *
  * Also this implement 3 tests differing on the basis of signal sender:
+ *
  * - Sender and receiver is the same thread.
  * - Sender is parent of the thread.
  * - Sender is different thread.
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#6 lore raw

PATCH 3/3 ci/alpine.sh: Update list of incompatible tests

In reply to Petr Vorel

rt_tgsigqueueinfo01.c has been ported in previous commit.

---
 ci/alpine.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ci/alpine.sh +1 -2
index d2495c3895..2803cf9ffc 100755
@@ -1,6 +1,6 @@
 #!/bin/sh -eux
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2019-2022 Petr Vorel <[email protected]>
+# Copyright (c) 2019-2024 Petr Vorel <[email protected]>
 
 apk update
 
@@ -34,7 +34,6 @@ echo "WARNING: remove unsupported tests (until they're fixed)"
 cd $(dirname $0)/..
 rm -rfv \
 	testcases/kernel/syscalls/fmtmsg/fmtmsg01.c \
-	testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c \
 	testcases/kernel/syscalls/timer_create/timer_create01.c \
 	testcases/kernel/syscalls/timer_create/timer_create03.c
 
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp