Mechanically replace #if defined(__FreeBSD__) and #if defined(__NetBSD__) with

their #ifdef equivalents for everything changed in contrib/netbsd-tests. There
are some items from the vendor tree that use #if defined(__FreeBSD__) or
#if defined(__NetBSD__) which are being left alone

Requested by: bde, rpaulo
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2014-11-17 13:39:00 +00:00
parent c26264ace9
commit ff0ba87247
52 changed files with 109 additions and 109 deletions

View File

@ -31,7 +31,7 @@
*/
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/stat.h>
#endif
#include <atf-c.h>
@ -251,7 +251,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent, tc)
posix_spawn_file_actions_destroy(&fa);
}
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(t_spawn_open_nonexistent_diag);
ATF_TC_HEAD(t_spawn_open_nonexistent_diag, tc)
@ -381,7 +381,7 @@ ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, t_spawn_fileactions);
ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent);
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent_diag);
#endif
ATF_TP_ADD_TC(tp, t_spawn_reopen);

View File

@ -56,7 +56,7 @@ ATF_TC_BODY(getcwd_err, tc)
ATF_REQUIRE(getcwd(buf, 0) == NULL);
ATF_REQUIRE(errno == EINVAL);
#if defined(__NetBSD__)
#ifdef __NetBSD__
errno = 0;
ATF_REQUIRE(getcwd((void *)-1, sizeof(buf)) == NULL);

View File

