summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sys
diff options
context:
space:
mode:
authormbuhl <>2021-09-02 15:28:41 +0000
committermbuhl <>2021-09-02 15:28:41 +0000
commitcb50e4cba7c57348005d6d7be62fcea1ee889b2e (patch)
treed6ea9147aaa1946e4f275034210959b9c3114eb8 /src/regress/lib/libc/sys
parent35f39be7bcee252b94261cea09e50dac5eba4f29 (diff)
downloadopenbsd-cb50e4cba7c57348005d6d7be62fcea1ee889b2e.tar.gz
openbsd-cb50e4cba7c57348005d6d7be62fcea1ee889b2e.tar.bz2
openbsd-cb50e4cba7c57348005d6d7be62fcea1ee889b2e.zip
Enable vfork syscall test. Disable SIGSTOP test as it is masked until
exec/exit with vfork. OK bluhm@
Diffstat (limited to 'src/regress/lib/libc/sys')
-rw-r--r--src/regress/lib/libc/sys/Makefile8
-rw-r--r--src/regress/lib/libc/sys/README2
-rw-r--r--src/regress/lib/libc/sys/macros.h3
-rw-r--r--src/regress/lib/libc/sys/t_fork.c7
-rw-r--r--src/regress/lib/libc/sys/t_vfork.c31
5 files changed, 45 insertions, 6 deletions
diff --git a/src/regress/lib/libc/sys/Makefile b/src/regress/lib/libc/sys/Makefile
index acb5c89896..0bc8822c2a 100644
--- a/src/regress/lib/libc/sys/Makefile
+++ b/src/regress/lib/libc/sys/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.11 2021/09/02 12:40:44 mbuhl Exp $ 1# $OpenBSD: Makefile,v 1.12 2021/09/02 15:28:41 mbuhl Exp $
2 2
3# Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de> 3# Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de>
4# Copyright (c) 2019 Alexander Bluhm <bluhm@openbsd.org> 4# Copyright (c) 2019 Alexander Bluhm <bluhm@openbsd.org>
@@ -66,6 +66,7 @@ PROGS += t_stat
66PROGS += t_syscall 66PROGS += t_syscall
67PROGS += t_truncate 67PROGS += t_truncate
68PROGS += t_umask t_unlink 68PROGS += t_umask t_unlink
69PROGS += t_vfork
69PROGS += t_wait_noproc 70PROGS += t_wait_noproc
70PROGS += t_wait_noproc_wnohang 71PROGS += t_wait_noproc_wnohang
71PROGS += t_write 72PROGS += t_write
@@ -78,6 +79,11 @@ REGRESS_EXPECTED_FAILURES += run-t_pipe2-2
78REGRESS_EXPECTED_FAILURES += run-t_stat-5 79REGRESS_EXPECTED_FAILURES += run-t_stat-5
79REGRESS_EXPECTED_FAILURES += run-t_unlink-2 80REGRESS_EXPECTED_FAILURES += run-t_unlink-2
80 81
82run-t_vfork-2:
83 # SIGSTOP with vfork is masked before exec(3)/exit(3)
84 # see NetBSD: kern_sig.c,v 1.345
85 @echo DISABLED
86
81. for p in ${PROGS} 87. for p in ${PROGS}
82SRCS_$p = $p.c atf-c.c 88SRCS_$p = $p.c atf-c.c
83. endfor 89. endfor
diff --git a/src/regress/lib/libc/sys/README b/src/regress/lib/libc/sys/README
index 5606fcaa15..b0092c4e0b 100644
--- a/src/regress/lib/libc/sys/README
+++ b/src/regress/lib/libc/sys/README
@@ -28,6 +28,7 @@ t_revoke - remove basic tests, revoke only on ttys supported
28t_select - remove sigset_t struct as it is int on OpenBSD 28t_select - remove sigset_t struct as it is int on OpenBSD
29t_setrlimit - remove unsupported resource parameters and lwp 29t_setrlimit - remove unsupported resource parameters and lwp
30t_syscall - add __syscall prototype 30t_syscall - add __syscall prototype
31t_vfork - SIGSTOP is masked before exec(3)/exit(3)
31t_wait_noproc - waitid and wait6 are not implemented 32t_wait_noproc - waitid and wait6 are not implemented
32t_wait_noproc_wnohang - waitid and wait6 are not implemented 33t_wait_noproc_wnohang - waitid and wait6 are not implemented
33 34
@@ -38,7 +39,6 @@ t_msgrcv - msgrcv(id, &r, 3 - 1, 0x41, 004000) != -1
38t_pipe2 - closefrom(4) == -1, remove F_GETNOSIGPIPE and nosigpipe test 39t_pipe2 - closefrom(4) == -1, remove F_GETNOSIGPIPE and nosigpipe test
39t_stat - invalid GID with doas 40t_stat - invalid GID with doas
40t_unlink - wrong errno according to POSIX 41t_unlink - wrong errno according to POSIX
41t_vfork - !(((status) & 0177) == 0) evaluated to false, SIGSTOP wrong
42 42
43Excluded tests: 43Excluded tests:
44t_clock_nanosleep - not available 44t_clock_nanosleep - not available
diff --git a/src/regress/lib/libc/sys/macros.h b/src/regress/lib/libc/sys/macros.h
index 56f9ff1a1a..ee7d77c31d 100644
--- a/src/regress/lib/libc/sys/macros.h
+++ b/src/regress/lib/libc/sys/macros.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: macros.h,v 1.3 2021/09/02 12:40:44 mbuhl Exp $ */ 1/* $OpenBSD: macros.h,v 1.4 2021/09/02 15:28:41 mbuhl Exp $ */
2/* Public domain - Moritz Buhl */ 2/* Public domain - Moritz Buhl */
3 3
4#include <sys/param.h> 4#include <sys/param.h>
@@ -56,6 +56,7 @@ sysctlbyname(char* s, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
56#define kinfo_proc2 kinfo_proc 56#define kinfo_proc2 kinfo_proc
57#define KERN_PROC2 KERN_PROC 57#define KERN_PROC2 KERN_PROC
58#define reallocarr(pp, n, s) ((*pp = reallocarray(*pp, n, s)), *pp == NULL) 58#define reallocarr(pp, n, s) ((*pp = reallocarray(*pp, n, s)), *pp == NULL)
59#define LSSTOP SSTOP
59 60
60/* t_mlock.c */ 61/* t_mlock.c */
61#define MAP_WIRED __MAP_NOREPLACE 62#define MAP_WIRED __MAP_NOREPLACE
diff --git a/src/regress/lib/libc/sys/t_fork.c b/src/regress/lib/libc/sys/t_fork.c
index 76d66ce9d4..04157efc5d 100644
--- a/src/regress/lib/libc/sys/t_fork.c
+++ b/src/regress/lib/libc/sys/t_fork.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t_fork.c,v 1.1 2021/09/02 12:40:44 mbuhl Exp $ */ 1/* $OpenBSD: t_fork.c,v 1.2 2021/09/02 15:28:41 mbuhl Exp $ */
2/* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ 2/* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */
3 3
4/*- 4/*-
@@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2018, 2019\
34__RCSID("$NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $"); 34__RCSID("$NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#ifdef __OpenBSD__
38#include <sys/proc.h>
39#endif
37#include <sys/types.h> 40#include <sys/types.h>
38#include <sys/sysctl.h> 41#include <sys/sysctl.h>
39#include <sys/wait.h> 42#include <sys/wait.h>
@@ -118,10 +121,8 @@ await_stopped_child(pid_t process)
118 continue; 121 continue;
119 if (p[i].p_ppid != process) 122 if (p[i].p_ppid != process)
120 continue; 123 continue;
121#ifndef __OpenBSD__
122 if (p[i].p_stat != LSSTOP) 124 if (p[i].p_stat != LSSTOP)
123 continue; 125 continue;
124#endif
125 child = p[i].p_pid; 126 child = p[i].p_pid;
126 break; 127 break;
127 } 128 }
diff --git a/src/regress/lib/libc/sys/t_vfork.c b/src/regress/lib/libc/sys/t_vfork.c
new file mode 100644
index 0000000000..a7c6f82e8a
--- /dev/null
+++ b/src/regress/lib/libc/sys/t_vfork.c
@@ -0,0 +1,31 @@
1/* $OpenBSD: t_vfork.c,v 1.1 2021/09/02 15:28:41 mbuhl Exp $ */
2/* $NetBSD: t_vfork.c,v 1.1 2018/05/18 06:39:58 kamil Exp $ */
3
4/*-
5 * Copyright (c) 2018 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#define VFORK
31#include "t_fork.c"