Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 May 2016 13:51:27 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300997 - in head: include lib/libc/gen
Message-ID:  <201605301351.u4UDpRVp002899@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Mon May 30 13:51:27 2016
New Revision: 300997
URL: https://svnweb.freebsd.org/changeset/base/300997

Log:
  Fix the signature of the psignal() function.
  
  POSIX 2008 added the psignal() function which has already been part of
  the BSDs for a long time. The only difference is, the POSIX version uses
  an 'int' for the signal number, unlike our version which uses an
  'unsigned int'. Fix up the function to use an 'int'. This should not
  affect the ABI.

Modified:
  head/include/signal.h
  head/lib/libc/gen/psignal.3
  head/lib/libc/gen/psignal.c

Modified: head/include/signal.h
==============================================================================
--- head/include/signal.h	Mon May 30 13:37:11 2016	(r300996)
+++ head/include/signal.h	Mon May 30 13:51:27 2016	(r300997)
@@ -113,7 +113,7 @@ int	siginterrupt(int, int);
 #endif
 
 #if __POSIX_VISIBLE >= 200809
-void	psignal(unsigned int, const char *);
+void	psignal(int, const char *);
 #endif
 
 #if __BSD_VISIBLE

Modified: head/lib/libc/gen/psignal.3
==============================================================================
--- head/lib/libc/gen/psignal.3	Mon May 30 13:37:11 2016	(r300996)
+++ head/lib/libc/gen/psignal.3	Mon May 30 13:51:27 2016	(r300997)
@@ -28,7 +28,7 @@
 .\"     @(#)psignal.3	8.2 (Berkeley) 2/27/95
 .\" $FreeBSD$
 .\"
-.Dd February 4, 2011
+.Dd May 30, 2016
 .Dt PSIGNAL 3
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@
 .Sh SYNOPSIS
 .In signal.h
 .Ft void
-.Fn psignal "unsigned sig" "const char *s"
+.Fn psignal "int sig" "const char *s"
 .Vt extern const char * const sys_siglist[] ;
 .Vt extern const char * const sys_signame[] ;
 .In string.h

Modified: head/lib/libc/gen/psignal.c
==============================================================================
--- head/lib/libc/gen/psignal.c	Mon May 30 13:37:11 2016	(r300996)
+++ head/lib/libc/gen/psignal.c	Mon May 30 13:51:27 2016	(r300997)
@@ -44,11 +44,11 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 void
-psignal(unsigned int sig, const char *s)
+psignal(int sig, const char *s)
 {
 	const char *c;
 
-	if (sig < NSIG)
+	if (sig >= 0 && sig < NSIG)
 		c = sys_siglist[sig];
 	else
 		c = "Unknown signal";



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605301351.u4UDpRVp002899>