aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ltp/ltp/0007-replace-SIGCLD-with-SIGCHLD.patch
blob: 4be906ec7828dffb9a7780a4cf2170866dfb4d10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
From 405c03171e4bf0edd698cb602cf7bd7fe1d0401a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 7 Jan 2016 19:33:53 +0000
Subject: [PATCH 07/32] replace SIGCLD with SIGCHLD

its defined to use SIGCHLD anyway in

bits/signum.h:#define     SIGCLD          SIGCHLD /* Same as SIGCHLD
(System V).  */

plus it helps these tests compile with musl which adheres to posix

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/tst_sig.c                                   |  8 ++++----
 testcases/kernel/connectors/pec/pec_listener.c  |  1 +
 testcases/kernel/fs/doio/doio.c                 |  4 ++--
 testcases/kernel/fs/doio/growfiles.c            |  2 +-
 testcases/kernel/syscalls/fcntl/fcntl11.c       |  8 ++++----
 testcases/kernel/syscalls/fcntl/fcntl17.c       |  8 ++++----
 testcases/kernel/syscalls/fcntl/fcntl19.c       |  8 ++++----
 testcases/kernel/syscalls/fcntl/fcntl20.c       |  8 ++++----
 testcases/kernel/syscalls/fcntl/fcntl21.c       |  8 ++++----
 testcases/kernel/syscalls/kill/kill02.c         |  6 +++---
 testcases/kernel/syscalls/kill/kill12.c         |  8 ++++----
 testcases/kernel/syscalls/mkdir/mkdir09.c       | 12 ++++++------
 testcases/kernel/syscalls/sighold/sighold02.c   |  2 +-
 testcases/network/tcp_cmds/perf_lan/pingpong.c  |  2 +-
 testcases/network/tcp_cmds/perf_lan/pingpong6.c |  2 +-
 15 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/lib/tst_sig.c b/lib/tst_sig.c
index 3af5ffd..36565e1 100644
--- a/lib/tst_sig.c
+++ b/lib/tst_sig.c
@@ -49,7 +49,7 @@
 		fork_flag - set to FORK or NOFORK depending upon whether the
 			calling program executes a fork() system call.  It
 			is normally the case that the calling program treats
-			SIGCLD as an expected signal if fork() is being used.
+			SIGCHLD as an expected signal if fork() is being used.
 
 		handler - a pointer to the unexpected signal handler to
 			be executed after an unexpected signal has been
@@ -82,7 +82,7 @@ static void (*tst_setup_signal(int, void (*)(int))) (int);
 
 /****************************************************************************
  * tst_sig() : set-up to catch unexpected signals.  fork_flag is set to NOFORK
- *    if SIGCLD is to be an "unexpected signal", otherwise it is set to
+ *    if SIGCHLD is to be an "unexpected signal", otherwise it is set to
  *    FORK.  cleanup points to a cleanup routine to be executed before
  *    tst_exit is called (cleanup is set to NULL if no cleanup is desired).
  *    handler is a pointer to the signal handling routine (if handler is
@@ -117,7 +117,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())
 	for (sig = 1; sig < NSIG; sig++) {
 		/*
 		 * SIGKILL is never unexpected.
-		 * SIGCLD is only unexpected when
+		 * SIGCHLD is only unexpected when
 		 *    no forking is being done.
 		 * SIGINFO is used for file quotas and should be expected
 		 */
@@ -205,7 +205,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())
 #endif
 			break;
 
-		case SIGCLD:
+		case SIGCHLD:
 			if (fork_flag == FORK)
 				continue;
 
diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c
index a1beb13..002750a 100644
--- a/testcases/kernel/connectors/pec/pec_listener.c
+++ b/testcases/kernel/connectors/pec/pec_listener.c
@@ -20,6 +20,7 @@
 /*                                                                            */
 /******************************************************************************/
 
+#define _GNU_SOURCE
 #include <sys/socket.h>
 #include <sys/poll.h>
 #include <sys/types.h>
