PR/51887: Ngie Cooper: Include and error message fixes

This commit is contained in:
christos 2017-01-16 16:27:43 +00:00
parent 138b5d077b
commit 75e7228cd4
1 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $ */
/* $NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
__RCSID("$NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $");
/*
* This is adapted from part of csw/cstest of the MPD implementation by
@ -49,10 +49,12 @@ __RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
* <is@netbsd.org>.
*/
#include <errno.h>
#include <math.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -77,14 +79,16 @@ stir(void *p)
for (;;) {
x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6)));
PTHREAD_REQUIRE(sched_yield());
ATF_REQUIRE_MSG(sched_yield() == 0,
"sched_yield failed: %s", strerror(errno));
}
}
static double
mul3(double x, double y, double z)
{
PTHREAD_REQUIRE(sched_yield());
ATF_REQUIRE_MSG(sched_yield() == 0,
"sched_yield failed: %s", strerror(errno));
return x * y * z;
}
@ -114,7 +118,7 @@ bar(void *p)
static void
recurse(void) {
pthread_t s2;
pthread_create(&s2, 0, bar, 0);
PTHREAD_REQUIRE(pthread_create(&s2, 0, bar, 0));
sleep(20); /* XXX must be long enough for our slowest machine */
}
@ -134,7 +138,7 @@ ATF_TC_BODY(fpu, tc)
PTHREAD_REQUIRE(pthread_mutex_init(&recursion_depth_lock, 0));
pthread_create(&s5, 0, stir, stirseed);
PTHREAD_REQUIRE(pthread_create(&s5, 0, stir, stirseed));
recurse();
atf_tc_fail("exiting from main");