summaryrefslogtreecommitdiffstats
path: root/kernel/filesystems/nfs/connectathon/434966lock.patch
blob: 337487945138f790f051391b227934e73c7b5526 (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
--- cthon04/lock/tlock.c.orig
+++ cthon04/lock/tlock.c
@@ -1399,7 +1399,6 @@ test12()
 		childfree(0);
 
 		parentwait();
-		(void) lseek(testfd, (off_t)0, 0);
 		if (read(pidpipe[0], &target, sizeof (target)) !=
 		    sizeof (target)) {
 			perror("can't read pid to kill");
@@ -1407,7 +1406,7 @@ test12()
 		}
 		kill(target, SIGINT);
 		comment("Killed child process.");
-		sleep(wait_time);
+		parentwait();
 		test(12, 1, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL);
 		childfree(0);
 		close_testfile(DO_UNLINK);
@@ -1437,14 +1436,8 @@ test12()
 		 */
 		if (subchild > 0) {
 			/* original child */
-			sleep(wait_time);
-			(void) lseek(testfd, (off_t)0, 0);
-			if (write(pidpipe[1], &subchild, sizeof (subchild)) !=
-			    sizeof (subchild)) {
-				perror("can't record pid to kill");
-				kill(subchild, SIGINT);
-				testexit(1);
-			}
+			parentfree(0);
+			wait((int *)0);
 			parentfree(0);
 			childwait();
 			close_testfile(DO_UNLINK);
@@ -1452,8 +1445,14 @@ test12()
 			/* subchild */
 			signal(SIGINT, SIG_DFL);
 			test(12, 0, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL);
+			subchild = getpid();
+			if (write(pidpipe[1], &subchild, sizeof (subchild)) !=
+			    sizeof (subchild)) {
+				perror("can't record pid to kill");
+				testexit(1);
+			}
 			for (;;)
-				sleep(1);
+				pause();
 			/* NOTREACHED */
 		}
 	}