Module Name:    src
Committed By:   drochner
Date:           Sun May 30 19:31:39 UTC 2010

Modified Files:
        src/lib/libc/sys: sigtimedwait.2 sigwait.c
        src/sys/compat/common: kern_time_50.c
        src/sys/compat/netbsd32: netbsd32_compat_50.c

Log Message:
-fix internal use of sigwaitinfo(2) by sigwait(3): The former returns
 the signal number now, as required by POSIX. The latter should just
 return 0 on success. Fixes a mysql problem reported by Kurt Schreiner.
-document the new behavior of sigwaitinfo and sigtimedwait
-retain non-POSIX behavior for NetBSD-5 binary compatibility -- the fix
 would likely not be polled into the .0-branches, and having 5.0.x and
 5.x behave differently would be confusing. Besides that, it was
 documented in the manpage all the time.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/sys/sigtimedwait.2
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/sys/sigwait.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/netbsd32/netbsd32_compat_50.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/sigtimedwait.2
diff -u src/lib/libc/sys/sigtimedwait.2:1.5 src/lib/libc/sys/sigtimedwait.2:1.6
--- src/lib/libc/sys/sigtimedwait.2:1.5	Wed Feb 25 20:50:16 2009
+++ src/lib/libc/sys/sigtimedwait.2	Sun May 30 19:31:39 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: sigtimedwait.2,v 1.5 2009/02/25 20:50:16 ad Exp $
+.\" $NetBSD: sigtimedwait.2,v 1.6 2010/05/30 19:31:39 drochner Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 10, 2003
+.Dd May 30, 2010
 .Dt SIGTIMEDWAIT 2
 .Os
 .Sh NAME
@@ -88,9 +88,16 @@
 .Fa set
 are unblocked at the time these functions are called.
 .Sh RETURN VALUES
-Upon successful completion
+Upon successful completion of
+.Fn sigtimedwait
+or
+.Fn sigwaitinfo
 .Fa info
-is updated with signal information, and the function returns 0.
+is updated with signal information, and the function returns the signal number.
+Upon successful completion of
+.Fn sigwait
+.Fa sig
+is updated with ihe signal number, and the function returns 0.
 Otherwise, \-1 is returned and the global variable
 .Va errno
 indicates the error.

Index: src/lib/libc/sys/sigwait.c
diff -u src/lib/libc/sys/sigwait.c:1.2 src/lib/libc/sys/sigwait.c:1.3
--- src/lib/libc/sys/sigwait.c:1.2	Mon Apr 28 20:23:00 2008
+++ src/lib/libc/sys/sigwait.c	Sun May 30 19:31:39 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sigwait.c,v 1.2 2008/04/28 20:23:00 martin Exp $ */
+/* $NetBSD: sigwait.c,v 1.3 2010/05/30 19:31:39 drochner Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sigwait.c,v 1.2 2008/04/28 20:23:00 martin Exp $");
+__RCSID("$NetBSD: sigwait.c,v 1.3 2010/05/30 19:31:39 drochner Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -53,12 +53,11 @@
 int
 _sigwait(const sigset_t * __restrict set, int * __restrict signum)
 {
-	siginfo_t si;
-	int error;
+	int sig;
 	
-	error = sigtimedwait(set, &si, NULL);
-	if (!error)
-		*signum = si.si_signo;
-
-	return (error);
+	sig = __sigtimedwait(set, NULL, NULL);
+	if (sig < 0)
+		return (-1);
+	*signum = sig;
+	return (0);
 }

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.15 src/sys/compat/common/kern_time_50.c:1.16
--- src/sys/compat/common/kern_time_50.c:1.15	Thu Apr  8 11:51:13 2010
+++ src/sys/compat/common/kern_time_50.c	Sun May 30 19:31:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.15 2010/04/08 11:51:13 njoly Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.16 2010/05/30 19:31:39 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.15 2010/04/08 11:51:13 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.16 2010/05/30 19:31:39 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -612,10 +612,14 @@
 compat_50_sys___sigtimedwait(struct lwp *l,
     const struct compat_50_sys___sigtimedwait_args *uap, register_t *retval)
 {
+	int res;
 
-	return sigtimedwait1(l,
+	res = sigtimedwait1(l,
 	    (const struct sys_____sigtimedwait50_args *)uap, retval, copyout,
 	    tscopyin, tscopyout);
+	if (!res)
+		*retval = 0; /* XXX NetBSD<=5 was not POSIX compliant */
+	return res;
 }
 
 void

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.16 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.17
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.16	Fri Apr 23 15:19:20 2010
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Sun May 30 19:31:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.16 2010/04/23 15:19:20 rmind Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.16 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -494,16 +494,19 @@
 		syscallarg(netbsd32_timespec50p_t) timeout;
 	} */
 	struct sys_____sigtimedwait50_args ua;
+	int res;
 
 	NETBSD32TOP_UAP(set, const sigset_t);
 	NETBSD32TOP_UAP(info, siginfo_t);
 	NETBSD32TOP_UAP(timeout, struct timespec);
 
-	return sigtimedwait1(l, &ua, retval,
+	res = sigtimedwait1(l, &ua, retval,
 	    compat_50_netbsd32_sigtimedwait_put_info,
 	    compat_50_netbsd32_sigtimedwait_fetch_timeout,
 	    compat_50_netbsd32_sigtimedwait_put_timeout);
-	return 0;
+	if (!res)
+		*retval = 0; /* XXX NetBSD<=5 was not POSIX compliant */
+	return res;
 }
 
 int

Reply via email to