diff options
-rw-r--r-- | test/signal/.cvsignore | 4 | ||||
-rw-r--r-- | test/signal/Makefile | 24 | ||||
-rw-r--r-- | test/signal/sigchld.c | 38 |
3 files changed, 65 insertions, 1 deletions
diff --git a/test/signal/.cvsignore b/test/signal/.cvsignore index 9ae898d74..975daee56 100644 --- a/test/signal/.cvsignore +++ b/test/signal/.cvsignore @@ -2,3 +2,7 @@ signal signal.o signal_glibc signal_glibc.o +sigchld +sigchld.o +sigchld_glibc +sigchld_glibc.o diff --git a/test/signal/Makefile b/test/signal/Makefile index 07bd58cee..b3c6eee79 100644 --- a/test/signal/Makefile +++ b/test/signal/Makefile @@ -21,7 +21,7 @@ include $(TESTDIR)/Rules.mak CFLAGS += -D_GNU_SOURCE -TARGETS=signal signal_glibc +TARGETS=signal signal_glibc sigchld sigchld_glibc all: $(TARGETS) signal: signal.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) @@ -46,6 +46,28 @@ signal_glibc: signal.c Makefile -./$@ -@ echo " " +sigchld: sigchld.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ + -@ echo " " + +sigchld_glibc: sigchld.c Makefile + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs GNU libc: " + -@ echo " " + $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o + $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@ + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ + -@ echo " " + clean: rm -f *.[oa] *~ core $(TARGETS) diff --git a/test/signal/sigchld.c b/test/signal/sigchld.c new file mode 100644 index 000000000..05f4d1594 --- /dev/null +++ b/test/signal/sigchld.c @@ -0,0 +1,38 @@ +#include <stdlib.h> +#include <stdio.h> +#include <sys/signal.h> +#include <unistd.h> + +void test_handler(int signo) +{ + fprintf(stderr, "caught signo: %d\n", signo); +} + + +int main(void) +{ + int count = 0; + struct sigaction siga; + static sigset_t sigset; + + sigfillset(&sigset); + + siga.sa_handler = test_handler; + siga.sa_mask = sigset; + siga.sa_flags = 0; + + if (0 != sigaction(SIGCHLD, &siga, (struct sigaction *)NULL)) { + fprintf(stderr, "ack!"); + } + printf("give me a SIGCHLD\n"); + + for(;;) { + sleep(10); + printf("after sleep %d\n", ++count); + } + + printf("after loop\n"); + + return 0; +} + |