Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src -fix internal use of sigwaitinfo(2) by sigwait(3): The forme...
details: https://anonhg.NetBSD.org/src/rev/f82bda6f275f
branches: trunk
changeset: 755277:f82bda6f275f
user: drochner <drochner%NetBSD.org@localhost>
date: Sun May 30 19:31:39 2010 +0000
description:
-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.
diffstat:
lib/libc/sys/sigtimedwait.2 | 15 +++++++++++----
lib/libc/sys/sigwait.c | 17 ++++++++---------
sys/compat/common/kern_time_50.c | 10 +++++++---
sys/compat/netbsd32/netbsd32_compat_50.c | 11 +++++++----
4 files changed, 33 insertions(+), 20 deletions(-)
diffs (148 lines):
diff -r 1ea5dfd81fdb -r f82bda6f275f lib/libc/sys/sigtimedwait.2
--- a/lib/libc/sys/sigtimedwait.2 Sun May 30 17:44:07 2010 +0000
+++ b/lib/libc/sys/sigtimedwait.2 Sun May 30 19:31:39 2010 +0000
@@ -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.
diff -r 1ea5dfd81fdb -r f82bda6f275f lib/libc/sys/sigwait.c
--- a/lib/libc/sys/sigwait.c Sun May 30 17:44:07 2010 +0000
+++ b/lib/libc/sys/sigwait.c Sun May 30 19:31:39 2010 +0000
@@ -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);
}
diff -r 1ea5dfd81fdb -r f82bda6f275f sys/compat/common/kern_time_50.c
--- a/sys/compat/common/kern_time_50.c Sun May 30 17:44:07 2010 +0000
+++ b/sys/compat/common/kern_time_50.c Sun May 30 19:31:39 2010 +0000
@@ -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
diff -r 1ea5dfd81fdb -r f82bda6f275f sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Sun May 30 17:44:07 2010 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Sun May 30 19:31:39 2010 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index