summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-12-06 17:05:19 -0500
committerRich Felker <dalias@aerifal.cx>2012-12-06 17:05:19 -0500
commit5c5e45e58bd0da2d74aea3e6631b240fedd707ef (patch)
tree167f7d94a829951a10e422812363f62cb5b4eaa1 /arch
parentd1b6fc6ecc59441a37269d6512c5d34d1a2412cd (diff)
downloadmusl-5c5e45e58bd0da2d74aea3e6631b240fedd707ef.tar.gz
musl-5c5e45e58bd0da2d74aea3e6631b240fedd707ef.tar.bz2
musl-5c5e45e58bd0da2d74aea3e6631b240fedd707ef.tar.xz
musl-5c5e45e58bd0da2d74aea3e6631b240fedd707ef.zip
move signal.h REG_* macros under _GNU_SOURCE protection
they were accidentally exposed under just baseline POSIX, which is a big namespace pollution issue. thankfully glibc only exposes them under _GNU_SOURCE, not under any of its other options, so omitting the pollution in the default _BSD_SOURCE profile does not hurt application compatibility at all.
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/bits/signal.h42
-rw-r--r--arch/x86_64/bits/signal.h50
2 files changed, 48 insertions, 44 deletions
diff --git a/arch/i386/bits/signal.h b/arch/i386/bits/signal.h
index 2943756e..aebf3812 100644
--- a/arch/i386/bits/signal.h
+++ b/arch/i386/bits/signal.h
@@ -1,6 +1,28 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#ifdef _GNU_SOURCE
+#define REG_GS 0
+#define REG_FS 1
+#define REG_ES 2
+#define REG_DS 3
+#define REG_EDI 4
+#define REG_ESI 5
+#define REG_EBP 6
+#define REG_ESP 7
+#define REG_EBX 8
+#define REG_EDX 9
+#define REG_ECX 10
+#define REG_EAX 11
+#define REG_TRAPNO 12
+#define REG_ERR 13
+#define REG_EIP 14
+#define REG_CS 15
+#define REG_EFL 16
+#define REG_UESP 17
+#define REG_SS 18
+#endif
+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef int greg_t, gregset_t[19];
typedef struct _fpstate {
@@ -49,26 +71,6 @@ typedef struct __ucontext {
#define SA_RESETHAND 0x80000000
#define SA_RESTORER 0x04000000
-#define REG_GS 0
-#define REG_FS 1
-#define REG_ES 2
-#define REG_DS 3
-#define REG_EDI 4
-#define REG_ESI 5
-#define REG_EBP 6
-#define REG_ESP 7
-#define REG_EBX 8
-#define REG_EDX 9
-#define REG_ECX 10
-#define REG_EAX 11
-#define REG_TRAPNO 12
-#define REG_ERR 13
-#define REG_EIP 14
-#define REG_CS 15
-#define REG_EFL 16
-#define REG_UESP 17
-#define REG_SS 18
-
#endif
#define SIGHUP 1
diff --git a/arch/x86_64/bits/signal.h b/arch/x86_64/bits/signal.h
index 069c6c33..b4220fe2 100644
--- a/arch/x86_64/bits/signal.h
+++ b/arch/x86_64/bits/signal.h
@@ -1,6 +1,32 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#ifdef _GNU_SOURCE
+#define REG_R8 0
+#define REG_R9 1
+#define REG_R10 2
+#define REG_R11 3
+#define REG_R12 4
+#define REG_R13 5
+#define REG_R14 6
+#define REG_R15 7
+#define REG_RDI 8
+#define REG_RSI 9
+#define REG_RBP 10
+#define REG_RBX 11
+#define REG_RDX 12
+#define REG_RAX 13
+#define REG_RCX 14
+#define REG_RSP 15
+#define REG_RIP 16
+#define REG_EFL 17
+#define REG_CSGFS 18
+#define REG_ERR 19
+#define REG_TRAPNO 20
+#define REG_OLDMASK 21
+#define REG_CR2 22
+#endif
+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef long long greg_t, gregset_t[23];
typedef struct _fpstate {
@@ -52,30 +78,6 @@ typedef struct __ucontext {
#define SA_RESETHAND 0x80000000
#define SA_RESTORER 0x04000000
-#define REG_R8 0
-#define REG_R9 1
-#define REG_R10 2
-#define REG_R11 3
-#define REG_R12 4
-#define REG_R13 5
-#define REG_R14 6
-#define REG_R15 7
-#define REG_RDI 8
-#define REG_RSI 9
-#define REG_RBP 10
-#define REG_RBX 11
-#define REG_RDX 12
-#define REG_RAX 13
-#define REG_RCX 14
-#define REG_RSP 15
-#define REG_RIP 16
-#define REG_EFL 17
-#define REG_CSGFS 18
-#define REG_ERR 19
-#define REG_TRAPNO 20
-#define REG_OLDMASK 21
-#define REG_CR2 22
-
#endif
#define SIGHUP 1