* tests/signal_receive.c: New file.
* tests/signal_receive.test: New test.
* tests/.gitignore: Add signal_receive.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add signal_receive.test.
---
 tests/.gitignore          |  1 +
 tests/Makefile.am         |  2 ++
 tests/signal_receive.c    | 67 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/signal_receive.test |  8 ++++++
 4 files changed, 78 insertions(+)
 create mode 100644 tests/signal_receive.c
 create mode 100755 tests/signal_receive.test

diff --git a/tests/.gitignore b/tests/.gitignore
index a6475d7..1aa7c4f 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -221,6 +221,7 @@ setuid32
 shmxt
 sigaction
 sigaltstack
+signal_receive
 signalfd
 sigreturn
 sleep
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1fff49a..d3ed2e9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -274,6 +274,7 @@ check_PROGRAMS = \
        shmxt \
        sigaction \
        sigaltstack \
+       signal_receive \
        signalfd \
        sigreturn \
        sleep \
@@ -629,6 +630,7 @@ MISC_TESTS = \
        qual_syscall.test \
        redirect.test \
        restart_syscall.test \
+       signal_receive.test \
        strace-S.test \
        strace-T.test \
        strace-V.test \
diff --git a/tests/signal_receive.c b/tests/signal_receive.c
new file mode 100644
index 0000000..73c4ea3
--- /dev/null
+++ b/tests/signal_receive.c
@@ -0,0 +1,67 @@
+#include "tests.h"
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#if defined ALPHA
+const char *const signalent[] = {
+# include "../linux/sparc/signalent.h"
+};
+#elif defined HPPA
+const char *const signalent[] = {
+# include "../linux/mips/signalent.h"
+};
+#elif defined MIPS
+const char *const signalent[] = {
+# include "../linux/alpha/signalent.h"
+};
+#elif defined SPARC || defined SPARC64
+const char *const signalent[] = {
+# include "../linux/hppa/signalent.h"
+};
+#else
+const char *const signalent[] = {
+# include "../linux/signalent.h"
+};
+#endif
+
+static void
+handler(int sig)
+{
+}
+
+int
+main(void)
+{
+       int i;
+       int pid = getpid();
+       const struct sigaction act = { .sa_handler = handler };
+       for (i = 1; i <= 31; i++)
+       {
+               if( i != SIGKILL && i != SIGSTOP)
+               {
+                       sigaction(i, &act, NULL);
+               }
+       }
+
+       sigset_t mask;
+       sigemptyset(&mask);
+       for (i = 1; i <= 31; i++)
+       {
+               sigaddset(&mask, i);
+       }
+       sigprocmask(SIG_UNBLOCK, &mask, NULL);
+       for (i = 1; i <= 31; i++)
+       {
+               if(i != SIGKILL && i != SIGSTOP)
+               {
+                       kill(pid, i);
+                       printf("kill\\(%d, %s\\) = 0\n"
+                              "--- %s {si_signo=%s, si_code=SI_USER, 
si_pid=%d,"
+                              " si_uid=%d} ---\n",
+                              pid, signalent[i], signalent[i], signalent[i],
+                              pid, getuid());
+               }
+       }
+       return 0;
+}
diff --git a/tests/signal_receive.test b/tests/signal_receive.test
new file mode 100755
index 0000000..2e3e98d
--- /dev/null
+++ b/tests/signal_receive.test
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+run_strace -a16 -esignal $args > "$EXP"
+match_grep "$LOG" "$EXP"
+rm -f "$EXP"
-- 
1.8.3.1




------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to