Hi, all
I execute fork12 test and OMM killer begin send SIGKILL to its children and
fork return success always.
fork12 hang up in this case, so I create the patch (see attach), which check
whether someone child killed and if it occur, return number of forked
processes.
--- /home/shpagin/tmp/ltp-base-20080531/testcases/kernel/syscalls/fork/fork12.c	2008-06-01 14:37:06.000000000 +0400
+++ /home/shpagin/ltp-base-20080531/testcases/kernel/syscalls/fork/fork12.c	2008-06-06 22:08:49.000000000 +0400
@@ -62,7 +62,7 @@ int
 main(int ac, char **av)
 {
 	int forks, pid1, fork_errno, waitstatus;
-
+	int ret, status;
 	int lc;			/* loop counter */
 	char *msg;		/* message returned from parse_opts */
 
@@ -96,6 +96,18 @@ main(int ac, char **av)
 			exit(0);
 		    }
 		    forks++;
+		    ret = waitpid(-1, &status, WNOHANG);
+		    if (ret < 0)
+			tst_brkm(TBROK, cleanup, "waitpid failed %d: %s\n", \
+					errno, strerror(errno));
+                    if (ret > 0) {
+			/* a child may be killed by OOM killer */
+		        if (WTERMSIG(status) == SIGKILL)
+			    break;
+                        tst_brkm(TBROK, cleanup, \
+				"child exit with error code %d or signal %d", \
+				WEXITSTATUS(status), WTERMSIG(status));
+                    }
 		}
 		fork_errno = errno;
 
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to