[LTP] [PATCH 13/31] kill: Remove UCLINUX

Petr Vorel pvorel@suse.cz
Thu Apr 11 16:30:07 CEST 2024


Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/kill/kill02.c | 93 +------------------------
 testcases/kernel/syscalls/kill/kill07.c | 10 ---
 testcases/kernel/syscalls/kill/kill08.c | 11 ---
 testcases/kernel/syscalls/kill/kill09.c | 11 ---
 4 files changed, 1 insertion(+), 124 deletions(-)

diff --git a/testcases/kernel/syscalls/kill/kill02.c b/testcases/kernel/syscalls/kill/kill02.c
index 21aacffa1..776540b4e 100644
--- a/testcases/kernel/syscalls/kill/kill02.c
+++ b/testcases/kernel/syscalls/kill/kill02.c
@@ -203,28 +203,12 @@ void cleanup();
 char *TCID = "kill02";
 int TST_TOTAL = 2;
 
-#ifdef UCLINUX
-static char *argv0;
-void childA_rout_uclinux();
-void childB_rout_uclinux();
-#endif
-
 int main(int ac, char **av)
 {
 	int lc;
 
 	tst_parse_opts(ac, av, NULL, NULL);
 
-#ifdef UCLINUX
-	argv0 = av[0];
-
-	maybe_run_child(&childA_rout_uclinux, "nd", 1, &pipeA_fd[1]);
-	maybe_run_child(&childB_rout_uclinux, "nd", 2, &pipeB_fd[1]);
-	maybe_run_child(&child1_rout, "ndddddd", 3, &pipe1_fd[1], &pipe2_fd[1],
-			&pipeA_fd[0], &pipeA_fd[1], &pipeB_fd[0], &pipeB_fd[1]);
-	maybe_run_child(&child2_rout, "nd", 4, &pipe2_fd[1]);
-#endif
-
 	setup();
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -235,19 +219,7 @@ int main(int ac, char **av)
 			if ((pid2 = tst_fork()) > 0) {
 				(void)parent_rout();
 			} else if (pid2 == 0) {
-#ifdef UCLINUX
-				if (self_exec(argv0, "nd", 4, pipe2_fd[1]) < 0) {
-					if (kill(pid1, SIGKILL) == -1
-					    && errno != ESRCH) {
-						tst_resm(TWARN,
-							 "Child process may not have been killed.");
-					}
-					tst_brkm(TBROK | TERRNO, cleanup,
-						 "fork failed");
-				}
-#else
 				(void)child2_rout();
-#endif
 			} else {
 				/*
 				 *  The second fork failed kill the first child.
@@ -264,17 +236,7 @@ int main(int ac, char **av)
 			/*
 			 *  This is child 1.
 			 */
-#ifdef UCLINUX
-			if (self_exec
-			    (argv0, "ndddddd", 3, pipe1_fd[1], pipe2_fd[1],
-			     pipeA_fd[0], pipeA_fd[1], pipeB_fd[0],
-			     pipeB_fd[1]) < 0) {
-				tst_brkm(TBROK | TERRNO, cleanup,
-					 "self_exec() failed");
-			}
-#else
 			(void)child1_rout();
-#endif
 		} else {
 			/*
 			 * Fork failed.
@@ -456,18 +418,10 @@ void child1_rout(void)
 		/*
 		 *  This is the parent(child1), fork again to create child B.
 		 */
+
 		if ((pidB = tst_fork()) == 0) {
 			/* This is child B. */
-#ifdef UCLINUX
-			if (self_exec(argv0, "nd", 2, pipeB_fd[1]) < 0) {
-				tst_brkm(TBROK | TERRNO, NULL,
-					 "self_exec() failed");
-				(void)write(pipe1_fd[1], CHAR_SET_FAILED, 1);
-				exit(0);
-			}
-#else
 			(void)childB_rout();
-#endif
 		}
 
 		else if (pidB == -1) {
@@ -485,16 +439,7 @@ void child1_rout(void)
 
 	else if (pidA == 0) {
 		/* This is child A. */
-#ifdef UCLINUX
-		if (self_exec(argv0, "nd", 1, pipeA_fd[1]) < 0) {
-			tst_brkm(TBROK | TERRNO, NULL, "self_exec() failed");
-			(void)write(pipe1_fd[1], CHAR_SET_FAILED, 1);
-			exit(0);
-		}
-#else
 		(void)childA_rout();
-#endif
-
 	}
 
 	else if (pidA == -1) {
@@ -625,24 +570,6 @@ void childA_rout(void)
 	exit(0);
 }				/*End of childA_rout */
 
-#ifdef UCLINUX
-/*******************************************************************************
- *  This is the routine for child A after self_exec
- ******************************************************************************/
-void childA_rout_uclinux(void)
-{
-	/* Setup the signal handler again */
-	if (signal(SIGUSR1, usr1_rout) == SIG_ERR) {
-		tst_brkm(TBROK, NULL,
-			 "Could not set to catch the childrens signal.");
-		(void)write(pipeA_fd[1], CHAR_SET_FAILED, 1);
-		exit(0);
-	}
-
-	childA_rout();
-}
-#endif
-
 /*******************************************************************************
  *  This is the routine for child B, which should not receive the parents signal.
  ******************************************************************************/
@@ -667,24 +594,6 @@ void childB_rout(void)
 	exit(0);
 }
 
-#ifdef UCLINUX
-/*******************************************************************************
- *  This is the routine for child B after self_exec
- ******************************************************************************/
-void childB_rout_uclinux(void)
-{
-	/* Setup the signal handler again */
-	if (signal(SIGUSR1, usr1_rout) == SIG_ERR) {
-		tst_brkm(TBROK, NULL,
-			 "Could not set to catch the childrens signal.");
-		(void)write(pipeB_fd[1], CHAR_SET_FAILED, 1);
-		exit(0);
-	}
-
-	childB_rout();
-}
-#endif
-
 /*******************************************************************************
  *  This routine sets up the interprocess communication pipes, signal handling,
  *  and process group information.
diff --git a/testcases/kernel/syscalls/kill/kill07.c b/testcases/kernel/syscalls/kill/kill07.c
index 21dd7ff4f..ac4ebd941 100644
--- a/testcases/kernel/syscalls/kill/kill07.c
+++ b/testcases/kernel/syscalls/kill/kill07.c
@@ -91,9 +91,6 @@ int main(int ac, char **av)
 	struct sigaction my_act, old_act;
 
 	tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
-	maybe_run_child(&do_child, "");
-#endif
 
 	setup();		/* global setup */
 
@@ -128,14 +125,7 @@ int main(int ac, char **av)
 		if (pid < 0) {
 			tst_brkm(TBROK, cleanup, "Fork of child failed");
 		} else if (pid == 0) {
-#ifdef UCLINUX
-			if (self_exec(av[0], "") < 0) {
-				tst_brkm(TBROK, cleanup,
-					 "self_exec of child failed");
-			}
-#else
 			do_child();
-#endif
 		} else {
 			/* sighandler should not catch this signal */
 			/* if it does flag will be set to 1 */
diff --git a/testcases/kernel/syscalls/kill/kill08.c b/testcases/kernel/syscalls/kill/kill08.c
index d75a4db46..9302f5470 100644
--- a/testcases/kernel/syscalls/kill/kill08.c
+++ b/testcases/kernel/syscalls/kill/kill08.c
@@ -78,9 +78,6 @@ int main(int ac, char **av)
 	int exno, status, nsig, i;
 
 	tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
-	maybe_run_child(&do_child, "");
-#endif
 
 	setup();		/* global setup */
 
@@ -105,15 +102,7 @@ int main(int ac, char **av)
 				if (pid2 < 0) {
 					tst_brkm(TBROK, cleanup, "Fork failed");
 				} else if (pid2 == 0) {
-#ifdef UCLINUX
-					if (self_exec(av[0], "") < 0) {
-						tst_brkm(TBROK, cleanup,
-							 "self_exec of "
-							 "child failed");
-					}
-#else
 					do_child();
-#endif
 				}
 			}
 			/* Kill all processes in this process group */
diff --git a/testcases/kernel/syscalls/kill/kill09.c b/testcases/kernel/syscalls/kill/kill09.c
index ad93c5d81..c0b703119 100644
--- a/testcases/kernel/syscalls/kill/kill09.c
+++ b/testcases/kernel/syscalls/kill/kill09.c
@@ -135,10 +135,6 @@ int main(int ac, char **av)
 
 	tst_parse_opts(ac, av, NULL, NULL);
 
-#ifdef UCLINUX
-	maybe_run_child(&do_child, "");
-#endif
-
 	setup();
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -149,14 +145,7 @@ int main(int ac, char **av)
 			tst_brkm(TBROK | TERRNO, cleanup, "fork failed");
 
 		if (fork_pid == 0) {
-#ifdef UCLINUX
-			if (self_exec(av[0], "") < 0) {
-				tst_brkm(TBROK, cleanup,
-					 "self_exec of child failed");
-			}
-#else
 			do_child();
-#endif
 		}
 
 		TEST(kill(fork_pid, SIGKILL));
-- 
2.43.0



More information about the ltp mailing list