diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile | 29 | ||||
-rw-r--r-- | test.c | 9 | ||||
-rw-r--r-- | tinysleep.c | 9 |
5 files changed, 49 insertions, 3 deletions
@@ -4,3 +4,6 @@ *.o *.su /pdeath +/tinysleep +/test +/.testdir @@ -1,6 +1,6 @@ ISC License -© 2016 Mattias Andrée <maandree@kth.se> +© 2016, 2017 Mattias Andrée <maandree@kth.se> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -3,7 +3,7 @@ CONFIGFILE = config.mk include $(CONFIGFILE) -all: pdeath +all: pdeath tinysleep test .o: $(CC) -o $@ $^ $(LDFLAGS) @@ -11,6 +11,31 @@ all: pdeath .c.o: $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) +check: pdeath tinysleep test + ./pdeath -L >/dev/null + ./pdeath -L | grep ABRT >/dev/null + ./pdeath -L | grep FPE >/dev/null + ./pdeath -L | grep ILL >/dev/null + ./pdeath -L | grep INT >/dev/null + ./pdeath -L | grep SEGV >/dev/null + ./pdeath -L | grep TERM >/dev/null + ! ./pdeath 2>/dev/null + ! ./pdeath KILL 2>/dev/null + ./pdeath KILL true + ! ./pdeath KILL false + ./pdeath 1 true + ./pdeath 1+1 true + ./pdeath 2-1 true + ! ./pdeath - true 2>/dev/null + ! ./test + ./pdeath KILL ./test + mkdir -p .testdir + sleep 1 & printf '%i\n' $$! > .testdir/pid; ./tinysleep + kill -0 $$(cat .testdir/pid) + ./pdeath KILL sleep 1 & printf '%i\n' $$! > .testdir/pid; ./tinysleep + ! kill -0 $$(cat .testdir/pid) 2>/dev/null + rm -r .testdir + install: pdeath mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath" @@ -25,7 +50,7 @@ uninstall: -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath" clean: - -rm -f -- *.o pdeath + -rm -rf -- *.o pdeath .testdir SUFFIXES: .o .c.o @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#include <sys/prctl.h> + +int +main(void) +{ + int val = 0; + return prctl(PR_GET_PDEATHSIG, &val) || !val; +} diff --git a/tinysleep.c b/tinysleep.c new file mode 100644 index 0000000..5c00a59 --- /dev/null +++ b/tinysleep.c @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#include <unistd.h> + +int +main(void) +{ + usleep(50000L); + return 0; +} |