summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c17
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/db/t_db.sh8
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c90
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c1
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_glob.c18
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_sleep.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/h_hash.c20
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/t_hmac.c127
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/t_sha2.c14
-rw-r--r--contrib/netbsd-tests/lib/libc/locale/t_io.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c1
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/debug.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/t_exhaust.c24
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/t_regex_att.c23
-rw-r--r--contrib/netbsd-tests/lib/libc/rpc/t_rpc.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/ssp/h_memset.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/ssp/h_read.c21
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c21
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strlen.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c15
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_connect.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_dup.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getcontext.c23
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getrusage.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_kevent.c29
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_link.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_listen.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mincore.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mlock.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mmap.c13
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgctl.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msync.c29
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_pipe.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_pipe2.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_revoke.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_select.c18
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigaction.c16
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c36
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_socketpair.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_stat.c13
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_timer_create.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_truncate.c15
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_umask.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_unlink.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_write.c16
58 files changed, 400 insertions, 453 deletions
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
index 5c496c8..4f91afd 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
+/* $NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -55,13 +55,11 @@ ATF_TC_HEAD(mkfifoat_fd, tc)
ATF_TC_BODY(mkfifoat_fd, tc)
{
int dfd;
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
- ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
(void)close(dfd);
}
@@ -74,12 +72,10 @@ ATF_TC_HEAD(mkfifoat_fdcwd, tc)
}
ATF_TC_BODY(mkfifoat_fdcwd, tc)
{
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
}
@@ -91,10 +87,9 @@ ATF_TC_HEAD(mkfifoat_fdcwderr, tc)
}
ATF_TC_BODY(mkfifoat_fdcwderr, tc)
{
- int fd;
mode_t mode = 0600;
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
}
ATF_TC(mkfifoat_fderr);
@@ -110,7 +105,7 @@ ATF_TC_BODY(mkfifoat_fderr, tc)
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
ATF_REQUIRE(close(fd) == 0);
- ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/db/t_db.sh b/contrib/netbsd-tests/lib/libc/db/t_db.sh
index 6858e36..93a7b1e 100755
--- a/contrib/netbsd-tests/lib/libc/db/t_db.sh
+++ b/contrib/netbsd-tests/lib/libc/db/t_db.sh
@@ -42,18 +42,10 @@ dict()
elif [ -f /usr/dict/words ]; then
echo /usr/dict/words
else
- echo ""
atf_fail "no dictionary found"
fi
}
-# Begin FreeBSD
-dict()
-{
- echo /usr/share/dict/words
-}
-# End FreeBSD
-
SEVEN_SEVEN="abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg"
atf_test_case small_btree
diff --git a/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c b/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c
new file mode 100644
index 0000000..4c85e4b
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c
@@ -0,0 +1,90 @@
+/* $NetBSD: t_exect.c,v 1.6 2016/12/12 10:34:55 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <atf-c.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+
+ATF_TC(t_exect_null);
+
+ATF_TC_HEAD(t_exect_null, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Tests an empty exect(2) executing");
+}
+
+static volatile sig_atomic_t caught = 0;
+
+static void
+sigtrap_handler(int sig, siginfo_t *info, void *ctx)
+{
+ ATF_REQUIRE_EQ(sig, SIGTRAP);
+ ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE);
+
+ ++caught;
+}
+
+ATF_TC_BODY(t_exect_null, tc)
+{
+ struct sigaction act;
+
+ /*
+ * Currently exect(3) is misdesigned -- see PR port-amd64/51700 and it
+ * needs to be redone from scratch.
+ *
+ * This test affects amd64 releng machines causing tests to hang or
+ * fail. As there is little point to test interface that is still not,
+ * designed and implemented and is breaking tests - skip it
+ * unconditionally for all ports.
+ */
+ /* Prevent static analysis from requiring t_exec_null to be __dead. */
+ if (!caught)
+ atf_tc_skip("exect(3) misdesigned and hangs - PR port-amd64/51700");
+
+ ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0);
+ act.sa_sigaction = sigtrap_handler;
+ act.sa_flags = SA_SIGINFO;
+
+ ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0);
+
+ ATF_REQUIRE_ERRNO(EFAULT, exect(NULL, NULL, NULL) == -1);
+
+ ATF_REQUIRE_EQ_MSG(caught, 1, "expected caught (1) != received (%d)",
+ (int)caught);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, t_exect_null);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
index 2085b9e..8e4d30d 100644
--- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
+++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_glob.c b/contrib/netbsd-tests/lib/libc/gen/t_glob.c
index 0572a42..c53e183 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_glob.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_glob.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $ */
+/* $NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
+__RCSID("$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $");
#include <atf-c.h>
@@ -46,13 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
#include <string.h>
#include <errno.h>
-#ifdef __FreeBSD__
#include "h_macros.h"
-#define __gl_stat_t struct stat
-#define _S_IFDIR S_IFDIR
-#else
-#include "../../../h_macros.h"
-#endif
#ifdef DEBUG
@@ -91,7 +85,7 @@ static struct gl_dir d[] = {
{ "a/b", b, __arraycount(b), 0 },
};
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
static const char *glob_star[] = {
"a/1", "a/3", "a/4", "a/b", "a/b/w", "a/b/x", "a/b/y", "a/b/z",
};
@@ -158,7 +152,7 @@ gl_stat(const char *name , __gl_stat_t *st)
memset(st, 0, sizeof(*st));
if (strcmp(buf, "a") == 0 || strcmp(buf, "a/b") == 0) {
- st->st_mode |= _S_IFDIR;
+ st->st_mode |= S_IFDIR;
return 0;
}
@@ -225,7 +219,7 @@ run(const char *p, int flags, const char **res, size_t len)
}
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
ATF_TC(glob_star);
ATF_TC_HEAD(glob_star, tc)
{
@@ -274,7 +268,7 @@ ATF_TC_BODY(glob_nocheck, tc)
ATF_TP_ADD_TCS(tp)
{
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
ATF_TP_ADD_TC(tp, glob_star);
#endif
ATF_TP_ADD_TC(tp, glob_star_not);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
index 17eac87..54d798f 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
@@ -34,11 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef __FreeBSD__
-#include <libutil.h>
-#else
#include <util.h>
-#endif
const struct hnopts {
size_t ho_len;
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
index e85867a..d4bd271 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
@@ -26,10 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef __FreeBSD__
-/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */
-#include <sys/types.h>
-#endif
#include <sys/cdefs.h>
#include <sys/event.h>
#include <sys/signal.h>
diff --git a/contrib/netbsd-tests/lib/libc/hash/h_hash.c b/contrib/netbsd-tests/lib/libc/hash/h_hash.c
index 6e20a48..33b9f9a 100644
--- a/contrib/netbsd-tests/lib/libc/hash/h_hash.c
+++ b/contrib/netbsd-tests/lib/libc/hash/h_hash.c
@@ -35,13 +35,8 @@
#include <unistd.h>
#include <string.h>
#include <md5.h>
-#ifdef __NetBSD__
#include <sha1.h>
-#endif
-#ifdef __FreeBSD__
-#include <sha.h>
-#endif
int mflag, rflag, sflag, tflag;
@@ -107,32 +102,17 @@ regress(void)
MD5Final(out, &ctx);
outlen = 16;
} else {
-#ifdef __FreeBSD__
- SHA_CTX ctx;
-
- SHA1_Init(&ctx);
- SHA1_Update(&ctx, buf, len);
-#else
SHA1_CTX ctx;
SHA1Init(&ctx);
SHA1Update(&ctx, buf, len);
-#endif
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);
-#ifdef __FreeBSD__
- SHA1_Update(&ctx, buf, len);
-#else
SHA1Update(&ctx, buf, len);
-#endif
}
-#ifdef __FreeBSD__
- SHA1_Final(out, &ctx);
-#else
SHA1Final(out, &ctx);
-#endif
outlen = 20;
}
hexdump(out, outlen);
diff --git a/contrib/netbsd-tests/lib/libc/hash/t_hmac.c b/contrib/netbsd-tests/lib/libc/hash/t_hmac.c
new file mode 100644
index 0000000..3dcbea9
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libc/hash/t_hmac.c
@@ -0,0 +1,127 @@
+/* $NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $");
+
+#include <atf-c.h>
+#include <string.h>
+#include <stdlib.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+
+static void
+test(void)
+{
+ uint8_t tmp1[EVP_MAX_MD_SIZE];
+ uint8_t tmp2[EVP_MAX_MD_SIZE];
+ uint8_t key[256];
+ uint8_t data[4096];
+ unsigned int tmp1len;
+ size_t tmp2len;
+ int stop;
+ void *e1;
+ const void *evps[] = {
+ EVP_md2(),
+ EVP_md4(),
+ EVP_md5(),
+ EVP_ripemd160(),
+ EVP_sha1(),
+ EVP_sha224(),
+ EVP_sha256(),
+ EVP_sha384(),
+ EVP_sha512(),
+ };
+ const char *names[] = {
+ "md2",
+ "md4",
+ "md5",
+ "rmd160",
+ "sha1",
+ "sha224",
+ "sha256",
+ "sha384",
+ "sha512",
+ };
+
+ for (size_t k = 0; k < sizeof(key); k++)
+ key[k] = k;
+ for (size_t d = 0; d < sizeof(data); d++)
+ data[d] = d % 256;
+
+ for (size_t t = 0; t < __arraycount(names); t++)
+ for (size_t i = 1; i < sizeof(key); i += 9)
+ for (size_t j = 3; j < sizeof(data); j += 111) {
+ stop = 0;
+#ifdef DEBUG
+ printf("%s: keysize = %zu datasize = %zu\n", names[t],
+ i, j);
+#endif
+ memset(tmp1, 0, sizeof(tmp1));
+ memset(tmp2, 0, sizeof(tmp2));
+ e1 = HMAC(evps[t], key, i, data, j, tmp1, &tmp1len);
+ ATF_REQUIRE(e1 != NULL);
+ tmp2len = hmac(names[t], key, i, data, j, tmp2,
+ sizeof(tmp2));
+ ATF_REQUIRE_MSG(tmp1len == tmp2len, "hash %s len %u "
+ "!= %zu", names[t], tmp1len, tmp2len);
+ for (size_t k = 0; k < tmp2len; k++)
+ if (tmp1[k] != tmp2[k]) {
+#ifdef DEBUG
+ printf("%zu %.2x %.2x\n",
+ k, tmp1[k], tmp2[k]);
+#endif
+ stop = 1;
+ break;
+ }
+ ATF_REQUIRE_MSG(!stop, "hash %s failed for "
+ "keylen=%zu, datalen=%zu", names[t], i, j);
+ }
+}
+
+ATF_TC(t_hmac);
+
+ATF_TC_HEAD(t_hmac, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test hmac functions for consistent results");
+}
+
+ATF_TC_BODY(t_hmac, tc)
+{
+ test();
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, t_hmac);
+ return atf_no_error();
+}
+
diff --git a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
index ce2c80d..a45e82a 100644
--- a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
+++ b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
@@ -36,23 +36,9 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $");
#include <atf-c.h>
#include <sys/types.h>
-#ifdef __NetBSD__
#include <sha2.h>
-#endif
#include <string.h>
-#ifdef __FreeBSD__
-#include <openssl/sha.h>
-typedef SHA512_CTX SHA384_CTX;
-/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */
-#define SHA256_DIGEST_LENGTH 32
-#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
-#define SHA384_DIGEST_LENGTH 48
-#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
-#define SHA512_DIGEST_LENGTH 64
-#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
-#endif
-
ATF_TC(t_sha256);
ATF_TC(t_sha384);
ATF_TC(t_sha512);
diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c
index 86029e9..8c7f371 100644
--- a/contrib/netbsd-tests/lib/libc/locale/t_io.c
+++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c
@@ -57,11 +57,9 @@ ATF_TC_BODY(bad_big5_wprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
-
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
setlocale(LC_CTYPE, "zh_TW.Big5");
-
ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0);
ATF_REQUIRE(ferror(stdout));
}
@@ -78,12 +76,10 @@ ATF_TC_BODY(bad_big5_swprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
-
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
wchar_t obuf[20];
setlocale(LC_CTYPE, "zh_TW.Big5");
-
ATF_REQUIRE_ERRNO(EILSEQ,
swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0);
}
diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
index 2e57786..e366344 100644
--- a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
+++ b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
@@ -137,7 +137,6 @@ ATF_TC_BODY(mbtowc, tc)
h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B");
h_mbtowc("ja_JP.SJIS", "\202", "\202\240");
h_mbtowc("ja_JP.eucJP", "\244", "\244\242");
- /* Moved last as it fails */
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
h_mbtowc("zh_TW.Big5", "\241", "\241@");
h_mbtowc("zh_TW.eucTW", "\241", "\241\241");
diff --git a/contrib/netbsd-tests/lib/libc/regex/debug.c b/contrib/netbsd-tests/lib/libc/regex/debug.c
index 22f0b90..18ab6ea 100644
--- a/contrib/netbsd-tests/lib/libc/regex/debug.c
+++ b/contrib/netbsd-tests/lib/libc/regex/debug.c
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $ */
+/* $NetBSD: debug.c,v 1.3 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -26,18 +26,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <sys/types.h>
-#ifdef __FreeBSD__
#include <wchar.h>
#include <wctype.h>
-#endif
/* Don't sort these! */
#include "utils.h"
diff --git a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
index 0670e51..f9bd276 100644
--- a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
+++ b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $ */
+/* $NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,17 +37,15 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");
+__RCSID("$NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $");
-#include <stdio.h>
+#include <sys/resource.h>
+#include <atf-c.h>
+#include <err.h>
#include <regex.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <err.h>
-#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <sys/resource.h>
-#endif
+#include <string.h>
#ifndef REGEX_MAXSIZE
#define REGEX_MAXSIZE 9999
@@ -179,25 +177,17 @@ ATF_TC_HEAD(regcomp_too_big, tc)
" crash, but return a proper error code");
// libtre needs it.
atf_tc_set_md_var(tc, "timeout", "600");
-#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.memory", "64M");
-#else
- atf_tc_set_md_var(tc, "require.memory", "120M");
-#endif
}
ATF_TC_BODY(regcomp_too_big, tc)
{
regex_t re;
-#ifdef __FreeBSD__
struct rlimit limit;
-#endif
int e;
-#ifdef __FreeBSD__
limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
-#endif
for (size_t i = 0; i < __arraycount(tests); i++) {
char *d = (*tests[i].pattern)(REGEX_MAXSIZE);
e = regcomp(&re, d, tests[i].type);
diff --git a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
index 0ca44b4..dd5b818 100644
--- a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
+++ b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $ */
+/* $NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,20 +37,18 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $");
+__RCSID("$NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $");
#include <sys/param.h>
-#include <stdio.h>
+#include <atf-c.h>
+#include <ctype.h>
#include <regex.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <util.h>
#include <vis.h>
-#include <ctype.h>
-#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <libutil.h>
-#endif
static const char sep[] = "\r\n\t";
static const char delim[3] = "\\\\\0";
@@ -377,11 +375,7 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm,
" cur=%d, max=%zu", res, l, len - off);
off += l;
}
-#ifdef __FreeBSD__
ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
-#else
- ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
-#endif
free(res);
}
@@ -580,9 +574,6 @@ ATF_TC_BODY(leftassoc, tc)
* any explation. Mark as broken here, but I don't know why. */
atf_tc_expect_fail("Reason for breakage unknown");
#endif
-#ifdef __FreeBSD__
- atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD");
-#endif
att_test(tc, "leftassoc");
}
diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
index bce3633..e5d4321 100644
--- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
+++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
@@ -24,13 +24,6 @@ __RCSID("$NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $");
return ev; \
} while(/*CONSTCOND*/0)
-#ifdef __FreeBSD__
-#define SKIPXI(ev, msg, ...) do { \
- atf_tc_skip(msg, __VA_ARGS__); \
- return ev; \
-} while(/*CONSTCOND*/0)
-#endif
-
#else
#define ERRX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__)
#define SKIPX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__)
@@ -196,7 +189,7 @@ regtest(const char *hostname, const char *transp, const char *arg, int p)
#endif
if (!svc_create(server, PROGNUM, VERSNUM, transp))
{
- SKIPXI(EXIT_FAILURE, "Cannot create server %d", num);
+ SKIPX(EXIT_FAILURE, "Cannot create server %d", num);
}
switch ((pid = fork())) {
diff --git a/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c b/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
index 34fd5cc..1f0f1ed 100644
--- a/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
+++ b/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $ */
+/* $NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $");
+__RCSID("$NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
#include <sys/types.h>
diff --git a/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c b/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
index 2014470..44d7555 100644
--- a/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
+++ b/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $ */
+/* $NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $");
+__RCSID("$NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
#include <sys/types.h>
diff --git a/contrib/netbsd-tests/lib/libc/ssp/h_memset.c b/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
index c5ab607..f1acbbd 100644
--- a/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
+++ b/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+/* $NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+__RCSID("$NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $");
#include <stdio.h>
#include <string.h>
@@ -41,9 +41,5 @@ main(int argc, char *argv[])
char b[10];
size_t len = atoi(argv[1]);
(void)memset(b, 0, len);
-#ifdef __FreeBSD__
return b[0]; /* keeps optimizer from zapping the call to memset() */
-#else
- return 0;
-#endif
}
diff --git a/contrib/netbsd-tests/lib/libc/ssp/h_read.c b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
index c25cfeb..046ac62 100644
--- a/contrib/netbsd-tests/lib/libc/ssp/h_read.c
+++ b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+/* $NetBSD: h_read.c,v 1.2 2017/01/16 16:35:57 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,17 +29,15 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+__RCSID("$NetBSD: h_read.c,v 1.2 2017/01/16 16:35:57 christos Exp $");
#include <sys/param.h>
+#include <fcntl.h>
+#include <paths.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#ifdef __FreeBSD__
-#include <fcntl.h>
-#include <paths.h>
-
int
main(int argc, char *argv[])
{
@@ -54,14 +52,3 @@ main(int argc, char *argv[])
(void)printf("%s\n", b);
return (0);
}
-#else
-int
-main(int argc, char *argv[])
-{
- char b[MAXPATHLEN];
- size_t len = atoi(argv[1]);
-
- (void)printf("%s\n", b);
- return 0;
-}
-#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
index ec2b9bb..d53d2d9 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
@@ -35,6 +35,10 @@
#include <unistd.h>
#include <err.h>
#ifdef __FreeBSD__
+/*
+ * Needed to avoid libutil.h pollution in stdio.h, which causes grief with
+ * with hexdump(3) in lib/libc/db/h_hash.c
+ */
#include <libutil.h>
#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
index 2293e2c..c7cd83e 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
@@ -37,6 +37,10 @@
#include <stdlib.h>
#include <unistd.h>
#ifdef __FreeBSD__
+/*
+ * Needed to avoid libutil.h pollution in stdio.h, which causes grief with
+ * with hexdump(3) in lib/libc/db/h_hash.c
+ */
#include <libutil.h>
#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
index a0e77d3..5a13250 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
@@ -75,7 +75,6 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014/07/20 20:17:21 christos Exp $");
#define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno))
-#ifdef __NetBSD__
ATF_TC(hsearch_basic);
ATF_TC_HEAD(hsearch_basic, tc)
{
@@ -122,9 +121,12 @@ ATF_TC_BODY(hsearch_basic, tc)
ATF_REQUIRE_EQ((intptr_t)ep->data, i);
}
+#ifdef __NetBSD__
hdestroy1(free, NULL);
-}
+#else
+ hdestroy();
#endif
+}
ATF_TC(hsearch_duplicate);
ATF_TC_HEAD(hsearch_duplicate, tc)
@@ -232,7 +234,6 @@ ATF_TC_BODY(hsearch_two, tc)
}
#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
-#ifdef __NetBSD__
ATF_TC(hsearch_r_basic);
ATF_TC_HEAD(hsearch_r_basic, tc)
{
@@ -278,10 +279,15 @@ ATF_TC_BODY(hsearch_r_basic, tc)
ATF_REQUIRE_EQ((intptr_t)ep->data, i);
}
+#ifdef __NetBSD__
hdestroy1_r(&t, free, NULL);
+#else
+ hdestroy_r(&t);
+#endif
}
#endif
+#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
ATF_TC(hsearch_r_duplicate);
ATF_TC_HEAD(hsearch_r_duplicate, tc)
{
@@ -332,6 +338,9 @@ ATF_TC_BODY(hsearch_r_nonexistent, tc)
REQUIRE_ERRNO(hcreate_r(16, &t));
+#ifdef __FreeBSD__
+ atf_tc_expect_fail("behavior doesn't match docs; see bug # 216872");
+#endif
e.key = __UNCONST("A");
ATF_REQUIRE(hsearch_r(e, FIND, &ep, &t) == 1);
ATF_REQUIRE_EQ(ep, NULL);
@@ -391,17 +400,13 @@ ATF_TC_BODY(hsearch_r_two, tc)
ATF_TP_ADD_TCS(tp)
{
-#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_basic);
-#endif
ATF_TP_ADD_TC(tp, hsearch_duplicate);
ATF_TP_ADD_TC(tp, hsearch_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_two);
-
+
#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
-#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_r_basic);
-#endif
ATF_TP_ADD_TC(tp, hsearch_r_duplicate);
ATF_TP_ADD_TC(tp, hsearch_r_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_r_two);
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
index 06f2de0..4835e5d 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
@@ -218,9 +218,7 @@ ATF_TC_BODY(strtold_nan, tc)
volatile long double ld = strtold(nan_string, &end);
ATF_REQUIRE(isnan(ld) != 0);
-#ifdef __FreeBSD__
- ATF_REQUIRE(strcmp(end, "y") == 0);
-#else
+#ifndef __FreeBSD__
ATF_REQUIRE(__isnanl(ld) != 0);
#endif
ATF_REQUIRE(strcmp(end, "y") == 0);
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strlen.c b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
index 7483dc6..9899e6d 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strlen.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strlen.c,v 1.5 2011/07/14 07:33:20 jruoho Exp $ */
+/* $NetBSD: t_strlen.c,v 1.6 2017/01/14 20:49:24 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@acorntoolworks.com>
@@ -40,9 +40,7 @@ ATF_TC_HEAD(strlen_basic, tc)
ATF_TC_BODY(strlen_basic, tc)
{
-#ifdef __FreeBSD__
void *dl_handle;
-#endif
/* try to trick the compiler */
size_t (*strlen_fn)(const char *);
@@ -110,12 +108,8 @@ ATF_TC_BODY(strlen_basic, tc)
* During testing it is useful have the rest of the program
* use a known good version!
*/
-#ifdef __FreeBSD__
dl_handle = dlopen(NULL, RTLD_LAZY);
strlen_fn = dlsym(dl_handle, "test_strlen");
-#else
- strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
-#endif
if (!strlen_fn)
strlen_fn = strlen;
@@ -142,9 +136,7 @@ ATF_TC_BODY(strlen_basic, tc)
}
}
}
-#ifdef __FreeBSD__
(void)dlclose(dl_handle);
-#endif
}
ATF_TC(strlen_huge);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
index 229c343..a319b09 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $ */
+/* $NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,30 +58,23 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
+__RCSID("$NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
-#ifdef __NetBSD__
-#include <machine/int_limits.h>
-#endif
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
-#ifdef __NetBSD__
-#include "../../../h_macros.h"
-#else
-#include <limits.h>
-#include <stdint.h>
#include "h_macros.h"
-#endif
#define MINPOSDIFF 15000000 /* 15 ms for now */
#define TIMEOUT 5
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_connect.c b/contrib/netbsd-tests/lib/libc/sys/t_connect.c
index 672a022..a920d3d 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_connect.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_connect.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_connect.c,v 1.2 2015/04/05 23:17:41 rtr Exp $ */
+/* $NetBSD: t_connect.c,v 1.3 2017/01/13 20:09:48 christos Exp $ */
/*
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -26,6 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/socket.h>
#include <err.h>
#include <errno.h>
#include <string.h>
@@ -36,10 +37,6 @@
#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <sys/socket.h>
-#endif
-
ATF_TC(connect_low_port);
ATF_TC_HEAD(connect_low_port, tc)
{
@@ -56,10 +53,8 @@ ATF_TC_BODY(connect_low_port, tc)
slist = socket(AF_INET, SOCK_STREAM, 0);
sd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef __FreeBSD__
ATF_REQUIRE(sd > 0);
ATF_REQUIRE(slist > 0);
-#endif
/* bind listening socket */
memset(&sinlist, 0, sizeof(sinlist));
@@ -97,9 +92,7 @@ ATF_TC_BODY(connect_low_port, tc)
ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX);
close(sd);
-#ifdef __FreeBSD__
close(slist);
-#endif
}
ATF_TC(connect_foreign_family);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_dup.c b/contrib/netbsd-tests/lib/libc/sys/t_dup.c
index d8125ab..b1924e4 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_dup.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_dup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $ */
+/* $NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $");
+__RCSID("$NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $");
#include <sys/resource.h>
#include <sys/stat.h>
@@ -39,16 +39,13 @@ __RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $");
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sysexits.h>
-#ifdef __FreeBSD__
-#include <stdbool.h>
-#endif
-
static char path[] = "dup";
#ifdef __NetBSD__
static void check_mode(bool, bool, bool);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
index 20a9e42..102c79f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
@@ -51,10 +51,16 @@ run(int n, ...)
ATF_REQUIRE_EQ(n, DEPTH - calls - 1);
va_start(va, n);
-#if defined(__FreeBSD__) && defined(__amd64__)
+#ifdef __FreeBSD__
+#if defined(__amd64__)
for (i = 0; i < 5; i++) {
-#elif defined(__FreeBSD__) && defined(__aarch64__)
+#elif defined(__aarch64__)
for (i = 0; i < 7; i++) {
+#elif defined(__mips__)
+ for (i = 0; i < 5; i++) {
+#else
+ for (i = 0; i < 9; i++) {
+#endif
#else
for (i = 0; i < 9; i++) {
#endif
@@ -114,14 +120,23 @@ ATF_TC_BODY(setcontext_link, tc)
uc[i].uc_stack.ss_size = STACKSZ;
uc[i].uc_link = (i > 0) ? &uc[i - 1] : &save;
-#if defined(__FreeBSD__) && defined(__amd64__)
+#ifdef __FreeBSD__
+#if defined(__amd64__)
/* FreeBSD/amd64 only permits up to 6 arguments. */
makecontext(&uc[i], (void *)run, 6, i,
0, 1, 2, 3, 4);
-#elif defined(__FreeBSD__) && defined(__aarch64__)
+#elif defined(__aarch64__)
/* FreeBSD/arm64 only permits up to 8 arguments. */
makecontext(&uc[i], (void *)run, 8, i,
0, 1, 2, 3, 4, 5, 6);
+#elif defined(__mips__)
+ /* FreeBSD/mips only permits up to 6 arguments. */
+ makecontext(&uc[i], (void *)run, 6, i,
+ 0, 1, 2, 3, 4);
+#else
+ makecontext(&uc[i], (void *)run, 10, i,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8);
+#endif
#else
makecontext(&uc[i], (void *)run, 10, i,
0, 1, 2, 3, 4, 5, 6, 7, 8);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
index f4ee96b..273fd83 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $ */
+/* $NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $");
+__RCSID("$NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $");
#include <sys/resource.h>
#include <sys/time.h>
@@ -47,11 +47,7 @@ static void sighandler(int);
static const size_t maxiter = 2000;
static void
-#ifdef __FreeBSD__
sighandler(int signo __unused)
-#else
-sighandler(int signo)
-#endif
{
/* Nothing. */
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
index 8a20d63..5bddea5 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
@@ -45,16 +45,14 @@ __RCSID("$NetBSD: t_kevent.c,v 1.7 2015/02/05 13:55:37 isaki Exp $");
#include <err.h>
#ifdef __NetBSD__
#include <sys/drvctlio.h>
+#else
+#define DRVCTLDEV "/nonexistent"
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/wait.h>
-#ifdef __FreeBSD__
-#define DRVCTLDEV "/nonexistent"
-#endif
-
ATF_TC(kevent_zerotimer);
ATF_TC_HEAD(kevent_zerotimer, tc)
{
@@ -117,15 +115,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
if (recvmsg(s[1], &m, 0) == -1)
err(1, "child: could not recvmsg");
-#ifdef __FreeBSD__
- bcopy(CMSG_DATA(msg), &kq, sizeof(kq));
- printf("child (pid %d): received kq fd %d\n", getpid(), kq);
- _exit(0);
-#else
kq = *(int *)CMSG_DATA(msg);
printf("child (pid %d): received kq fd %d\n", getpid(), kq);
exit(0);
-#endif
}
close(s[1]);
@@ -133,17 +125,14 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
iov.iov_base = &storage;
iov.iov_len = sizeof(int);
+#ifdef __FreeBSD__
+ msg = CMSG_FIRSTHDR(&m);
+#endif
msg->cmsg_level = SOL_SOCKET;
msg->cmsg_type = SCM_RIGHTS;
msg->cmsg_len = CMSG_LEN(sizeof(int));
-#ifdef __FreeBSD__
- /*
- * What is should have been
- * bcopy(&s[0], CMSG_DATA(msg), sizeof(kq));
- */
- bcopy(&kq, CMSG_DATA(msg), sizeof(kq));
-#else
+#ifdef __NetBSD__
*(int *)CMSG_DATA(msg) = kq;
#endif
@@ -152,14 +141,8 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
printf("parent (pid %d): sending kq fd %d\n", getpid(), kq);
if (sendmsg(s[0], &m, 0) == -1) {
-#ifdef __NetBSD__
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
atf_tc_skip("PR kern/46523");
-#endif
-#ifdef __FreeBSD__
- ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
- close(s[0]);
-#endif
}
close(kq);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_link.c b/contrib/netbsd-tests/lib/libc/sys/t_link.c
index b8dcacc..a6d894c 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_link.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_link.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $ */
+/* $NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $");
+__RCSID("$NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -37,14 +37,11 @@ __RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $");
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static const char *getpath(void);
static char path[] = "link";
static const char *pathl;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_listen.c b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
index a9ee733..9f3f9b8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_listen.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_listen.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_listen.c,v 1.5 2017/01/13 20:41:50 christos Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -26,6 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/socket.h>
#include <atf-c.h>
#include <err.h>
#include <errno.h>
@@ -36,10 +37,6 @@
#include <arpa/inet.h>
#include <netinet/in.h>
-#ifdef __FreeBSD__
-#include <sys/socket.h>
-#endif
-
static const char *path = "listen";
ATF_TC_WITH_CLEANUP(listen_err);
@@ -110,9 +107,7 @@ ATF_TC_BODY(listen_low_port, tc)
int sd, val;
sd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
-#endif
val = IP_PORTRANGE_LOW;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
index ab8c33f..da6cafe 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $");
#include <sys/mman.h>
#include <sys/stat.h>
@@ -141,9 +141,7 @@ ATF_TC_WITH_CLEANUP(mincore_resid);
ATF_TC_HEAD(mincore_resid, tc)
{
atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)");
-#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.user", "root");
-#endif
}
ATF_TC_BODY(mincore_resid, tc)
@@ -155,13 +153,11 @@ ATF_TC_BODY(mincore_resid, tc)
struct rlimit rlim;
ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
-#ifdef __FreeBSD__
/*
* Bump the mlock limit to unlimited so the rest of the testcase
* passes instead of failing on the mlock call.
*/
rlim.rlim_max = RLIM_INFINITY;
-#endif
rlim.rlim_cur = rlim.rlim_max;
ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
@@ -276,9 +272,7 @@ ATF_TC_BODY(mincore_resid, tc)
(void)munmap(addr2, npgs * page);
(void)munmap(addr3, npgs * page);
(void)unlink(path);
-#ifdef __FreeBSD__
free(buf);
-#endif
}
ATF_TC_CLEANUP(mincore_resid, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
index 75048b3..cd9ad55 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
@@ -32,7 +32,7 @@
__RCSID("$NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $");
#ifdef __FreeBSD__
-#include <sys/types.h>
+#include <sys/param.h> /* NetBSD requires sys/param.h for sysctl(3), unlike FreeBSD */
#endif
#include <sys/mman.h>
#include <sys/resource.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
index b35b2ae..8839aea 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_mmap.c,v 1.12 2017/01/16 16:31:05 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,9 +55,10 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.12 2017/01/16 16:31:05 christos Exp $");
#include <sys/param.h>
+#include <sys/disklabel.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/socket.h>
@@ -73,12 +74,7 @@ __RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
#include <string.h>
#include <unistd.h>
#include <paths.h>
-#ifdef __NetBSD__
-#include <machine/disklabel.h>
-#endif
-
#ifdef __FreeBSD__
-#include <sys/disklabel.h>
#include <stdint.h>
#endif
@@ -453,6 +449,7 @@ ATF_TC_BODY(mmap_truncate, tc)
ATF_REQUIRE(ftruncate(fd, page / 12) == 0);
ATF_REQUIRE(ftruncate(fd, page / 64) == 0);
+ (void)munmap(map, page);
ATF_REQUIRE(close(fd) == 0);
}
@@ -509,6 +506,8 @@ ATF_TC_BODY(mmap_truncate_signal, tc)
prevent the access to be optimized out */
ATF_REQUIRE(i == 0);
ATF_REQUIRE(sta == 0);
+ (void)munmap(map, page);
+ (void)close(fd);
return;
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
index b9b3067..9f99980 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $ */
+/* $NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
+__RCSID("$NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -46,10 +47,6 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 12345689
#define MSG_MTYPE_1 0x41
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
index 70f8906..522ceb8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $ */
+/* $NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
+__RCSID("$NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 1234
#define MSG_MTYPE_1 0x41
#define MSG_MTYPE_2 0x42
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
index d30cb7b..5988821 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $ */
+/* $NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
+__RCSID("$NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 1234
#define MSG_MTYPE_1 0x41
#define MSG_MTYPE_2 0x42
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msync.c b/contrib/netbsd-tests/lib/libc/sys/t_msync.c
index 70d0ccf..d1fdbe0 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msync.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msync.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $ */
+/* $NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $");
+__RCSID("$NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $");
#include <sys/mman.h>
@@ -52,8 +52,7 @@ msync_sync(const char *garbage, int flags)
{
char *buf, *map = MAP_FAILED;
const char *str = NULL;
- size_t i, len;
- ssize_t tot;
+ size_t len;
int fd, rv;
/*
@@ -65,29 +64,17 @@ msync_sync(const char *garbage, int flags)
if (buf == NULL)
return NULL;
- for (i = 0; i < (size_t)page; i++)
- buf[i] = 'x';
+ memset(buf, 'x', page);
fd = open(path, O_RDWR | O_CREAT, 0700);
if (fd < 0) {
- str = "failed to open";
- goto out;
+ free(buf);
+ return "failed to open";
}
- tot = 0;
-
- while (tot < page) {
-
- rv = write(fd, buf, sizeof(buf));
-
- if (rv < 0) {
- str = "failed to write";
- goto out;
- }
-
- tot += rv;
- }
+ ATF_REQUIRE_MSG(write(fd, buf, page) != -1, "write(2) failed: %s",
+ strerror(errno));
map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_FILE|MAP_PRIVATE,
fd, 0);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c b/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
index b4d9f8a..1ad6661 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $ */
+/* $NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
+__RCSID("$NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $");
#include <sys/time.h>
#include <sys/wait.h>
@@ -45,11 +45,7 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
#include <unistd.h>
static void
-#ifdef __FreeBSD__
handler(int signo __unused)
-#else
-handler(int signo)
-#endif
{
/* Nothing. */
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
index 32beecc..df8f1ed 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $ */
+/* $NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $");
+__RCSID("$NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/wait.h>
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
static pid_t pid;
static int nsiginfo = 0;
@@ -153,9 +153,7 @@ ATF_TC_BODY(pipe_restart, tc)
ATF_REQUIRE_EQ(WEXITSTATUS(st), 0);
}
-#ifdef __FreeBSD__
free(f);
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
index 8208cf7..48f9734 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $ */
+/* $NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $");
+__RCSID("$NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $");
#include <atf-c.h>
#include <fcntl.h>
@@ -56,7 +56,8 @@ run(int flags)
#ifdef __FreeBSD__
closefrom(3);
#else
- ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+ ATF_REQUIRE_MSG(closefrom(3) != -1, "closefrom failed: %s",
+ strerror(errno));
#endif
ATF_REQUIRE(pipe2(fd, flags) == 0);
@@ -116,13 +117,13 @@ ATF_TC_BODY(pipe2_consume, tc)
{
struct rlimit rl;
int err, filedes[2];
-#ifdef __FreeBSD__
int old;
+#ifdef __FreeBSD__
closefrom(4);
#else
- err = fcntl(4, F_CLOSEM);
- ATF_REQUIRE(err == 0);
+ ATF_REQUIRE_MSG(closefrom(4) != -1, "closefrom failed: %s",
+ strerror(errno));
#endif
err = getrlimit(RLIMIT_NOFILE, &rl);
@@ -132,19 +133,15 @@ ATF_TC_BODY(pipe2_consume, tc)
* file descriptor limit in the middle of a pipe2() call - i.e.
* before the call only a single descriptor may be openend.
*/
-#ifdef __FreeBSD__
old = rl.rlim_cur;
-#endif
rl.rlim_cur = 4;
err = setrlimit(RLIMIT_NOFILE, &rl);
ATF_REQUIRE(err == 0);
err = pipe2(filedes, O_CLOEXEC);
ATF_REQUIRE(err == -1);
-#ifdef __FreeBSD__
rl.rlim_cur = old;
err = setrlimit(RLIMIT_NOFILE, &rl);
-#endif
}
ATF_TC(pipe2_nonblock);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c b/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
index da4e746..813bfb8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $ */
+/* $NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $");
+__RCSID("$NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/fcntl.h>
@@ -68,7 +68,7 @@ __RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
index 8e4c2a3..ec225b9 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $");
+__RCSID("$NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $");
#include <sys/resource.h>
#include <sys/wait.h>
@@ -176,9 +176,7 @@ ATF_TC_BODY(revoke_perm, tc)
if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS)
atf_tc_fail("revoke(2) did not obey permissions");
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
ATF_REQUIRE(unlink(path) == 0);
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_select.c b/contrib/netbsd-tests/lib/libc/sys/t_select.c
index 437b67b..04a684a 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_select.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_select.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_select.c,v 1.3 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_select.c,v 1.4 2017/01/13 21:18:33 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -47,21 +47,13 @@
static sig_atomic_t keep_going = 1;
static void
-#ifdef __FreeBSD__
sig_handler(int signum __unused)
-#else
-sig_handler(int signum)
-#endif
{
keep_going = 0;
}
static void
-#ifdef __FreeBSD__
sigchld(int signum __unused)
-#else
-sigchld(int signum)
-#endif
{
}
@@ -90,7 +82,7 @@ prmask(const sigset_t *m, char *buf, size_t len)
return buf;
}
-static void
+static __dead void
child(const struct timespec *ts)
{
struct sigaction sa;
@@ -135,9 +127,7 @@ child(const struct timespec *ts)
"after timeout %s != %s",
prmask(&nset, nbuf, sizeof(nbuf)),
prmask(&oset, obuf, sizeof(obuf)));
-#ifdef __FreeBSD__
_exit(0);
-#endif
}
ATF_TC(pselect_sigmask);
@@ -157,9 +147,7 @@ ATF_TC_BODY(pselect_sigmask, tc)
switch (pid = fork()) {
case 0:
child(NULL);
-#ifdef __FreeBSD__
- break;
-#endif
+ /*NOTREACHED*/
case -1:
err(1, "fork");
default:
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
index f1100bf..7bef590 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $ */
+/* $NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $");
+__RCSID("$NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $");
#include <sys/resource.h>
#include <sys/mman.h>
@@ -124,9 +124,7 @@ out:
if (lim != 0)
atf_tc_fail("failed to set limit (%d)", lim);
-#ifdef __FreeBSD__
free(buf);
-#endif
}
ATF_TC(setrlimit_current);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c b/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
index 23ca36a..4bbf421 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $ */
+/* $NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $");
+__RCSID("$NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/wait.h>
@@ -41,20 +41,12 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $");
#include <atf-c.h>
-#ifdef __NetBSD__
-#include "../../../h_macros.h"
-#else
#include "h_macros.h"
-#endif
static bool handler_called = false;
static void
-#ifdef __FreeBSD__
handler(int signo __unused)
-#else
-handler(int signo)
-#endif
{
handler_called = true;
}
@@ -87,11 +79,7 @@ wait_and_check_child(const pid_t pid, const char *fail_message)
}
static void
-#ifdef __FreeBSD__
catch(int sig __unused)
-#else
-catch(int sig)
-#endif
{
return;
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
index e911d42..af560f8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $ */
+/* $NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,31 +30,24 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $");
+__RCSID("$NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $");
#include <atf-c.h>
+#include <err.h>
#include <errno.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <err.h>
-#include <stdio.h>
-#endif
-
static void handler(int, siginfo_t *, void *);
#define VALUE (int)0xc001dad1
static int value;
static void
-#ifdef __FreeBSD__
-handler(int signo __unused, siginfo_t *info __unused, void *data __unused)
-#else
-handler(int signo, siginfo_t *info, void *data)
-#endif
+handler(int signo __unused, siginfo_t *info, void *data __unused)
{
value = info->si_value.sival_int;
kill(0, SIGINFO);
@@ -123,12 +116,10 @@ static sig_atomic_t count = 0;
static int delivered[CNT];
static void
-myhandler(int signo, siginfo_t *info, void *context)
+myhandler(int signo, siginfo_t *info, void *context __unused)
{
delivered[count++] = signo;
-#ifdef __FreeBSD__
printf("Signal #%zu: signo: %d\n", (size_t)count, signo);
-#endif
}
static int
@@ -213,12 +204,8 @@ ATF_TC_BODY(sigqueue_rt, tc)
sigset_t mask, orig;
sigemptyset(&mask);
for (size_t i = 0; i < CNT; i++)
-#ifdef __FreeBSD__
if (sigaddset(&mask, signals[i]) == -1)
warn("sigaddset");
-#else
- sigaddset(&mask, signals[i]);
-#endif
ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1);
@@ -227,23 +214,16 @@ ATF_TC_BODY(sigqueue_rt, tc)
ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1);
sleep(1);
-#ifdef __FreeBSD__
ATF_CHECK_MSG((size_t)count == ndelivered,
"count %zu != ndelivered %zu", (size_t)count, ndelivered);
-#else
- ATF_REQUIRE_MSG((size_t)count == ndelivered,
- "count %zu != ndelivered %zu", (size_t)count, ndelivered);
-#endif
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE_MSG(ordered[i] == delivered[i],
"%zu: ordered %d != delivered %d",
i, ordered[i], delivered[i]);
-#ifdef __FreeBSD__
- if (count > ndelivered)
- for (size_t i = ndelivered; i < count; i++)
+ if ((size_t)count > ndelivered)
+ for (size_t i = ndelivered; i < (size_t)count; i++)
printf("Undelivered signal #%zu: %d\n", i, ordered[i]);
-#endif
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
index 9da7861..7a0cc20 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $ */
+/* $NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $");
+__RCSID("$NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $");
#include <atf-c.h>
#include <fcntl.h>
@@ -66,7 +66,7 @@ run(int flags)
#ifdef __FreeBSD__
closefrom(3);
#else
- ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+ ATF_REQUIRE(closefrom(3) != -1);
#endif
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
index 300c6e8..adb32bb 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $ */
+/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $");
+__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $");
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
+#include <netinet/in.h>
#include <atf-c.h>
#include <errno.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $");
#include <stdio.h>
-#ifdef __FreeBSD__
-#include <netinet/in.h>
-#endif
-
static const char *path = "stat";
ATF_TC_WITH_CLEANUP(stat_chflags);
@@ -396,11 +393,9 @@ ATF_TC_BODY(stat_symlink, tc)
if (sa.st_mode == sb.st_mode)
atf_tc_fail("inconsistencies between stat(2) and lstat(2)");
+ (void)close(fd);
ATF_REQUIRE(unlink(path) == 0);
ATF_REQUIRE(unlink(pathlink) == 0);
-#ifdef __FreeBSD__
- (void)close(fd);
-#endif
}
ATF_TC_CLEANUP(stat_symlink, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c b/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
index cc85307..e8a6acd 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_timer_create.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_timer_create.c,v 1.5 2017/01/16 16:32:13 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -38,11 +38,7 @@ static timer_t t;
static bool fail = true;
static void
-#ifdef __FreeBSD__
timer_signal_handler(int signo, siginfo_t *si, void *osi __unused)
-#else
-timer_signal_handler(int signo, siginfo_t *si, void *osi)
-#endif
{
timer_t *tp;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
index 59193a9..5b96a20 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $ */
+/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,21 +29,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $");
+__RCSID("$NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $");
#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static const char path[] = "truncate";
static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 };
@@ -153,9 +150,7 @@ ATF_TC_HEAD(truncate_err, tc)
ATF_TC_BODY(truncate_err, tc)
{
-#ifndef __NetBSD__
char buf[PATH_MAX];
-#endif
errno = 0;
ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
@@ -167,13 +162,9 @@ ATF_TC_BODY(truncate_err, tc)
ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
errno = 0;
-#ifdef __NetBSD__
- ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1);
-#else
snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned",
atf_tc_get_config_var(tc, "srcdir"));
ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_umask.c b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
index 7a65574..fb3e405b 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_umask.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $");
+__RCSID("$NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $");
#include <sys/stat.h>
#include <sys/wait.h>
@@ -129,9 +129,7 @@ ATF_TC_BODY(umask_open, tc)
if (fd < 0)
continue;
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
(void)memset(&st, 0, sizeof(struct stat));
if (stat(path, &st) != 0) {
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
index b504bb0..cda9c16 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $ */
+/* $NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $");
+__RCSID("$NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <sys/stat.h>
@@ -111,15 +111,8 @@ ATF_TC_HEAD(unlink_fifo, tc)
ATF_TC_BODY(unlink_fifo, tc)
{
-#ifdef __FreeBSD__
- int fd;
- ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
- "mkfifo failed: %s", strerror(errno));
- (void)close(fd);
-#else
ATF_REQUIRE(mkfifo(path, 0666) == 0);
-#endif
ATF_REQUIRE(unlink(path) == 0);
errno = 0;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait.c b/contrib/netbsd-tests/lib/libc/sys/t_wait.c
index 8653265..91bbaf1f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_wait.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */
+/* $NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,25 +29,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
#include <sys/wait.h>
#include <sys/resource.h>
-#include <stdio.h>
#include <errno.h>
+#include <inttypes.h>
#include <limits.h>
#include <pwd.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <atf-c.h>
-#ifdef __FreeBSD__
-#define wrusage __wrusage
-#endif
-
ATF_TC(wait6_invalid);
ATF_TC_HEAD(wait6_invalid, tc)
{
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
index e5ddcbd..c529f17 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
@@ -29,9 +29,6 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $");
-#ifdef __FreeBSD__
-#include <sys/param.h> /* For NBBY -- it's in sys/types.h on NetBSD */
-#endif
#include <sys/wait.h>
#include <sys/resource.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_write.c b/contrib/netbsd-tests/lib/libc/sys/t_write.c
index a3783cb..576ce7e 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_write.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_write.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $ */
+/* $NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,37 +29,27 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $");
#include <sys/uio.h>
-#ifdef __NetBSD__
-#include <sys/syslimits.h>
-#endif
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static void sighandler(int);
static bool fail = false;
static const char *path = "write";
static void
-#ifdef __FreeBSD__
sighandler(int signo __unused)
-#else
-sighandler(int signo)
-#endif
{
fail = false;
}
OpenPOWER on IntegriCloud