Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libpthread PR/51888: Ngie Cooper: more error check...



details:   https://anonhg.NetBSD.org/src/rev/2997fda77ac9
branches:  trunk
changeset: 350692:2997fda77ac9
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 16:23:41 2017 +0000

description:
PR/51888: Ngie Cooper: more error checking, missing includes

diffstat:

 tests/lib/libpthread/t_mutex.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 66bba1c32bc4 -r 2997fda77ac9 tests/lib/libpthread/t_mutex.c
--- a/tests/lib/libpthread/t_mutex.c    Mon Jan 16 16:22:22 2017 +0000
+++ b/tests/lib/libpthread/t_mutex.c    Mon Jan 16 16:23:41 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $ */
+/* $NetBSD: t_mutex.c,v 1.15 2017/01/16 16:23:41 christos Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.15 2017/01/16 16:23:41 christos Exp $");
 
+#include <sys/time.h> /* For timespecadd */
+#include <inttypes.h> /* For UINT16_MAX */
 #include <pthread.h>
 #include <stdio.h>
 #include <string.h>
@@ -570,9 +572,16 @@
        int min_prio = sched_get_priority_min(SCHED_FIFO);
        for (int i = min_prio; i <= max_prio; i++) {
                int prioceiling;
+               int protocol;
+
+               PTHREAD_REQUIRE(pthread_mutexattr_getprotocol(&mattr,
+                   &protocol));
+
+               printf("priority: %d\nprotocol: %d\n", i, protocol);
                PTHREAD_REQUIRE(pthread_mutexattr_setprioceiling(&mattr, i));
                PTHREAD_REQUIRE(pthread_mutexattr_getprioceiling(&mattr,
                    &prioceiling));
+               printf("prioceiling: %d\n", prioceiling);
                ATF_REQUIRE_EQ(i, prioceiling);
        }
 }



Home | Main Index | Thread Index | Old Index