@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
#include <string.h>
#include <errno.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include "h_macros.h"
#define __gl_stat_t struct stat
#define _S_IFDIR S_IFDIR
@ -138,7 +138,7 @@ gl_readdir(void *v)
dir.d_ino = dd->pos;
dir.d_type = f->dir ? DT_DIR : DT_REG;
DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */
#else
dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen);
@ -223,7 +223,7 @@ run(const char *p, int flags, const char **res, size_t len)
}
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TC(glob_star);
ATF_TC_HEAD(glob_star, tc)
{
@ -272,7 +272,7 @@ ATF_TC_BODY(glob_nocheck, tc)
ATF_TP_ADD_TCS(tp)
{
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TP_ADD_TC(tp, glob_star);
#endif
ATF_TP_ADD_TC(tp, glob_star_not);

View File

@ -34,7 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#else
#include <util.h>
@ -82,7 +82,7 @@ const struct hnopts {
/*
* Truncated output. Rev. 1.7 produces "1.0 K".
*/
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
{ 6, 1000, "A", HN_AUTOSCALE, HN_DECIMAL, -1, "" },
/*

View File

@ -72,7 +72,7 @@ ATF_TC_BODY(nice_err, tc)
{
int i;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged "
"users and sets errno == EPERM; see PR # 189821 for more details");
#endif
@ -98,7 +98,7 @@ ATF_TC_HEAD(nice_priority, tc)
ATF_TC_BODY(nice_priority, tc)
{
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
int i, pri, pri2, nic;
#else
int i, pri, nic;
@ -115,7 +115,7 @@ ATF_TC_BODY(nice_priority, tc)
pri = getpriority(PRIO_PROCESS, 0);
ATF_REQUIRE(errno == 0);
#if defined(__NetBSD__)
#ifdef __NetBSD__
if (nic != pri)
atf_tc_fail("nice(3) and getpriority(2) conflict");
#endif
@ -130,14 +130,14 @@ ATF_TC_BODY(nice_priority, tc)
if (pid == 0) {
errno = 0;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
pri = getpriority(PRIO_PROCESS, 0);
#else
pri2 = getpriority(PRIO_PROCESS, 0);
#endif
ATF_REQUIRE(errno == 0);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
if (pri != pri2)
#else
if (nic != pri)
@ -180,7 +180,7 @@ ATF_TC_HEAD(nice_thread, tc)
ATF_TC_BODY(nice_thread, tc)
{
pthread_t tid[5];
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
int pri, rv, val;
#else
int rv, val;
@ -196,7 +196,7 @@ ATF_TC_BODY(nice_thread, tc)
val = nice(i);
ATF_REQUIRE(val != -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
pri = getpriority(PRIO_PROCESS, 0);
rv = pthread_create(&tid[i], NULL, threadfunc, &pri);
#else

View File

@ -43,7 +43,7 @@ static int count;
static void handler_err(int);
static void handler_ret(int);
static void handler_stress(int);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2 };
#else
static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2, SIGPWR };

View File

@ -63,7 +63,7 @@ ATF_TC_BODY(setdomainname_basic, tc)
(void)memset(name, 0, sizeof(name));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
* Sanity checks to ensure that the wrong invariant isn't being
* tested for per PR # 181127
@ -101,7 +101,7 @@ ATF_TC_BODY(setdomainname_limit, tc)
(void)memset(name, 0, sizeof(name));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0);
ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN) == -1);
#endif

View File

@ -28,7 +28,7 @@
#include <atf-c.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/inttypes.h>
#endif
#include <sys/resource.h>
@ -87,7 +87,7 @@ sig_debug(int signo, siginfo_t *info, ucontext_t *ctx)
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
#if defined(__NetBSD__)
#ifdef __NetBSD__
for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++)
printf("uc_mcontext.greg[%d] 0x%lx\n", i,
(long)ctx->uc_mcontext.__gregs[i]);
@ -144,7 +144,7 @@ sigchild_action(int signo, siginfo_t *info, void *ptr)
printf("si_uid=%d\n", info->si_uid);
printf("si_pid=%d\n", info->si_pid);
printf("si_status=%d\n", info->si_status);
#if defined(__NetBSD__)
#ifdef __NetBSD__
printf("si_utime=%lu\n", (unsigned long int)info->si_utime);
printf("si_stime=%lu\n", (unsigned long int)info->si_stime);
#endif

View File

@ -31,7 +31,7 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/time.h>
#endif
#include <atf-c.h>

View File

@ -107,7 +107,7 @@ ATF_TC_BODY(ttyname_r_err, tc)
ATF_REQUIRE(rv == ERANGE);
}
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936");
#endif
rv = ttyname_r(-1, buf, ttymax);

View File

@ -132,7 +132,7 @@ h_ctype2(const struct test *t, bool use_mbstate)
size_t n;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {
@ -245,7 +245,7 @@ ATF_TC_BODY(mbrtowc_internal, tc)
{
struct test *t;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("ja_* locale fails");
#endif
for (t = &tests[0]; t->data != NULL; ++t)

View File

@ -150,7 +150,7 @@ ATF_TC_BODY(mbstowcs_basic, tc)
int i;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {

View File

@ -76,7 +76,7 @@ h_mbtowc(const char *locale, const char *illegal, const char *legal)
char *str;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, locale) != NULL);
#else
if (setlocale(LC_CTYPE, locale) == NULL) {
@ -137,13 +137,13 @@ ATF_TC_BODY(mbtowc, tc)
h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B");
h_mbtowc("ja_JP.SJIS", "\202", "\202\240");
h_mbtowc("ja_JP.eucJP", "\244", "\244\242");
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
/* Moved last as it fails */
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
#endif
h_mbtowc("zh_TW.Big5", "\241", "\241@");
h_mbtowc("zh_TW.eucTW", "\241", "\241\241");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("zh_CN.GB18030");
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
#endif

View File

@ -66,7 +66,7 @@ __RCSID("$NetBSD: t_wcstod.c,v 1.3 2011/10/01 17:56:11 christos Exp $");
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <stdio.h>
#endif

View File

@ -109,7 +109,7 @@ h_wctomb(const struct test *t, char tc)
size_t sz, ret, i;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {

View File

@ -46,14 +46,14 @@ __RCSID("$NetBSD: t_ether_aton.c,v 1.1 2011/11/01 22:36:53 pgoyette Exp $");
#include <string.h>
#include <errno.h>
#if !defined(__NetBSD__)
#if defined(__linux__)
#ifndef __NetBSD__
#ifdef __linux__
#include <netinet/ether.h>
#endif
#include <net/ethernet.h>
#endif
#if defined(__NetBSD__)
#ifdef __NetBSD__
#define ETHER_ADDR_LEN 6
int ether_aton_r(u_char *dest, size_t len, const char *str);
@ -65,7 +65,7 @@ static const struct {
int error;
} tests[] = {
{ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, "01:23:45:67:89:ab", 0 },
#if defined(__NetBSD__)
#ifdef __NetBSD__
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "0:1:22-3:14:05", 0 },
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "000122031405", 0 },
{ { 0x0a, 0x0B, 0xcc, 0xdD, 0xEE, 0x0f }, "0a0BccdDEE0f", 0 },
@ -86,13 +86,13 @@ ATF_TC_HEAD(tc_ether_aton, tc)
ATF_TC_BODY(tc_ether_aton, tc)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
u_char dest[ETHER_ADDR_LEN];
#else
struct ether_addr dest;
#endif
size_t t;
#if defined(__NetBSD__)
#ifdef __NetBSD__
int e, r;
#else
int e;
@ -103,7 +103,7 @@ ATF_TC_BODY(tc_ether_aton, tc)
for (t = 0; tests[t].str; t++) {
s = tests[t].str;
if ((e = tests[t].error) == 0) {
#if defined(__NetBSD__)
#ifdef __NetBSD__
if (ether_aton_r(dest, sizeof(dest), s) != e)
atf_tc_fail("failed on `%s'", s);
if (memcmp(dest, tests[t].res, sizeof(dest)) != 0)
@ -115,7 +115,7 @@ ATF_TC_BODY(tc_ether_aton, tc)
atf_tc_fail("unexpected result on `%s'", s);
#endif
} else {
#if defined(__NetBSD__)
#ifdef __NetBSD__
if ((r = ether_aton_r(dest, sizeof(dest), s)) != e)
atf_tc_fail("unexpectedly succeeded on `%s' "
"(%d != %d)", s, r, e);

View File

@ -34,7 +34,7 @@
#include <string.h>
#include <sys/types.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <wchar.h>
#include <wctype.h>
#endif
@ -54,7 +54,7 @@ static char *regchar(int);
void
regprint(regex_t *r, FILE *d)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
struct re_guts *g = r->re_g;
int c;
int last;
@ -177,7 +177,7 @@ s_print(struct re_guts *g, FILE *d)
break;
case OANYOF:
fprintf(d, "[(%ld)", (long)opnd);
#if defined(__NetBSD__)
#ifdef __NetBSD__
cs = &g->sets[opnd];
last = -1;
for (size_t i = 0; i < g->csetsize+1; i++) /* +1 flushes */
@ -250,7 +250,7 @@ s_print(struct re_guts *g, FILE *d)
fprintf(d, ">");
break;
default:
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
#else
fprintf(d, "!%d(%d)!", OP(*s), opnd);

View File

@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");
#include <stdlib.h>
#include <err.h>
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/resource.h>
#endif
@ -179,7 +179,7 @@ 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");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.memory", "64M");
#else
atf_tc_set_md_var(tc, "require.memory", "120M");
@ -189,12 +189,12 @@ ATF_TC_HEAD(regcomp_too_big, tc)
ATF_TC_BODY(regcomp_too_big, tc)
{
regex_t re;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
struct rlimit limit;
#endif
int e;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
#endif

View File

@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $");
#include <vis.h>
#include <ctype.h>
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif
@ -377,7 +377,7 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm,
" cur=%d, max=%zu", res, l, len - off);
off += l;
}
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
#else
ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
@ -580,7 +580,7 @@ ATF_TC_BODY(leftassoc, tc)
* any explation. Mark as broken here, but I don't know why. */
atf_tc_expect_fail("Reason for breakage unknown");
#endif
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD");
#endif
att_test(tc, "leftassoc");

View File

@ -42,7 +42,7 @@ __RCSID("$NetBSD: h_atexit.c,v 1.1 2011/01/12 19:44:08 pgoyette Exp $");
extern int __cxa_atexit(void (*func)(void *), void *, void *);
extern void __cxa_finalize(void *);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
* On shared object unload, in __cxa_finalize, call and clear all installed
* atexit and __cxa_atexit handlers that are either installed by unloaded
@ -191,7 +191,7 @@ main(int argc, char *argv[])
ASSERT(0 == atexit(normal_handler_0));
ASSERT(0 == atexit(normal_handler_1));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, dso_handle_2));

View File

@ -34,7 +34,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif

View File

@ -36,7 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif

View File

@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_getenv.c,v 1.2 2011/07/15 13:54:31 jruoho Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <signal.h>
#endif
@ -155,7 +155,7 @@ ATF_TC_BODY(setenv_basic, tc)
ATF_CHECK_ERRNO(EINVAL, setenv(NULL, "val", 1) == -1);
ATF_CHECK_ERRNO(EINVAL, setenv("", "val", 1) == -1);
ATF_CHECK_ERRNO(EINVAL, setenv("v=r", "val", 1) == -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
Both FreeBSD and OS/X does not validate the second
argument to setenv(3)

View File

@ -75,7 +75,7 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014/07/20 20:17:21 christos Exp $");
#define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno))
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(hsearch_basic);
ATF_TC_HEAD(hsearch_basic, tc)
{
@ -231,7 +231,7 @@ ATF_TC_BODY(hsearch_two, tc)
hdestroy();
}
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(hsearch_r_basic);
ATF_TC_HEAD(hsearch_r_basic, tc)
{
@ -389,14 +389,14 @@ ATF_TC_BODY(hsearch_r_two, tc)
ATF_TP_ADD_TCS(tp)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_basic);
#endif
ATF_TP_ADD_TC(tp, hsearch_duplicate);
ATF_TP_ADD_TC(tp, hsearch_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_two);
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_r_basic);
#endif
ATF_TP_ADD_TC(tp, hsearch_r_duplicate);

View File

@ -51,7 +51,7 @@ unsigned char *start[BLOCKTYPES] = {
};
char result[100];
#if defined(__NetBSD__)
#ifdef __NetBSD__
const char goodResult[] = "7b405d24bc03195474c70ddae9e1f8fb";
#else
const char goodResult[] = "217b4fbe456916bf62a2f85df752e4ab";
@ -93,7 +93,7 @@ ATF_TC_BODY(memcpy_basic, tc)
start[2] = auto1;
start[3] = auto2;
#if defined(__NetBSD__)
#ifdef __NetBSD__
srandom(0L);
#else
/*

View File

@ -37,7 +37,7 @@ __RCSID("$NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $");
#include <locale.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <stdio.h>
#endif

View File

@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/stat.h>
#endif

View File

@ -63,7 +63,7 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <machine/int_limits.h>
#endif
@ -75,7 +75,7 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
#include <time.h>
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include "../../../h_macros.h"
#else
#include <limits.h>

View File

@ -57,7 +57,7 @@ ATF_TC_BODY(getgroups_err, tc)
errno = 0;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("Reported as kern/189941");
#endif
ATF_REQUIRE(getgroups(-1, gidset) == -1);

View File

@ -47,7 +47,7 @@ static void sighandler(int);
static const size_t maxiter = 2000;
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
sighandler(int signo __unused)
#else
sighandler(int signo)

View File

@ -149,11 +149,11 @@ 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) {
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
atf_tc_skip("PR kern/46523");
#endif
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
close(s[0]);
#endif

View File

@ -36,7 +36,7 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/socket.h>
#endif

View File

@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <time.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <limits.h>
#endif

View File

@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
#include <time.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <limits.h>
#endif

View File

@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
#include <unistd.h>
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
handler(int signo __unused)
#else
handler(int signo)

View File

@ -53,7 +53,7 @@ run(int flags)
while ((i = open("/", O_RDONLY)) < 3)
ATF_REQUIRE(i != -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
closefrom(3);
#else
ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
@ -80,7 +80,7 @@ run(int flags)
ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0);
}
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
if (flags & O_NOSIGPIPE) {
ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0);
ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0);
@ -116,7 +116,7 @@ ATF_TC_BODY(pipe2_consume, tc)
{
struct rlimit rl;
int err, filedes[2];
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
int old;
closefrom(4);
@ -132,7 +132,7 @@ 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.
*/
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
old = rl.rlim_cur;
#endif
rl.rlim_cur = 4;
@ -141,7 +141,7 @@ ATF_TC_BODY(pipe2_consume, tc)
err = pipe2(filedes, O_CLOEXEC);
ATF_REQUIRE(err == -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
rl.rlim_cur = old;
err = setrlimit(RLIMIT_NOFILE, &rl);
#endif
@ -169,7 +169,7 @@ ATF_TC_BODY(pipe2_cloexec, tc)
run(O_CLOEXEC);
}
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(pipe2_nosigpipe);
ATF_TC_HEAD(pipe2_nosigpipe, tc)
{
@ -201,7 +201,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, pipe2_consume);
ATF_TP_ADD_TC(tp, pipe2_nonblock);
ATF_TP_ADD_TC(tp, pipe2_cloexec);
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, pipe2_nosigpipe);
#endif
ATF_TP_ADD_TC(tp, pipe2_einval);

