This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[glibc/zack/no-nested-includes] Rename sys/ucontext.h to bits/ucontext.h.


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4e187c73778d8201138ae5b0ca687d3a765b65f8

commit 4e187c73778d8201138ae5b0ca687d3a765b65f8
Author: Zack Weinberg <zackw@panix.com>
Date:   Tue Jun 11 13:05:02 2019 -0400

    Rename sys/ucontext.h to bits/ucontext.h.
    
    sys/ucontext.h is effectively a bits header.  Its contents are
    extremely system-specific, and itâ??s strongly associated with a
    specific public header (ucontext.h) that provides a superset of its
    definitions, but there are other public headers that also require some
    of its definitions.  This patch therefore moves it into the bits/
    namespace and adjusts all the headers that refer to it.  In case there
    are external users, a stub is added that includes ucontext.h.
    
    Most of the fallout changes are trivial, but aarch64, ia64 and riscv
    need a little more work.  aarch64 sys/ucontext.h (now bits/ucontext.h)
    was including sys/procfs.h for the definition of elf_greg_t etc;
    the simplest fix is to have it include bits/procfs.h instead (and then
    that needs to include sys/user.h for user_regs_struct).  This is not
    ideal but fixing it properly would require disentangling all of the
    debugger interface headers which is more than Iâ??m up for at the moment.
    
    ia64 bits/ptrace.h and bits/procfs.h were both including
    bits/sigcontext.h, which is only licensed to be included from
    signal.h.  (Iâ??m not sure how this ever worked, or why it broke with
    this patch and not some previous one.)  This is fixed by creating
    another single-type header, bits/types/__ia64_fpreg.h, which provides
    the only thing they need from bits/sigcontext.h.
    
    s/u/s/l/riscv/makecontext.c was defining makecontext with a function
    head that didnâ??t agree with its official prototype (in ucontext.h);
    formerly that file did not include ucontext.h, only sys/ucontext.h,
    so we were getting away with it, but itâ??s still wrong.  Making the
    function head match the prototype actually simplifies the code.
    
    	* sysdeps/generic/sys/ucontext.h: Move to top level bits/ucontext.h.
    	Adjust multiple inclusion guard.
    	* sysdeps/arm/sys/ucontext.h: Move to sysdeps/arm/bits/ucontext.h.
    	Adjust multiple inclusion guard.
    	* sysdeps/i386/sys/ucontext.h: Similarly.
    	* sysdeps/m68k/sys/ucontext.h: Similarly.
    	* sysdeps/mips/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Similarly.
    	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Similarly.
    	* stdlib/Makefile: Install bits/ucontext.h.
    
    	* stdlib/sys/ucontext.h: New backward compatibility stub header,
    	includes ucontext.h.
    	* include/sys/ucontext.h: New wrapper.
    
    	* sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Allow inclusion
    	by bits/ucontext.h as well as sys/procfs.h.  Include sys/user.h.
    	* sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h: Include
    	bits/procfs.h instead of sys/procfs.h.
    
    	* sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h:
    	New file, contents factored out of ia64/bits/sigcontext.h and
    	ia64/bits/ucontext.h.
    	* sysdeps/unix/sysv/linux/ia64/Makefile:
    	Install bits/types/__ia64_fpreg.h.  Merge subdir=misc blocks.
    	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
    	* sysdeps/unix/sysv/linux/ia64/bits/ucontext.h:
    	Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
    
    	* sysdeps/unix/sysv/linux/ia64/bits/procfs.h:
    	Include bits/types/__ia64_fpreg.h for struct ia64_fpreg.
    	Donâ??t include bits/sigcontext.h or bits/ucontext.h.
    	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h:
    	Donâ??t include bits/sigcontext.h.
    
    	* sysdeps/unix/sysv/linux/riscv/makecontext.c: Include
    	ucontext.h, not sys/ucontext.h. Correct function head to match
    	prototype in ucontext.h.  Use va_arg to retrieve all arguments
    	past argc.
    
    	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
    	Sort list of includes.
    
    	* signal/signal.h, stdlib/ucontext.h
    	* sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
    	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
    	* sysdeps/unix/sysv/linux/riscv/bits/procfs.h
    	* sysdeps/unix/sysv/linux/s390/bits/procfs.h:
    	Include bits/ucontext.h, not sys/ucontext.h.
    
    	* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
    	* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
    	* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
    	* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h:
    	Include signal.h, not sys/ucontext.h.
    
    	* sysdeps/unix/sysv/linux/arm/register-dump.h
    	* sysdeps/unix/sysv/linux/csky/register-dump.h:
    	Include ucontext.h, not sys/ucontext.h.
    
    	* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
    	* sysdeps/unix/sysv/linux/arm/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/i386/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
    	* sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/mips/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/s390/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
    	* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym:
    	Include stddef.h and signal.h; donâ??t include any other headers.
    
    	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES)
    	(SYSDEP_ALLOWED_INCLUDES): Update.

