]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added a modified version of the rt_sigqueue test program provided by Konstantin Sereb...
authorBart Van Assche <bvanassche@acm.org>
Tue, 27 Oct 2009 14:20:23 +0000 (14:20 +0000)
committerBart Van Assche <bvanassche@acm.org>
Tue, 27 Oct 2009 14:20:23 +0000 (14:20 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10910

memcheck/tests/linux/Makefile.am
memcheck/tests/linux/sigqueue.c [new file with mode: 0644]
memcheck/tests/linux/sigqueue.stderr.exp [new file with mode: 0644]
memcheck/tests/linux/sigqueue.vgtest [new file with mode: 0644]

index a7a2d0201d74514ff4be3a8d234600789bc96074..4bd77513025ca716265b03f30ca3ab326997fff2 100644 (file)
@@ -8,6 +8,7 @@ EXTRA_DIST = \
        capget capget.stderr.exp \
        lsframe1.vgtest lsframe1.stdout.exp lsframe1.stderr.exp \
        lsframe2.vgtest lsframe2.stdout.exp lsframe2.stderr.exp \
+       sigqueue.vgtest sigqueue.stderr.exp \
        stack_changes.stderr.exp stack_changes.stdout.exp \
            stack_changes.stdout.exp2 stack_changes.vgtest \
        stack_switch.stderr.exp stack_switch.vgtest \
@@ -19,6 +20,7 @@ check_PROGRAMS = \
        capget \
        lsframe1 \
        lsframe2 \
+       sigqueue \
        stack_changes \
        stack_switch \
        timerfd-syscall
diff --git a/memcheck/tests/linux/sigqueue.c b/memcheck/tests/linux/sigqueue.c
new file mode 100644 (file)
index 0000000..138a276
--- /dev/null
@@ -0,0 +1,30 @@
+#include <signal.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <syscall.h>
+#include <unistd.h>
+
+int main()
+{
+  siginfo_t *si;
+  const size_t sz = sizeof(*si);
+
+  fprintf(stderr, "sizeof(*si) = %zu\n", sz);
+  fprintf(stderr, "%zd %zd %zd %zd\n",
+          offsetof(siginfo_t, si_signo),
+          offsetof(siginfo_t, si_errno),
+          offsetof(siginfo_t, si_code),
+          offsetof(siginfo_t, _sifields)
+         );
+  si = calloc(1, sz);
+  si->si_signo = SIGWINCH;
+  si->si_code = SI_QUEUE;
+  si->si_pid = getpid();
+  si->si_uid = getuid();
+  syscall(__NR_rt_sigqueueinfo, getpid(), SIGWINCH, si);
+  free(si);
+  fprintf(stderr, "Done.\n");
+  return 0;
+}
diff --git a/memcheck/tests/linux/sigqueue.stderr.exp b/memcheck/tests/linux/sigqueue.stderr.exp
new file mode 100644 (file)
index 0000000..19a8d2f
--- /dev/null
@@ -0,0 +1,13 @@
+
+sizeof(*si) = 128
+0 4 8 16
+Done.
+
+HEAP SUMMARY:
+    in use at exit: 0 bytes in 0 blocks
+  total heap usage: 1 allocs, 1 frees, 128 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
diff --git a/memcheck/tests/linux/sigqueue.vgtest b/memcheck/tests/linux/sigqueue.vgtest
new file mode 100644 (file)
index 0000000..38ab7ed
--- /dev/null
@@ -0,0 +1 @@
+prog: sigqueue