diff options
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/sys')
33 files changed, 121 insertions, 281 deletions
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; } |