NetBSD-Bugs archive

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

Re: bin/51847: [PATCH] tests/lib/libc/sys/t_sigqueue: various fixes



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

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51847: [PATCH] tests/lib/libc/sys/t_sigqueue: various fixes
Date: Thu, 12 Jan 2017 22:38:54 -0800

 --Apple-Mail=_D8248F9F-CF32-4166-AB38-F3433B5B538D
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_D8248F9F-CF32-4166-AB38-F3433B5B538D
 Content-Disposition: attachment;
 	filename=t_sigqueue-various-fixes.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_sigqueue-various-fixes.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libc/sys/t_sigqueue.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/sys/t_sigqueue.c,v
 retrieving revision 1.6
 diff -u -r1.6 t_sigqueue.c
 --- lib/libc/sys/t_sigqueue.c	4 Aug 2016 06:43:43 -0000	1.6
 +++ lib/libc/sys/t_sigqueue.c	13 Jan 2017 05:36:16 -0000
 @@ -32,10 +32,11 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 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>
 @@ -46,7 +47,7 @@
  static int value;
  
  static void
 -handler(int signo, siginfo_t *info, void *data)
 +handler(int signo __unused, siginfo_t *info, void *data __unused)
  {
  	value = info->si_value.sival_int;
  	kill(0, SIGINFO);
 @@ -107,9 +108,10 @@
  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;
 +	printf("Signal #%zu: signo: %d\n", (size_t)count, signo);
  }
  
  static int
 @@ -176,7 +178,8 @@
  	sigset_t mask, orig;
  	sigemptyset(&mask);
  	for (size_t i = 0; i < CNT; i++)
 -		sigaddset(&mask, signals[i]);
 +		if (sigaddset(&mask, signals[i]) == -1)
 +			warn("sigaddset");
  
  	ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1);
  	
 @@ -185,13 +188,17 @@
  	
  	ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1);
  	sleep(1);
 -	ATF_REQUIRE_MSG((size_t)count == ndelivered,
 +	ATF_CHECK_MSG((size_t)count == ndelivered,
  	    "count %zu != ndelivered %zu", (size_t)count, ndelivered);
  	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]);
  
 +	if ((size_t)count > ndelivered)
 +		for (size_t i = ndelivered; i < (size_t)count; i++)
 +			printf("Undelivered signal #%zu: %d\n", i, ordered[i]);
 +
  	for (size_t i = 0; i < ndelivered; i++)
  		ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1);
  }
 
 --Apple-Mail=_D8248F9F-CF32-4166-AB38-F3433B5B538D--
 


Home | Main Index | Thread Index | Old Index