diff --git a/testcases/kernel/fs/doio/doio.c b/testcases/kernel/fs/doio/doio.c
index 4b0dec5..5f65ef9 100644
--- a/testcases/kernel/fs/doio/doio.c
+++ b/testcases/kernel/fs/doio/doio.c
@@ -573,7 +573,7 @@ int main(int argc, char **argv)
 		case SIGTSTP:
 		case SIGSTOP:
 		case SIGCONT:
-		case SIGCLD:
+		case SIGCHLD:
 		case SIGBUS:
 		case SIGSEGV:
 		case SIGQUIT:
@@ -615,7 +615,7 @@ int main(int argc, char **argv)
 	}
 
 	sigemptyset(&block_mask);
-	sigaddset(&block_mask, SIGCLD);
+	sigaddset(&block_mask, SIGCHLD);
 	sigprocmask(SIG_BLOCK, &block_mask, &omask);
 
 	/*
diff --git a/testcases/kernel/fs/doio/growfiles.c b/testcases/kernel/fs/doio/growfiles.c
index 09e7f35..bbad230 100644
--- a/testcases/kernel/fs/doio/growfiles.c
+++ b/testcases/kernel/fs/doio/growfiles.c
@@ -1640,7 +1640,7 @@ int set_sig(void)
 #ifdef SIGRESTART
 		case SIGRESTART:
 #endif /* SIGRESTART */
-		case SIGCLD:
+		case SIGCHLD:
 			break;
 
 		default:
diff --git a/testcases/kernel/syscalls/fcntl/fcntl11.c b/testcases/kernel/syscalls/fcntl/fcntl11.c
index fa6ce53..2de2b6c 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl11.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl11.c
@@ -105,10 +105,10 @@ void setup(void)
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = catch_child;
 	sigemptyset(&act.sa_mask);
-	sigaddset(&act.sa_mask, SIGCLD);
-	if ((sigaction(SIGCLD, &act, NULL)) < 0)
+	sigaddset(&act.sa_mask, SIGCHLD);
+	if ((sigaction(SIGCHLD, &act, NULL)) < 0)
 		tst_brkm(TBROK | TERRNO, cleanup,
-			 "sigaction(SIGCLD, ..) failed");
+			 "sigaction(SIGCHLD, ..) failed");
 }
 
 void do_child(void)
