summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-02-04 16:47:56 +0000
committerngie <ngie@FreeBSD.org>2017-02-04 16:47:56 +0000
commit3c2d6610b4f395363fd8c565af496d279ab44162 (patch)
tree4233fb25eabacbc7092f9d59c5ffa87b494a1e16
parent1a9602695754476d7f89f486f4e040cd432243ef (diff)
downloadFreeBSD-src-3c2d6610b4f395363fd8c565af496d279ab44162.zip
FreeBSD-src-3c2d6610b4f395363fd8c565af496d279ab44162.tar.gz
MFC r311925,r311968,r311969,r312102,r312108:
r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312102: Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD r312108: Delete trailing whitespace and use __arraycount instead of nitems in contrib code
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_faccessat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fchownat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fexecve.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fstatat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mknodat.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_o_search.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_openat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_utimensat.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_assert.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_dir.c22
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ftok.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_sleep.c21
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_time.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ttyname.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_vis.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strchr.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strerror.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_access.c19
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_chroot.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mincore.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mmap.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait.c116
-rw-r--r--contrib/netbsd-tests/lib/libc/t_cdb.c7
-rw-r--r--lib/libc/tests/stdlib/Makefile8
32 files changed, 209 insertions, 215 deletions
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
index 99235ea..7de4f61 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/faccessat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c b/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
index 6598059..a7bb683 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/fchmodat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fchownat.c b/contrib/netbsd-tests/lib/libc/c063/t_fchownat.c
index 2ca14cf..631d55a 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fchownat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fchownat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fchownat.c,v 1.4 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fchownat.c,v 1.4 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -40,10 +42,6 @@ __RCSID("$NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
#include <string.h>
#include <unistd.h>
#include <pwd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/fchownat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c b/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
index 30b26a7..b9aa017 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $ */
+/* $NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $");
+__RCSID("$NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
#include <sys/wait.h>
@@ -70,9 +70,7 @@ ATF_TC_BODY(fexecve, tc)
error = 76;
else
error = EXIT_FAILURE;
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
err(error, "fexecve");
}
}
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fstatat.c b/contrib/netbsd-tests/lib/libc/c063/t_fstatat.c
index b23f625..c17961f 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fstatat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fstatat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/fstatat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
index 3736dfa..5c496c8 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.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 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.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -63,9 +63,7 @@ ATF_TC_BODY(mkfifoat_fd, tc)
ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
-#ifdef __FreeBSD__
(void)close(dfd);
-#endif
}
ATF_TC(mkfifoat_fdcwd);
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c b/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
index e8f71cd..7c3ab9b 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -80,9 +80,7 @@ ATF_TC_BODY(mknodat_fd, tc)
ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(access(FILE, F_OK) == 0);
-#ifdef __FreeBSD__
(void)close(dfd);
-#endif
}
ATF_TC(mknodat_fdcwd);
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_o_search.c b/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
index d9dbe19..7cefa8b 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,9 +29,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
#include <atf-c.h>
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@@ -40,7 +44,6 @@ __RCSID("$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $");
#include <string.h>
#include <unistd.h>
#include <pwd.h>
-#include <sys/param.h>
/*
* dholland 20130112: disable tests that require O_SEARCH semantics
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_openat.c b/contrib/netbsd-tests/lib/libc/c063/t_openat.c
index 5112efc..f7c8c74 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_openat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_openat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/openat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c b/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c
index c9bc267..cf14652 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_readlinkat.c,v 1.4 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_readlinkat.c,v 1.4 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/readlinkat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c b/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c
index 220c4b2..9897b92 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_unlinkat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_unlinkat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,10 +41,6 @@ __RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#define DIR "dir"
#define FILE "dir/unlinkat"
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c b/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
index bbfa28b..682c2df 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,11 +42,6 @@ __RCSID("$NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
-#include <sys/time.h>
#define DIR "dir"
#define FILE "dir/utimensat"
diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c
index 5bbf337..74009a8 100644
--- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c
+++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fileactions.c,v 1.5 2012/04/09 19:42:07 martin Exp $ */
+/* $NetBSD: t_fileactions.c,v 1.6 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,10 +31,11 @@
*/
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
#include <atf-c.h>
+
+#include <sys/wait.h>
+#include <sys/stat.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -42,7 +43,6 @@
#include <fcntl.h>
#include <spawn.h>
#include <unistd.h>
-#include <sys/wait.h>
ATF_TC(t_spawn_openmode);
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 78313cd..2085b9e 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
@@ -60,16 +60,16 @@ get_different_scheduler(void)
/* get current schedule policy */
scheduler = sched_getscheduler(0);
- for (i = 0; i < nitems(schedulers); i++) {
+ for (i = 0; i < __arraycount(schedulers); i++) {
if (schedulers[i] == scheduler)
break;
}
- ATF_REQUIRE_MSG(i < nitems(schedulers),
+ ATF_REQUIRE_MSG(i < __arraycount(schedulers),
"Unknown current scheduler %d", scheduler);
-
+
/* new scheduler */
i++;
- if (i >= nitems(schedulers))
+ if (i >= __arraycount(schedulers))
i = 0;
return schedulers[i];
}
@@ -85,7 +85,7 @@ get_different_priority(int scheduler)
sched_getparam(0, &param);
priority = param.sched_priority;
-
+
/*
* Change numerical value of the priority, to ensure that it
* was set for the spawned child.
@@ -127,7 +127,7 @@ ATF_TC_BODY(t_spawnattr, tc)
scheduler = get_different_scheduler();
priority = get_different_priority(scheduler);
sp.sched_priority = priority;
-
+
sigemptyset(&sig);
sigaddset(&sig, SIGUSR1);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_assert.c b/contrib/netbsd-tests/lib/libc/gen/t_assert.c
index a09c130..ce73015 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_assert.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_assert.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $ */
+/* $NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,8 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");
+__RCSID("$NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $");
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <assert.h>
@@ -40,11 +43,6 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
static void
disable_corefile(void)
{
@@ -55,7 +53,6 @@ disable_corefile(void)
ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0);
}
-#endif
static void handler(int);
@@ -82,9 +79,7 @@ ATF_TC_BODY(assert_false, tc)
if (pid == 0) {
-#ifdef __FreeBSD__
disable_corefile();
-#endif
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
@@ -122,9 +117,7 @@ ATF_TC_BODY(assert_true, tc)
if (pid == 0) {
-#ifdef __FreeBSD__
disable_corefile();
-#endif
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_dir.c b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
index 3b4c6cb..c058738 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_dir.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dir.c,v 1.6 2013/10/19 17:45:00 christos Exp $ */
+/* $NetBSD: t_dir.c,v 1.8 2017/01/11 07:26:17 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,22 +26,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <atf-c.h>
-
+#include <sys/stat.h>
#include <assert.h>
+#include <atf-c.h>
#include <dirent.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/stat.h>
-#ifdef __FreeBSD__
-#include <errno.h>
-#endif
ATF_TC(seekdir_basic);
ATF_TC_HEAD(seekdir_basic, tc)
@@ -58,7 +55,6 @@ ATF_TC_BODY(seekdir_basic, tc)
struct dirent *entry;
long here;
-#ifdef __FreeBSD__
#define CREAT(x, m) do { \
int _creat_fd; \
ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))) != -1, \
@@ -72,12 +68,6 @@ ATF_TC_BODY(seekdir_basic, tc)
CREAT("t/a", 0600);
CREAT("t/b", 0600);
CREAT("t/c", 0600);
-#else
- mkdir("t", 0755);
- creat("t/a", 0600);
- creat("t/b", 0600);
- creat("t/c", 0600);
-#endif
dp = opendir("t");
if ( dp == NULL)
@@ -90,10 +80,8 @@ ATF_TC_BODY(seekdir_basic, tc)
/* get first entry */
entry = readdir(dp);
here = telldir(dp);
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(here != -1,
"telldir failed: %s", strerror(errno));
-#endif
/* get second entry */
entry = readdir(dp);
@@ -137,9 +125,7 @@ ATF_TC_BODY(seekdir_basic, tc)
atf_tc_fail("3rd seekdir found wrong name");
closedir(dp);
-#ifdef __FreeBSD__
free(wasname);
-#endif
}
/* There is no sbrk on AArch64 and RISC-V */
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_ftok.c b/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
index 718d310..4c1ab18 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ftok.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $ */
+/* $NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ftok.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $");
+__RCSID("$NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $");
#include <sys/types.h>
#include <sys/ipc.h>
@@ -68,9 +68,7 @@ ATF_TC_BODY(ftok_link, tc)
fd = open(path, O_RDONLY | O_CREAT);
ATF_REQUIRE(fd >= 0);
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
ATF_REQUIRE(link(path, hlnk) == 0);
ATF_REQUIRE(symlink(path, slnk) == 0);
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 53055d2..17eac87 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_humanize_number.c,v 1.8 2012/03/18 07:14:08 jruoho Exp $ */
+/* $NetBSD: t_humanize_number.c,v 1.9 2017/01/10 15:20:44 christos Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -247,9 +247,7 @@ ATF_TC_BODY(humanize_number_basic, tc)
newline();
atf_tc_fail_nonfatal("Failed for table entry %d", i);
}
-#ifdef __FreeBSD__
free(buf);
-#endif
}
ATF_TC(humanize_number_big);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
index e89df69..e85867a 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sleep.c,v 1.9 2016/08/11 21:34:11 kre Exp $ */
+/* $NetBSD: t_sleep.c,v 1.11 2017/01/10 15:43:59 maya Exp $ */
/*-
* Copyright (c) 2006 Frank Kardel
@@ -26,8 +26,18 @@
* 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>
+#include <sys/time.h> /* for TIMESPEC_TO_TIMEVAL on FreeBSD */
+
#include <atf-c.h>
#include <errno.h>
+#include <inttypes.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,10 +45,6 @@
#include <time.h>
#include <unistd.h>
-#include <sys/cdefs.h>
-#include <sys/event.h>
-#include <sys/signal.h>
-
#include "isqemu.h"
#define BILLION 1000000000LL /* nano-seconds per second */
@@ -49,11 +55,6 @@
#define KEVNT_TIMEOUT 10300 /* measured in milli-seconds */
#define FUZZ (40 * MILLION) /* scheduling fuzz accepted - 40 ms */
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#include <inttypes.h>
-#endif
-
/*
* Timer notes
*
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_time.c b/contrib/netbsd-tests/lib/libc/gen/t_time.c
index 2905403..15a8d58 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_time.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $ */
+/* $NetBSD: t_time.c,v 1.4 2017/01/10 15:32:46 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,11 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $");
+__RCSID("$NetBSD: t_time.c,v 1.4 2017/01/10 15:32:46 christos Exp $");
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#endif
#include <atf-c.h>
#include <errno.h>
#include <inttypes.h>
@@ -41,6 +38,7 @@ __RCSID("$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <sys/time.h>
#include <unistd.h>
ATF_TC(time_copy);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
index 1c813fb..61121b8 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $ */
+/* $NetBSD: t_ttyname.c,v 1.4 2017/01/10 15:33:40 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $");
+__RCSID("$NetBSD: t_ttyname.c,v 1.4 2017/01/10 15:33:40 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -78,9 +78,7 @@ ATF_TC_BODY(ttyname_err, tc)
ATF_REQUIRE(ttyname(fd) == NULL);
ATF_REQUIRE(errno == ENOTTY);
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
}
}
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_vis.c b/contrib/netbsd-tests/lib/libc/gen/t_vis.c
index 76f85f4..adb0930 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_vis.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_vis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vis.c,v 1.8 2015/05/23 14:02:11 christos Exp $ */
+/* $NetBSD: t_vis.c,v 1.9 2017/01/10 15:16:57 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -144,9 +144,7 @@ ATF_TC_BODY(strunvis_hex, tc)
}
}
-/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */
#ifdef VIS_NOLOCALE
-/* End FreeBSD */
ATF_TC(strvis_locale);
ATF_TC_HEAD(strvis_locale, tc)
{
@@ -175,9 +173,7 @@ ATF_TC_BODY(strvis_locale, tc)
setlocale(LC_CTYPE, ol);
free(ol);
}
-/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */
#endif /* VIS_NOLOCALE */
-/* End FreeBSD */
ATF_TP_ADD_TCS(tp)
{
@@ -186,13 +182,9 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, strvis_null);
ATF_TP_ADD_TC(tp, strvis_empty);
ATF_TP_ADD_TC(tp, strunvis_hex);
-/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */
#ifdef VIS_NOLOCALE
-/* End FreeBSD */
ATF_TP_ADD_TC(tp, strvis_locale);
-/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */
#endif /* VIS_NOLOCALE */
-/* End FreeBSD */
return atf_no_error();
}
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
index 905306d..06f2de0 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
@@ -51,10 +51,6 @@ static const char * const inf_strings[] =
const char *nan_string = "NaN(x)y";
#endif
-#ifdef __FreeBSD__
-#define __HAVE_LONG_DOUBLE
-#endif
-
ATF_TC(strtod_basic);
ATF_TC_HEAD(strtod_basic, tc)
{
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strchr.c b/contrib/netbsd-tests/lib/libc/string/t_strchr.c
index 4556b2c..5dd9a62 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strchr.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strchr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strchr.c,v 1.1 2011/07/07 08:59:33 jruoho Exp $ */
+/* $NetBSD: t_strchr.c,v 1.2 2017/01/10 15:34:49 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@acorntoolworks.com>
@@ -58,12 +58,10 @@ ATF_TC_HEAD(strchr_basic, tc)
ATF_TC_BODY(strchr_basic, tc)
{
-#ifdef __FreeBSD__
void *dl_handle;
-#endif
- unsigned int t, a;
char *off;
char buf[32];
+ unsigned int t, a;
const char *tab[] = {
"",
@@ -248,12 +246,8 @@ ATF_TC_BODY(strchr_basic, tc)
"abcdefgh/abcdefgh/",
};
-#ifdef __FreeBSD__
dl_handle = dlopen(NULL, RTLD_LAZY);
strchr_fn = dlsym(dl_handle, "test_strlen");
-#else
- strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr");
-#endif
if (!strchr_fn)
strchr_fn = strchr;
@@ -288,9 +282,7 @@ ATF_TC_BODY(strchr_basic, tc)
verify_strchr(buf + a, 0xff, t, a);
}
}
-#ifdef __FreeBSD__
(void)dlclose(dl_handle);
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strerror.c b/contrib/netbsd-tests/lib/libc/string/t_strerror.c
index 888a826..99b95b4 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strerror.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strerror.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $ */
+/* $NetBSD: t_strerror.c,v 1.4 2017/01/10 20:35:49 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,18 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $");
+__RCSID("$NetBSD: t_strerror.c,v 1.4 2017/01/10 20:35:49 christos Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <stdio.h> /* Needed for sys_nerr on FreeBSD */
#include <limits.h>
#include <locale.h>
#include <string.h>
-#ifdef __FreeBSD__
-#include <stdio.h>
-#endif
-
ATF_TC(strerror_basic);
ATF_TC_HEAD(strerror_basic, tc)
{
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_access.c b/contrib/netbsd-tests/lib/libc/sys/t_access.c
index 69d2df2..c537eca 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_access.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_access.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
+/* $NetBSD: t_access.c,v 2.2 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
+__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
+
+#ifdef __FreeBSD__
+#include <sys/param.h> /* For __FreeBSD_version */
+#endif
+
+#include <atf-c.h>
+
+#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
@@ -38,13 +46,6 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
#include <stdlib.h>
#include <unistd.h>
-#include <atf-c.h>
-
-#ifdef __FreeBSD__
-#include <sys/param.h>
-#include <sys/stat.h>
-#endif
-
static const char path[] = "access";
static const int mode[4] = { R_OK, W_OK, X_OK, F_OK };
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_chroot.c b/contrib/netbsd-tests/lib/libc/sys/t_chroot.c
index 651dc10..1f1c49b 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_chroot.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_chroot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_chroot.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
+/* $NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,9 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_chroot.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
+__RCSID("$NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
#include <sys/wait.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
@@ -42,10 +43,6 @@ __RCSID("$NetBSD: t_chroot.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
-
ATF_TC(chroot_basic);
ATF_TC_HEAD(chroot_basic, tc)
{
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
index c31170f..ab8c33f 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.8 2012/06/08 07:18:58 martin Exp $ */
+/* $NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,9 +59,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mincore.c,v 1.8 2012/06/08 07:18:58 martin Exp $");
+__RCSID("$NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $");
#include <sys/mman.h>
+#include <sys/stat.h>
#include <sys/shm.h>
#include <atf-c.h>
@@ -74,10 +75,6 @@ __RCSID("$NetBSD: t_mincore.c,v 1.8 2012/06/08 07:18:58 martin Exp $");
#include <unistd.h>
#include <sys/resource.h>
-#ifdef __FreeBSD__
-#include <sys/stat.h>
-#endif
-
static long page = 0;
static const char path[] = "mincore";
static size_t check_residency(void *, size_t);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
index 9e74d41..b35b2ae 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.9 2015/02/28 13:57:08 martin Exp $ */
+/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,10 +55,11 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.9 2015/02/28 13:57:08 martin Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
#include <sys/param.h>
#include <sys/mman.h>
+#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
@@ -78,7 +79,6 @@ __RCSID("$NetBSD: t_mmap.c,v 1.9 2015/02/28 13:57:08 martin Exp $");
#ifdef __FreeBSD__
#include <sys/disklabel.h>
-#include <sys/stat.h>
#include <stdint.h>
#endif
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait.c b/contrib/netbsd-tests/lib/libc/sys/t_wait.c
index 027c40d..8653265 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.4 2016/04/27 21:14:24 christos Exp $ */
+/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_wait.c,v 1.4 2016/04/27 21:14:24 christos Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $");
#include <sys/wait.h>
#include <sys/resource.h>
@@ -64,22 +64,6 @@ ATF_TC_BODY(wait6_invalid, tc)
&& errno == EINVAL);
}
-ATF_TC(wait6_noproc);
-ATF_TC_HEAD(wait6_noproc, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Test that wait6(2) returns ECHILD with for no processes");
-}
-
-ATF_TC_BODY(wait6_noproc, tc)
-{
- siginfo_t si;
- struct wrusage wru;
- int st;
- ATF_REQUIRE(wait6(P_ALL, 0, &st, WEXITED, &wru, &si) == -1
- && errno == ECHILD);
-}
-
ATF_TC(wait6_exited);
ATF_TC_HEAD(wait6_exited, tc)
{
@@ -96,12 +80,12 @@ ATF_TC_BODY(wait6_exited, tc)
switch (pid = fork()) {
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
case 0:
exit(0x5a5a5a5a);
/*NOTREACHED*/
default:
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFEXITED(st) && WEXITSTATUS(st) == 0x5a);
ATF_REQUIRE(si.si_status = 0x5a5a5a5a);
ATF_REQUIRE(si.si_pid == pid);
@@ -134,10 +118,10 @@ ATF_TC_BODY(wait6_terminated, tc)
sleep(100);
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
ATF_REQUIRE(kill(pid, SIGTERM) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGTERM);
ATF_REQUIRE(si.si_status == SIGTERM);
ATF_REQUIRE(si.si_pid == pid);
@@ -172,9 +156,9 @@ ATF_TC_BODY(wait6_coredumped, tc)
*(char *)8 = 0;
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGSEGV
&& WCOREDUMP(st));
ATF_REQUIRE(si.si_status == SIGSEGV);
@@ -210,11 +194,14 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
sleep(100);
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
+ ATF_REQUIRE(!WIFCONTINUED(st));
ATF_REQUIRE(si.si_status == SIGSTOP);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -225,8 +212,11 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
#endif
ATF_REQUIRE(kill(pid, SIGCONT) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
ATF_REQUIRE(WIFCONTINUED(st));
+ ATF_REQUIRE(!WIFSTOPPED(st));
ATF_REQUIRE(si.si_status == SIGCONT);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -237,8 +227,11 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
#endif
ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(!WIFCONTINUED(st));
ATF_REQUIRE(si.si_status == SIGQUIT);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -251,15 +244,80 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
}
}
+ATF_TC(wait6_stopgo_loop);
+ATF_TC_HEAD(wait6_stopgo_loop, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test that wait6(2) handled stopped/continued process loop");
+}
+
+ATF_TC_BODY(wait6_stopgo_loop, tc)
+{
+ siginfo_t si;
+ struct wrusage wru;
+ int st;
+ pid_t pid;
+ static const struct rlimit rl = { 0, 0 };
+ size_t N = 100;
+
+ ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
+ switch (pid = fork()) {
+ case 0:
+ sleep(100);
+ /*FALLTHROUGH*/
+ case -1:
+ ATF_REQUIRE(pid > 0);
+ }
+
+ printf("Before loop of SIGSTOP/SIGCONT sequence %zu times\n", N);
+ while (N --> 0) {
+ ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
+ ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
+ ATF_REQUIRE(!WIFCONTINUED(st));
+ ATF_REQUIRE(si.si_status == SIGSTOP);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_STOPPED);
+
+ ATF_REQUIRE(kill(pid, SIGCONT) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
+ ATF_REQUIRE(WIFCONTINUED(st));
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(si.si_status == SIGCONT);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_CONTINUED);
+ }
+ ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(!WIFCONTINUED(st));
+ ATF_REQUIRE(si.si_status == SIGQUIT);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_KILLED);
+#ifdef __NetBSD__
+ printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
+ (uintmax_t)si.si_utime);
+#endif
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, wait6_invalid);
- ATF_TP_ADD_TC(tp, wait6_noproc);
ATF_TP_ADD_TC(tp, wait6_exited);
ATF_TP_ADD_TC(tp, wait6_terminated);
ATF_TP_ADD_TC(tp, wait6_coredumped);
ATF_TP_ADD_TC(tp, wait6_stop_and_go);
+ ATF_TP_ADD_TC(tp, wait6_stopgo_loop);
return atf_no_error();
}
diff --git a/contrib/netbsd-tests/lib/libc/t_cdb.c b/contrib/netbsd-tests/lib/libc/t_cdb.c
index 5e88e65..97da4a3 100644
--- a/contrib/netbsd-tests/lib/libc/t_cdb.c
+++ b/contrib/netbsd-tests/lib/libc/t_cdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $ */
+/* $NetBSD: t_cdb.c,v 1.2 2017/01/10 22:24:29 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,12 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $");
+__RCSID("$NetBSD: t_cdb.c,v 1.2 2017/01/10 22:24:29 christos Exp $");
#include <atf-c.h>
+
+#include <sys/stat.h>
+
#include <assert.h>
#include <cdbr.h>
#include <cdbw.h>
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index f2d866c..c681cb6 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -11,6 +11,14 @@ ATF_TESTS_CXX+= cxa_thread_atexit_test
ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test
.endif
+# Not sure why this isn't defined for all architectures, since most
+# have long double.
+.if ${MACHINE_CPUARCH} == "aarch64" || \
+ ${MACHINE_CPUARCH} == "amd64" || \
+ ${MACHINE_CPUARCH} == "i386"
+CFLAGS+= -D__HAVE_LONG_DOUBLE
+.endif
+
# TODO: t_getenv_thread, t_mi_vector_hash, t_strtoi
NETBSD_ATF_TESTS_C+= abs_test
NETBSD_ATF_TESTS_C+= atoi_test
OpenPOWER on IntegriCloud