瀏覽代碼

fix _NSIG and SIGRTMAX on mips

a mips signal mask contains 128 bits, enough for signals 1 through
128. however, the exit status obtained from the wait-family functions
only has room for values up to 127. reportedly signal 128 was causing
kernelspace bugs, so it was removed from the kernel recently; even
without that issue, however, it was impossible to support it correctly
in userspace.

at the same time, the bug was masked on musl by SIGRTMAX incorrectly
yielding 64 on mips, rather than the "correct" value of 128. now that
the _NSIG issue is fixed, SIGRTMAX can be fixed at the same time,
exposing the full range of signals for application use.

note that the (nonstandardized) libc _NSIG value is actually one
greater than the max signal number, and also one greater than the
kernel headers' idea of _NSIG. this is the reason for the discrepency
with the recent kernel changes. since reducing _NSIG by one brought it
down from 129 to 128, rather than from 128 to 127, _NSIG/8, used
widely in the musl sources, is unchanged.
Rich Felker 11 年之前
父節點
當前提交
7c440977db
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 1 1
      arch/mips/bits/signal.h
  2. 3 1
      src/signal/sigrtmax.c

+ 1 - 1
arch/mips/bits/signal.h

@@ -100,4 +100,4 @@ typedef struct __ucontext {
 #define SIGXFSZ   31
 #define SIGUNUSED SIGSYS
 
-#define _NSIG 129
+#define _NSIG 128

+ 3 - 1
src/signal/sigrtmax.c

@@ -1,4 +1,6 @@
+#include <signal.h>
+
 int __libc_current_sigrtmax()
 {
-	return 64;
+	return _NSIG-1;
 }