@@ -227,7 +227,7 @@ void stop_child(void)
 {
 	struct flock fl;
 
-	signal(SIGCLD, SIG_DFL);
+	signal(SIGCHLD, SIG_DFL);
 	fl.l_type = STOP;
 	parent_put(&fl);
 	wait(0);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl17.c b/testcases/kernel/syscalls/fcntl/fcntl17.c
index 5b03e39..6598b20 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl17.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl17.c
@@ -150,9 +150,9 @@ int setup(void)
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = catch_child;
 	sigemptyset(&act.sa_mask);
-	sigaddset(&act.sa_mask, SIGCLD);
-	if (sigaction(SIGCLD, &act, NULL) < 0) {
-		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
+	sigaddset(&act.sa_mask, SIGCHLD);
+	if (sigaction(SIGCHLD, &act, NULL) < 0) {
+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
 		return 1;
 	}
 	return 0;
@@ -381,7 +381,7 @@ void stop_children(void)
 {
 	int arg;
 
-	signal(SIGCLD, SIG_DFL);
+	signal(SIGCHLD, SIG_DFL);
 	arg = STOP;
 	child_free(child_pipe1[1], arg);
 	child_free(child_pipe2[1], arg);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl19.c b/testcases/kernel/syscalls/fcntl/fcntl19.c
index a542cfc..88c91d6 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl19.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl19.c
@@ -112,9 +112,9 @@ void setup(void)
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = catch_child;
 	sigemptyset(&act.sa_mask);
-	sigaddset(&act.sa_mask, SIGCLD);
-	if ((sigaction(SIGCLD, &act, NULL)) < 0) {
-		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
+	sigaddset(&act.sa_mask, SIGCHLD);
+	if ((sigaction(SIGCHLD, &act, NULL)) < 0) {
+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
 		fail = 1;
 	}
 }
@@ -265,7 +265,7 @@ void stop_child(void)
 {
 	struct flock fl;
 
-	signal(SIGCLD, SIG_DFL);
+	signal(SIGCHLD, SIG_DFL);
 	fl.l_type = STOP;
 	parent_put(&fl);
 	wait(0);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl20.c b/testcases/kernel/syscalls/fcntl/fcntl20.c
index aa06bab..99fd783 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl20.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl20.c
@@ -109,9 +109,9 @@ void setup(void)
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = catch_child;
 	sigemptyset(&act.sa_mask);
-	sigaddset(&act.sa_mask, SIGCLD);
-	if (sigaction(SIGCLD, &act, NULL) == -1)
-		tst_brkm(TFAIL | TERRNO, cleanup, "SIGCLD signal setup failed");
+	sigaddset(&act.sa_mask, SIGCHLD);
+	if (sigaction(SIGCHLD, &act, NULL) == -1)
+		tst_brkm(TFAIL | TERRNO, cleanup, "SIGCHLD signal setup failed");
 }
 
 void cleanup(void)
@@ -264,7 +264,7 @@ void stop_child(void)
 {
 	struct flock fl;
 
-	signal(SIGCLD, SIG_DFL);
+	signal(SIGCHLD, SIG_DFL);
 	fl.l_type = STOP;
 	parent_put(&fl);
 	wait(0);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl21.c b/testcases/kernel/syscalls/fcntl/fcntl21.c
index 5307021..8f1a67c 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl21.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl21.c
@@ -110,9 +110,9 @@ void setup(void)
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = catch_child;
 	sigemptyset(&act.sa_mask);
-	sigaddset(&act.sa_mask, SIGCLD);
-	if ((sigaction(SIGCLD, &act, NULL)) < 0) {
-		tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno);
+	sigaddset(&act.sa_mask, SIGCHLD);
+	if ((sigaction(SIGCHLD, &act, NULL)) < 0) {
+		tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno);
 		fail = 1;
 	}
 }
@@ -272,7 +272,7 @@ void stop_child(void)
 {
 	struct flock fl;
 
-	signal(SIGCLD, SIG_DFL);
+	signal(SIGCHLD, SIG_DFL);
 	fl.l_type = STOP;
 	parent_put(&fl);
 	wait(0);
diff --git a/testcases/kernel/syscalls/kill/kill02.c b/testcases/kernel/syscalls/kill/kill02.c
index 9d6cc68..08360dd 100644
--- a/testcases/kernel/syscalls/kill/kill02.c
+++ b/testcases/kernel/syscalls/kill/kill02.c
@@ -701,7 +701,7 @@ void setup(void)
 
 	/*
 	 *  Set to catch unexpected signals.
-	 *  SIGCLD is set to be ignored because we do not wait for termination status.
+	 *  SIGCHLD is set to be ignored because we do not wait for termination status.
 	 *  SIGUSR1 is set to be ignored because this is the signal we are using for
 	 *  the test and we are not concerned with the parent getting it.
 	 */
@@ -713,9 +713,9 @@ void setup(void)
 			 "signal(SIGUSR1, SIG_IGN) failed");
 	}
 
-	if (signal(SIGCLD, SIG_IGN) == SIG_ERR) {
+	if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
 		tst_brkm(TBROK | TERRNO, NULL,
-			 "signal(SIGCLD, SIG_IGN) failed");
+			 "signal(SIGCHLD, SIG_IGN) failed");
 	}
 
 	TEST_PAUSE;
diff --git a/testcases/kernel/syscalls/kill/kill12.c b/testcases/kernel/syscalls/kill/kill12.c
index 7a47a4a..d7c4147 100644
--- a/testcases/kernel/syscalls/kill/kill12.c
+++ b/testcases/kernel/syscalls/kill/kill12.c
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
 
 	exno = 1;
 
