Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From 405c03171e4bf0edd698cb602cf7bd7fe1d0401a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 7 Jan 2016 19:33:53 +0000 |
| 4 | Subject: [PATCH 07/32] replace SIGCLD with SIGCHLD |
| 5 | |
| 6 | its defined to use SIGCHLD anyway in |
| 7 | |
| 8 | bits/signum.h:#define SIGCLD SIGCHLD /* Same as SIGCHLD |
| 9 | (System V). */ |
| 10 | |
| 11 | plus it helps these tests compile with musl which adheres to posix |
| 12 | |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | lib/tst_sig.c | 8 ++++---- |
| 16 | testcases/kernel/connectors/pec/pec_listener.c | 1 + |
| 17 | testcases/kernel/fs/doio/doio.c | 4 ++-- |
| 18 | testcases/kernel/fs/doio/growfiles.c | 2 +- |
| 19 | testcases/kernel/syscalls/fcntl/fcntl11.c | 8 ++++---- |
| 20 | testcases/kernel/syscalls/fcntl/fcntl17.c | 8 ++++---- |
| 21 | testcases/kernel/syscalls/fcntl/fcntl19.c | 8 ++++---- |
| 22 | testcases/kernel/syscalls/fcntl/fcntl20.c | 8 ++++---- |
| 23 | testcases/kernel/syscalls/fcntl/fcntl21.c | 8 ++++---- |
| 24 | testcases/kernel/syscalls/kill/kill02.c | 6 +++--- |
| 25 | testcases/kernel/syscalls/kill/kill12.c | 8 ++++---- |
| 26 | testcases/kernel/syscalls/mkdir/mkdir09.c | 12 ++++++------ |
| 27 | testcases/kernel/syscalls/sighold/sighold02.c | 2 +- |
| 28 | testcases/network/tcp_cmds/perf_lan/pingpong.c | 2 +- |
| 29 | testcases/network/tcp_cmds/perf_lan/pingpong6.c | 2 +- |
| 30 | 15 files changed, 44 insertions(+), 43 deletions(-) |
| 31 | |
| 32 | diff --git a/lib/tst_sig.c b/lib/tst_sig.c |
| 33 | index 3af5ffd..36565e1 100644 |
| 34 | --- a/lib/tst_sig.c |
| 35 | +++ b/lib/tst_sig.c |
| 36 | @@ -49,7 +49,7 @@ |
| 37 | fork_flag - set to FORK or NOFORK depending upon whether the |
| 38 | calling program executes a fork() system call. It |
| 39 | is normally the case that the calling program treats |
| 40 | - SIGCLD as an expected signal if fork() is being used. |
| 41 | + SIGCHLD as an expected signal if fork() is being used. |
| 42 | |
| 43 | handler - a pointer to the unexpected signal handler to |
| 44 | be executed after an unexpected signal has been |
| 45 | @@ -82,7 +82,7 @@ static void (*tst_setup_signal(int, void (*)(int))) (int); |
| 46 | |
| 47 | /**************************************************************************** |
| 48 | * tst_sig() : set-up to catch unexpected signals. fork_flag is set to NOFORK |
| 49 | - * if SIGCLD is to be an "unexpected signal", otherwise it is set to |
| 50 | + * if SIGCHLD is to be an "unexpected signal", otherwise it is set to |
| 51 | * FORK. cleanup points to a cleanup routine to be executed before |
| 52 | * tst_exit is called (cleanup is set to NULL if no cleanup is desired). |
| 53 | * handler is a pointer to the signal handling routine (if handler is |
| 54 | @@ -117,7 +117,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ()) |
| 55 | for (sig = 1; sig < NSIG; sig++) { |
| 56 | /* |
| 57 | * SIGKILL is never unexpected. |
| 58 | - * SIGCLD is only unexpected when |
| 59 | + * SIGCHLD is only unexpected when |
| 60 | * no forking is being done. |
| 61 | * SIGINFO is used for file quotas and should be expected |
| 62 | */ |
| 63 | @@ -205,7 +205,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ()) |
| 64 | #endif |
| 65 | break; |
| 66 | |
| 67 | - case SIGCLD: |
| 68 | + case SIGCHLD: |
| 69 | if (fork_flag == FORK) |
| 70 | continue; |
| 71 | |
| 72 | diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c |
| 73 | index a1beb13..002750a 100644 |
| 74 | --- a/testcases/kernel/connectors/pec/pec_listener.c |
| 75 | +++ b/testcases/kernel/connectors/pec/pec_listener.c |
| 76 | @@ -20,6 +20,7 @@ |
| 77 | /* */ |
| 78 | /******************************************************************************/ |
| 79 | |
| 80 | +#define _GNU_SOURCE |
| 81 | #include <sys/socket.h> |
| 82 | #include <sys/poll.h> |
| 83 | #include <sys/types.h> |
| 84 | diff --git a/testcases/kernel/fs/doio/doio.c b/testcases/kernel/fs/doio/doio.c |
| 85 | index 4b0dec5..5f65ef9 100644 |
| 86 | --- a/testcases/kernel/fs/doio/doio.c |
| 87 | +++ b/testcases/kernel/fs/doio/doio.c |
| 88 | @@ -573,7 +573,7 @@ int main(int argc, char **argv) |
| 89 | case SIGTSTP: |
| 90 | case SIGSTOP: |
| 91 | case SIGCONT: |
| 92 | - case SIGCLD: |
| 93 | + case SIGCHLD: |
| 94 | case SIGBUS: |
| 95 | case SIGSEGV: |
| 96 | case SIGQUIT: |
| 97 | @@ -615,7 +615,7 @@ int main(int argc, char **argv) |
| 98 | } |
| 99 | |
| 100 | sigemptyset(&block_mask); |
| 101 | - sigaddset(&block_mask, SIGCLD); |
| 102 | + sigaddset(&block_mask, SIGCHLD); |
| 103 | sigprocmask(SIG_BLOCK, &block_mask, &omask); |
| 104 | |
| 105 | /* |
| 106 | diff --git a/testcases/kernel/fs/doio/growfiles.c b/testcases/kernel/fs/doio/growfiles.c |
| 107 | index 09e7f35..bbad230 100644 |
| 108 | --- a/testcases/kernel/fs/doio/growfiles.c |
| 109 | +++ b/testcases/kernel/fs/doio/growfiles.c |
| 110 | @@ -1640,7 +1640,7 @@ int set_sig(void) |
| 111 | #ifdef SIGRESTART |
| 112 | case SIGRESTART: |
| 113 | #endif /* SIGRESTART */ |
| 114 | - case SIGCLD: |
| 115 | + case SIGCHLD: |
| 116 | break; |
| 117 | |
| 118 | default: |
| 119 | diff --git a/testcases/kernel/syscalls/fcntl/fcntl11.c b/testcases/kernel/syscalls/fcntl/fcntl11.c |
| 120 | index fa6ce53..2de2b6c 100644 |
| 121 | --- a/testcases/kernel/syscalls/fcntl/fcntl11.c |
| 122 | +++ b/testcases/kernel/syscalls/fcntl/fcntl11.c |
| 123 | @@ -105,10 +105,10 @@ void setup(void) |
| 124 | memset(&act, 0, sizeof(act)); |
| 125 | act.sa_handler = catch_child; |
| 126 | sigemptyset(&act.sa_mask); |
| 127 | - sigaddset(&act.sa_mask, SIGCLD); |
| 128 | - if ((sigaction(SIGCLD, &act, NULL)) < 0) |
| 129 | + sigaddset(&act.sa_mask, SIGCHLD); |
| 130 | + if ((sigaction(SIGCHLD, &act, NULL)) < 0) |
| 131 | tst_brkm(TBROK | TERRNO, cleanup, |
| 132 | - "sigaction(SIGCLD, ..) failed"); |
| 133 | + "sigaction(SIGCHLD, ..) failed"); |
| 134 | } |
| 135 | |
| 136 | void do_child(void) |
| 137 | @@ -227,7 +227,7 @@ void stop_child(void) |
| 138 | { |
| 139 | struct flock fl; |
| 140 | |
| 141 | - signal(SIGCLD, SIG_DFL); |
| 142 | + signal(SIGCHLD, SIG_DFL); |
| 143 | fl.l_type = STOP; |
| 144 | parent_put(&fl); |
| 145 | wait(0); |
| 146 | diff --git a/testcases/kernel/syscalls/fcntl/fcntl17.c b/testcases/kernel/syscalls/fcntl/fcntl17.c |
| 147 | index 5b03e39..6598b20 100644 |
| 148 | --- a/testcases/kernel/syscalls/fcntl/fcntl17.c |
| 149 | +++ b/testcases/kernel/syscalls/fcntl/fcntl17.c |
| 150 | @@ -150,9 +150,9 @@ int setup(void) |
| 151 | memset(&act, 0, sizeof(act)); |
| 152 | act.sa_handler = catch_child; |
| 153 | sigemptyset(&act.sa_mask); |
| 154 | - sigaddset(&act.sa_mask, SIGCLD); |
| 155 | - if (sigaction(SIGCLD, &act, NULL) < 0) { |
| 156 | - tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno); |
| 157 | + sigaddset(&act.sa_mask, SIGCHLD); |
| 158 | + if (sigaction(SIGCHLD, &act, NULL) < 0) { |
| 159 | + tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno); |
| 160 | return 1; |
| 161 | } |
| 162 | return 0; |
| 163 | @@ -381,7 +381,7 @@ void stop_children(void) |
| 164 | { |
| 165 | int arg; |
| 166 | |
| 167 | - signal(SIGCLD, SIG_DFL); |
| 168 | + signal(SIGCHLD, SIG_DFL); |
| 169 | arg = STOP; |
| 170 | child_free(child_pipe1[1], arg); |
| 171 | child_free(child_pipe2[1], arg); |
| 172 | diff --git a/testcases/kernel/syscalls/fcntl/fcntl19.c b/testcases/kernel/syscalls/fcntl/fcntl19.c |
| 173 | index a542cfc..88c91d6 100644 |
| 174 | --- a/testcases/kernel/syscalls/fcntl/fcntl19.c |
| 175 | +++ b/testcases/kernel/syscalls/fcntl/fcntl19.c |
| 176 | @@ -112,9 +112,9 @@ void setup(void) |
| 177 | memset(&act, 0, sizeof(act)); |
| 178 | act.sa_handler = catch_child; |
| 179 | sigemptyset(&act.sa_mask); |
| 180 | - sigaddset(&act.sa_mask, SIGCLD); |
| 181 | - if ((sigaction(SIGCLD, &act, NULL)) < 0) { |
| 182 | - tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno); |
| 183 | + sigaddset(&act.sa_mask, SIGCHLD); |
| 184 | + if ((sigaction(SIGCHLD, &act, NULL)) < 0) { |
| 185 | + tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno); |
| 186 | fail = 1; |
| 187 | } |
| 188 | } |
| 189 | @@ -265,7 +265,7 @@ void stop_child(void) |
| 190 | { |
| 191 | struct flock fl; |
| 192 | |
| 193 | - signal(SIGCLD, SIG_DFL); |
| 194 | + signal(SIGCHLD, SIG_DFL); |
| 195 | fl.l_type = STOP; |
| 196 | parent_put(&fl); |
| 197 | wait(0); |
| 198 | diff --git a/testcases/kernel/syscalls/fcntl/fcntl20.c b/testcases/kernel/syscalls/fcntl/fcntl20.c |
| 199 | index aa06bab..99fd783 100644 |
| 200 | --- a/testcases/kernel/syscalls/fcntl/fcntl20.c |
| 201 | +++ b/testcases/kernel/syscalls/fcntl/fcntl20.c |
| 202 | @@ -109,9 +109,9 @@ void setup(void) |
| 203 | memset(&act, 0, sizeof(act)); |
| 204 | act.sa_handler = catch_child; |
| 205 | sigemptyset(&act.sa_mask); |
| 206 | - sigaddset(&act.sa_mask, SIGCLD); |
| 207 | - if (sigaction(SIGCLD, &act, NULL) == -1) |
| 208 | - tst_brkm(TFAIL | TERRNO, cleanup, "SIGCLD signal setup failed"); |
| 209 | + sigaddset(&act.sa_mask, SIGCHLD); |
| 210 | + if (sigaction(SIGCHLD, &act, NULL) == -1) |
| 211 | + tst_brkm(TFAIL | TERRNO, cleanup, "SIGCHLD signal setup failed"); |
| 212 | } |
| 213 | |
| 214 | void cleanup(void) |
| 215 | @@ -264,7 +264,7 @@ void stop_child(void) |
| 216 | { |
| 217 | struct flock fl; |
| 218 | |
| 219 | - signal(SIGCLD, SIG_DFL); |
| 220 | + signal(SIGCHLD, SIG_DFL); |
| 221 | fl.l_type = STOP; |
| 222 | parent_put(&fl); |
| 223 | wait(0); |
| 224 | diff --git a/testcases/kernel/syscalls/fcntl/fcntl21.c b/testcases/kernel/syscalls/fcntl/fcntl21.c |
| 225 | index 5307021..8f1a67c 100644 |
| 226 | --- a/testcases/kernel/syscalls/fcntl/fcntl21.c |
| 227 | +++ b/testcases/kernel/syscalls/fcntl/fcntl21.c |
| 228 | @@ -110,9 +110,9 @@ void setup(void) |
| 229 | memset(&act, 0, sizeof(act)); |
| 230 | act.sa_handler = catch_child; |
| 231 | sigemptyset(&act.sa_mask); |
| 232 | - sigaddset(&act.sa_mask, SIGCLD); |
| 233 | - if ((sigaction(SIGCLD, &act, NULL)) < 0) { |
| 234 | - tst_resm(TFAIL, "SIGCLD signal setup failed, errno: %d", errno); |
| 235 | + sigaddset(&act.sa_mask, SIGCHLD); |
| 236 | + if ((sigaction(SIGCHLD, &act, NULL)) < 0) { |
| 237 | + tst_resm(TFAIL, "SIGCHLD signal setup failed, errno: %d", errno); |
| 238 | fail = 1; |
| 239 | } |
| 240 | } |
| 241 | @@ -272,7 +272,7 @@ void stop_child(void) |
| 242 | { |
| 243 | struct flock fl; |
| 244 | |
| 245 | - signal(SIGCLD, SIG_DFL); |
| 246 | + signal(SIGCHLD, SIG_DFL); |
| 247 | fl.l_type = STOP; |
| 248 | parent_put(&fl); |
| 249 | wait(0); |
| 250 | diff --git a/testcases/kernel/syscalls/kill/kill02.c b/testcases/kernel/syscalls/kill/kill02.c |
| 251 | index 9d6cc68..08360dd 100644 |
| 252 | --- a/testcases/kernel/syscalls/kill/kill02.c |
| 253 | +++ b/testcases/kernel/syscalls/kill/kill02.c |
| 254 | @@ -701,7 +701,7 @@ void setup(void) |
| 255 | |
| 256 | /* |
| 257 | * Set to catch unexpected signals. |
| 258 | - * SIGCLD is set to be ignored because we do not wait for termination status. |
| 259 | + * SIGCHLD is set to be ignored because we do not wait for termination status. |
| 260 | * SIGUSR1 is set to be ignored because this is the signal we are using for |
| 261 | * the test and we are not concerned with the parent getting it. |
| 262 | */ |
| 263 | @@ -713,9 +713,9 @@ void setup(void) |
| 264 | "signal(SIGUSR1, SIG_IGN) failed"); |
| 265 | } |
| 266 | |
| 267 | - if (signal(SIGCLD, SIG_IGN) == SIG_ERR) { |
| 268 | + if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { |
| 269 | tst_brkm(TBROK | TERRNO, NULL, |
| 270 | - "signal(SIGCLD, SIG_IGN) failed"); |
| 271 | + "signal(SIGCHLD, SIG_IGN) failed"); |
| 272 | } |
| 273 | |
| 274 | TEST_PAUSE; |
| 275 | diff --git a/testcases/kernel/syscalls/kill/kill12.c b/testcases/kernel/syscalls/kill/kill12.c |
| 276 | index 7a47a4a..d7c4147 100644 |
| 277 | --- a/testcases/kernel/syscalls/kill/kill12.c |
| 278 | +++ b/testcases/kernel/syscalls/kill/kill12.c |
| 279 | @@ -98,7 +98,7 @@ int main(int argc, char **argv) |
| 280 | |
| 281 | exno = 1; |
| 282 | |
| 283 | - if (sigset(SIGCLD, chsig) == SIG_ERR) { |
| 284 | + if (sigset(SIGCHLD, chsig) == SIG_ERR) { |
| 285 | fprintf(temp, "\tsigset failed, errno = %d\n", errno); |
| 286 | fail_exit(); |
| 287 | } |
| 288 | @@ -128,7 +128,7 @@ int main(int argc, char **argv) |
| 289 | sleep(1); |
| 290 | |
| 291 | kill(pid, sig); /* child should ignroe this sig */ |
| 292 | - kill(pid, SIGCLD); /* child should exit */ |
| 293 | + kill(pid, SIGCHLD); /* child should exit */ |
| 294 | |
| 295 | #ifdef BCS |
| 296 | while ((npid = wait(&status)) != pid |
| 297 | @@ -222,14 +222,14 @@ void do_child(void) |
| 298 | int exno = 1; |
| 299 | |
| 300 | #ifdef UCLINUX |
| 301 | - if (sigset(SIGCLD, chsig) == SIG_ERR) { |
| 302 | + if (sigset(SIGCHLD, chsig) == SIG_ERR) { |
| 303 | fprintf(temp, "\tsigset failed, errno = %d\n", errno); |
| 304 | fail_exit(); |
| 305 | } |
| 306 | #endif |
| 307 | |
| 308 | sigset(sig, SIG_IGN); /* set to ignore signal */ |
| 309 | - kill(getppid(), SIGCLD); /* tell parent we are ready */ |
| 310 | + kill(getppid(), SIGCHLD); /* tell parent we are ready */ |
| 311 | while (!chflag) |
| 312 | sleep(1); /* wait for parent */ |
| 313 | |
| 314 | diff --git a/testcases/kernel/syscalls/mkdir/mkdir09.c b/testcases/kernel/syscalls/mkdir/mkdir09.c |
| 315 | index 41c20e9..07b4fb8 100644 |
| 316 | --- a/testcases/kernel/syscalls/mkdir/mkdir09.c |
| 317 | +++ b/testcases/kernel/syscalls/mkdir/mkdir09.c |
| 318 | @@ -122,10 +122,10 @@ int main(int argc, char *argv[]) |
| 319 | |
| 320 | } |
| 321 | |
| 322 | - /* Set up to catch SIGCLD signal */ |
| 323 | - if (signal(SIGCLD, chld) == SIG_ERR) { |
| 324 | + /* Set up to catch SIGCHLD signal */ |
| 325 | + if (signal(SIGCHLD, chld) == SIG_ERR) { |
| 326 | tst_brkm(TFAIL, cleanup, |
| 327 | - "Error setting up SIGCLD signal, ERRNO = %d", errno); |
| 328 | + "Error setting up SIGCHLD signal, ERRNO = %d", errno); |
| 329 | |
| 330 | } |
| 331 | |
| 332 | @@ -236,9 +236,9 @@ int runtest(void) |
| 333 | tst_brkm(TFAIL, cleanup, |
| 334 | "Error resetting SIGTERM signal, ERRNO = %d", errno); |
| 335 | } |
| 336 | - if (signal(SIGCLD, SIG_DFL) == SIG_ERR) { |
| 337 | + if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) { |
| 338 | tst_brkm(TFAIL, cleanup, |
| 339 | - "Error resetting SIGCLD signal, ERRNO = %d", errno); |
| 340 | + "Error resetting SIGCHLD signal, ERRNO = %d", errno); |
| 341 | } |
| 342 | |
| 343 | if (test_time) { |
| 344 | @@ -372,7 +372,7 @@ void term(int sig) |
| 345 | |
| 346 | void chld(int sig) |
| 347 | { |
| 348 | - /* Routine to handle SIGCLD signal. */ |
| 349 | + /* Routine to handle SIGCHLD signal. */ |
| 350 | |
| 351 | sigchld++; |
| 352 | if (jump) { |
| 353 | diff --git a/testcases/kernel/syscalls/sighold/sighold02.c b/testcases/kernel/syscalls/sighold/sighold02.c |
| 354 | index e3076fb..be01874 100644 |
| 355 | --- a/testcases/kernel/syscalls/sighold/sighold02.c |
| 356 | +++ b/testcases/kernel/syscalls/sighold/sighold02.c |
| 357 | @@ -77,7 +77,7 @@ static int sigs_map[NUMSIGS]; |
| 358 | static int skip_sig(int sig) |
| 359 | { |
| 360 | switch (sig) { |
| 361 | - case SIGCLD: |
| 362 | + case SIGCHLD: |
| 363 | case SIGKILL: |
| 364 | case SIGALRM: |
| 365 | case SIGSTOP: |
| 366 | diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong.c b/testcases/network/tcp_cmds/perf_lan/pingpong.c |
| 367 | index 1196312..5b06798 100644 |
| 368 | --- a/testcases/network/tcp_cmds/perf_lan/pingpong.c |
| 369 | +++ b/testcases/network/tcp_cmds/perf_lan/pingpong.c |
| 370 | @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) |
| 371 | |
| 372 | /* Setup traps */ |
| 373 | signal(SIGINT, finish); |
| 374 | - signal(SIGCLD, finish); |
| 375 | + signal(SIGCHLD, finish); |
| 376 | |
| 377 | /* Fork a child process to continue sending packets */ |
| 378 | tst_resm(TINFO, "Create a child process to continue to send packets"); |
| 379 | diff --git a/testcases/network/tcp_cmds/perf_lan/pingpong6.c b/testcases/network/tcp_cmds/perf_lan/pingpong6.c |
| 380 | index 9747f58..0a0fb1d 100644 |
| 381 | --- a/testcases/network/tcp_cmds/perf_lan/pingpong6.c |
| 382 | +++ b/testcases/network/tcp_cmds/perf_lan/pingpong6.c |
| 383 | @@ -153,7 +153,7 @@ char *argv[]; |
| 384 | |
| 385 | /* Setup traps */ |
| 386 | signal(SIGINT, finish); |
| 387 | - signal(SIGCLD, finish); |
| 388 | + signal(SIGCHLD, finish); |
| 389 | |
| 390 | /* Fork a child process to continue sending packets */ |
| 391 | printf("Create a child process to continue to send packets \n"); |
| 392 | -- |
| 393 | 2.7.0 |
| 394 | |