diff options
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
31 files changed, 187 insertions, 198 deletions
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 0000000000000..4c85e4b2db4b6 --- /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/t_glob.c b/contrib/netbsd-tests/lib/libc/gen/t_glob.c index 0572a42023a6f..c0d3a3d2ae38d 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.4 2017/01/13 21:30: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.4 2017/01/13 21:30:41 christos Exp $"); #include <atf-c.h> @@ -46,12 +46,11 @@ __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" + +#ifdef __FreeBSD__ #define __gl_stat_t struct stat #define _S_IFDIR S_IFDIR -#else -#include "../../../h_macros.h" #endif diff --git a/contrib/netbsd-tests/lib/libc/regex/debug.c b/contrib/netbsd-tests/lib/libc/regex/debug.c index 22f0b90d2272c..18ab6ea6b611e 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 0670e514e7e11..f9bd276f63d6d 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 0ca44b47577e6..5f4353fa12405 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.2 2017/01/14 00:50:56 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #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.2 2017/01/14 00:50:56 christos Exp $"); #include <sys/param.h> @@ -377,11 +377,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); } 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 229c343c7a8b4..3a18286091b38 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,22 @@ #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 672a022c326ec..5dc88d5661cad 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> @@ -56,10 +57,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 +96,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 d8125ab335313..044b6e37dc204 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,6 +39,7 @@ __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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c index f4ee96b057f23..273fd836a9529 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_link.c b/contrib/netbsd-tests/lib/libc/sys/t_link.c index b8dcacc994fe5..5663d9ae946a7 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,6 +37,7 @@ __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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_listen.c b/contrib/netbsd-tests/lib/libc/sys/t_listen.c index a9ee733c737e7..f9ac1dcd87c4e 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> @@ -110,9 +111,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_mmap.c b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c index 738758c637f78..33adcf2e0feeb 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.11 2017/01/13 20:43:11 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ * 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.11 2017/01/13 20:43:11 christos Exp $"); #include <sys/param.h> #include <sys/mman.h> @@ -460,9 +460,7 @@ ATF_TC_BODY(mmap_truncate, tc) ATF_REQUIRE(ftruncate(fd, page / 12) == 0); ATF_REQUIRE(ftruncate(fd, page / 64) == 0); -#ifdef __FreeBSD__ (void)munmap(map, page); -#endif ATF_REQUIRE(close(fd) == 0); } @@ -519,10 +517,8 @@ ATF_TC_BODY(mmap_truncate_signal, tc) prevent the access to be optimized out */ ATF_REQUIRE(i == 0); ATF_REQUIRE(sta == 0); -#ifdef __FreeBSD__ (void)munmap(map, page); (void)close(fd); -#endif return; } diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c index b9b306742699d..a573d158fb100 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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c index 70f890682a769..bd8024754fa43 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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c index d30cb7b97f26b..36a428a843216 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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c b/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c index b4d9f8a809eb6..1ad6661c808f9 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 32beeccb3b603..df8f1edd1d16e 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 8208cf79231f3..48f973488c7ae 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 da4e7461c8af0..813bfb8cba11b 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 8e4c2a3993530..ec225b9be4917 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 437b67b5e9ccb..04a684a8cdeaa 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 31db878c5851e..6b90deab8f3f9 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> @@ -129,9 +129,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 23ca36a659f84..4bbf421c62043 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 e911d42e93a0f..a309f53d55507 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,11 +30,13 @@ */ #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> @@ -50,11 +52,7 @@ static void handler(int, siginfo_t *, void *); 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 +121,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 +209,9 @@ 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 +220,17 @@ 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 9da7861b1b8a6..7a0cc205ece54 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 300c6e89593c7..956075275c335 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> @@ -396,6 +397,7 @@ 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__ diff --git a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c index 59193a953f37e..695ac37d4b379 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,13 +29,14 @@ * 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> @@ -153,9 +154,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 +166,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 7a65574742b8c..fb3e405b5aa22 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 b504bb06debc6..9e0bd42ae1555 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.3 2017/01/13 19:33:03 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.3 2017/01/13 19:33:03 christos Exp $"); #include <sys/stat.h> @@ -111,15 +111,11 @@ 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 86532652c6e6a..9f749cb2daae9 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,16 +29,17 @@ * 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> diff --git a/contrib/netbsd-tests/lib/libc/sys/t_write.c b/contrib/netbsd-tests/lib/libc/sys/t_write.c index a3783cb5deee3..576ce7e7c0b53 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; } |