View File

@ -233,7 +233,7 @@ ATF_TC_BODY(poll_err, tc)
ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1);
}
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TC(pollts_basic);
ATF_TC_HEAD(pollts_basic, tc)
{
@ -386,7 +386,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, poll_3way);
ATF_TP_ADD_TC(tp, poll_basic);
ATF_TP_ADD_TC(tp, poll_err);
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TP_ADD_TC(tp, pollts_basic);
ATF_TP_ADD_TC(tp, pollts_err);
ATF_TP_ADD_TC(tp, pollts_sigmask);

View File

@ -58,7 +58,7 @@ ATF_TC_BODY(revoke_basic, tc)
size_t i, n;
int *buf;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_skip("revoke(2) is only implemented for devfs(5).");
#endif
(void)memset(&res, 0, sizeof(struct rlimit));
@ -116,7 +116,7 @@ ATF_TC_BODY(revoke_err, tc)
errno = 0;
ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_skip("revoke(2) is only implemented for devfs(5).");
#endif
errno = 0;
@ -139,7 +139,7 @@ ATF_TC_BODY(revoke_perm, tc)
int fd, sta;
pid_t pid;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_skip("revoke(2) is only implemented for devfs(5).");
#endif
pw = getpwnam("nobody");

View File

@ -46,7 +46,7 @@ static void handler(int, siginfo_t *, void *);
static int value;
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
handler(int signo __unused, siginfo_t *info __unused, void *data __unused)
#else
handler(int signo, siginfo_t *info, void *data)
@ -76,7 +76,7 @@ ATF_TC_BODY(sigqueue_basic, tc)
sv.sival_int = VALUE;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
* From kern_sig.c:
* Specification says sigqueue can only send signal to single process.

View File

@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $");
#include <stdio.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <netinet/in.h>
#endif

View File

@ -38,7 +38,7 @@ static timer_t t;
static bool fail = true;
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
timer_signal_handler(int signo, siginfo_t *si, void *osi __unused)
#else
timer_signal_handler(int signo, siginfo_t *si, void *osi)

View File

@ -85,7 +85,7 @@ ATF_TC_BODY(unlink_err, tc)
(void)memset(buf, 'x', sizeof(buf));
errno = 0;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_REQUIRE_ERRNO(EISDIR, unlink("/") == -1);
#else
ATF_REQUIRE_ERRNO(EBUSY, unlink("/") == -1);

View File

@ -32,7 +32,7 @@ __COPYRIGHT("@(#) Copyright (c) 2008\
__RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $");
#include <sys/uio.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/syslimits.h>
#endif
@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $");
#include <string.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <limits.h>
#endif
@ -55,7 +55,7 @@ static bool fail = false;
static const char *path = "write";
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
sighandler(int signo __unused)
#else
sighandler(int signo)

View File

@ -49,7 +49,7 @@ h_pass(const char *buf, const char *fmt, int len,
exp = buf + len;
ret = strptime(buf, fmt, &tm);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_CHECK_MSG(ret == exp,
"strptime(\"%s\", \"%s\", tm): incorrect return code: "
"expected: %p, got: %p", buf, fmt, exp, ret);
@ -88,7 +88,7 @@ h_fail(const char *buf, const char *fmt)
{
struct tm tm = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, NULL };
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_CHECK_MSG(strptime(buf, fmt, &tm) == NULL, "strptime(\"%s\", "
"\"%s\", &tm) should fail, but it didn't", buf, fmt);
#else
@ -108,7 +108,7 @@ ATF_TC_HEAD(common, tc)
ATF_TC_BODY(common, tc)
{
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("There are various issues with strptime on FreeBSD");
#endif
@ -189,13 +189,13 @@ ATF_TC_BODY(day, tc)
h_pass("mon", "%a", 3, -1, -1, -1, -1, -1, -1, 1, -1);
h_pass("tueSDay", "%A", 7, -1, -1, -1, -1, -1, -1, 2, -1);
h_pass("sunday", "%A", 6, -1, -1, -1, -1, -1, -1, 0, -1);
#if defined(__NetBSD__)
#ifdef __NetBSD__
h_fail("sunday", "%EA");
#else
h_pass("Sunday", "%EA", 6, -1, -1, -1, -1, -1, -1, 0, -1);
#endif
h_pass("SaturDay", "%A", 8, -1, -1, -1, -1, -1, -1, 6, -1);
#if defined(__NetBSD__)
#ifdef __NetBSD__
h_fail("SaturDay", "%OA");
#else
h_pass("SaturDay", "%OA", 8, -1, -1, -1, -1, -1, -1, 6, -1);

View File

@ -36,7 +36,7 @@ __RCSID("$NetBSD: h_tls_dlopen.c,v 1.5 2013/10/21 19:14:16 joerg Exp $");
#include <atf-c.h>
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -39,7 +39,7 @@ __RCSID("$NetBSD: t_tls_dlopen.c,v 1.3 2012/01/17 20:34:57 joerg Exp $");
#include <pthread.h>
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -38,7 +38,7 @@ __RCSID("$NetBSD: t_tls_dynamic.c,v 1.3 2012/01/17 20:34:57 joerg Exp $");
#include <pthread.h>
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -37,7 +37,7 @@ __RCSID("$NetBSD: t_tls_static.c,v 1.2 2012/01/17 20:34:57 joerg Exp $");
#include <atf-c.h>
#include <pthread.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_tls_static_helper.c,v 1.2 2012/01/17 20:34:57 joerg Exp $");
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -35,7 +35,7 @@
__RCSID("$NetBSD: h_tls_dynamic.c,v 1.5 2013/10/21 19:11:17 joerg Exp $");
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/tls.h>
#endif

View File

@ -180,7 +180,7 @@ main(int argc, char *argv[])
exiting_state = 5;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ASSERT(0 == atexit(normal_handler_0));
ASSERT(0 == atexit(normal_handler_1));
ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, dso_handle_1));

View File

@ -75,7 +75,7 @@ ATF_TC_BODY(pthread_detach, tc)
rv = pthread_join(t, NULL);
ATF_REQUIRE(rv == EINVAL);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("PR # 191906: fails with EINVAL, not ESRCH");
#endif