Skip to contentSkip to conversation

sighold02: Fix muslc builds by removing __SIGRTMIN

PATCH In review Richard Palethorpe via ltp 3 participants 6 messages Apr 25, 2022 – Apr 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sighold02: Fix muslc builds by removing __SIGRTMIN

The minimum real-time signal is always 32 according to signal(7). Meanwhile __SIGRTMIN is not defined in all lib C implementations.

---
 testcases/kernel/syscalls/sighold/sighold02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/sighold/sighold02.c +1 -1
index daa86192e..1cfb7688b 100644
@@ -33,7 +33,7 @@ static int sigs_map[NUMSIGS];
 
 static int skip_sig(int sig)
 {
-	if (sig >= __SIGRTMIN && sig < SIGRTMIN)
+	if (sig >= 32 && sig < SIGRTMIN)
 		return 1;
 
 	switch (sig) {
Signature · 5 lines
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi!

Quoted 14 lines

The minimum real-time signal is always 32 according to signal(7). Meanwhile __SIGRTMIN is not defined in all lib C implementations.

---
 testcases/kernel/syscalls/sighold/sighold02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/sighold/sighold02.c +0 -0
index daa86192e..1cfb7688b 100644

testcases/kernel/syscalls/sighold/sighold02.c static int sigs_map[NUMSIGS]; · line 37

Quoted 6 lines
testcases/kernel/syscalls/sighold/sighold02.c +1 -1
@@ -33,7 +33,7 @@ static int sigs_map[NUMSIGS];
 
 static int skip_sig(int sig)
 {
-	if (sig >= __SIGRTMIN && sig < SIGRTMIN)
+	if (sig >= 32 && sig < SIGRTMIN)
 		return 1;

Looks like __SIGRTMIN is defined to 32 for all architectures glibc supports, so this should be pretty much safe.

Signature · 5 lines
Cyril Hrubis
[email protected]

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

Hi all,

Quoted 25 lines

Hi!

Quoted 14 lines

The minimum real-time signal is always 32 according to signal(7). Meanwhile __SIGRTMIN is not defined in all lib C implementations.

---
 testcases/kernel/syscalls/sighold/sighold02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/sighold/sighold02.c +0 -0
index daa86192e..1cfb7688b 100644

testcases/kernel/syscalls/sighold/sighold02.c static int sigs_map[NUMSIGS]; · line 37

Quoted 6 lines
testcases/kernel/syscalls/sighold/sighold02.c +1 -1
@@ -33,7 +33,7 @@ static int sigs_map[NUMSIGS];
 
 static int skip_sig(int sig)
 {
-	if (sig >= __SIGRTMIN && sig < SIGRTMIN)
+	if (sig >= 32 && sig < SIGRTMIN)
 		return 1;

Looks like __SIGRTMIN is defined to 32 for all architectures glibc supports, so this should be pretty much safe.

Quoted 1 line

Well, we have __SIGRTMIN 32 fallback definition in include/lapi/signal.h, we use it in few tests. It was used in old variant, but you removed it during rewrite in 38e69985cb2707a056f9c86a90c8570c721e6a7d.

BTW I looked whether we could use SIGRTMIN instead of underscore variants, I suppose we can't (looks like SIGRTMIN is 32 + something):

musl:
#define SIGRTMIN (__libc_current_sigrtmin())
src/signal/sigrtmin.c
#include <signal.h>
int __libc_current_sigrtmin()

{
    return 35;
}

glibc:
static int current_rtmin = __SIGRTMIN + RESERVED_SIGRT;
(current_rtmin is used in __libc_current_sigrtmin(), RESERVED_SIGRT is defined 0 and 2)

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 27 lines

Hi all,

Quoted 24 lines

Hi!

Quoted 14 lines

The minimum real-time signal is always 32 according to signal(7). Meanwhile __SIGRTMIN is not defined in all lib C implementations.

---
 testcases/kernel/syscalls/sighold/sighold02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/sighold/sighold02.c +0 -0
index daa86192e..1cfb7688b 100644

testcases/kernel/syscalls/sighold/sighold02.c static int sigs_map[NUMSIGS]; · line 37

Quoted 6 lines
testcases/kernel/syscalls/sighold/sighold02.c +1 -1
@@ -33,7 +33,7 @@ static int sigs_map[NUMSIGS];
 
 static int skip_sig(int sig)
 {
-	if (sig >= __SIGRTMIN && sig < SIGRTMIN)
+	if (sig >= 32 && sig < SIGRTMIN)
 		return 1;

Looks like __SIGRTMIN is defined to 32 for all architectures glibc supports, so this should be pretty much safe.

Quoted 8 lines
Quoted 1 line

Well, we have __SIGRTMIN 32 fallback definition in include/lapi/signal.h, we use it in few tests. It was used in old variant, but you removed it during rewrite in 38e69985cb2707a056f9c86a90c8570c721e6a7d.

BTW I looked whether we could use SIGRTMIN instead of underscore variants, I suppose we can't (looks like SIGRTMIN is 32 + something):

Ah, looking at the code "if (sig >= __SIGRTMIN && sig < SIGRTMIN)", we need both underscore and non-underscore.

Let's go back to use lapi again.

Kind regards,
Petr

Quoted 15 lines

musl:
#define SIGRTMIN (__libc_current_sigrtmin())
src/signal/sigrtmin.c
#include <signal.h>
int __libc_current_sigrtmin()

{
    return 35;
}

glibc:
static int current_rtmin = __SIGRTMIN + RESERVED_SIGRT;
(current_rtmin is used in __libc_current_sigrtmin(), RESERVED_SIGRT is defined 0 and 2)

Kind regards,
Petr

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

Hi!

Quoted 2 lines

Ah, looking at the code "if (sig >= __SIGRTMIN && sig < SIGRTMIN)", we need both underscore and non-underscore.

This is code to actually skip signals used internally by libc, so anything between 32 and SIGRTMIN. It's pretty safe to hardcode the first value to 32 since that is the number of signals allocated by kernel which is not going to change.

I guess that we can add something as SIGRTMIN_KERN or SIGRTMIN_BASE and define it to 32 in some LTP header instead of hardcoding 32 into testcases, which would be way better than misusing glibc internal __SIGRTMIN.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 8 lines

Hi!

Quoted 2 lines

Ah, looking at the code "if (sig >= __SIGRTMIN && sig < SIGRTMIN)", we need both underscore and non-underscore.

This is code to actually skip signals used internally by libc, so anything between 32 and SIGRTMIN. It's pretty safe to hardcode the first value to 32 since that is the number of signals allocated by kernel which is not going to change.

Ah, right!

Quoted 4 lines

I guess that we can add something as SIGRTMIN_KERN or SIGRTMIN_BASE and define it to 32 in some LTP header instead of hardcoding 32 into testcases, which would be way better than misusing glibc internal __SIGRTMIN.

+1

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp