blob: c324463e62034093dcdbbf20028a744bfd4724bb [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 34b91edc70709f32b44f6b3a32c8f18db393e36c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
3Date: Wed, 20 Feb 2019 08:07:27 -0600
4Subject: [PATCH] Define __SIGRTMIN and __SIGRTMAX for MUSL
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Some libc implementations might differ in the definitions they
10include. Exempli gratia: MUSL does not define __SIGRTMAX nor
11__SIGRTMIN.
12
13These two tests fail to build because of the missing
14definitions:
15 testcases/kernel/syscalls/ptrace/ptrace05.c
16 testcases/kernel/syscalls/sighold/sighold02.c
17
18Out of precaution, these two also include this header:
19 lib/tst_sig.c
20 testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
21
22Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2019-February/010916.html]
23
24Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
25---
26 include/lapi/signal.h | 24 +++++++++++++++++++
27 lib/tst_sig.c | 1 +
28 testcases/kernel/syscalls/ptrace/ptrace05.c | 1 +
29 .../syscalls/rt_sigsuspend/rt_sigsuspend01.c | 1 +
30 testcases/kernel/syscalls/sighold/sighold02.c | 1 +
31 5 files changed, 28 insertions(+)
32 create mode 100644 include/lapi/signal.h
33
34diff --git a/include/lapi/signal.h b/include/lapi/signal.h
35new file mode 100644
36index 000000000..d22965a94
37--- /dev/null
38+++ b/include/lapi/signal.h
39@@ -0,0 +1,24 @@
40+// SPDX-License-Identifier: GPL-2.0-or-later
41+/*
42+ * Copyright (c) 2019 Linaro Limited. All rights reserved.
43+ * Author: Daniel Díaz <daniel.diaz@linaro.org>
44+ */
45+
46+#ifndef LAPI_SIGNAL_H
47+#define LAPI_SIGNAL_H
48+
49+#include <signal.h>
50+
51+/*
52+ * Some libc implementations might differ in the definitions they include. This
53+ * covers those differences for all tests to successfully build.
54+ */
55+
56+#ifndef __SIGRTMIN
57+# define __SIGRTMIN 32
58+#endif
59+#ifndef __SIGRTMAX
60+# define __SIGRTMAX (_NSIG - 1)
61+#endif
62+
63+#endif
64diff --git a/lib/tst_sig.c b/lib/tst_sig.c
65index 36565e13d..6d77aeafd 100644
66--- a/lib/tst_sig.c
67+++ b/lib/tst_sig.c
68@@ -72,6 +72,7 @@
69 #include <signal.h>
70 #include <unistd.h>
71 #include "test.h"
72+#include "lapi/signal.h"
73
74 #define MAXMESG 150 /* size of mesg string sent to tst_res */
75
76diff --git a/testcases/kernel/syscalls/ptrace/ptrace05.c b/testcases/kernel/syscalls/ptrace/ptrace05.c
77index 420330029..54cfa4d7b 100644
78--- a/testcases/kernel/syscalls/ptrace/ptrace05.c
79+++ b/testcases/kernel/syscalls/ptrace/ptrace05.c
80@@ -38,6 +38,7 @@
81 #include "ptrace.h"
82
83 #include "test.h"
84+#include "lapi/signal.h"
85
86 char *TCID = "ptrace05";
87 int TST_TOTAL = 0;
88diff --git a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
89index f17a9aae6..e577cf227 100644
90--- a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
91+++ b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
92@@ -18,6 +18,7 @@
93 #include "tst_test.h"
94 #include "lapi/syscalls.h"
95 #include "lapi/safe_rt_signal.h"
96+#include "lapi/signal.h"
97
98 static void sig_handler(int sig)
99 {
100diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c
101index d1d4b0b06..b763142df 100644
102--- a/testcases/kernel/syscalls/sighold/sighold02.c
103+++ b/testcases/kernel/syscalls/sighold/sighold02.c
104@@ -49,6 +49,7 @@
105 #include <sys/wait.h>
106 #include "test.h"
107 #include "safe_macros.h"
108+#include "lapi/signal.h"
109
110 /* _XOPEN_SOURCE disables NSIG */
111 #ifndef NSIG
112--
1132.17.1
114