Diff:
---
 {sysdeps/generic/sys => bits}/ucontext.h           |  6 +++---
 include/sys/ucontext.h                             |  1 +
 scripts/check-obsolete-constructs.py               | 25 ++++++++++------------
 signal/signal.h                                    |  2 +-
 stdlib/Makefile                                    |  2 +-
 stdlib/sys/ucontext.h                              |  1 +
 stdlib/ucontext.h                                  |  2 +-
 sysdeps/arm/{sys => bits}/ucontext.h               |  6 +++---
 sysdeps/i386/{sys => bits}/ucontext.h              |  6 +++---
 sysdeps/m68k/{sys => bits}/ucontext.h              |  6 +++---
 sysdeps/mips/{sys => bits}/ucontext.h              |  6 +++---
 sysdeps/unix/sysv/linux/aarch64/bits/procfs.h      |  3 ++-
 .../sysv/linux/aarch64/{sys => bits}/ucontext.h    |  8 +++----
 sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h   |  2 +-
 sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym     |  5 +----
 .../unix/sysv/linux/alpha/bits/procfs-prregset.h   |  4 ++--
 .../unix/sysv/linux/alpha/{sys => bits}/ucontext.h |  6 +++---
 sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym |  2 +-
 .../unix/sysv/linux/arm/{sys => bits}/ucontext.h   |  6 +++---
 sysdeps/unix/sysv/linux/arm/register-dump.h        |  2 +-
 sysdeps/unix/sysv/linux/arm/sigcontextinfo.h       |  2 +-
 sysdeps/unix/sysv/linux/arm/ucontext_i.sym         |  4 +---
 sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym  |  4 +---
 .../unix/sysv/linux/csky/{sys => bits}/ucontext.h  |  6 +++---
 sysdeps/unix/sysv/linux/csky/register-dump.h       |  2 +-
 .../unix/sysv/linux/hppa/{sys => bits}/ucontext.h  |  6 +++---
 sysdeps/unix/sysv/linux/hppa/ucontext_i.sym        |  1 -
 sysdeps/unix/sysv/linux/i386/ucontext_i.sym        |  1 -
 sysdeps/unix/sysv/linux/ia64/Makefile              |  6 +++---
 sysdeps/unix/sysv/linux/ia64/bits/procfs.h         |  5 +----
 sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h     |  9 +-------
 .../unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h | 22 +++++++++++++++++++
 .../unix/sysv/linux/ia64/{sys => bits}/ucontext.h  | 18 +++++-----------
 .../unix/sysv/linux/ia64/sigcontext-offsets.sym    |  2 +-
 sysdeps/unix/sysv/linux/ia64/sys/ptrace.h          |  3 +--
 .../unix/sysv/linux/m68k/{sys => bits}/ucontext.h  |  6 +++---
 sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym |  1 -
 .../sysv/linux/microblaze/{sys => bits}/ucontext.h |  6 +++---
 .../unix/sysv/linux/mips/{sys => bits}/ucontext.h  |  6 +++---
 sysdeps/unix/sysv/linux/mips/ucontext_i.sym        |  2 --
 .../unix/sysv/linux/nios2/{sys => bits}/ucontext.h |  6 +++---
 sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h     |  3 +--
 sysdeps/unix/sysv/linux/nios2/ucontext_i.sym       |  2 --
 .../sysv/linux/powerpc/{sys => bits}/ucontext.h    |  6 +++---
 .../sysv/linux/powerpc/powerpc32/ucontext_i.sym    |  1 -
 .../sysv/linux/powerpc/powerpc64/ucontext_i.sym    |  1 -
 sysdeps/unix/sysv/linux/riscv/bits/procfs.h        |  6 +++---
 .../unix/sysv/linux/riscv/{sys => bits}/ucontext.h |  6 +++---
 sysdeps/unix/sysv/linux/riscv/makecontext.c        | 18 +++++-----------
 sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h     |  2 +-
 sysdeps/unix/sysv/linux/riscv/ucontext_i.sym       |  4 +---
 sysdeps/unix/sysv/linux/s390/bits/procfs.h         |  6 +++---
 .../unix/sysv/linux/s390/{sys => bits}/ucontext.h  |  6 +++---
 .../unix/sysv/linux/s390/tst-ptrace-singleblock.c  | 10 ++++-----
 sysdeps/unix/sysv/linux/s390/ucontext_i.sym        |  1 -
 .../unix/sysv/linux/sh/{sys => bits}/ucontext.h    |  6 +++---
 sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym      |  1 -
 sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym      |  1 -
 .../unix/sysv/linux/sparc/{sys => bits}/ucontext.h |  6 +++---
 .../unix/sysv/linux/sparc/sparc32/ucontext_i.sym   |  1 -
 .../unix/sysv/linux/x86/{sys => bits}/ucontext.h   |  6 +++---
 sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym      |  1 -
 62 files changed, 142 insertions(+), 171 deletions(-)

