View | Details | Raw Unified | Return to bug 237657 | Differences between
and this patch

Collapse All | Expand All

(-)b/tests/sys/kern/pdeathsig.c (-1 / +12 lines)
Lines 229-234 ATF_TC_BODY(signal_delivered_ptrace, tc) Link Here
229
	int rc;
229
	int rc;
230
	int pipe_ca[2];
230
	int pipe_ca[2];
231
	int pipe_db[2];
231
	int pipe_db[2];
232
	int pipe_cd[2];
232
	char buffer;
233
	char buffer;
233
	int status;
234
	int status;
234
235
Lines 236-241 ATF_TC_BODY(signal_delivered_ptrace, tc) Link Here
236
	ATF_REQUIRE(rc == 0);
237
	ATF_REQUIRE(rc == 0);
237
	rc = pipe(pipe_db);
238
	rc = pipe(pipe_db);
238
	ATF_REQUIRE(rc == 0);
239
	ATF_REQUIRE(rc == 0);
240
	rc = pipe(pipe_cd);
241
	assert(rc == 0);
239
242
240
	rc = fork();
243
	rc = fork();
241
	ATF_REQUIRE(rc != -1);
244
	ATF_REQUIRE(rc != -1);
Lines 263-268 ATF_TC_BODY(signal_delivered_ptrace, tc) Link Here
263
			rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
266
			rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
264
			assert(rc == 0);
267
			assert(rc == 0);
265
268
269
			rc = write(pipe_cd[1], "x", 1);
270
			assert(rc == 1);
271
266
			/* wait for B to die and signal us... */
272
			/* wait for B to die and signal us... */
267
			signum = 0xdeadbeef;
273
			signum = 0xdeadbeef;
268
			rc = sigwait(&sigset, &signum);
274
			rc = sigwait(&sigset, &signum);
Lines 293-298 ATF_TC_BODY(signal_delivered_ptrace, tc) Link Here
293
			rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0);
299
			rc = ptrace(PT_CONTINUE, c_pid, (caddr_t) 1, 0);
294
			assert(rc == 0);
300
			assert(rc == 0);
295
301
302
			rc = read(pipe_cd[0], &buffer, 1);
303
			assert(rc == 1);
304
296
			/* tell B that we're ready for it to exit now */
305
			/* tell B that we're ready for it to exit now */
297
			rc = write(pipe_db[1], ".", 1);
306
			rc = write(pipe_db[1], ".", 1);
298
			assert(rc == 1);
307
			assert(rc == 1);
Lines 305-311 ATF_TC_BODY(signal_delivered_ptrace, tc) Link Here
305
				    WSTOPSIG(status));
314
				    WSTOPSIG(status));
306
			assert(rc == 0);
315
			assert(rc == 0);
307
316
308
			ptrace(PT_DETACH, c_pid, 0, 0);
317
			waitpid(c_pid, &status, 0);
318
			if (!WIFEXITED(status))
319
				ptrace(PT_DETACH, c_pid, 0, 0);
309
320
310
			_exit(0);
321
			_exit(0);
311
		}
322
		}

Return to bug 237657