summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-10-01 10:18:55 +0000
committerkib <kib@FreeBSD.org>2011-10-01 10:18:55 +0000
commit71b9169fe9444b8207262f62c1b9396dfdbf3693 (patch)
tree6839617c00146f79f5483b8a199a39a6ef17019f
parent91bf568cd6ac3039b0005e4b0472bc318fa46fde (diff)
downloadFreeBSD-src-71b9169fe9444b8207262f62c1b9396dfdbf3693.zip
FreeBSD-src-71b9169fe9444b8207262f62c1b9396dfdbf3693.tar.gz
The sigwait(3) function shall not return EINTR, according to the
POSIX/SUSvN. The sigwait(2) syscall does return EINTR, and libc.so.7 contains the wrapper sigwait(3) which hides EINTR from callers. The EINTR return is used by libthr to handle required cancellation point in the sigwait(3). To help the binaries linked against pre-libc.so.7, i.e. RELENG_6 and earlier, to have right ABI for sigwait(3), transform EINTR return from sigwait(2) into ERESTART. Discussed with: davidxu MFC after: 1 week
-rw-r--r--sys/kern/kern_sig.c2
-rw-r--r--sys/sys/param.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 8622b41..188bf83 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1094,6 +1094,8 @@ sys_sigwait(struct thread *td, struct sigwait_args *uap)
error = kern_sigtimedwait(td, set, &ksi, NULL);
if (error) {
+ if (error == EINTR && td->td_proc->p_osrel < P_OSREL_SIGWAIT)
+ error = ERESTART;
if (error == ERESTART)
return (error);
td->td_retval[0] = error;
diff --git a/sys/sys/param.h b/sys/sys/param.h
index c10b433..57ff3a3 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -61,6 +61,7 @@
#define __FreeBSD_version 1000000 /* Master, propagated to newvers */
#ifdef _KERNEL
+#define P_OSREL_SIGWAIT 700000
#define P_OSREL_SIGSEGV 700004
#define P_OSREL_MAP_ANON 800104
#endif
OpenPOWER on IntegriCloud