Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/lib/libc/clone Test the "alternate exit signal" faci...
details: https://anonhg.NetBSD.org/src/rev/25d0e10f1891
branches: trunk
changeset: 512885:25d0e10f1891
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Jul 18 19:24:02 2001 +0000
description:
Test the "alternate exit signal" facility of clone(2).
diffstat:
regress/lib/libc/clone/clonetest.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r a1646f1990ad -r 25d0e10f1891 regress/lib/libc/clone/clonetest.c
--- a/regress/lib/libc/clone/clonetest.c Wed Jul 18 19:12:21 2001 +0000
+++ b/regress/lib/libc/clone/clonetest.c Wed Jul 18 19:24:02 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clonetest.c,v 1.1 2001/07/17 23:58:30 thorpej Exp $ */
+/* $NetBSD: clonetest.c,v 1.2 2001/07/18 19:24:02 thorpej Exp $ */
/*
* This file placed in the public domain.
@@ -26,6 +26,7 @@
int
main(int argc, char *argv[])
{
+ sigset_t mask;
void *stack;
__volatile int frobme = 0;
pid_t pid;
@@ -44,13 +45,19 @@
printf("parent: stack = %p\n", stack);
fflush(stdout);
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGUSR1);
+
+ if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
+ err(1, "sigprocmask (SIGUSR1)");
+
pid = __clone(newclone, stack,
- CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD,
+ CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGUSR1,
(void *) &frobme);
if (pid == -1)
err(1, "clone");
- while (waitpid(pid, &stat, 0) != pid)
+ while (waitpid(pid, &stat, __WCLONE) != pid)
/* spin */ ;
if (WIFEXITED(stat) == 0)
Home |
Main Index |
Thread Index |
Old Index