summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2019-10-15 18:43:02 +0000
committermartin <martin@NetBSD.org>2019-10-15 18:43:02 +0000
commit085bac6009fd85df09f736a3307f32fdfb24e3a4 (patch)
tree703c3e90a62e1d4a328a6c932ac68860502a2eb9 /tests
parent468550de5981a1d4fa43750b29340bfedea2ba0b (diff)
Pull up following revision(s) (requested by kamil in ticket #315):
tests/lib/libc/sys/t_ptrace_wait.c: revision 1.132 Add a few static asserts in t_ptrace_wait.c for conditions that must be kept Assert that ptrace_state and siginfo_t's _ptrace_state are synchronized.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/libc/sys/t_ptrace_wait.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/lib/libc/sys/t_ptrace_wait.c b/tests/lib/libc/sys/t_ptrace_wait.c
index 2ff8b2622b2..04e104b9bd6 100644
--- a/tests/lib/libc/sys/t_ptrace_wait.c
+++ b/tests/lib/libc/sys/t_ptrace_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $ */
/*-
* Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $")
#include <sys/uio.h>
#include <sys/wait.h>
#include <machine/reg.h>
+#include <assert.h>
#include <elf.h>
#include <err.h>
#include <errno.h>
@@ -73,6 +74,20 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $")
#include <atf-c.h>
+/* Assumptions in the kernel code that must be kept. */
+static_assert(sizeof(((struct ptrace_state *)0)->pe_report_event) ==
+ sizeof(((siginfo_t *)0)->si_pe_report_event),
+ "pe_report_event and si_pe_report_event must be of the same size");
+static_assert(sizeof(((struct ptrace_state *)0)->pe_other_pid) ==
+ sizeof(((siginfo_t *)0)->si_pe_other_pid),
+ "pe_other_pid and si_pe_other_pid must be of the same size");
+static_assert(sizeof(((struct ptrace_state *)0)->pe_lwp) ==
+ sizeof(((siginfo_t *)0)->si_pe_lwp),
+ "pe_lwp and si_pe_lwp must be of the same size");
+static_assert(sizeof(((struct ptrace_state *)0)->pe_other_pid) ==
+ sizeof(((struct ptrace_state *)0)->pe_lwp),
+ "pe_other_pid and pe_lwp must be of the same size");
+
#include "h_macros.h"
#include "t_ptrace_wait.h"