diff --git a/sysdeps/generic/sys/ucontext.h b/bits/ucontext.h
similarity index 95%
rename from sysdeps/generic/sys/ucontext.h
rename to bits/ucontext.h
index b09bdf6..5d8ec34 100644
--- a/sysdeps/generic/sys/ucontext.h
+++ b/bits/ucontext.h
@@ -21,8 +21,8 @@
    use of struct sigcontext does not conform to POSIX namespace
    requirements.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -51,4 +51,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/include/sys/ucontext.h b/include/sys/ucontext.h
new file mode 100644
index 0000000..1450bae
--- /dev/null
+++ b/include/sys/ucontext.h
@@ -0,0 +1 @@
+#include <stdlib/sys/ucontext.h>
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 9536015..997b73b 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -504,24 +504,25 @@ HEADER_ALLOWED_INCLUDES = {
     #           tgmath.h   -> complex.h, math.h
     #           threads.h  -> time.h
     "inttypes.h":                  [ "stdint.h" ],
-    "signal.h":                    [ "sys/ucontext.h" ],
-    "stdlib.h":                    [ "alloca.h", "sys/types.h" ],
     "tgmath.h":                    [ "complex.h", "math.h" ],
     "threads.h":                   [ "time.h" ],
+    # necessary for backward compatibility with old GNU extensions
+    "stdlib.h":                    [ "alloca.h", "sys/types.h" ],
 
     # POSIX top-level headers
     # mandated: pthread.h -> sched.h, time.h
+    "pthread.h":                   [ "sched.h", "time.h" ],
     # allowed:  ftw.h -> sys/stat.h
     #           mqueue.h -> fcntl.h
     #           sched.h -> time.h
     #           spawn.h -> sched.h
     "ftw.h":                       [ "sys/stat.h" ],
-    "langinfo.h":                  [ "nl_types.h" ],
     "mqueue.h":                    [ "fcntl.h" ],
-    "pthread.h":                   [ "sched.h", "time.h" ],
-    "regex.h":                     [ "limits.h", "sys/types.h" ],
     "sched.h":                     [ "time.h" ],
     "spawn.h":                     [ "sched.h" ],
+    # not yet analyzed
+    "langinfo.h":                  [ "nl_types.h" ],
+    "regex.h":                     [ "limits.h", "sys/types.h" ],
     "termios.h":                   [ "sys/ttydefaults.h" ],
     "utmpx.h":                     [ "paths.h" ],
 
@@ -562,7 +563,6 @@ HEADER_ALLOWED_INCLUDES = {
     "shadow.h":                    [ "paths.h" ],
     "stdio_ext.h":                 [ "stdio.h" ],
     "thread_db.h":                 [ "pthread.h", "stdint.h", "sys/procfs.h" ],
-    "ucontext.h":                  [ "sys/ucontext.h" ],
     "utmp.h":                      [ "paths.h" ],
     "values.h":                    [ "float.h", "limits.h" ],
 
@@ -574,12 +574,10 @@ HEADER_ALLOWED_INCLUDES = {
     "sys/mount.h":                 [ "sys/ioctl.h" ],
     "sys/mtio.h":                  [ "sys/ioctl.h" ],
     "sys/param.h":                 [ "endian.h", "limits.h", "sys/types.h" ],
-    "sys/procfs.h":                [ "sys/ucontext.h", "sys/user.h" ],
-    "sys/ptrace.h":                [ "sys/ucontext.h" ],
+    "sys/procfs.h":                [ "sys/user.h" ],
     "sys/raw.h":                   [ "sys/ioctl.h" ],
     "sys/timerfd.h":               [ "time.h" ],
     "sys/ttychars.h":              [ "sys/ttydefaults.h" ],
-    "sys/ucontext.h":              [ "sys/procfs.h" ],
     "sys/vfs.h":                   [ "sys/statfs.h" ],
 
     # Nonstandardized headers that do nothing but include some other
@@ -597,6 +595,7 @@ HEADER_ALLOWED_INCLUDES = {
     "sys/socketvar.h":             [ "sys/socket.h" ],
     "sys/syslog.h":                [ "syslog.h" ],
     "sys/termios.h":               [ "termios.h" ],
+    "sys/ucontext.h":              [ "ucontext.h" ],
     "sys/unistd.h":                [ "unistd.h" ],
     "syscall.h":                   [ "sys/syscall.h" ],
     "termio.h":                    [ "sys/ioctl.h", "termios.h" ],
@@ -623,8 +622,6 @@ HEADER_ALLOWED_INCLUDES = {
     "features.h":                  [ "gnu/stubs.h", "stdc-predef.h",
                                      "sys/cdefs.h" ],
 
-    "bits/procfs.h":               [ "signal.h", "sys/ucontext.h" ],
-
     "bits/types/__va_list.h":      [ "stdarg.h" ],
     "bits/types/ptrdiff_t.h":      [ "stddef.h" ],
     "bits/types/size_t.h":         [ "stddef.h" ],
@@ -670,8 +667,8 @@ SYSDEP_ALLOWED_INCLUDES = {
         "bits/ioctls.h":           [ "asm/ioctls.h", "linux/sockios.h" ],
         "bits/local_lim.h":        [ "linux/limits.h" ],
         "bits/param.h":            [ "linux/limits.h", "linux/param.h" ],
-        "bits/procfs.h":           [ "asm/elf.h", "asm/ptrace.h" ],
-        "bits/procfs-prregset.h":  [ "sys/ucontext.h" ],
+        "bits/procfs.h":           [ "asm/elf.h", "asm/ptrace.h",
+                                     "sys/user.h" ],
         "bits/sigcontext.h":       [ "asm/sigcontext.h" ],
         "bits/socket.h":           [ "asm/socket.h" ],
     },
@@ -689,7 +686,6 @@ SYSDEP_ALLOWED_INCLUDES = {
         "sys/fpregdef.h":          [ "sgidefs.h" ],
         "sys/regdef.h":            [ "sgidefs.h" ],
         "sys/tas.h":               [ "sgidefs.h" ],
-        "sys/ucontext.h":          [ "sgidefs.h" ],
         "sys/user.h":              [ "sgidefs.h" ],
 
         "bits/fcntl.h":            [ "sgidefs.h" ],
@@ -699,6 +695,7 @@ SYSDEP_ALLOWED_INCLUDES = {
         "bits/setjmp.h":           [ "sgidefs.h" ],
         "bits/sigcontext.h":       [ "sgidefs.h" ],
         "bits/stat.h":             [ "sgidefs.h" ],
+        "bits/ucontext.h":         [ "sgidefs.h" ],
         "bits/wordsize.h":         [ "sgidefs.h" ],
     },
 }
diff --git a/signal/signal.h b/signal/signal.h
index 2c52466..3ddd7ab 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -293,7 +293,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
 # include <bits/types/stack_t.h>
 # if defined __USE_XOPEN || defined __USE_XOPEN2K8
 /* This will define `ucontext_t' and `mcontext_t'.  */
-#  include <sys/ucontext.h>
+#  include <bits/ucontext.h>
 # endif
 #endif /* Use POSIX.1-2008 or X/Open Unix.  */
 
diff --git a/stdlib/Makefile b/stdlib/Makefile
index fbf1b84..41609a9 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -26,7 +26,7 @@ headers	:= stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h      \
 	   monetary.h bits/monetary-ldbl.h				      \
 	   inttypes.h stdint.h bits/wordsize.h bits/timesize.h		      \
 	   errno.h sys/errno.h bits/errno.h bits/types/error_t.h	      \
-	   ucontext.h sys/ucontext.h bits/indirect-return.h		      \
+	   ucontext.h sys/ucontext.h bits/ucontext.h bits/indirect-return.h   \
 	   alloca.h fmtmsg.h						      \
 	   bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h	      \
 	   bits/stdint-uintn.h bits/time64.h bits/NULL.h		      \
diff --git a/stdlib/sys/ucontext.h b/stdlib/sys/ucontext.h
new file mode 100644
index 0000000..5fdbd63
--- /dev/null
+++ b/stdlib/sys/ucontext.h
@@ -0,0 +1 @@
+#include <ucontext.h>
diff --git a/stdlib/ucontext.h b/stdlib/ucontext.h
index ab97224..f12587a 100644
--- a/stdlib/ucontext.h
+++ b/stdlib/ucontext.h
@@ -26,7 +26,7 @@
 #include <bits/indirect-return.h>
 
 /* Get machine dependent definition of data structures.  */
-#include <sys/ucontext.h>
+#include <bits/ucontext.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/bits/ucontext.h
similarity index 96%
rename from sysdeps/arm/sys/ucontext.h
rename to sysdeps/arm/bits/ucontext.h
index bf210f0..0436adb 100644
--- a/sysdeps/arm/sys/ucontext.h
+++ b/sysdeps/arm/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/ARM ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -107,4 +107,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/bits/ucontext.h
similarity index 97%
rename from sysdeps/i386/sys/ucontext.h
rename to sysdeps/i386/bits/ucontext.h
index b1a5ab9..74fd0e0 100644
--- a/sysdeps/i386/sys/ucontext.h
+++ b/sysdeps/i386/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/i386 ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -135,4 +135,4 @@ typedef struct ucontext_t
 #undef __ctx
 #undef __ctxt
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/bits/ucontext.h
similarity index 96%
rename from sysdeps/m68k/sys/ucontext.h
rename to sysdeps/m68k/bits/ucontext.h
index 2204cae..9e50996 100644
--- a/sysdeps/m68k/sys/ucontext.h
+++ b/sysdeps/m68k/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/m68k ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -122,4 +122,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/bits/ucontext.h
similarity index 97%
rename from sysdeps/mips/sys/ucontext.h
rename to sysdeps/mips/bits/ucontext.h
index e5bbb46..411f841 100644
--- a/sysdeps/mips/sys/ucontext.h
+++ b/sysdeps/mips/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/mips ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -173,4 +173,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h
index fec2f6a..9603b02 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h
@@ -20,11 +20,12 @@
 #ifndef _BITS_PROCFS_H
 #define _BITS_PROCFS_H 1
 
-#ifndef _SYS_PROCFS_H
+#if !defined _SYS_PROCFS_H && !defined _BITS_UCONTEXT_H
 # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
 #include <bits/types.h>
+#include <sys/user.h>
 
 /* Type for a general-purpose register.  */
 typedef __uint64_t elf_greg_t;
diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h
similarity index 95%
rename from sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h
index 140d4b3..7be5302 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h
@@ -18,8 +18,8 @@
 
 /* System V/AArch64 ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -33,7 +33,7 @@
 #endif
 
 #ifdef __USE_MISC
-# include <sys/procfs.h>
+# include <bits/procfs.h>
 
 
 typedef elf_greg_t greg_t;
@@ -75,4 +75,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
index a0b0002..fa0483f5 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h
@@ -17,7 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <stdint.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 #define SIGCONTEXT siginfo_t *_si, ucontext_t *
 #define GET_PC(ctx) ((void *) (uintptr_t) (ctx)->uc_mcontext.pc)
diff --git a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
index ab3930c..7d5c4a1 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
@@ -1,8 +1,5 @@
-#include <inttypes.h>
-#include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
-#include <asm/sigcontext.h>
+#include <signal.h>
 
 #include "kernel_rt_sigframe.h"
 
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
index 58b015f..33bc086 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h
@@ -25,8 +25,8 @@
 #endif
 
 /* For gregset_t and fpregset_t.  FIXME: sys/procfs.h should not
-   expose all of sys/ucontext.h.  */
-#include <sys/ucontext.h>
+   expose all of bits/ucontext.h.  */
+#include <bits/ucontext.h>
 
 typedef gregset_t __prgregset_t;
 typedef fpregset_t __prfpregset_t;
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h
similarity index 96%
rename from sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/alpha/bits/ucontext.h
index d2f93da..2849117 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h
@@ -15,8 +15,8 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -91,4 +91,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
index 9e86f8a..f57c779 100644
--- a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
+++ b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
@@ -1,5 +1,5 @@
 #include <stddef.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 --
 UC_LINK		offsetof (ucontext_t, uc_link)
diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/arm/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/arm/bits/ucontext.h
index 76ea4dc..60c7289 100644
--- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/ARM ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -141,4 +141,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h
index 44c69a2..f702c59 100644
--- a/sysdeps/unix/sysv/linux/arm/register-dump.h
+++ b/sysdeps/unix/sysv/linux/arm/register-dump.h
@@ -19,7 +19,7 @@
 
 #include <sys/uio.h>
 #include <_itoa.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
 
 /* We will print the register dump in this format:
 
diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
index 0bf3bea..3704993 100644
--- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
@@ -16,7 +16,7 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ucontext.h>
+#include <signal.h>
 
 #define SIGCONTEXT siginfo_t *_si, ucontext_t *
 
diff --git a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym
index 306292f..ccf555d 100644
--- a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym
@@ -1,7 +1,5 @@
-#include <inttypes.h>
-#include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 SIG_BLOCK
 SIG_SETMASK
diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
index 4581b65..0ee6dd0 100644
--- a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym
@@ -1,7 +1,5 @@
-#include <inttypes.h>
-#include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 SIG_BLOCK
 SIG_SETMASK
diff --git a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h
similarity index 96%
rename from sysdeps/unix/sysv/linux/csky/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/csky/bits/ucontext.h
index 5eac9e6..90ee71b 100644
--- a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h
@@ -16,8 +16,8 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -86,4 +86,4 @@ typedef struct ucontext_t
 #undef __ctx
 
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h
index 9496189..47b273b 100644
--- a/sysdeps/unix/sysv/linux/csky/register-dump.h
+++ b/sysdeps/unix/sysv/linux/csky/register-dump.h
@@ -19,7 +19,7 @@
 #include <sys/uio.h>
 #include <_itoa.h>
 #include <bits/sigcontext.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
 
 /* abiv1 register dump in this format:
 
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h
similarity index 96%
rename from sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/hppa/bits/ucontext.h
index 9a55d93a..fe8a82f 100644
--- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* Don't rely on this, the interface is currently messed up and may need to
    be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -79,4 +79,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
index ee33029..1ec474c 100644
--- a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
index b11a550..79d9570 100644
--- a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile
index 97fc7df..36240a6 100644
--- a/sysdeps/unix/sysv/linux/ia64/Makefile
+++ b/sysdeps/unix/sysv/linux/ia64/Makefile
@@ -1,5 +1,5 @@
-ifeq ($(subdir),misc)
-sysdep_headers += sys/rse.h
+ifeq ($(subdir),signal)
+sysdep_headers += bits/types/__ia64_fpreg.h
 endif
 
 ifeq ($(subdir),stdlib)
@@ -8,7 +8,7 @@ gen-as-const-headers += sigcontext-offsets.sym
 endif
 
 ifeq ($(subdir),misc)
-sysdep_headers += sys/io.h
+sysdep_headers += sys/io.h sys/rse.h
 sysdep_routines += ioperm clone2
 gen-as-const-headers += sigaltstack-offsets.sym
 endif
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h
index 754e969..def7e5b 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h
@@ -23,10 +23,7 @@
 # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
-/* For struct __ia64_fpreg.  FIXME: sys/procfs.h should not expose all
-   of sys/ucontext.h.  */
-#include <sys/ucontext.h>
-#include <bits/sigcontext.h>
+#include <bits/types/__ia64_fpreg.h>
 
 /* We really need just 72 but let's leave some headroom...  */
 #define ELF_NGREG	128
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
index b1b45ee..5404746 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
@@ -26,17 +26,10 @@
 #include <bits/types/size_t.h>
 #include <bits/types/struct_sigstack.h>
 #include <bits/types/stack_t.h>
+#include <bits/types/__ia64_fpreg.h>
 #include <bits/sigstack.h>
 #include <bits/ss_flags.h>
 
-struct __ia64_fpreg
-  {
-    union
-      {
-	unsigned long bits[2];
-      } u;
-  } __attribute__ ((__aligned__ (16)));
-
 struct sigcontext
 {
   unsigned long int sc_flags;	/* see manifest constants below */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h
new file mode 100644
index 0000000..6d69586
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h
@@ -0,0 +1,22 @@
+#ifndef ____ia64_fpreg_defined
+#define ____ia64_fpreg_defined
+
+#include <features.h>
+
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
+struct __ia64_fpreg
+  {
+    union
+      {
+	unsigned long __ctx(bits)[2];
+      } __ctx(u);
+  } __attribute__ ((__aligned__ (16)));
+
+#undef __ctx
+
+#endif /* __ia64_fpreg */
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h
similarity index 91%
rename from sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/ia64/bits/ucontext.h
index 2aeac65..219526c 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h
@@ -15,14 +15,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
 #include <bits/types/stack_t.h>
-
+#include <bits/types/__ia64_fpreg.h>
 
 #ifdef __USE_MISC
 # define __ctx(fld) fld
@@ -36,14 +36,6 @@
  * "ucontext_t" as all the necessary info is inside the former.
  */
 
-struct __ia64_fpreg_mcontext
-  {
-    union
-      {
-	unsigned long __ctx(bits)[2];
-      } __ctx(u);
-  } __attribute__ ((__aligned__ (16)));
-
 typedef struct
   {
     unsigned long int __ctx(sc_flags);
@@ -63,7 +55,7 @@ typedef struct
     unsigned long int __ctx(sc_pr);
     unsigned long int __ctx(sc_br)[8];
     unsigned long int __ctx(sc_gr)[32];
-    struct __ia64_fpreg_mcontext __ctx(sc_fr)[128];
+    struct __ia64_fpreg __ctx(sc_fr)[128];
     unsigned long int __ctx(sc_rbs_base);
     unsigned long int __ctx(sc_loadrs);
     unsigned long int __ctx(sc_ar25);
@@ -103,4 +95,4 @@ ucontext_t;
 #define uc_stack	_u._mc.__ctx(sc_stack)
 #define uc_link		_u._uc._link
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
index ac3e3c8..46459f7 100644
--- a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
+++ b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
@@ -1,5 +1,5 @@
 #include <stddef.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 --
 SC_NAT		offsetof (mcontext_t, sc_nat)
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
index 4578ffb..9f12f59 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
@@ -20,9 +20,8 @@
 #define _SYS_PTRACE_H	1
 
 #include <features.h>
-#include <sys/ucontext.h>
-#include <bits/sigcontext.h>
 #include <bits/types.h>
+#include <bits/ucontext.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/m68k/bits/ucontext.h
index 8a3b69d..11752ce 100644
--- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* System V/m68k ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -127,4 +127,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
index 46bd4bf..400c57b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h
similarity index 96%
rename from sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h
index cbdc677..1f168ea 100644
--- a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h
@@ -16,8 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -89,4 +89,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/mips/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/mips/bits/ucontext.h
index 39fe23c..0b2c02c 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h
@@ -16,8 +16,8 @@
 
 /* Don't rely on this, the interface is currently messed up and may need to
    be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -121,4 +121,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym
index f14b886..d9692ad 100644
--- a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym
@@ -1,7 +1,5 @@
-#include <inttypes.h>
 #include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
 
 #include <kernel_rt_sigframe.h>
 
diff --git a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h
similarity index 95%
rename from sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/nios2/bits/ucontext.h
index e3773ce..8549117 100644
--- a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h
@@ -18,8 +18,8 @@
 
 /* System V/Nios II ABI compliant context switching support.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -58,4 +58,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h b/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
index dbbb47b..9a4e511 100644
--- a/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ucontext.h>
-#include "kernel-features.h"
+#include <signal.h>
 
 #define SIGCONTEXT siginfo_t *_si, ucontext_t *
 #define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.regs[27])
diff --git a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
index a844c96..5455cdb 100644
--- a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym
@@ -1,7 +1,5 @@
-#include <inttypes.h>
 #include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
 
 #include "kernel_rt_sigframe.h"
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h
similarity index 98%
rename from sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h
index 640381a..324ec3c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h
@@ -15,8 +15,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -197,4 +197,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
index 293761f..e1b22b8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
index 8364e46..b2d420e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h
index 6ab2601..4e2dae4 100644
--- a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h
+++ b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h
@@ -23,10 +23,10 @@
 # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
-/* FIXME: sys/ucontext.h does not define NGREG or NFPREG unless
+/* FIXME: bits/ucontext.h does not define NGREG or NFPREG unless
    __USE_MISC is active, and sys/procfs.h should not expose all of
-   sys/ucontext.h.  */
-#include <sys/ucontext.h>
+   bits/ucontext.h.  */
+#include <bits/ucontext.h>
 
 /* ELF register definitions */
 #define ELF_NGREG	NGREG
diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/riscv/bits/ucontext.h
index 6f62eb3..48ff2cd 100644
--- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h
@@ -18,8 +18,8 @@
 
 /* Don't rely on this, the interface is currently messed up and may need to
    be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -107,4 +107,4 @@ typedef struct ucontext_t
     mcontext_t uc_mcontext;
   } ucontext_t;
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/riscv/makecontext.c b/sysdeps/unix/sysv/linux/riscv/makecontext.c
index 671f202..8a929bf 100644
--- a/sysdeps/unix/sysv/linux/riscv/makecontext.c
+++ b/sysdeps/unix/sysv/linux/riscv/makecontext.c
@@ -18,14 +18,12 @@
 
 #include <sysdep.h>
 #include <sys/asm.h>
-#include <sys/ucontext.h>
+#include <ucontext.h>
 #include <stdarg.h>
 #include <assert.h>
 
 void
-__makecontext (ucontext_t *ucp, void (*func) (void), int argc,
-	       long int a0, long int a1, long int a2, long int a3, long int a4,
-	       ...)
+__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __start_context (void) attribute_hidden;
   long int i, sp;
@@ -47,19 +45,13 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc,
   ucp->uc_mcontext.__gregs[REG_PC] = (long int) &__start_context;
 
   /* Put args in a0-a7, then put any remaining args on the stack.  */
-  ucp->uc_mcontext.__gregs[REG_A0 + 0] = a0;
-  ucp->uc_mcontext.__gregs[REG_A0 + 1] = a1;
-  ucp->uc_mcontext.__gregs[REG_A0 + 2] = a2;
-  ucp->uc_mcontext.__gregs[REG_A0 + 3] = a3;
-  ucp->uc_mcontext.__gregs[REG_A0 + 4] = a4;
-
-  if (__glibc_unlikely (argc > 5))
+  if (argc > 0)
     {
       va_list vl;
-      va_start (vl, a4);
+      va_start (vl, argc);
 
       long reg_args = argc < REG_NARGS ? argc : REG_NARGS;
-      for (i = 5; i < reg_args; i++)
+      for (i = 0; i < reg_args; i++)
         ucp->uc_mcontext.__gregs[REG_A0 + i] = va_arg (vl, long);
 
       long int stack_args = argc - reg_args;
diff --git a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h
index 27ed9bd..5f7ba36 100644
--- a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h
@@ -16,7 +16,7 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sys/ucontext.h>
+#include <signal.h>
 
 #define SIGCONTEXT siginfo_t *_si, ucontext_t *
 #define GET_PC(ctx)	((void *) ctx->uc_mcontext.__gregs[REG_PC])
diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
index be55b26..105b538 100644
--- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
@@ -1,7 +1,5 @@
-#include <inttypes.h>
-#include <signal.h>
 #include <stddef.h>
-#include <sys/ucontext.h>
+#include <signal.h>
 
 -- Constants used by the rt_sigprocmask call.
 
diff --git a/sysdeps/unix/sysv/linux/s390/bits/procfs.h b/sysdeps/unix/sysv/linux/s390/bits/procfs.h
index 597ccdb..c2a4b54 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/procfs.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/procfs.h
@@ -23,9 +23,9 @@
 # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
-/* FIXME: sys/ucontext.h does not define NGREG unless __USE_MISC is
-   active, and sys/procfs.h should not expose all of sys/ucontext.h.  */
-#include <sys/ucontext.h>
+/* FIXME: bits/ucontext.h does not define NGREG unless __USE_MISC is
+   active, and sys/procfs.h should not expose all of bits/ucontext.h.  */
+#include <bits/ucontext.h>
 
 typedef greg_t elf_greg_t;
 #define ELF_NGREG NGREG
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h
similarity index 96%
rename from sysdeps/unix/sysv/linux/s390/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/s390/bits/ucontext.h
index c1770ca..4ce1ee8 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h
@@ -16,8 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -92,4 +92,4 @@ typedef struct ucontext_t
 #undef __ctx
 
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c
index e7d36d2..1c2aed9 100644
--- a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c
+++ b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c
@@ -16,19 +16,19 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <elf.h>
+#include <errno.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/wait.h>
 #include <sys/types.h>
 #include <sys/uio.h>
-#include <elf.h>
-#include <support/xunistd.h>
+#include <sys/wait.h>
+
 #include <support/check.h>
-#include <string.h>
-#include <errno.h>
+#include <support/xunistd.h>
 
 /* Ensure that we use the PTRACE_SINGLEBLOCK definition from glibc ptrace.h
    in tracer_func.  We need the kernel ptrace.h for structs ptrace_area
diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
index 6cc9f19..5b98555 100644
--- a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h
similarity index 97%
rename from sysdeps/unix/sysv/linux/sh/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/sh/bits/ucontext.h
index 9092103..65b66ce 100644
--- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h
@@ -17,8 +17,8 @@
 
 /* Where is System V/SH ABI?  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -123,4 +123,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
index 25f914a..4cd312a 100644
--- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
index 130f60c..530a06f 100644
--- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h
similarity index 99%
rename from sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/sparc/bits/ucontext.h
index a125084..9c3f4e3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h
@@ -15,8 +15,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -301,4 +301,4 @@ typedef struct ucontext_t
   } ucontext_t;
 
 #endif /* __WORDSIZE == 32 */
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
index 8a7cb5a..0fe920d 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --
 
diff --git a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h
similarity index 98%
rename from sysdeps/unix/sysv/linux/x86/sys/ucontext.h
rename to sysdeps/unix/sysv/linux/x86/bits/ucontext.h
index 3d883c2..e786583 100644
--- a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h
@@ -15,8 +15,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
 
 #include <features.h>
 
@@ -259,4 +259,4 @@ typedef struct ucontext_t
 
 #undef __ctx
 
-#endif /* sys/ucontext.h */
+#endif /* bits/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
index c08b3b8..4bffe04 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
@@ -1,6 +1,5 @@
 #include <stddef.h>
 #include <signal.h>
-#include <sys/ucontext.h>
 
 --


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]