NetBSD-Bugs archive

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

Re: bin/51890: [PATCH] tests/lib/libpthread/t_sem: getcontext/swapcontext fixes



The following reply was made to PR bin/51890; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51890: [PATCH] tests/lib/libpthread/t_sem:
 getcontext/swapcontext fixes
Date: Sun, 15 Jan 2017 12:58:59 -0800

 --Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18
 Content-Disposition: attachment;
 	filename=t_swapcontext-various-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_swapcontext-various-fixes.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libpthread/t_swapcontext.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libpthread/t_swapcontext.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_swapcontext.c
 --- lib/libpthread/t_swapcontext.c	25 Aug 2014 16:31:15 -0000	1.2
 +++ lib/libpthread/t_swapcontext.c	15 Jan 2017 20:57:58 -0000
 @@ -28,10 +28,13 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD");
  
 +#include <sys/types.h>
 +#include <errno.h>
  #include <pthread.h>
 -#include <ucontext.h>
  #include <stdio.h>
  #include <stdlib.h>
 +#include <string.h>
 +#include <ucontext.h>
  
  #include <atf-c.h>
  
 @@ -77,7 +80,8 @@
         
  	oself = (void *)pthread_self();
  	printf("before swapcontext self = %p\n", oself);
 -	PTHREAD_REQUIRE(swapcontext(&octx, &nctx));
 +	ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s",
 +	    strerror(errno));
  
  	/* NOTREACHED */
  	return NULL;
 @@ -99,7 +103,8 @@
  
  	printf("Testing if swapcontext() alters pthread_self()\n");
  
 -	PTHREAD_REQUIRE(getcontext(&nctx));
 +	ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s",
 +	    strerror(errno));
  	PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
  	PTHREAD_REQUIRE(pthread_join(thread, NULL));
  }
 
 --Apple-Mail=_E6EF5A83-B491-44B4-B78F-F8A952790D18--
 


Home | Main Index | Thread Index | Old Index