diff options
| -rw-r--r-- | src/regress/lib/libc/sys/Makefile | 43 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_chroot.c | 14 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_dup.c | 27 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_fsync.c | 9 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_getgroups.c | 6 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_getitimer.c | 4 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_getrusage.c | 30 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_gettimeofday.c | 10 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_mknod.c | 22 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_mlock.c | 31 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_mmap.c | 17 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_msgget.c | 10 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_pipe.c | 10 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_pipe2.c | 30 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_poll.c | 179 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_ptrace.c | 6 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_revoke.c | 23 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_select.c | 12 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_stat.c | 6 | ||||
| -rw-r--r-- | src/regress/lib/libc/sys/t_write.c | 6 |
20 files changed, 212 insertions, 283 deletions
diff --git a/src/regress/lib/libc/sys/Makefile b/src/regress/lib/libc/sys/Makefile index c22d08da74..db67e9078a 100644 --- a/src/regress/lib/libc/sys/Makefile +++ b/src/regress/lib/libc/sys/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.5 2020/10/06 09:20:29 mpi Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2020/11/09 23:18:51 bluhm 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> |
| @@ -26,24 +26,35 @@ REGRESS_TARGETS = ${PROGS:S/^/run-/} | |||
| 26 | .endif | 26 | .endif |
| 27 | 27 | ||
| 28 | PROGS = | 28 | PROGS = |
| 29 | PROGS += t_access t_bind t_chroot t_clock_gettime t_dup t_fsync | 29 | PROGS += t_access |
| 30 | PROGS += t_bind | ||
| 31 | PROGS += t_chroot t_clock_gettime | ||
| 32 | PROGS += t_dup | ||
| 33 | PROGS += t_fsync | ||
| 30 | PROGS += t_getgroups t_getitimer t_getlogin t_getpid t_getrusage | 34 | PROGS += t_getgroups t_getitimer t_getlogin t_getpid t_getrusage |
| 31 | PROGS += t_getsid t_getsockname t_gettimeofday t_kill t_link t_listen | 35 | PROGS += t_getsid t_getsockname t_gettimeofday |
| 32 | PROGS += t_mkdir t_mknod t_msgctl t_msgget t_msgsnd t_msync t_pipe | 36 | PROGS += t_kill |
| 33 | PROGS += t_poll t_ptrace t_revoke t_select t_sendrecv t_setuid | 37 | PROGS += t_link t_listen |
| 34 | PROGS += t_socketpair t_sigaction t_truncate t_umask t_write | 38 | PROGS += t_mkdir t_mkfifo t_mknod t_mlock t_mmap |
| 39 | PROGS += t_msgctl t_msgget t_msgrcv t_msgsnd t_msync | ||
| 40 | PROGS += t_pipe t_pipe2 t_poll t_ptrace | ||
| 41 | PROGS += t_revoke | ||
| 42 | PROGS += t_select t_sendrecv t_setuid t_socketpair t_sigaction t_stat | ||
| 43 | PROGS += t_syscall | ||
| 44 | PROGS += t_truncate | ||
| 45 | PROGS += t_umask t_unlink | ||
| 46 | PROGS += t_write | ||
| 35 | 47 | ||
| 36 | # failing tests | 48 | # failing tests |
| 37 | .if 0 | 49 | REGRESS_EXPECTED_FAILURES = |
| 38 | PROGS += t_mkfifo | 50 | REGRESS_EXPECTED_FAILURES += run-t_mlock-4 |
| 39 | PROGS += t_mlock | 51 | REGRESS_EXPECTED_FAILURES += run-t_mmap-1 run-t_mmap-3 |
| 40 | PROGS += t_mmap | 52 | REGRESS_EXPECTED_FAILURES += run-t_msgrcv-3 |
| 41 | PROGS += t_msgrcv | 53 | REGRESS_EXPECTED_FAILURES += run-t_pipe2-2 |
| 42 | PROGS += t_pipe2 | 54 | REGRESS_EXPECTED_FAILURES += run-t_stat-1 run-t_stat-4 run-t_stat-5 |
| 43 | PROGS += t_stat | 55 | REGRESS_EXPECTED_FAILURES += run-t_stat-6 run-t_stat-8 |
| 44 | PROGS += t_syscall | 56 | REGRESS_EXPECTED_FAILURES += run-t_syscall-1 |
| 45 | PROGS += t_unlink | 57 | REGRESS_EXPECTED_FAILURES += run-t_unlink-2 |
| 46 | .endif | ||
| 47 | 58 | ||
| 48 | . for p in ${PROGS} | 59 | . for p in ${PROGS} |
| 49 | SRCS_$p = $p.c atf-c.c | 60 | SRCS_$p = $p.c atf-c.c |
diff --git a/src/regress/lib/libc/sys/t_chroot.c b/src/regress/lib/libc/sys/t_chroot.c index 1fbe392a88..b2bc16e49e 100644 --- a/src/regress/lib/libc/sys/t_chroot.c +++ b/src/regress/lib/libc/sys/t_chroot.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_chroot.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_chroot.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ | 2 | /* $NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -310,12 +310,12 @@ ATF_TP_ADD_TCS(tp) | |||
| 310 | ATF_TP_ADD_TC(tp, chroot_basic); | 310 | ATF_TP_ADD_TC(tp, chroot_basic); |
| 311 | ATF_TP_ADD_TC(tp, chroot_err); | 311 | ATF_TP_ADD_TC(tp, chroot_err); |
| 312 | ATF_TP_ADD_TC(tp, chroot_perm); | 312 | ATF_TP_ADD_TC(tp, chroot_perm); |
| 313 | /* | 313 | #ifndef __OpenBSD__ |
| 314 | * Not available on OpenBSD | 314 | /* fchroot(2) not available */ |
| 315 | * ATF_TP_ADD_TC(tp, fchroot_basic); | 315 | ATF_TP_ADD_TC(tp, fchroot_basic); |
| 316 | * ATF_TP_ADD_TC(tp, fchroot_err); | 316 | ATF_TP_ADD_TC(tp, fchroot_err); |
| 317 | * ATF_TP_ADD_TC(tp, fchroot_perm); | 317 | ATF_TP_ADD_TC(tp, fchroot_perm); |
| 318 | */ | 318 | #endif |
| 319 | 319 | ||
| 320 | return atf_no_error(); | 320 | return atf_no_error(); |
| 321 | } | 321 | } |
diff --git a/src/regress/lib/libc/sys/t_dup.c b/src/regress/lib/libc/sys/t_dup.c index 4021a4f6e4..c998c228b4 100644 --- a/src/regress/lib/libc/sys/t_dup.c +++ b/src/regress/lib/libc/sys/t_dup.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_dup.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_dup.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $ */ | 2 | /* $NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -212,12 +212,18 @@ ATF_TC_BODY(dup3_err, tc) | |||
| 212 | ATF_REQUIRE(fd >= 0); | 212 | ATF_REQUIRE(fd >= 0); |
| 213 | 213 | ||
| 214 | errno = 0; | 214 | errno = 0; |
| 215 | /* Adjusted for OpenBSD, initially != -1 */ | 215 | #ifdef __OpenBSD__ |
| 216 | ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) == -1); | 216 | ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) == -1); |
| 217 | #else | ||
| 218 | ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) != -1); | ||
| 219 | #endif | ||
| 217 | 220 | ||
| 218 | errno = 0; | 221 | errno = 0; |
| 219 | /* Adjusted for OpenBSD, initially EBADF */ | 222 | #ifdef __OpenBSD__ |
| 220 | ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1); | 223 | ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1); |
| 224 | #else | ||
| 225 | ATF_REQUIRE_ERRNO(EBADF, dup3(-1, -1, O_CLOEXEC) == -1); | ||
| 226 | #endif | ||
| 221 | 227 | ||
| 222 | errno = 0; | 228 | errno = 0; |
| 223 | ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1); | 229 | ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1); |
| @@ -302,8 +308,11 @@ ATF_TC_BODY(dup_max, tc) | |||
| 302 | * reached. Ater that dup(2) family | 308 | * reached. Ater that dup(2) family |
| 303 | * should fail with EMFILE. | 309 | * should fail with EMFILE. |
| 304 | */ | 310 | */ |
| 305 | /* Adjusted for OpenBSD, initially 0 */ | 311 | #ifdef __OpenBSD__ |
| 306 | (void)closefrom(STDERR_FILENO + 1); | 312 | (void)closefrom(STDERR_FILENO + 1); |
| 313 | #else | ||
| 314 | (void)closefrom(0); | ||
| 315 | #endif | ||
| 307 | (void)memset(&res, 0, sizeof(struct rlimit)); | 316 | (void)memset(&res, 0, sizeof(struct rlimit)); |
| 308 | 317 | ||
| 309 | n = 10; | 318 | n = 10; |
| @@ -316,14 +325,20 @@ ATF_TC_BODY(dup_max, tc) | |||
| 316 | if (buf == NULL) | 325 | if (buf == NULL) |
| 317 | _exit(EX_OSERR); | 326 | _exit(EX_OSERR); |
| 318 | 327 | ||
| 319 | /* Adjusted for OpenBSD, initially mkstemp(path) */ | 328 | #ifdef __OpenBSD__ |
| 320 | buf[0] = open(path, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR); | 329 | buf[0] = open(path, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR); |
| 330 | #else | ||
| 331 | buf[0] = mkstemp(path); | ||
| 332 | #endif | ||
| 321 | 333 | ||
| 322 | if (buf[0] < 0) | 334 | if (buf[0] < 0) |
| 323 | _exit(EX_OSERR); | 335 | _exit(EX_OSERR); |
| 324 | 336 | ||
| 325 | /* Adjusted for OpenBSD, initially i < n */ | 337 | #ifdef __OpenBSD__ |
| 326 | for (i = 1; i < n - (STDERR_FILENO + 1); i++) { | 338 | for (i = 1; i < n - (STDERR_FILENO + 1); i++) { |
| 339 | #else | ||
| 340 | for (i = 1; i < n; i++) { | ||
| 341 | #endif | ||
| 327 | 342 | ||
| 328 | buf[i] = open(path, O_RDONLY); | 343 | buf[i] = open(path, O_RDONLY); |
| 329 | 344 | ||
diff --git a/src/regress/lib/libc/sys/t_fsync.c b/src/regress/lib/libc/sys/t_fsync.c index c6f24c0e85..bc3cd7939b 100644 --- a/src/regress/lib/libc/sys/t_fsync.c +++ b/src/regress/lib/libc/sys/t_fsync.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_fsync.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_fsync.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_fsync.c,v 1.2 2012/03/18 07:00:52 jruoho Exp $ */ | 2 | /* $NetBSD: t_fsync.c,v 1.2 2012/03/18 07:00:52 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -103,8 +103,11 @@ ATF_TC_BODY(fsync_sync, tc) | |||
| 103 | 103 | ||
| 104 | (void)snprintf(buf, sizeof(buf), "t_fsync-%d", i); | 104 | (void)snprintf(buf, sizeof(buf), "t_fsync-%d", i); |
| 105 | 105 | ||
| 106 | /* Adjusted for OpenBSD, initially mkstemp(buf) */ | 106 | #ifdef __OpenBSD__ |
| 107 | fd = open(buf, O_CREAT|O_EXCL|O_RDWR, 0600); | 107 | fd = open(buf, O_CREAT|O_EXCL|O_RDWR, 0600); |
| 108 | #else | ||
| 109 | fd = mkstemp(buf); | ||
| 110 | #endif | ||
| 108 | 111 | ||
| 109 | ATF_REQUIRE(fd != -1); | 112 | ATF_REQUIRE(fd != -1); |
| 110 | ATF_REQUIRE(write(fd, "0", 1) == 1); | 113 | ATF_REQUIRE(write(fd, "0", 1) == 1); |
diff --git a/src/regress/lib/libc/sys/t_getgroups.c b/src/regress/lib/libc/sys/t_getgroups.c index dcef3c16f5..5cecd3031f 100644 --- a/src/regress/lib/libc/sys/t_getgroups.c +++ b/src/regress/lib/libc/sys/t_getgroups.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_getgroups.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_getgroups.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_getgroups.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ | 2 | /* $NetBSD: t_getgroups.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -56,7 +56,11 @@ ATF_TC_BODY(getgroups_err, tc) | |||
| 56 | 56 | ||
| 57 | errno = 0; | 57 | errno = 0; |
| 58 | 58 | ||
| 59 | #if __OpenBSD__ | ||
| 59 | ATF_REQUIRE(getgroups(NGROUPS_MAX, (gid_t *)-1) == -1); | 60 | ATF_REQUIRE(getgroups(NGROUPS_MAX, (gid_t *)-1) == -1); |
| 61 | #else | ||
| 62 | ATF_REQUIRE(getgroups(10, (gid_t *)-1) == -1); | ||
| 63 | #endif | ||
| 60 | ATF_REQUIRE(errno == EFAULT); | 64 | ATF_REQUIRE(errno == EFAULT); |
| 61 | 65 | ||
| 62 | errno = 0; | 66 | errno = 0; |
diff --git a/src/regress/lib/libc/sys/t_getitimer.c b/src/regress/lib/libc/sys/t_getitimer.c index fbf9c28ccc..9e5bd792ed 100644 --- a/src/regress/lib/libc/sys/t_getitimer.c +++ b/src/regress/lib/libc/sys/t_getitimer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_getitimer.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */ | 1 | /* $OpenBSD: t_getitimer.c,v 1.3 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $ */ | 2 | /* $NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -33,7 +33,7 @@ | |||
| 33 | #include "macros.h" | 33 | #include "macros.h" |
| 34 | 34 | ||
| 35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> |
| 36 | __RCSID("$NetBSD: t_getitimer.c,v 1.2 2012/03/22 18:20:46 christos Exp $"); | 36 | __RCSID("$NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $"); |
| 37 | 37 | ||
| 38 | #include <sys/time.h> | 38 | #include <sys/time.h> |
| 39 | 39 | ||
diff --git a/src/regress/lib/libc/sys/t_getrusage.c b/src/regress/lib/libc/sys/t_getrusage.c index 481d73431b..316377f8ce 100644 --- a/src/regress/lib/libc/sys/t_getrusage.c +++ b/src/regress/lib/libc/sys/t_getrusage.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_getrusage.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_getrusage.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ | 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -208,6 +208,9 @@ ATF_TC_BODY(getrusage_utime_back, tc) | |||
| 208 | /* | 208 | /* |
| 209 | * Test that two consecutive calls are sane. | 209 | * Test that two consecutive calls are sane. |
| 210 | */ | 210 | */ |
| 211 | #ifndef __OpenBSD__ | ||
| 212 | atf_tc_expect_fail("PR kern/30115"); | ||
| 213 | #endif | ||
| 211 | 214 | ||
| 212 | for (i = 0; i < maxiter; i++) { | 215 | for (i = 0; i < maxiter; i++) { |
| 213 | 216 | ||
| @@ -225,6 +228,10 @@ ATF_TC_BODY(getrusage_utime_back, tc) | |||
| 225 | if (timercmp(&ru2.ru_utime, &ru1.ru_utime, <) != 0) | 228 | if (timercmp(&ru2.ru_utime, &ru1.ru_utime, <) != 0) |
| 226 | atf_tc_fail("user time went backwards"); | 229 | atf_tc_fail("user time went backwards"); |
| 227 | } | 230 | } |
| 231 | |||
| 232 | #ifndef __OpenBSD__ | ||
| 233 | atf_tc_fail("anticipated error did not occur"); | ||
| 234 | #endif | ||
| 228 | } | 235 | } |
| 229 | 236 | ||
| 230 | ATF_TC(getrusage_utime_zero); | 237 | ATF_TC(getrusage_utime_zero); |
| @@ -241,18 +248,31 @@ ATF_TC_BODY(getrusage_utime_zero, tc) | |||
| 241 | /* | 248 | /* |
| 242 | * Test that getrusage(2) does not return | 249 | * Test that getrusage(2) does not return |
| 243 | * zero user time for the calling process. | 250 | * zero user time for the calling process. |
| 251 | * | ||
| 252 | * See also (duplicate) PR port-amd64/41734. | ||
| 244 | */ | 253 | */ |
| 254 | #ifndef __OpenBSD__ | ||
| 255 | atf_tc_expect_fail("PR kern/30115"); | ||
| 256 | #endif | ||
| 245 | 257 | ||
| 246 | for (i = 0; i < maxiter; i++) { | 258 | for (i = 0; i < maxiter; i++) { |
| 259 | |||
| 247 | work(); | 260 | work(); |
| 261 | #ifdef __OpenBSD__ | ||
| 248 | } | 262 | } |
| 263 | #endif | ||
| 249 | 264 | ||
| 250 | (void)memset(&ru, 0, sizeof(struct rusage)); | 265 | (void)memset(&ru, 0, sizeof(struct rusage)); |
| 251 | 266 | ||
| 252 | ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0); | 267 | ATF_REQUIRE(getrusage(RUSAGE_SELF, &ru) == 0); |
| 253 | 268 | ||
| 254 | if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0) | 269 | if (ru.ru_utime.tv_sec == 0 && ru.ru_utime.tv_usec == 0) |
| 255 | atf_tc_fail("zero user time from getrusage(2)"); | 270 | atf_tc_fail("zero user time from getrusage(2)"); |
| 271 | #ifndef __OpenBSD__ | ||
| 272 | } | ||
| 273 | |||
| 274 | atf_tc_fail("anticipated error did not occur"); | ||
| 275 | #endif | ||
| 256 | } | 276 | } |
| 257 | 277 | ||
| 258 | ATF_TP_ADD_TCS(tp) | 278 | ATF_TP_ADD_TCS(tp) |
diff --git a/src/regress/lib/libc/sys/t_gettimeofday.c b/src/regress/lib/libc/sys/t_gettimeofday.c index ec4a72c63e..bb716ffdcc 100644 --- a/src/regress/lib/libc/sys/t_gettimeofday.c +++ b/src/regress/lib/libc/sys/t_gettimeofday.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_gettimeofday.c,v 1.2 2020/10/21 16:26:28 kettenis Exp $ */ | 1 | /* $OpenBSD: t_gettimeofday.c,v 1.3 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ | 2 | /* $NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_gettimeofday.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $"); | |||
| 41 | #include <errno.h> | 41 | #include <errno.h> |
| 42 | #include <string.h> | 42 | #include <string.h> |
| 43 | 43 | ||
| 44 | #ifdef __OpenBSD__ | ||
| 44 | static void sighandler(int); | 45 | static void sighandler(int); |
| 45 | 46 | ||
| 46 | static void | 47 | static void |
| @@ -48,6 +49,7 @@ sighandler(int signo) | |||
| 48 | { | 49 | { |
| 49 | _exit(0); | 50 | _exit(0); |
| 50 | } | 51 | } |
| 52 | #endif | ||
| 51 | 53 | ||
| 52 | ATF_TC(gettimeofday_err); | 54 | ATF_TC(gettimeofday_err); |
| 53 | ATF_TC_HEAD(gettimeofday_err, tc) | 55 | ATF_TC_HEAD(gettimeofday_err, tc) |
| @@ -58,14 +60,16 @@ ATF_TC_HEAD(gettimeofday_err, tc) | |||
| 58 | ATF_TC_BODY(gettimeofday_err, tc) | 60 | ATF_TC_BODY(gettimeofday_err, tc) |
| 59 | { | 61 | { |
| 60 | 62 | ||
| 63 | #ifdef __OpenBSD__ | ||
| 61 | /* | 64 | /* |
| 62 | * With userland timecounters we will generate SIGSEGV instead | 65 | * With userland timecounters we will generate SIGSEGV instead |
| 63 | * of failing with errno so to EFAULT. POSIX explicitly | 66 | * of failing with errno set to EFAULT. POSIX explicitly |
| 64 | * allows this behaviour. | 67 | * allows this behaviour. |
| 65 | */ | 68 | */ |
| 66 | ATF_REQUIRE(signal(SIGSEGV, sighandler) != SIG_ERR); | 69 | ATF_REQUIRE(signal(SIGSEGV, sighandler) != SIG_ERR); |
| 67 | 70 | #endif | |
| 68 | errno = 0; | 71 | errno = 0; |
| 72 | |||
| 69 | ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0); | 73 | ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0); |
| 70 | } | 74 | } |
| 71 | 75 | ||
diff --git a/src/regress/lib/libc/sys/t_mknod.c b/src/regress/lib/libc/sys/t_mknod.c index 0a16124859..b1e412cb68 100644 --- a/src/regress/lib/libc/sys/t_mknod.c +++ b/src/regress/lib/libc/sys/t_mknod.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_mknod.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_mknod.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_mknod.c,v 1.2 2012/03/18 07:00:52 jruoho Exp $ */ | 2 | /* $NetBSD: t_mknod.c,v 1.2 2012/03/18 07:00:52 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -170,16 +170,16 @@ ATF_TC_BODY(mknod_stat, tc) | |||
| 170 | 170 | ||
| 171 | (void)memset(&st, 0, sizeof(struct stat)); | 171 | (void)memset(&st, 0, sizeof(struct stat)); |
| 172 | 172 | ||
| 173 | /* | 173 | #ifndef __OpenBSD__ |
| 174 | * Adjusted for OpenBSD, only supports FIFO and device special files | 174 | /* OpenBSD only supports FIFO and device special files */ |
| 175 | * ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0); | 175 | ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0); |
| 176 | * ATF_REQUIRE(stat(path, &st) == 0); | 176 | ATF_REQUIRE(stat(path, &st) == 0); |
| 177 | * | 177 | |
| 178 | * if (S_ISREG(st.st_mode) == 0) | 178 | if (S_ISREG(st.st_mode) == 0) |
| 179 | * atf_tc_fail_nonfatal("invalid mode from mknod(2) (S_IFREG)"); | 179 | atf_tc_fail_nonfatal("invalid mode from mknod(2) (S_IFREG)"); |
| 180 | * | 180 | |
| 181 | * ATF_REQUIRE(unlink(path) == 0); | 181 | ATF_REQUIRE(unlink(path) == 0); |
| 182 | */ | 182 | #endif |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | ATF_TC_CLEANUP(mknod_stat, tc) | 185 | ATF_TC_CLEANUP(mknod_stat, tc) |
diff --git a/src/regress/lib/libc/sys/t_mlock.c b/src/regress/lib/libc/sys/t_mlock.c index 1fd986383d..e41f52443c 100644 --- a/src/regress/lib/libc/sys/t_mlock.c +++ b/src/regress/lib/libc/sys/t_mlock.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* $OpenBSD: t_mlock.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_mlock.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $ */ | 2 | /* $NetBSD: t_mlock.c,v 1.8 2020/01/24 08:45:16 skrll Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| 5 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2012 The NetBSD Foundation, Inc. |
| @@ -33,7 +33,7 @@ | |||
| 33 | #include "macros.h" | 33 | #include "macros.h" |
| 34 | 34 | ||
| 35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> |
| 36 | __RCSID("$NetBSD: t_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $"); | 36 | __RCSID("$NetBSD: t_mlock.c,v 1.8 2020/01/24 08:45:16 skrll Exp $"); |
| 37 | 37 | ||
| 38 | #include <sys/mman.h> | 38 | #include <sys/mman.h> |
| 39 | #include <sys/resource.h> | 39 | #include <sys/resource.h> |
| @@ -108,8 +108,11 @@ ATF_TC_BODY(mlock_err, tc) | |||
| 108 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); | 108 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); |
| 109 | 109 | ||
| 110 | errno = 0; | 110 | errno = 0; |
| 111 | /* Adjusted for OpenBSD, initially ENOMEM */ | 111 | #ifdef __OpenBSD__ |
| 112 | ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); | 112 | ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); |
| 113 | #else | ||
| 114 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); | ||
| 115 | #endif | ||
| 113 | 116 | ||
| 114 | errno = 0; | 117 | errno = 0; |
| 115 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); | 118 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); |
| @@ -118,8 +121,11 @@ ATF_TC_BODY(mlock_err, tc) | |||
| 118 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); | 121 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); |
| 119 | 122 | ||
| 120 | errno = 0; | 123 | errno = 0; |
| 121 | /* Adjusted for OpenBSD, initially ENOMEM */ | 124 | #ifdef __OpenBSD__ |
| 122 | ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); | 125 | ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); |
| 126 | #else | ||
| 127 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); | ||
| 128 | #endif | ||
| 123 | 129 | ||
| 124 | buf = malloc(page); | 130 | buf = malloc(page); |
| 125 | ATF_REQUIRE(buf != NULL); | 131 | ATF_REQUIRE(buf != NULL); |
| @@ -129,11 +135,10 @@ ATF_TC_BODY(mlock_err, tc) | |||
| 129 | * unlocking memory that is not locked is an error... | 135 | * unlocking memory that is not locked is an error... |
| 130 | */ | 136 | */ |
| 131 | 137 | ||
| 132 | /* | 138 | #ifndef __OpenBSD__ |
| 133 | * Adjusted for OpenBSD | 139 | errno = 0; |
| 134 | * errno = 0; | 140 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); |
| 135 | * ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); | 141 | #endif |
| 136 | */ | ||
| 137 | 142 | ||
| 138 | /* | 143 | /* |
| 139 | * These are permitted to fail (EINVAL) but do not on NetBSD | 144 | * These are permitted to fail (EINVAL) but do not on NetBSD |
| @@ -229,8 +234,11 @@ ATF_TC_HEAD(mlock_mmap, tc) | |||
| 229 | 234 | ||
| 230 | ATF_TC_BODY(mlock_mmap, tc) | 235 | ATF_TC_BODY(mlock_mmap, tc) |
| 231 | { | 236 | { |
| 232 | /* Adjusted for OpenBSD, initially ... | MAP_WIRED */ | 237 | #ifdef __OpenBSD__ |
| 233 | static const int flags = MAP_ANON | MAP_PRIVATE; | 238 | static const int flags = MAP_ANON | MAP_PRIVATE; |
| 239 | #else | ||
| 240 | static const int flags = MAP_ANON | MAP_PRIVATE | MAP_WIRED; | ||
| 241 | #endif | ||
| 234 | void *buf; | 242 | void *buf; |
| 235 | 243 | ||
| 236 | /* | 244 | /* |
| @@ -312,7 +320,6 @@ ATF_TP_ADD_TCS(tp) | |||
| 312 | { | 320 | { |
| 313 | 321 | ||
| 314 | page = sysconf(_SC_PAGESIZE); | 322 | page = sysconf(_SC_PAGESIZE); |
| 315 | fprintf(stderr, "t_mlock: pagesize %ld\n", page); | ||
| 316 | ATF_REQUIRE(page >= 0); | 323 | ATF_REQUIRE(page >= 0); |
| 317 | 324 | ||
| 318 | ATF_TP_ADD_TC(tp, mlock_clip); | 325 | ATF_TP_ADD_TC(tp, mlock_clip); |
diff --git a/src/regress/lib/libc/sys/t_mmap.c b/src/regress/lib/libc/sys/t_mmap.c index 6dbfae5bb1..9da88fa9cc 100644 --- a/src/regress/lib/libc/sys/t_mmap.c +++ b/src/regress/lib/libc/sys/t_mmap.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* $OpenBSD: t_mmap.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_mmap.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_mmap.c,v 1.13 2017/05/23 13:04:29 christos Exp $ */ | 2 | /* $NetBSD: t_mmap.c,v 1.14 2020/06/26 07:50:11 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| 5 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2011 The NetBSD Foundation, Inc. |
| @@ -59,7 +59,7 @@ | |||
| 59 | #include "macros.h" | 59 | #include "macros.h" |
| 60 | 60 | ||
| 61 | #include <sys/cdefs.h> | 61 | #include <sys/cdefs.h> |
| 62 | __RCSID("$NetBSD: t_mmap.c,v 1.13 2017/05/23 13:04:29 christos Exp $"); | 62 | __RCSID("$NetBSD: t_mmap.c,v 1.14 2020/06/26 07:50:11 jruoho Exp $"); |
| 63 | 63 | ||
| 64 | #include <sys/param.h> | 64 | #include <sys/param.h> |
| 65 | #include <sys/disklabel.h> | 65 | #include <sys/disklabel.h> |
| @@ -175,7 +175,8 @@ ATF_TC_BODY(mmap_block, tc) | |||
| 175 | size_t len; | 175 | size_t len; |
| 176 | int fd = -1; | 176 | int fd = -1; |
| 177 | 177 | ||
| 178 | atf_tc_skip("The test case causes a panic (PR kern/38889, kern/46592)"); | 178 | atf_tc_skip("The test case causes a panic " \ |
| 179 | "(PR kern/38889, PR kern/46592)"); | ||
| 179 | 180 | ||
| 180 | ATF_REQUIRE(sysctl(mib, miblen, NULL, &len, NULL, 0) == 0); | 181 | ATF_REQUIRE(sysctl(mib, miblen, NULL, &len, NULL, 0) == 0); |
| 181 | drives = malloc(len); | 182 | drives = malloc(len); |
| @@ -575,10 +576,10 @@ ATF_TP_ADD_TCS(tp) | |||
| 575 | ATF_TP_ADD_TC(tp, mmap_prot_3); | 576 | ATF_TP_ADD_TC(tp, mmap_prot_3); |
| 576 | ATF_TP_ADD_TC(tp, mmap_truncate); | 577 | ATF_TP_ADD_TC(tp, mmap_truncate); |
| 577 | ATF_TP_ADD_TC(tp, mmap_truncate_signal); | 578 | ATF_TP_ADD_TC(tp, mmap_truncate_signal); |
| 578 | /* | 579 | #ifndef __OpenBSD__ |
| 579 | * Adjusted for OpenBSD, not available | 580 | /* sysctl vm.user_va0_disable not available */ |
| 580 | * ATF_TP_ADD_TC(tp, mmap_va0); | 581 | ATF_TP_ADD_TC(tp, mmap_va0); |
| 581 | */ | 582 | #endif |
| 582 | 583 | ||
| 583 | return atf_no_error(); | 584 | return atf_no_error(); |
| 584 | } | 585 | } |
diff --git a/src/regress/lib/libc/sys/t_msgget.c b/src/regress/lib/libc/sys/t_msgget.c index 2a9bb4cf3b..c5b7d97e15 100644 --- a/src/regress/lib/libc/sys/t_msgget.c +++ b/src/regress/lib/libc/sys/t_msgget.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_msgget.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_msgget.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_msgget.c,v 1.3 2017/10/08 08:31:05 kre Exp $ */ | 2 | /* $NetBSD: t_msgget.c,v 1.3 2017/10/08 08:31:05 kre Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -328,10 +328,10 @@ ATF_TP_ADD_TCS(tp) | |||
| 328 | ATF_TP_ADD_TC(tp, msgget_excl); | 328 | ATF_TP_ADD_TC(tp, msgget_excl); |
| 329 | ATF_TP_ADD_TC(tp, msgget_exit); | 329 | ATF_TP_ADD_TC(tp, msgget_exit); |
| 330 | ATF_TP_ADD_TC(tp, msgget_init); | 330 | ATF_TP_ADD_TC(tp, msgget_init); |
| 331 | /* | 331 | #ifndef __OpenBSD__ |
| 332 | * Adjusted for OpenBSD, not available | 332 | /* sysctl kern.ipc.msgmni not available */ |
| 333 | * ATF_TP_ADD_TC(tp, msgget_limit); | 333 | ATF_TP_ADD_TC(tp, msgget_limit); |
| 334 | */ | 334 | #endif |
| 335 | ATF_TP_ADD_TC(tp, msgget_mode); | 335 | ATF_TP_ADD_TC(tp, msgget_mode); |
| 336 | } | 336 | } |
| 337 | 337 | ||
diff --git a/src/regress/lib/libc/sys/t_pipe.c b/src/regress/lib/libc/sys/t_pipe.c index bd9805a4b9..2fcb6d4b13 100644 --- a/src/regress/lib/libc/sys/t_pipe.c +++ b/src/regress/lib/libc/sys/t_pipe.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* $OpenBSD: t_pipe.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_pipe.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */ | 2 | /* $NetBSD: t_pipe.c,v 1.7 2020/06/26 07:50:11 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| 5 | * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. |
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> |
| 34 | __COPYRIGHT("@(#) Copyright (c) 2008\ | 34 | __COPYRIGHT("@(#) Copyright (c) 2008\ |
| 35 | The NetBSD Foundation, inc. All rights reserved."); | 35 | The NetBSD Foundation, inc. All rights reserved."); |
| 36 | __RCSID("$NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $"); | 36 | __RCSID("$NetBSD: t_pipe.c,v 1.7 2020/06/26 07:50:11 jruoho Exp $"); |
| 37 | 37 | ||
| 38 | #include <sys/types.h> | 38 | #include <sys/types.h> |
| 39 | #include <sys/wait.h> | 39 | #include <sys/wait.h> |
| @@ -74,7 +74,7 @@ ATF_TC_HEAD(pipe_restart, tc) | |||
| 74 | { | 74 | { |
| 75 | atf_tc_set_md_var(tc, "descr", "Checks that writing to pipe " | 75 | atf_tc_set_md_var(tc, "descr", "Checks that writing to pipe " |
| 76 | "works correctly after being interrupted and restarted " | 76 | "works correctly after being interrupted and restarted " |
| 77 | "(kern/14087)"); | 77 | "(PR kern/14087)"); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | ATF_TC_BODY(pipe_restart, tc) | 80 | ATF_TC_BODY(pipe_restart, tc) |
| @@ -103,7 +103,7 @@ ATF_TC_BODY(pipe_restart, tc) | |||
| 103 | /* child */ | 103 | /* child */ |
| 104 | RL(close(pp[1])); | 104 | RL(close(pp[1])); |
| 105 | 105 | ||
| 106 | /* Do inital write. This should succeed, make | 106 | /* Do initial write. This should succeed, make |
| 107 | * the other side do partial write and wait for us to pick | 107 | * the other side do partial write and wait for us to pick |
| 108 | * rest up. | 108 | * rest up. |
| 109 | */ | 109 | */ |
diff --git a/src/regress/lib/libc/sys/t_pipe2.c b/src/regress/lib/libc/sys/t_pipe2.c index 4964be14ce..07991de455 100644 --- a/src/regress/lib/libc/sys/t_pipe2.c +++ b/src/regress/lib/libc/sys/t_pipe2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_pipe2.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_pipe2.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $ */ | 2 | /* $NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -81,16 +81,16 @@ run(int flags) | |||
| 81 | ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0); | 81 | ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /* | 84 | #ifndef __OpenBSD__ |
| 85 | * Adjusted for OpenBSD, not available | 85 | /* F_GETNOSIGPIPE not available */ |
| 86 | * if (flags & O_NOSIGPIPE) { | 86 | if (flags & O_NOSIGPIPE) { |
| 87 | * ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0); | 87 | ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0); |
| 88 | * ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0); | 88 | ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0); |
| 89 | *} else { | 89 | } else { |
| 90 | * ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) == 0); | 90 | ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) == 0); |
| 91 | * ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) == 0); | 91 | ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) == 0); |
| 92 | *} | 92 | } |
| 93 | */ | 93 | #endif |
| 94 | 94 | ||
| 95 | ATF_REQUIRE(close(fd[0]) != -1); | 95 | ATF_REQUIRE(close(fd[0]) != -1); |
| 96 | ATF_REQUIRE(close(fd[1]) != -1); | 96 | ATF_REQUIRE(close(fd[1]) != -1); |
| @@ -193,10 +193,10 @@ ATF_TP_ADD_TCS(tp) | |||
| 193 | ATF_TP_ADD_TC(tp, pipe2_consume); | 193 | ATF_TP_ADD_TC(tp, pipe2_consume); |
| 194 | ATF_TP_ADD_TC(tp, pipe2_nonblock); | 194 | ATF_TP_ADD_TC(tp, pipe2_nonblock); |
| 195 | ATF_TP_ADD_TC(tp, pipe2_cloexec); | 195 | ATF_TP_ADD_TC(tp, pipe2_cloexec); |
| 196 | /* | 196 | #ifndef __OpenBSD__ |
| 197 | * Adjusted for OpenBSD, not available | 197 | /* O_NOSIGPIPE not available */ |
| 198 | * ATF_TP_ADD_TC(tp, pipe2_nosigpipe); | 198 | ATF_TP_ADD_TC(tp, pipe2_nosigpipe); |
| 199 | */ | 199 | #endif |
| 200 | ATF_TP_ADD_TC(tp, pipe2_einval); | 200 | ATF_TP_ADD_TC(tp, pipe2_einval); |
| 201 | 201 | ||
| 202 | return atf_no_error(); | 202 | return atf_no_error(); |
diff --git a/src/regress/lib/libc/sys/t_poll.c b/src/regress/lib/libc/sys/t_poll.c index bbb8dc2d14..d27fbf159f 100644 --- a/src/regress/lib/libc/sys/t_poll.c +++ b/src/regress/lib/libc/sys/t_poll.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* $OpenBSD: t_poll.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_poll.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_poll.c,v 1.3 2012/03/18 07:00:52 jruoho Exp $ */ | 2 | /* $NetBSD: t_poll.c,v 1.4 2020/07/17 15:34:16 kamil Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| 5 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2011 The NetBSD Foundation, Inc. |
| @@ -85,8 +85,8 @@ child3(void) | |||
| 85 | (void)printf("child3 exit\n"); | 85 | (void)printf("child3 exit\n"); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | ATF_TC(poll_3way); | 88 | ATF_TC(3way); |
| 89 | ATF_TC_HEAD(poll_3way, tc) | 89 | ATF_TC_HEAD(3way, tc) |
| 90 | { | 90 | { |
| 91 | atf_tc_set_md_var(tc, "timeout", "15"); | 91 | atf_tc_set_md_var(tc, "timeout", "15"); |
| 92 | atf_tc_set_md_var(tc, "descr", | 92 | atf_tc_set_md_var(tc, "descr", |
| @@ -97,7 +97,7 @@ ATF_TC_HEAD(poll_3way, tc) | |||
| 97 | "both be awaken. (kern/17517)"); | 97 | "both be awaken. (kern/17517)"); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | ATF_TC_BODY(poll_3way, tc) | 100 | ATF_TC_BODY(3way, tc) |
| 101 | { | 101 | { |
| 102 | int pf[2]; | 102 | int pf[2]; |
| 103 | int status, i; | 103 | int status, i; |
| @@ -148,15 +148,15 @@ ATF_TC_BODY(poll_3way, tc) | |||
| 148 | (void)printf("parent terminated\n"); | 148 | (void)printf("parent terminated\n"); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | ATF_TC(poll_basic); | 151 | ATF_TC(basic); |
| 152 | ATF_TC_HEAD(poll_basic, tc) | 152 | ATF_TC_HEAD(basic, tc) |
| 153 | { | 153 | { |
| 154 | atf_tc_set_md_var(tc, "timeout", "10"); | 154 | atf_tc_set_md_var(tc, "timeout", "10"); |
| 155 | atf_tc_set_md_var(tc, "descr", | 155 | atf_tc_set_md_var(tc, "descr", |
| 156 | "Basis functionality test for poll(2)"); | 156 | "Basis functionality test for poll(2)"); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | ATF_TC_BODY(poll_basic, tc) | 159 | ATF_TC_BODY(basic, tc) |
| 160 | { | 160 | { |
| 161 | int fds[2]; | 161 | int fds[2]; |
| 162 | struct pollfd pfds[2]; | 162 | struct pollfd pfds[2]; |
| @@ -215,13 +215,13 @@ ATF_TC_BODY(poll_basic, tc) | |||
| 215 | ATF_REQUIRE_EQ(close(fds[1]), 0); | 215 | ATF_REQUIRE_EQ(close(fds[1]), 0); |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | ATF_TC(poll_err); | 218 | ATF_TC(err); |
| 219 | ATF_TC_HEAD(poll_err, tc) | 219 | ATF_TC_HEAD(err, tc) |
| 220 | { | 220 | { |
| 221 | atf_tc_set_md_var(tc, "descr", "Check errors from poll(2)"); | 221 | atf_tc_set_md_var(tc, "descr", "Check errors from poll(2)"); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | ATF_TC_BODY(poll_err, tc) | 224 | ATF_TC_BODY(err, tc) |
| 225 | { | 225 | { |
| 226 | struct pollfd pfd; | 226 | struct pollfd pfd; |
| 227 | int fd = 0; | 227 | int fd = 0; |
| @@ -236,163 +236,12 @@ ATF_TC_BODY(poll_err, tc) | |||
| 236 | ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1); | 236 | ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | ATF_TC(pollts_basic); | ||
| 240 | ATF_TC_HEAD(pollts_basic, tc) | ||
| 241 | { | ||
| 242 | atf_tc_set_md_var(tc, "timeout", "10"); | ||
| 243 | atf_tc_set_md_var(tc, "descr", | ||
| 244 | "Basis functionality test for pollts(2)"); | ||
| 245 | } | ||
| 246 | |||
| 247 | ATF_TC_BODY(pollts_basic, tc) | ||
| 248 | { | ||
| 249 | int fds[2]; | ||
| 250 | struct pollfd pfds[2]; | ||
| 251 | struct timespec timeout; | ||
| 252 | int ret; | ||
| 253 | |||
| 254 | ATF_REQUIRE_EQ(pipe(fds), 0); | ||
| 255 | |||
| 256 | pfds[0].fd = fds[0]; | ||
| 257 | pfds[0].events = POLLIN; | ||
| 258 | pfds[1].fd = fds[1]; | ||
| 259 | pfds[1].events = POLLOUT; | ||
| 260 | |||
| 261 | /* Use a timeout of 1 second. */ | ||
| 262 | timeout.tv_sec = 1; | ||
| 263 | timeout.tv_nsec = 0; | ||
| 264 | |||
| 265 | /* | ||
| 266 | * Check that we get a timeout waiting for data on the read end | ||
| 267 | * of our pipe. | ||
| 268 | */ | ||
| 269 | pfds[0].revents = -1; | ||
| 270 | pfds[1].revents = -1; | ||
| 271 | ATF_REQUIRE_EQ_MSG(ret = pollts(&pfds[0], 1, &timeout, NULL), 0, | ||
| 272 | "got: %d", ret); | ||
| 273 | ATF_REQUIRE_EQ_MSG(pfds[0].revents, 0, "got: %d", pfds[0].revents); | ||
| 274 | ATF_REQUIRE_EQ_MSG(pfds[1].revents, -1, "got: %d", pfds[1].revents); | ||
| 275 | |||
| 276 | /* Check that the write end of the pipe as reported as ready. */ | ||
| 277 | pfds[0].revents = -1; | ||
| 278 | pfds[1].revents = -1; | ||
| 279 | ATF_REQUIRE_EQ_MSG(ret = pollts(&pfds[1], 1, &timeout, NULL), 1, | ||
| 280 | "got: %d", ret); | ||
| 281 | ATF_REQUIRE_EQ_MSG(pfds[0].revents, -1, "got: %d", pfds[0].revents); | ||
| 282 | ATF_REQUIRE_EQ_MSG(pfds[1].revents, POLLOUT, "got: %d",\ | ||
| 283 | pfds[1].revents); | ||
| 284 | |||
| 285 | /* Check that only the write end of the pipe as reported as ready. */ | ||
| 286 | pfds[0].revents = -1; | ||
| 287 | pfds[1].revents = -1; | ||
| 288 | ATF_REQUIRE_EQ_MSG(ret = pollts(pfds, 2, &timeout, NULL), 1, | ||
| 289 | "got: %d", ret); | ||
| 290 | ATF_REQUIRE_EQ_MSG(pfds[0].revents, 0, "got: %d", pfds[0].revents); | ||
| 291 | ATF_REQUIRE_EQ_MSG(pfds[1].revents, POLLOUT, "got: %d", | ||
| 292 | pfds[1].revents); | ||
| 293 | |||
| 294 | /* Write data to our pipe. */ | ||
| 295 | ATF_REQUIRE_EQ(write(fds[1], "", 1), 1); | ||
| 296 | |||
| 297 | /* Check that both ends of our pipe are reported as ready. */ | ||
| 298 | pfds[0].revents = -1; | ||
| 299 | pfds[1].revents = -1; | ||
| 300 | ATF_REQUIRE_EQ_MSG(ret = pollts(pfds, 2, &timeout, NULL), 2, | ||
| 301 | "got: %d", ret); | ||
| 302 | ATF_REQUIRE_EQ_MSG(pfds[0].revents, POLLIN, "got: %d", | ||
| 303 | pfds[0].revents); | ||
| 304 | ATF_REQUIRE_EQ_MSG(pfds[1].revents, POLLOUT, "got: %d", | ||
| 305 | pfds[1].revents); | ||
| 306 | |||
| 307 | ATF_REQUIRE_EQ(close(fds[0]), 0); | ||
| 308 | ATF_REQUIRE_EQ(close(fds[1]), 0); | ||
| 309 | } | ||
| 310 | |||
| 311 | ATF_TC(pollts_err); | ||
| 312 | ATF_TC_HEAD(pollts_err, tc) | ||
| 313 | { | ||
| 314 | atf_tc_set_md_var(tc, "descr", "Check errors from pollts(2)"); | ||
| 315 | } | ||
| 316 | |||
| 317 | ATF_TC_BODY(pollts_err, tc) | ||
| 318 | { | ||
| 319 | struct timespec timeout; | ||
| 320 | struct pollfd pfd; | ||
| 321 | int fd = 0; | ||
| 322 | |||
| 323 | pfd.fd = fd; | ||
| 324 | pfd.events = POLLIN; | ||
| 325 | |||
| 326 | timeout.tv_sec = 1; | ||
| 327 | timeout.tv_nsec = 0; | ||
| 328 | |||
| 329 | errno = 0; | ||
| 330 | ATF_REQUIRE_ERRNO(EFAULT, pollts((void *)-1, 1, &timeout, NULL) == -1); | ||
| 331 | |||
| 332 | timeout.tv_sec = -1; | ||
| 333 | timeout.tv_nsec = -1; | ||
| 334 | |||
| 335 | errno = 0; | ||
| 336 | ATF_REQUIRE_ERRNO(EINVAL, pollts(&pfd, 1, &timeout, NULL) == -1); | ||
| 337 | } | ||
| 338 | |||
| 339 | ATF_TC(pollts_sigmask); | ||
| 340 | ATF_TC_HEAD(pollts_sigmask, tc) | ||
| 341 | { | ||
| 342 | atf_tc_set_md_var(tc, "timeout", "10"); | ||
| 343 | atf_tc_set_md_var(tc, "descr", | ||
| 344 | "Check that pollts(2) restores the signal mask (PR kern/44986)"); | ||
| 345 | } | ||
| 346 | |||
| 347 | ATF_TC_BODY(pollts_sigmask, tc) | ||
| 348 | { | ||
| 349 | int fd; | ||
| 350 | struct pollfd pfd; | ||
| 351 | struct timespec timeout; | ||
| 352 | sigset_t mask; | ||
| 353 | int ret; | ||
| 354 | |||
| 355 | fd = open(_PATH_DEVNULL, O_RDONLY); | ||
| 356 | ATF_REQUIRE(fd >= 0); | ||
| 357 | |||
| 358 | pfd.fd = fd; | ||
| 359 | pfd.events = POLLIN; | ||
| 360 | |||
| 361 | /* Use a timeout of 1 second. */ | ||
| 362 | timeout.tv_sec = 1; | ||
| 363 | timeout.tv_nsec = 0; | ||
| 364 | |||
| 365 | /* Unblock all signals. */ | ||
| 366 | ATF_REQUIRE_EQ(sigfillset(&mask), 0); | ||
| 367 | ATF_REQUIRE_EQ(sigprocmask(SIG_UNBLOCK, &mask, NULL), 0); | ||
| 368 | |||
| 369 | /* | ||
| 370 | * Check that pollts(2) immediately returns. We block *all* | ||
| 371 | * signals during pollts(2). | ||
| 372 | */ | ||
| 373 | ATF_REQUIRE_EQ_MSG(ret = pollts(&pfd, 1, &timeout, &mask), 1, | ||
| 374 | "got: %d", ret); | ||
| 375 | |||
| 376 | /* Check that signals are now longer blocked. */ | ||
| 377 | ATF_REQUIRE_EQ(sigprocmask(SIG_SETMASK, NULL, &mask), 0); | ||
| 378 | ATF_REQUIRE_EQ_MSG(sigismember(&mask, SIGUSR1), 0, | ||
| 379 | "signal mask was changed."); | ||
| 380 | |||
| 381 | ATF_REQUIRE_EQ(close(fd), 0); | ||
| 382 | } | ||
| 383 | |||
| 384 | ATF_TP_ADD_TCS(tp) | 239 | ATF_TP_ADD_TCS(tp) |
| 385 | { | 240 | { |
| 386 | 241 | ||
| 387 | ATF_TP_ADD_TC(tp, poll_3way); | 242 | ATF_TP_ADD_TC(tp, 3way); |
| 388 | ATF_TP_ADD_TC(tp, poll_basic); | 243 | ATF_TP_ADD_TC(tp, basic); |
| 389 | ATF_TP_ADD_TC(tp, poll_err); | 244 | ATF_TP_ADD_TC(tp, err); |
| 390 | /* | ||
| 391 | * Adjusted for OpenBSD, not supported | ||
| 392 | * ATF_TP_ADD_TC(tp, pollts_basic); | ||
| 393 | * ATF_TP_ADD_TC(tp, pollts_err); | ||
| 394 | * ATF_TP_ADD_TC(tp, pollts_sigmask); | ||
| 395 | */ | ||
| 396 | 245 | ||
| 397 | return atf_no_error(); | 246 | return atf_no_error(); |
| 398 | } | 247 | } |
diff --git a/src/regress/lib/libc/sys/t_ptrace.c b/src/regress/lib/libc/sys/t_ptrace.c index e651dec0a1..a48616efb2 100644 --- a/src/regress/lib/libc/sys/t_ptrace.c +++ b/src/regress/lib/libc/sys/t_ptrace.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_ptrace.c,v 1.3 2020/02/02 20:18:17 bluhm Exp $ */ | 1 | /* $OpenBSD: t_ptrace.c,v 1.4 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_ptrace.c,v 1.4 2018/05/14 12:44:40 kamil Exp $ */ | 2 | /* $NetBSD: t_ptrace.c,v 1.4 2018/05/14 12:44:40 kamil Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -171,7 +171,11 @@ ATF_TC_BODY(attach_chroot, tc) | |||
| 171 | rv = write(fds_toparent[1], &msg, sizeof(msg)); | 171 | rv = write(fds_toparent[1], &msg, sizeof(msg)); |
| 172 | FORKEE_ASSERTX(rv == sizeof(msg)); | 172 | FORKEE_ASSERTX(rv == sizeof(msg)); |
| 173 | 173 | ||
| 174 | #ifdef __OpenBSD__ | ||
| 174 | ATF_REQUIRE_ERRNO(EINVAL, | 175 | ATF_REQUIRE_ERRNO(EINVAL, |
| 176 | #else | ||
| 177 | ATF_REQUIRE_ERRNO(EPERM, | ||
| 178 | #endif | ||
| 175 | ptrace(PT_ATTACH, getppid(), NULL, 0) == -1); | 179 | ptrace(PT_ATTACH, getppid(), NULL, 0) == -1); |
| 176 | 180 | ||
| 177 | rv = read(fds_fromparent[0], &msg, sizeof(msg)); | 181 | rv = read(fds_fromparent[0], &msg, sizeof(msg)); |
diff --git a/src/regress/lib/libc/sys/t_revoke.c b/src/regress/lib/libc/sys/t_revoke.c index ad54f814d1..7640c2d871 100644 --- a/src/regress/lib/libc/sys/t_revoke.c +++ b/src/regress/lib/libc/sys/t_revoke.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_revoke.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_revoke.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $ */ | 2 | /* $NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -118,8 +118,11 @@ ATF_TC_BODY(revoke_err, tc) | |||
| 118 | ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1); | 118 | ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1); |
| 119 | 119 | ||
| 120 | errno = 0; | 120 | errno = 0; |
| 121 | /* Adjusted for OpenBSD, initially EPERM */ | 121 | #ifdef __OpenBSD__ |
| 122 | ATF_REQUIRE_ERRNO(ENOTTY, revoke("/etc/passwd") == -1); | 122 | ATF_REQUIRE_ERRNO(ENOTTY, revoke("/etc/passwd") == -1); |
| 123 | #else | ||
| 124 | ATF_REQUIRE_ERRNO(EPERM, revoke("/etc/passwd") == -1); | ||
| 125 | #endif | ||
| 123 | 126 | ||
| 124 | errno = 0; | 127 | errno = 0; |
| 125 | ATF_REQUIRE_ERRNO(ENOENT, revoke("/etc/xxx/yyy") == -1); | 128 | ATF_REQUIRE_ERRNO(ENOENT, revoke("/etc/xxx/yyy") == -1); |
| @@ -184,15 +187,15 @@ ATF_TC_CLEANUP(revoke_perm, tc) | |||
| 184 | ATF_TP_ADD_TCS(tp) | 187 | ATF_TP_ADD_TCS(tp) |
| 185 | { | 188 | { |
| 186 | 189 | ||
| 187 | /* | 190 | #ifndef __OpenBSD__ |
| 188 | * Adjusted for OpenBSD, revoke only on ttys supported | 191 | /* OpenBSD supports revoke only on ttys */ |
| 189 | * ATF_TP_ADD_TC(tp, revoke_basic); | 192 | ATF_TP_ADD_TC(tp, revoke_basic); |
| 190 | */ | 193 | #endif |
| 191 | ATF_TP_ADD_TC(tp, revoke_err); | 194 | ATF_TP_ADD_TC(tp, revoke_err); |
| 192 | /* | 195 | #ifndef __OpenBSD__ |
| 193 | * Adjusted for OpenBSD, revoke only on ttys supported | 196 | /* OpenBSD supports revoke only on ttys */ |
| 194 | * ATF_TP_ADD_TC(tp, revoke_perm); | 197 | ATF_TP_ADD_TC(tp, revoke_perm); |
| 195 | */ | 198 | #endif |
| 196 | 199 | ||
| 197 | return atf_no_error(); | 200 | return atf_no_error(); |
| 198 | } | 201 | } |
diff --git a/src/regress/lib/libc/sys/t_select.c b/src/regress/lib/libc/sys/t_select.c index 94ff3d3410..b10fe87495 100644 --- a/src/regress/lib/libc/sys/t_select.c +++ b/src/regress/lib/libc/sys/t_select.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_select.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_select.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_select.c,v 1.4 2017/01/13 21:18:33 christos Exp $ */ | 2 | /* $NetBSD: t_select.c,v 1.4 2017/01/13 21:18:33 christos Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -76,10 +76,18 @@ prmask(const sigset_t *m, char *buf, size_t len) | |||
| 76 | buf[0] = '0'; | 76 | buf[0] = '0'; |
| 77 | buf[1] = 'x'; | 77 | buf[1] = 'x'; |
| 78 | #define N(p, a) (((p) >> ((a) * 4)) & 0xf) | 78 | #define N(p, a) (((p) >> ((a) * 4)) & 0xf) |
| 79 | /* Adjusted for OpenBSD, on NetBSD sigset_t is a struct */ | 79 | #ifdef __OpenBSD__ |
| 80 | /* On NetBSD sigset_t is a struct */ | ||
| 80 | uint32_t p = (*m); | 81 | uint32_t p = (*m); |
| 81 | for (size_t k = sizeof(p); k > 0; k--) | 82 | for (size_t k = sizeof(p); k > 0; k--) |
| 82 | buf[j++] = xtoa(N(p, k - 1)); | 83 | buf[j++] = xtoa(N(p, k - 1)); |
| 84 | #else | ||
| 85 | for (size_t i = __arraycount(m->__bits); i > 0; i--) { | ||
| 86 | uint32_t p = m->__bits[i - 1]; | ||
| 87 | for (size_t k = sizeof(p); k > 0; k--) | ||
| 88 | buf[j++] = xtoa(N(p, k - 1)); | ||
| 89 | } | ||
| 90 | #endif | ||
| 83 | buf[j] = '\0'; | 91 | buf[j] = '\0'; |
| 84 | return buf; | 92 | return buf; |
| 85 | } | 93 | } |
diff --git a/src/regress/lib/libc/sys/t_stat.c b/src/regress/lib/libc/sys/t_stat.c index 73350c0e6a..5aadf39b99 100644 --- a/src/regress/lib/libc/sys/t_stat.c +++ b/src/regress/lib/libc/sys/t_stat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_stat.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */ | 1 | /* $OpenBSD: t_stat.c,v 1.3 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $ */ | 2 | /* $NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -68,7 +68,7 @@ ATF_TC_BODY(stat_chflags, tc) | |||
| 68 | (void)memset(&sa, 0, sizeof(struct stat)); | 68 | (void)memset(&sa, 0, sizeof(struct stat)); |
| 69 | (void)memset(&sb, 0, sizeof(struct stat)); | 69 | (void)memset(&sb, 0, sizeof(struct stat)); |
| 70 | 70 | ||
| 71 | fd = open(path, O_RDONLY | O_CREAT); | 71 | fd = open(path, O_RDONLY | O_CREAT, 0600); |
| 72 | 72 | ||
| 73 | ATF_REQUIRE(fd != -1); | 73 | ATF_REQUIRE(fd != -1); |
| 74 | ATF_REQUIRE(stat(path, &sa) == 0); | 74 | ATF_REQUIRE(stat(path, &sa) == 0); |
| @@ -258,7 +258,7 @@ ATF_TC_BODY(stat_perm, tc) | |||
| 258 | uid = getuid(); | 258 | uid = getuid(); |
| 259 | gid = getgid(); | 259 | gid = getgid(); |
| 260 | 260 | ||
| 261 | fd = open(path, O_RDONLY | O_CREAT); | 261 | fd = open(path, O_RDONLY | O_CREAT, 0600); |
| 262 | 262 | ||
| 263 | ATF_REQUIRE(fd != -1); | 263 | ATF_REQUIRE(fd != -1); |
| 264 | ATF_REQUIRE(fstat(fd, &sa) == 0); | 264 | ATF_REQUIRE(fstat(fd, &sa) == 0); |
diff --git a/src/regress/lib/libc/sys/t_write.c b/src/regress/lib/libc/sys/t_write.c index f05edb5bed..326032db71 100644 --- a/src/regress/lib/libc/sys/t_write.c +++ b/src/regress/lib/libc/sys/t_write.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_write.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */ | 1 | /* $OpenBSD: t_write.c,v 1.3 2020/11/09 23:18:51 bluhm Exp $ */ |
| 2 | /* $NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */ | 2 | /* $NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -74,7 +74,7 @@ ATF_TC_BODY(write_err, tc) | |||
| 74 | errno = 0; | 74 | errno = 0; |
| 75 | ATF_REQUIRE_ERRNO(EBADF, write(-1, wbuf, sizeof(wbuf)) == -1); | 75 | ATF_REQUIRE_ERRNO(EBADF, write(-1, wbuf, sizeof(wbuf)) == -1); |
| 76 | 76 | ||
| 77 | fd = open(path, O_RDWR | O_CREAT); | 77 | fd = open(path, O_RDWR | O_CREAT, 0600); |
| 78 | 78 | ||
| 79 | if (fd >= 0) { | 79 | if (fd >= 0) { |
| 80 | 80 | ||
| @@ -146,7 +146,7 @@ ATF_TC_BODY(write_pos, tc) | |||
| 146 | size_t i; | 146 | size_t i; |
| 147 | int fd; | 147 | int fd; |
| 148 | 148 | ||
| 149 | fd = open(path, O_RDWR | O_CREAT); | 149 | fd = open(path, O_RDWR | O_CREAT, 0600); |
| 150 | ATF_REQUIRE(fd >= 0); | 150 | ATF_REQUIRE(fd >= 0); |
| 151 | 151 | ||
| 152 | for (i = 0; i < n; i++) { | 152 | for (i = 0; i < n; i++) { |