-	if (sigset(SIGCLD, chsig) == SIG_ERR) {
+	if (sigset(SIGCHLD, chsig) == SIG_ERR) {
 		fprintf(temp, "\tsigset failed, errno = %d\n", errno);
 		fail_exit();
 	}
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
 				sleep(1);
 
 			kill(pid, sig);	/* child should ignroe this sig */
-			kill(pid, SIGCLD);	/* child should exit */
+			kill(pid, SIGCHLD);	/* child should exit */
 
 #ifdef BCS
 			while ((npid = wait(&status)) != pid
@@ -222,14 +222,14 @@ void do_child(void)
 	int exno = 1;
 
 #ifdef UCLINUX
-	if (sigset(SIGCLD, chsig) == SIG_ERR) {
+	if (sigset(SIGCHLD, chsig) == SIG_ERR) {
 		fprintf(temp, "\tsigset failed, errno = %d\n", errno);
 		fail_exit();
 	}
 #endif
 
 	sigset(sig, SIG_IGN);	/* set to ignore signal */
-	kill(getppid(), SIGCLD);	/* tell parent we are ready */
+	kill(getppid(), SIGCHLD);	/* tell parent we are ready */
 	while (!chflag)
 		sleep(1);	/* wait for parent */
 
diff --git a/testcases/kernel/syscalls/mkdir/mkdir09.c b/testcases/kernel/syscalls/mkdir/mkdir09.c
index 41c20e9..07b4fb8 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir09.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir09.c
@@ -122,10 +122,10 @@ int main(int argc, char *argv[])
 
 	}
 
-	/* Set up to catch SIGCLD signal */
-	if (signal(SIGCLD, chld) == SIG_ERR) {
+	/* Set up to catch SIGCHLD signal */
+	if (signal(SIGCHLD, chld) == SIG_ERR) {
 		tst_brkm(TFAIL, cleanup,
-			 "Error setting up SIGCLD signal, ERRNO = %d", errno);
+			 "Error setting up SIGCHLD signal, ERRNO = %d", errno);
 
 	}
 
@@ -236,9 +236,9 @@ int runtest(void)
 		tst_brkm(TFAIL, cleanup,
 			 "Error resetting SIGTERM signal, ERRNO = %d", errno);
 	}
-	if (signal(SIGCLD, SIG_DFL) == SIG_ERR) {
+	if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) {
 		tst_brkm(TFAIL, cleanup,
-			 "Error resetting SIGCLD signal, ERRNO = %d", errno);
+			 "Error resetting SIGCHLD signal, ERRNO = %d", errno);
 	}
 
 	if (test_time) {
@@ -372,7 +372,7 @@ void term(int sig)
 
 void chld(int sig)
 {
-	/* Routine to handle SIGCLD signal. */
+	/* Routine to handle SIGCHLD signal. */
 
 	sigchld++;
 	if (jump) {
diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c
index e3076fb..be01874 100644
--- a/testcases/kernel/syscalls/sighold/sighold02.c
+++ b/testcases/kernel/syscalls/sighold/sighold02.c
@@ -77,7 +77,7 @@ static int sigs_map[NUMSIGS];
 static int skip_sig(int sig)
 {
 	switch (sig) {
-	case SIGCLD:
+	case SIGCHLD:
 	case SIGKILL:
 	case SIGALRM:
 	case SIGSTOP:
diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong.c b/testcases/network/tcp_cmds/perf_lan/pingpong.c
index 1196312..5b06798 100644
--- a/testcases/network/tcp_cmds/perf_lan/pingpong.c
+++ b/testcases/network/tcp_cmds/perf_lan/pingpong.c
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])
 
 	/* Setup traps */
 	signal(SIGINT, finish);
-	signal(SIGCLD, finish);
+	signal(SIGCHLD, finish);
 
 	/* Fork a child process to continue sending packets */
 	tst_resm(TINFO, "Create a child process to continue to send packets");
diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong6.c b/testcases/network/tcp_cmds/perf_lan/pingpong6.c
index 9747f58..0a0fb1d 100644
--- a/testcases/network/tcp_cmds/perf_lan/pingpong6.c
+++ b/testcases/network/tcp_cmds/perf_lan/pingpong6.c
@@ -153,7 +153,7 @@ char *argv[];
 
 	/* Setup traps */
 	signal(SIGINT, finish);
-	signal(SIGCLD, finish);
+	signal(SIGCHLD, finish);
 
 	/* Fork a child process to continue sending packets */
 	printf("Create a child process to continue to send packets \n");
-- 
2.7.0