summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-06-21 02:59:26 +0000
committerUlrich Drepper <drepper@redhat.com>1997-06-21 02:59:26 +0000
commit5107cf1d7d27f17c6de68ec15a8e8d9dd5b471c1 (patch)
treedbe8fd6c6a69eac9e3e6f465ab6396d47f232e6f
parentd705269e75ff9846000abea981774b381b076482 (diff)
downloadglibc-5107cf1d7d27f17c6de68ec15a8e8d9dd5b471c1.tar.gz
glibc-5107cf1d7d27f17c6de68ec15a8e8d9dd5b471c1.tar.xz
glibc-5107cf1d7d27f17c6de68ec15a8e8d9dd5b471c1.zip
1997-06-21 02:48  Ulrich Drepper  <drepper@cygnus.com>

	* config.h.in: Add DO_STATIC_NSS.
	* config.make.in: Add build-static-nss.

	* elf/eval.c: Use __getdelim instead of __getline.

	* locale/programs/locale.c: Correct comment.

	* manual/libc.texinfo: Update copyright and date.
	Remove A4 option.

	* sysdeps/libm-ieee754/k_standard.c: Always return HUGE_VAL
	for gamma overflow.
	* sysdeps/libm-ieee754/w_gamma.c: Handle SVID and ISO C behaviour.
	* sysdeps/libm-ieee754/w_gammaf.c: Likewise.
	* sysdeps/libm-ieee754/w_gammalp.c: Likewise.

	* po/ko.po: Update.

1997-06-13 10:06  Richard Henderson  <rth@tamu.edu>

	The Great Bit File Move:
	* configure.in (AC_INIT): Look in include/ for features.h.
	(sysnames): Add include as the final search directory.
	(AC_OUTPUT): Create a bits directory in the build directory.
	* Makeconfig (CPPFLAGS): Look in include/ for libc-symbols.h.
	* Makefile: Make sure the target directory exists when installing
	<gnu/stubs.h> and <gnu/lib-names.h>.
	* csu/Makefile: Use $(compile.S) and $(compile.c) instead of
	invoking $(CC) directly, as the former have the full include path.

	* ansidecl.h: Removed.

	* aliases.h: Moved to include/.
	* alloca.h: Likewise.
	* argp.h: Likewise.
	* argz.h: Likewise.
	* arpa/ftp.h: Likewise.
	* arpa/inet.h: Likewise.
	* arpa/nameser.h: Likewise.
	* arpa/telnet.h: Likewise.
	* arpa/tftp.h: Likewise.
	* assert.h: Likewise.
	* ctype.h: Likewise.
	* db.h: Likewise.
	* dirent.h: Likewise.
	* dlfcn.h: Likewise.
	* elf.h: Likewise.
	* endian.h: Likewise.
	* envz.h: Likewise.
	* err.h: Likewise.
	* errno.h: Likewise.
	* error.h: Likewise.
	* fcntl.h: Likewise.
	* features.h: Likewise.
	* fnmatch.h: Likewise.
	* ftw.h: Likewise.
	* getopt.h: Likewise.
	* glob.h: Likewise.
	* gnu-versions.h: Likewise.
	* grp.h: Likewise.
	* langinfo.h: Likewise.
	* libc-symbols.h: Likewise.
	* libgen.h: Likewise.
	* libintl.h: Likewise.
	* limits.h: Likewise.
	* linewrap.h: Likewise.
	* link.h: Likewise.
	* locale.h: Likewise.
	* malloc.h: Likewise.
	* math.h: Likewise.
	* mathcalls.h: Likewise.
	* mcheck.h: Likewise.
	* memory.h: Likewise.
	* netdb.h: Likewise.
	* netgroup.h: Likewise.
	* netinet/ether.h: Likewise.
	* netinet/in.h: Likewise.
	* nlist.h: Likewise.
	* nss.h: Likewise.
	* nsswitch.h: Likewise.
	* obstack.h: Likewise.
	* poll.h: Likewise.
	* posix1_lim.h: Likewise.
	* posix2_lim.h: Likewise.
	* printf.h: Likewise.
	* protocols/routed.h: Likewise.
	* protocols/rwhod.h: Likewise.
	* protocols/talkd.h: Likewise.
	* protocols/timed.h: Likewise.
	* pwd.h: Likewise.
	* regex.h: Likewise.
	* resolv.h: Likewise.
	* rpc/auth_unix.h: Likewise.
	* rpc/clnt.h: Likewise.
	* rpc/netdb.h: Likewise.
	* rpc/pmap_clnt.h: Likewise.
	* rpc/pmap_prot.h: Likewise.
	* rpc/pmap_rmt.h: Likewise.
	* rpc/rpc.h: Likewise.
	* rpc/rpc_msg.h: Likewise.
	* rpc/svc.h: Likewise.
	* rpc/svc_auth.h: Likewise.
	* rpc/types.h: Likewise.
	* rpc/xdr.h: Likewise.
	* sched.h: Likewise.
	* search.h: Likewise.
	* set-hooks.h: Likewise.
	* setjmp.h: Likewise.
	* sgtty.h: Likewise.
	* shadow.h: Likewise.
	* signal.h: Likewise.
	* stab.def: Likewise.
	* stab.h: Likewise.
	* stdio.h: Likewise.
	* stdlib.h: Likewise.
	* string.h: Likewise.
	* strings.h: Likewise.
	* sys/bitypes.h: Likewise.
	* sys/cdefs.h: Likewise.
	* sys/dir.h: Likewise.
	* sys/errno.h: Likewise.
	* sys/fcntl.h: Likewise.
	* sys/file.h: Likewise.
	* sys/gmon.h: Likewise.
	* sys/ioctl.h: Likewise.
	* sys/ipc.h: Likewise.
	* sys/msg.h: Likewise.
	* sys/poll.h: Likewise.
	* sys/queue.h: Likewise.
	* sys/resource.h: Likewise.
	* sys/select.h: Likewise.
	* sys/sem.h: Likewise.
	* sys/shm.h: Likewise.
	* sys/signal.h: Likewise.
	* sys/socket.h: Likewise.
	* sys/stat.h: Likewise.
	* sys/statfs.h: Likewise.
	* sys/syslog.h: Likewise.
	* sys/termios.h: Likewise.
	* sys/time.h: Likewise.
	* sys/timeb.h: Likewise.
	* sys/times.h: Likewise.
	* sys/types.h: Likewise.
	* sys/uio.h: Likewise.
	* sys/un.h: Likewise.
	* sys/unistd.h: Likewise.
	* sys/utsname.h: Likewise.
	* sys/vlimit.h: Likewise.
	* sys/vtimes.h: Likewise.
	* sys/wait.h: Likewise.
	* syscall.h: Likewise.
	* syslog.h: Likewise.
	* tar.h: Likewise.
	* termios.h: Likewise.
	* time.h: Likewise.
	* ttyent.h: Likewise.
	* unistd.h: Likewise.
	* utime.h: Likewise.
	* utmp.h: Likewise.
	* values.h: Likewise.
	* wchar.h: Likewise.
	* wctype.h: Likewise.
	* wordexp.h: Likewise.
	* xlocale.h: Likewise.
	* xopen_lim.h: Likewise.

	* linuxthreads/sysdeps/alpha/semaphorebits.h: -> .../bits/semaphore.h.
	* linuxthreads/sysdeps/powerpc/semaphorebits.h: Likewise.
	* linuxthreads/sysdeps/pthread/cmpxchg/semaphorebits.h: Likewise.
	* linuxthreads/sysdeps/pthread/no-cmpxchg/semaphorebits.h: Likewise.
	* linuxthreads/sysdeps/pthread/libc-lock.h: -> bits/
	* sysdeps/mach/libc-lock.h: Likewise.
	* sysdeps/stub/libc-lock.h: Likewise.
	* linuxthreads/sysdeps/pthread/stdio-lock.h: Likewise.
	* linuxthreads/sysdeps/unix/sysv/linux/local_lim.h: Likewise.
	* sysdeps/mach/hurd/local_lim.h: Likewise.
	* sysdeps/stub/local_lim.h: Likewise.
	* sysdeps/unix/sysv/linux/local_lim.h: Likewise.
	* sysdeps/unix/sysv/local_lim.h: Likewise.
	* sysdeps/unix/sysv/sco3.2/local_lim.h: Likewise.
	* linuxthreads/sysdeps/unix/sysv/linux/posix_opt.h: Likewise.
	* sysdeps/mach/hurd/posix_opt.h: Likewise.
	* sysdeps/stub/posix_opt.h: Likewise.
	* sysdeps/unix/bsd/posix_opt.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/posix_opt.h: Likewise.
	* sysdeps/unix/sysv/linux/posix_opt.h: Likewise.
	* math/cmathcalls.h: -> bits/
	* math/mathcalls.h: Likewise.
	* misc/stab.def: -> bits/
	* posix/posix1_lim.h: -> bits/
	* posix/posix2_lim.h: Likewise.
	* sysdeps/alpha/__math.h: -> .../fpu/bits/mathinline.h
	* sysdeps/i386/fpu/__math.h: Likewise.
	* sysdeps/m68k/fpu/__math.h: Likewise.
	* sysdeps/m68k/fpu/switch/__math.h: Likewise.
	* sysdeps/powerpc/__math.h: Likewise.
	* sysdeps/stub/__math.h: Likewise.
	* sysdeps/alpha/bytesex.h: -> .../bits/endian.h
	* sysdeps/arm/bytesex.h: Likewise.
	* sysdeps/i386/bytesex.h: Likewise.
	* sysdeps/m68k/bytesex.h: Likewise.
	* sysdeps/mips/bytesex.h: Likewise.
	* sysdeps/mips/dec/bytesex.h: Likewise.
	* sysdeps/mips/mipsel/bytesex.h: Likewise.
	* sysdeps/mips/p40/bytesex.h: Likewise.
	* sysdeps/sparc/bytesex.h: Likewise.
	* sysdeps/stub/bytesex.h: Likewise.
	* sysdeps/alpha/fpu/fenvbits.h: -> .../bits/fenv.h
	* sysdeps/i386/fpu/fenvbits.h: Likewise.
	* sysdeps/m68k/fpu/fenvbits.h: Likewise.
	* sysdeps/powerpc/fenvbits.h: Likewise.
	* sysdeps/stub/fenvbits.h: Likewise.
	* sysdeps/alpha/jmp_buf.h: -> .../bits/setenv.h
	* sysdeps/arm/jmp_buf.h: Likewise.
	* sysdeps/i386/jmp_buf.h: Likewise.
	* sysdeps/m68k/jmp_buf.h: Likewise.
	* sysdeps/mips/jmp_buf.h: Likewise.
	* sysdeps/sparc/jmp_buf.h: Likewise.
	* sysdeps/powerpc/jmp_buf.h: Likewise.
	* sysdeps/stub/jmp_buf.h: Likewise.
	* sysdeps/vax/jmp_buf.h: Likewise.
	* sysdeps/generic/confname.h: -> bits/
	* sysdeps/unix/sysv/irix4/confname.h: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/confname.h: Likewise.
	* sysdeps/generic/gnu/types.h: -> ../bits/types.h
	* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Likewise.
	* sysdeps/unix/sysv/linux/gnu/types.h: Likewise.
	* sysdeps/generic/ioctl-types.h: -> bits/
	* sysdeps/unix/sysv/linux/ioctl-types.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ioctl-types.h: Likewise.
	* sysdeps/generic/iovec.h: -> .../bits/uio.h
	* sysdeps/unix/sysv/linux/iovec.h: Likewise.
	* sysdeps/generic/mathbits.h: -> .../bits/mathdef.h
	* sysdeps/i386/fpu/mathbits.h: Likewise.
	* sysdeps/m68k/fpu/mathbits.h: Likewise.
	* sysdeps/powerpc/mathbits.h: Likewise.
	* sysdeps/generic/resourcebits.h: -> .../bits/resource.h
	* sysdeps/unix/bsd/sun/sunos4/resourcebits.h: Likewise.
	* sysdeps/unix/sysv/linux/resourcebits.h: Likewise.
	* sysdeps/generic/schedbits.h: -> .../bits/sched.h
	* sysdeps/unix/sysv/linux/schedbits.h: Likewise.
	* sysdeps/generic/selectbits.h: -> .../bits/select.h
	* sysdeps/i386/selectbits.h: Likewise.
	* sysdeps/generic/sigaction.h: -> bits/
	* sysdeps/unix/bsd/osf/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sigaction.h: Likewise.
	* sysdeps/unix/sysv/minix/sigaction.h: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/sigaction.h: Likewise.
	* sysdeps/unix/sysv/sysv4/sigaction.h: Likewise.
	* sysdeps/generic/sigset.h: -> bits/
	* sysdeps/unix/sysv/linux/sigset.h: Likewise.
	* sysdeps/unix/sysv/sysv4/sigset.h: Likewise.
	* sysdeps/generic/sockaddrcom.h: -> .../bits/sockaddr.h
	* sysdeps/unix/bsd/bsd4.4/sockaddrcom.h: Likewise.
	* sysdeps/generic/socketbits.h: -> .../bits/socket.h
	* sysdeps/unix/sysv/linux/socketbits.h: Likewise.
	* sysdeps/generic/statfsbuf.h: -> .../bits/statfs.h
	* sysdeps/unix/sysv/linux/statfsbuf.h: Likewise.
	* sysdeps/generic/termbits.h: -> .../bits/termios.h
	* sysdeps/unix/bsd/sun/sunos4/termbits.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/termbits.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/termbits.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/termbits.h: Likewise.
	* sysdeps/unix/sysv/linux/termbits.h: Likewise.
	* sysdeps/generic/ustatbits.h: -> .../bits/ustat.h
	* sysdeps/unix/sysv/linux/ustatbits.h: Likewise.
	* sysdeps/generic/utmpbits.h: -> .../bits/utmp.h
	* sysdeps/gnu/utmpbits.h: Likewise.
	* sysdeps/unix/sysv/utmpbits.h: Likewise.
	* sysdeps/generic/utsnamelen.h: -> .../bits/utsname.h
	* sysdeps/unix/bsd/sun/sunos4/utsnamelen.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/utsnamelen.h: Likewise.
	* sysdeps/unix/sysv/linux/utsnamelen.h: Likewise.
	* sysdeps/unix/sysv/sysv4/utsnamelen.h: Likewise.
	* sysdeps/unix/sysv/utsnamelen.h: Likewise.
	* sysdeps/generic/waitstatus.h: -> bits/
	* sysdeps/i386/huge_val.h: -> bits/
	* sysdeps/ieee754/huge_val.h: Likewise.
	* sysdeps/m68k/huge_val.h: Likewise.
	* sysdeps/stub/huge_val.h: Likewise.
	* sysdeps/vax/huge_val.h: Likewise.
	* sysdeps/ieee754/nan.h: Likewise.
	* sysdeps/stub/nan.h: Likewise.
	* sysdeps/mach/hurd/alpha/sigcontext.h: -> bits/
	* sysdeps/mach/hurd/hppa/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/i386/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/mips/sigcontext.h: Likewise.
	* sysdeps/stub/sigcontext.h: Likewise.
	* sysdeps/unix/bsd/sun/m68k/sigcontext.h: Likewise.
	* sysdeps/unix/bsd/sun/sparc/sigcontext.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/mips/sigcontext.h: Likewise.
	* sysdeps/unix/sysv/linux/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/errnos.h: -> .../bits/errno.h
	* sysdeps/standalone/arm/errnos.h: Likewise.
	* sysdeps/stub/errnos.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/errnos.h: Likewise.
	* sysdeps/unix/sysv/linux/errnos.h: Likewise.
	* sysdeps/mach/hurd/fcntlbits.h: -> .../bits/fcntl.h
	* sysdeps/stub/fcntlbits.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/fcntlbits.h: Likewise.
	* sysdeps/unix/bsd/fcntlbits.h: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/fcntlbits.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/fcntlbits.h: Likewise.
	* sysdeps/unix/common/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/irix4/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/linux/fcntlbits.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/fcntlbits.h: Likewise.
	* sysdeps/mach/hurd/ioctls.h: -> bits/
	* sysdeps/stub/ioctls.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/ioctls.h: Likewise.
	* sysdeps/mach/hurd/statbuf.h: -> .../bits/stat.h
	* sysdeps/stub/statbuf.h: Likewise.
	* sysdeps/unix/bsd/osf/alpha/statbuf.h: Likewise.
	* sysdeps/unix/bsd/statbuf.h: Likewise.
	* sysdeps/unix/sysv/irix4/statbuf.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/statbuf.h: Likewise.
	* sysdeps/unix/sysv/linux/statbuf.h: Likewise.
	* sysdeps/unix/sysv/statbuf.h: Likewise.
	* sysdeps/unix/sysv/sysv4/i386/statbuf.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/statbuf.h: Likewise.
	* sysdeps/standalone/stdio_lim.h: -> bits/
	* sysdeps/stub/stdio_lim.h: Likewise.
	* sysdeps/stub/direntry.h: -> ../bits/dirent.h
	* sysdeps/unix/bsd/bsd4.4/direntry.h: Likewise.
	* sysdeps/unix/bsd/direntry.h: Likewise.
	* sysdeps/unix/common/direntry.h: Likewise.
	* sysdeps/unix/sysv/direntry.h: Likewise.
	* sysdeps/unix/sysv/linux/direntry.h: Likewise.
	* sysdeps/stub/elfclass.h: -> bits/
	* sysdeps/wordsize-32/elfclass.h: Likewise.
	* sysdeps/wordsize-64/elfclass.h: Likewise.
	* sysdeps/stub/signum.h: -> bits/
	* sysdeps/unix/bsd/signum.h: Likewise.
	* sysdeps/unix/bsd/sun/signum.h: Likewise.
	* sysdeps/unix/sysv/irix4/signum.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/signum.h: Likewise.
	* sysdeps/unix/sysv/linux/signum.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/signum.h: Likewise.
	* sysdeps/unix/sysv/signum.h: Likewise.
	* sysdeps/unix/sysv/sysv4/signum.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/signum.h: Likewise.
	* sysdeps/stub/sys/ipc_buf.h: -> .../bits/ipc.h
	* sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/ipc_buf.h: Likewise.
	* sysdeps/stub/sys/msq_buf.h: -> .../bits/msq.h
	* sysdeps/unix/sysv/linux/sys/msq_buf.h: Likewise.
	* sysdeps/stub/sys/sem_buf.h: -> .../bits/sem.h
	* sysdeps/unix/sysv/linux/sys/sem_buf.h: Likewise.
	* sysdeps/stub/sys/shm_buf.h: -> .../bits/shm.h
	* sysdeps/unix/sysv/linux/sys/shm_buf.h: Likewise.
	* sysdeps/stub/timebits.h: -> .../bits/time.h
	* sysdeps/unix/sysv/linux/alpha/timebits.h: Likewise.
	* sysdeps/unix/sysv/linux/timebits.h: Likewise.
	* sysdeps/stub/waitflags.h: -> bits/
	* sysdeps/unix/bsd/waitflags.h: Likewise.
	* sysdeps/unix/sysv/linux/waitflags.h: Likewise.
	* sysdeps/unix/sysv/sysv4/waitflags.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h: -> ../
	* sysdeps/unix/sysv/linux/powerpc/sys/kernel_termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/socketcall.h: -> ../

	* argp/argp-fmtstream.h: Standardize the multiple-include protect.
	* argp/argp.h: Likewise.
	* catgets/nl_types.h: Likewise.
	* crypt/sysdeps/unix/crypt.h: Likewise.
	* ctype/ctype.h: Likewise.
	* db/db.h: Likewise.
	* db/mpool.h: Likewise.
	* db/ndbm.h: Likewise.
	* dirent/dirent.h: Likewise.
	* elf/dlfcn.h: Likewise.
	* elf/elf.h: Likewise.
	* elf/link.h: Likewise.
	* gmon/sys/gmon.h: Likewise.
	* gmon/sys/gmon_out.h: Likewise.
	* grp/grp.h: Likewise.
	* inet/aliases.h: Likewise.
	* inet/arpa/ftp.h: Likewise.
	* inet/arpa/inet.h: Likewise.
	* inet/arpa/telnet.h: Likewise.
	* inet/arpa/tftp.h: Likewise.
	* inet/netinet/ether.h: Likewise.
	* inet/netinet/icmp6.h: Likewise.
	* inet/netinet/in.h: Likewise.
	* inet/netinet/ip6.h: Likewise.
	* inet/protocols/routed.h: Likewise.
	* inet/protocols/rwhod.h: Likewise.
	* inet/protocols/talkd.h: Likewise.
	* inet/protocols/timed.h: Likewise.
	* intl/libintl.h: Likewise.
	* io/fcntl.h: Likewise.
	* io/fts.h: Likewise.
	* io/ftw.h: Likewise.
	* io/sys/poll.h: Likewise.
	* io/sys/stat.h: Likewise.
	* io/sys/statfs.h: Likewise.
	* io/utime.h: Likewise.
	* linuxthreads/semaphore.h: Likewise.
	* linuxthreads/sysdeps/pthread/pthread.h: Likewise.
	* locale/locale.h: Likewise.
	* login/pty.h: Likewise.
	* login/utmp.h: Likewise.
	* malloc/malloc.h: Likewise.
	* malloc/obstack.h: Likewise.
	* math/complex.h: Likewise.
	* math/fenv.h: Likewise.
	* math/math.h: Likewise.
	* md5-crypt/md5.h: Likewise.
	* misc/ar.h: Likewise.
	* misc/err.h: Likewise.
	* misc/error.h: Likewise.
	* misc/fstab.h: Likewise.
	* misc/libgen.h: Likewise.
	* misc/nlist.h: Likewise.
	* misc/sys/cdefs.h: Likewise.
	* misc/sys/file.h: Likewise.
	* misc/sys/ioctl.h: Likewise.
	* misc/sys/queue.h: Likewise.
	* misc/sys/select.h: Likewise.
	* misc/sys/syslog.h: Likewise.
	* misc/sys/uio.h: Likewise.
	* misc/sysexits.h: Likewise.
	* misc/ttyent.h: Likewise.
	* nss/nss.h: Likewise.
	* posix/fnmatch.h: Likewise.
	* posix/getopt.h: Likewise.
	* posix/glob.h: Likewise.
	* posix/regex.h: Likewise.
	* posix/sys/times.h: Likewise.
	* posix/sys/types.h: Likewise.
	* posix/sys/utsname.h: Likewise.
	* posix/sys/wait.h: Likewise.
	* posix/tar.h: Likewise.
	* posix/unistd.h: Likewise.
	* posix/wordexp.h: Likewise.
	* pwd/pwd.h: Likewise.
	* resolv/arpa/nameser.h: Likewise.
	* resolv/netdb.h: Likewise.
	* resolv/resolv.h: Likewise.
	* resource/sys/resource.h: Likewise.
	* resource/sys/vlimit.h: Likewise.
	* resource/sys/vtimes.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* shadow/shadow.h: Likewise.
	* socket/sys/socket.h: Likewise.
	* socket/sys/un.h: Likewise.
	* stdlib/exit.h: Likewise.
	* stdlib/fmtmsg.h: Likewise.
	* stdlib/monetary.h: Likewise.
	* stdlib/stdlib.h: Likewise.
	* string/argz.h: Likewise.
	* string/envz.h: Likewise.
	* string/memory.h: Likewise.
	* string/string.h: Likewise.
	* string/strings.h: Likewise.
	* sunrpc/rpc/rpc.h: Likewise.
	* sunrpc/rpc/svc.h: Likewise.
	* sunrpc/rpc/types.h: Likewise.
	* sunrpc/rpc/xdr.h: Likewise.
	* termios/sys/ttychars.h: Likewise.
	* termios/termios.h: Likewise.

	* argp/argp-parse.c: <foo.h> -> <bits/foo.h>.
	* crypt/sysdeps/unix/crypt_util.c: Likewise.
	* dirent/dirent.h: Likewise.
	* elf/link.h: Likewise.
	* grp/fgetgrent.c: Likewise.
	* grp/grp.h: Likewise.
	* hurd/hurd/ioctl.h: Likewise.
	* inet/getnameinfo.c: Likewise.
	* inet/getnetgrent_r.c: Likewise.
	* inet/inet_ntoa.c: Likewise.
	* inet/netinet/in.h: Likewise.
	* io/fcntl.h: Likewise.
	* io/ftw.h: Likewise.
	* io/sys/stat.h: Likewise.
	* io/sys/statfs.h: Likewise.
	* io/utime.h: Likewise.
	* libio/_G_config.h: Likewise.
	* libio/libio.h: Likewise.
	* libio/libioP.h: Likewise.
	* libio/stdio.h: Likewise.
	* linuxthreads/lockfile.c: Likewise.
	* linuxthreads/semaphore.h: Likewise.
	* locale/duplocale.c: Likewise.
	* locale/freelocale.c: Likewise.
	* locale/lc-time.c: Likewise.
	* locale/setlocale.c: Likewise.
	* login/getutent_r.c: Likewise.
	* login/getutid_r.c: Likewise.
	* login/getutline_r.c: Likewise.
	* login/lastlog.h: Likewise.
	* login/pty.h: Likewise.
	* login/utmp.h: Likewise.
	* login/utmpname.c: Likewise.
	* malloc/mtrace.c: Likewise.
	* malloc/thread-m.h: Likewise.
	* math/complex.h: Likewise.
	* math/fenv.h: Likewise.
	* math/libm-test.c: Likewise.
	* math/math.h: Likewise.
	* misc/sgtty.h: Likewise.
	* misc/stab.h: Likewise.
	* misc/sys/ioctl.h: Likewise.
	* misc/sys/select.h: Likewise.
	* misc/sys/uio.h: Likewise.
	* misc/sys/ustat.h: Likewise.
	* misc/syslog.c: Likewise.
	* nis/nss_compat/compat-grp.c: Likewise.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/compat-spwd.c: Likewise.
	* nis/nss_nis/nis-alias.c: Likewise.
	* nis/nss_nis/nis-ethers.c: Likewise.
	* nis/nss_nis/nis-grp.c: Likewise.
	* nis/nss_nis/nis-hosts.c: Likewise.
	* nis/nss_nis/nis-netgrp.c: Likewise.
	* nis/nss_nis/nis-network.c: Likewise.
	* nis/nss_nis/nis-proto.c: Likewise.
	* nis/nss_nis/nis-publickey.c: Likewise.
	* nis/nss_nis/nis-pwd.c: Likewise.
	* nis/nss_nis/nis-rpc.c: Likewise.
	* nis/nss_nis/nis-service.c: Likewise.
	* nis/nss_nis/nis-spwd.c: Likewise.
	* nss_nisplus/nisplus-alias.c: Likewise.
	* nis/nss_nisplus/nisplus-ethers.c: Likewise.
	* nis/nss_nisplus/nisplus-grp.c: Likewise.
	* nis/nss_nisplus/nisplus-hosts.c: Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
	* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-pwd.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.
	* nis/nss_nisplus/nisplus-spwd.c: Likewise.
	* nis/ypclnt.c: Likewise.
	* nss/getXXbyYY.c: Likewise.
	* nss/getXXent.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* nss/nss_db/db-XXX.c: Likewise.
	* nss/nss_db/db-alias.c: Likewise.
	* nss/nss_db/db-netgrp.c: Likewise.
	* nss/nss_files/files-XXX.c: Likewise.
	* nss/nss_files/files-alias.c: Likewise.
	* nss/nsswitch.c: Likewise.
	* posix/sched.h: Likewise.
	* posix/sys/types.h: Likewise.
	* posix/sys/utsname.h: Likewise.
	* posix/sys/wait.h: Likewise.
	* posix/unistd.h: Likewise.
	* pwd/fgetpwent.c: Likewise.
	* pwd/pwd.h: Likewise.
	* resource/sys/resource.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* shadow/fgetspent.c: Likewise.
	* shadow/lckpwdf.c: Likewise.
	* shadow/sgetspent.c: Likewise.
	* signal/signal.h: Likewise.
	* signal/sigsetops.c: Likewise.
	* socket/sys/socket.h: Likewise.
	* socket/sys/un.h: Likewise.
	* stdio/stdio.h: Likewise.
	* stdio-common/vfprintf.c: Likewise.
	* stdio-common/vfscanf.c: Likewise.
	* stdlib/atexit.c: Likewise.
	* stdlib/fmtmsg.c: Likewise.
	* stdlib/random.c: Likewise.
	* string/endian.h: Likewise.
	* sysdeps/alpha/w_sqrt.S: Likewise.
	* sysdeps/arm/__longjmp.S: Likewise.
	* sysdeps/arm/setjmp.S: Likewise.
	* sysdeps/generic/abort.c: Likewise.
	* sysdeps/generic/netinet/ip.h: Likewise.
	* sysdeps/generic/setenv.c: Likewise.
	* generic/sys/mman.h: Likewise.
	* sysdeps/i386/__longjmp.S: Likewise.
	* sysdeps/i386/setjmp.S: Likewise.
	* sysdeps/mach/hurd/dirstream.h: Likewise.
	* sysdeps/mach/hurd/jmp-unwind.c: Likewise.
	* sysdeps/posix/mk-stdiolim.c: Likewise.
	* sysdeps/powerpc/__longjmp.S: Likewise.
	* sysdeps/powerpc/setjmp.S: Likewise.
	* sysdeps/sparc/__longjmp.S: Likewise.
	* sysdeps/sparc/setjmp.S: Likewise.
	* sysdeps/standalone/close.c: Likewise.
	* sysdeps/standalone/filedesc.h: Likewise.
	* sysdeps/standalone/open.c: Likewise.
	* sysdeps/unix/bsd/bsd4.4/tcsetattr.c: Likewise.
	* sysdeps/unix/bsd/m68k/sysdep.S: Likewise.
	* sysdeps/unix/bsd/osf/sys/mman.h: Likewise.
	* sysdeps/unix/bsd/sun/m68k/sethostid.S: Likewise.
	* sysdeps/unix/bsd/sun/sparc/sethostid.S: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/sys/mman.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/sys/mman.h: Likewise.
	* sysdeps/unix/bsd/vax/sysdep.S: Likewise.
	* sysdeps/unix/dirstream.h: Likewise.
	* sysdeps/unix/i386/sysdep.S: Likewise.
	* sysdeps/unix/mips/sysdep.S: Likewise.
	* sysdeps/unix/mk-local_lim.c: Likewise.
	* sysdeps/unix/sparc/sysdep.S: Likewise.
	* sysdeps/unix/sysv/irix4/sys/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/m68k/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/netinet/ip.h: Likewise.
	* sysdeps/unix/sysv/linux/netinet/tcp.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sys/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/sys/syscall.h: Likewise.
	* sysdeps/unix/sysv/linux/tcgetattr.c: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/sysconf.S: Likewise.
	* sysdeps/unix/sysv/sysv4/i386/sysdep.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S: Likewise.
	* sysvipc/sys/ipc.h: Likewise.
	* sysvipc/sys/msg.h: Likewise.
	* sysvipc/sys/sem.h: Likewise.
	* sysvipc/sys/shm.h: Likewise.
	* termios/termios.h: Likewise.
	* time/localtime.c: Likewise.
	* time/sys/time.h: Likewise.
	* time/time.h: Likewise.
	* time/tzset.c: Likewise.

	* sysdeps/unix/sysv/linux/arm/socket.S: socketcall.h change.
	* sysdeps/unix/sysv/linux/i386/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/m68k/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/socket.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/socket.S: Likewise.

	* Makefile (headers): foo.h -> bits/foo.h.
	* dirent/Makefile: Likewise.
	* elf/Makefile: Likewise.
	* io/Makefile: Likewise.
	* linuxthreads/Makefile: Likewise.
	* linuxthreads/sysdeps/pthread/Makefile: Likewise.
	* login/Makefile: Likewise.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* posix/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/Makefile: Likewise.
	* sysvipc/Makefile: Likewise.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* sysdeps/generic/Makefile (make_siglist-CFLAGS): Likewise.
	* sysdeps/posix/Makefile: stdio_lim.h -> bits/stdio_lim.h
	* sysdeps/unix/Makefile: Likewise with local_lim.h, errnos.h,
	ioctls.h, termbits.h.

	* sysdeps/unix/sysv/linux/Dist: sys/kernel_termios.h
	-> kernel_termios.h, sys/socketcall.h -> socketcall.h

	* elf/elf.h: Use <inttypes.h> definitions instead of __attribute__
	for getting the proper length on the ELF types to be friendly to
	non-gcc compilers.
	* posix/sys/types.h: Notice when int8_t and friends are defined
	and don't redefine them.
	* sysdeps/wordsize-32/inttypes.h: Likewise.
	* sysdeps/wordsize-64/inttypes.h: Likewise.

	* sysdeps/unix/sysv/linux/arm/profil-counter.h: Get sigcontext
	via <signal.h> instead.
	* sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/profil-counter.h: Likewise.

1997-06-20 17:59  Kazumoto Kojima  <kkojima@kk.info.kanagawa-u.ac.jp>

	* hurd/intr-msg.c: More 64bit changes.
	* mach/msg-destroy.c: Likewise.
	* sysdeps/mach/hurd/ioctl.c: Likewise.
	* sysdeps/mach/hurd/ioctls.h: Likewise.
	* sysdeps/mach/hurd/select.c: Likewise.
	* sysdeps/mach/hurd/statbuf.h: Likewise.

	* sysdeps/mach/hurd/mips/dl-machine.c: Hurd/MIPS64 patches.
	* sysdeps/mach/hurd/mips/exc2signal.c: Likewise.
	* sysdeps/mach/hurd/mips/init-fault.c: Likewise.
	* sysdeps/mach/hurd/mips/init-first.c: Likewise.
	* sysdeps/mach/hurd/mips/intr-msg.h: Likewise.
	* sysdeps/mach/hurd/mips/longjmp-ctx.c: Likewise.
	* sysdeps/mach/hurd/mips/longjmp-ts.c: Likewise.
	* sysdeps/mach/hurd/mips/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/mips/sigreturn.c: Likewise.
	* sysdeps/mach/hurd/mips/trampoline.c: Likewise.
	* sysdeps/mach/mips/cacheflush.c: Likewise.
	* sysdeps/mach/mips/machine-lock.h: Likewise.
	* sysdeps/mach/mips/machine-sp.h: Likewise.
	* sysdeps/mach/mips/syscall.S: Likewise.
	* sysdeps/mach/mips/sysdep.h: Likewise.
	* sysdeps/mach/mips/thread_state.h: Likewise.
	* sysdeps/mach/start.c: Likewise.

	* sysdeps/mips/dl-machine.h: MIPS changes.
	* sysdeps/mips/elf/start.S: Likewise.
	* sysdeps/mips/init-first.c: Likewise.
	* sysdeps/mips/fpu_control.h: Likewise.
	* sysdeps/mips/machine-gmon.h: Likewise.
	* sysdeps/mips/jmp_buf.h: Likewise.
	* sysdeps/mips/__longjmp.c: Likewise.
	* sysdeps/mips/bsd-_setjmp.S: Likewise.
	* sysdeps/mips/bsd-setjmp.S: Likewise.
	* sysdeps/mips/setjmp.S: Likewise.
	* sysdeps/mips/setjmp_aux.c: Likewise.
	* sysdeps/mips/mips64/gmp-mparam.h: Likewise.
	* sysdeps/mips/add_n.S: New file.
	* sysdeps/mips/addmul_1.S: Likewise.
	* sysdeps/mips/lshift.S: Likewise.
	* sysdeps/mips/mul_1.S: Likewise.
	* sysdeps/mips/rshift.S: Likewise.
	* sysdeps/mips/sub_n.S: Likewise.
	* sysdeps/mips/submul_1.S: Likewise.
	* sysdeps/mips/mips64/Implies: Likewise.
	* sysdeps/mips/mips64/add_n.S: Likewise.
	* sysdeps/mips/mips64/addmul_1.S: Likewise.
	* sysdeps/mips/mips64/lshift.S: Likewise.
	* sysdeps/mips/mips64/mul_1.S: Likewise.
	* sysdeps/mips/mips64/rshift.S: Likewise.
	* sysdeps/mips/mips64/sub_n.S: Likewise.
	* sysdeps/mips/mips64/submul_1.S: Likewise.
	* sysdeps/mips/add_n.S: Removed.
	* sysdeps/mips/addmul_1.S: Likewise.
	* sysdeps/mips/lshift.S: Likewise.
	* sysdeps/mips/mul_1.S: Likewise.
	* sysdeps/mips/rshift.S: Likewise.
	* sysdeps/mips/sub_n.S: Likewise.
	* sysdeps/mips/submul_1.S: Likewise.

	* nss/Makefile: Prepare for static NSS.
	* resolv/Makefile: Likewise.
	* nss/nsswitch.c: Add code for static NSS.
	* nss/function.def: Define functions for static NSS.

1997-06-19 11:10  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libc.map: Add yet more symbols.

1997-06-19 20:33  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/dl-lookup.c (_dl_lookup_versioned_symbol): Don't pass NULL
	as object name to _dl_signal_error.
	(do_lookup): Skip objects that could not be opened.

	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Check that the
	symbol was found.
	* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
	* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.

1997-06-20 03:13  Kazumoto Kojima  <kkojima@kk.info.kanagawa-u.ac.jp>

	* ctype/ctype-info.c: Use int32_t where `int' with 4 bytes is
	assumed.
	* ctype/ctype.h: Likewise.
	* math/math_private.h: Likewise.
	* inet/netinet/in.h: Likewise.
	* wctype/wctype.h: Likewise.

	* nss/Makefile: Only inhibit nss_files and nss_db modules if static
	NSS modules are not enabled.
	* resolv/Makefile: Likewise for nss_dns.
	* nss/function.def: New file.  List all available lookup functions
	for static NSS.
	* nss/nsswitch.c: Add code for static NSS.

1997-06-15 21:15  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm-test.c (gamma_test): Test for _SVID_ and for normal
	behaviour.

1997-06-15 20:32  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm.map: Add all necessary functions, correct existing entries.

1997-06-20 02:35  a sun  <asun@zoology.washington.edu>

	* sysdeps/unix/sysv/linux/netipx/ipx.h: Don't use kernel header.

1997-06-19 18:43  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_parse_spent):
	Compare pointer with NULL.

	* login/logout.c (logout): Compare pututline result with NULL.

	* inet/rcmd.c: Correct a few typos.  Reported by Erik Troan.
-rw-r--r--ChangeLog800
-rw-r--r--Makeconfig4
-rw-r--r--Makefile6
-rw-r--r--ansidecl.h108
-rw-r--r--argp/argp-fmtstream.h6
-rw-r--r--argp/argp-parse.c2
-rw-r--r--argp/argp.h6
-rw-r--r--bits/confname.h (renamed from sysdeps/generic/confname.h)0
-rw-r--r--bits/ioctl-types.h (renamed from sysdeps/generic/ioctl-types.h)10
-rw-r--r--bits/mathdef.h (renamed from sysdeps/generic/mathbits.h)8
-rw-r--r--bits/resource.h (renamed from sysdeps/generic/resourcebits.h)0
-rw-r--r--bits/sched.h35
-rw-r--r--bits/select.h (renamed from sysdeps/generic/selectbits.h)8
-rw-r--r--bits/sigaction.h (renamed from sysdeps/generic/sigaction.h)0
-rw-r--r--bits/sigset.h (renamed from sysdeps/generic/sigset.h)0
-rw-r--r--bits/sockaddr.h (renamed from sysdeps/generic/sockaddrcom.h)10
-rw-r--r--bits/socket.h (renamed from sysdeps/generic/socketbits.h)10
-rw-r--r--bits/statfs.h52
-rw-r--r--bits/termios.h (renamed from sysdeps/generic/termbits.h)5
-rw-r--r--bits/types.h (renamed from sysdeps/generic/gnu/types.h)19
-rw-r--r--bits/uio.h32
-rw-r--r--bits/ustat.h (renamed from sysdeps/generic/ustatbits.h)0
-rw-r--r--bits/utmp.h (renamed from sysdeps/generic/utmpbits.h)10
-rw-r--r--bits/utsname.h (renamed from sysdeps/generic/utsnamelen.h)0
-rw-r--r--bits/waitstatus.h (renamed from sysdeps/generic/waitstatus.h)12
-rw-r--r--catgets/nl_types.h1
-rw-r--r--config.h.in3
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure137
-rw-r--r--configure.in18
-rw-r--r--csu/Makefile6
-rw-r--r--ctype/ctype-info.c10
-rw-r--r--ctype/ctype.h7
-rw-r--r--db/db.h7
-rw-r--r--db/mpool.h5
-rw-r--r--db/ndbm.h6
-rw-r--r--dirent/Makefile2
-rw-r--r--dirent/dirent.h10
-rw-r--r--elf/Makefile2
-rw-r--r--elf/dl-lookup.c7
-rw-r--r--elf/dlfcn.h2
-rw-r--r--elf/elf.h43
-rw-r--r--elf/eval.c4
-rw-r--r--elf/link.h5
-rw-r--r--gmon/sys/gmon.h6
-rw-r--r--gmon/sys/gmon_out.h4
-rw-r--r--grp/fgetgrent.c2
-rw-r--r--grp/grp.h4
-rw-r--r--hurd/hurd/ioctl.h2
-rw-r--r--hurd/intr-msg.c4
-rw-r--r--include/aliases.h (renamed from aliases.h)0
-rw-r--r--include/alloca.h (renamed from alloca.h)0
-rw-r--r--include/argp.h (renamed from argp.h)0
-rw-r--r--include/argz.h (renamed from argz.h)0
-rw-r--r--include/arpa/ftp.h (renamed from arpa/ftp.h)0
-rw-r--r--include/arpa/inet.h (renamed from arpa/inet.h)0
-rw-r--r--include/arpa/nameser.h (renamed from arpa/nameser.h)0
-rw-r--r--include/arpa/telnet.h (renamed from arpa/telnet.h)0
-rw-r--r--include/arpa/tftp.h (renamed from arpa/tftp.h)0
-rw-r--r--include/assert.h (renamed from assert.h)0
-rw-r--r--include/bits/mathcalls.h1
-rw-r--r--include/bits/posix1_lim.h1
-rw-r--r--include/bits/posix2_lim.h1
-rw-r--r--include/bits/stab.def1
-rw-r--r--include/bits/xopen_lim.h (renamed from xopen_lim.h)8
-rw-r--r--include/ctype.h (renamed from ctype.h)0
-rw-r--r--include/db.h (renamed from db.h)0
-rw-r--r--include/dirent.h (renamed from dirent.h)0
-rw-r--r--include/dlfcn.h (renamed from dlfcn.h)0
-rw-r--r--include/elf.h (renamed from elf.h)0
-rw-r--r--include/endian.h (renamed from endian.h)0
-rw-r--r--include/envz.h (renamed from envz.h)0
-rw-r--r--include/err.h (renamed from err.h)0
-rw-r--r--include/errno.h (renamed from errno.h)14
-rw-r--r--include/error.h (renamed from error.h)0
-rw-r--r--include/fcntl.h (renamed from fcntl.h)0
-rw-r--r--include/features.h (renamed from features.h)77
-rw-r--r--include/fnmatch.h (renamed from fnmatch.h)0
-rw-r--r--include/ftw.h (renamed from ftw.h)0
-rw-r--r--include/getopt.h (renamed from getopt.h)0
-rw-r--r--include/glob.h (renamed from glob.h)0
-rw-r--r--include/gnu-versions.h (renamed from gnu-versions.h)0
-rw-r--r--include/grp.h (renamed from grp.h)0
-rw-r--r--include/langinfo.h (renamed from langinfo.h)0
-rw-r--r--include/libc-symbols.h (renamed from libc-symbols.h)0
-rw-r--r--include/libgen.h (renamed from libgen.h)0
-rw-r--r--include/libintl.h (renamed from libintl.h)0
-rw-r--r--include/limits.h (renamed from limits.h)6
-rw-r--r--include/linewrap.h (renamed from linewrap.h)0
-rw-r--r--include/link.h (renamed from link.h)0
-rw-r--r--include/locale.h (renamed from locale.h)0
-rw-r--r--include/malloc.h (renamed from malloc.h)0
-rw-r--r--include/math.h (renamed from math.h)0
-rw-r--r--include/mcheck.h (renamed from mcheck.h)0
-rw-r--r--include/memory.h (renamed from memory.h)0
-rw-r--r--include/monetary.h (renamed from monetary.h)0
-rw-r--r--include/netdb.h (renamed from netdb.h)0
-rw-r--r--include/netgroup.h (renamed from netgroup.h)0
-rw-r--r--include/netinet/ether.h (renamed from netinet/ether.h)0
-rw-r--r--include/netinet/in.h (renamed from netinet/in.h)0
-rw-r--r--include/nlist.h (renamed from nlist.h)0
-rw-r--r--include/nss.h (renamed from nss.h)0
-rw-r--r--include/nsswitch.h (renamed from nsswitch.h)0
-rw-r--r--include/obstack.h (renamed from obstack.h)0
-rw-r--r--include/poll.h (renamed from poll.h)0
-rw-r--r--include/printf.h (renamed from printf.h)0
-rw-r--r--include/protocols/routed.h (renamed from protocols/routed.h)0
-rw-r--r--include/protocols/rwhod.h (renamed from protocols/rwhod.h)0
-rw-r--r--include/protocols/talkd.h (renamed from protocols/talkd.h)0
-rw-r--r--include/protocols/timed.h (renamed from protocols/timed.h)0
-rw-r--r--include/pwd.h (renamed from pwd.h)0
-rw-r--r--include/regex.h (renamed from regex.h)0
-rw-r--r--include/resolv.h (renamed from resolv.h)0
-rw-r--r--include/rpc/auth_unix.h (renamed from rpc/auth_unix.h)0
-rw-r--r--include/rpc/clnt.h (renamed from rpc/clnt.h)0
-rw-r--r--include/rpc/netdb.h (renamed from rpc/netdb.h)0
-rw-r--r--include/rpc/pmap_clnt.h (renamed from rpc/pmap_clnt.h)0
-rw-r--r--include/rpc/pmap_prot.h (renamed from rpc/pmap_prot.h)0
-rw-r--r--include/rpc/pmap_rmt.h (renamed from rpc/pmap_rmt.h)0
-rw-r--r--include/rpc/rpc.h (renamed from rpc/rpc.h)0
-rw-r--r--include/rpc/rpc_msg.h (renamed from rpc/rpc_msg.h)0
-rw-r--r--include/rpc/svc.h (renamed from rpc/svc.h)0
-rw-r--r--include/rpc/svc_auth.h (renamed from rpc/svc_auth.h)0
-rw-r--r--include/rpc/types.h (renamed from rpc/types.h)0
-rw-r--r--include/rpc/xdr.h (renamed from rpc/xdr.h)0
-rw-r--r--include/sched.h (renamed from sched.h)0
-rw-r--r--include/search.h (renamed from search.h)0
-rw-r--r--include/set-hooks.h (renamed from set-hooks.h)31
-rw-r--r--include/setjmp.h (renamed from setjmp.h)0
-rw-r--r--include/sgtty.h (renamed from sgtty.h)0
-rw-r--r--include/shadow.h (renamed from shadow.h)0
-rw-r--r--include/signal.h (renamed from signal.h)0
-rw-r--r--include/stab.h1
-rw-r--r--include/stdio.h (renamed from stdio.h)0
-rw-r--r--include/stdlib.h (renamed from stdlib.h)0
-rw-r--r--include/string.h (renamed from string.h)0
-rw-r--r--include/strings.h (renamed from strings.h)0
-rw-r--r--include/sys/bitypes.h (renamed from sys/bitypes.h)0
-rw-r--r--include/sys/cdefs.h (renamed from sys/cdefs.h)0
-rw-r--r--include/sys/dir.h (renamed from sys/dir.h)0
-rw-r--r--include/sys/errno.h (renamed from sys/errno.h)0
-rw-r--r--include/sys/fcntl.h (renamed from sys/fcntl.h)0
-rw-r--r--include/sys/file.h (renamed from sys/file.h)0
-rw-r--r--include/sys/gmon.h (renamed from sys/gmon.h)0
-rw-r--r--include/sys/ioctl.h (renamed from sys/ioctl.h)0
-rw-r--r--include/sys/ipc.h (renamed from sys/ipc.h)0
-rw-r--r--include/sys/msg.h (renamed from sys/msg.h)0
-rw-r--r--include/sys/poll.h (renamed from sys/poll.h)0
-rw-r--r--include/sys/queue.h (renamed from sys/queue.h)0
-rw-r--r--include/sys/resource.h (renamed from sys/resource.h)0
-rw-r--r--include/sys/select.h (renamed from sys/select.h)0
-rw-r--r--include/sys/sem.h (renamed from sys/sem.h)0
-rw-r--r--include/sys/shm.h (renamed from sys/shm.h)0
-rw-r--r--include/sys/signal.h (renamed from sys/signal.h)0
-rw-r--r--include/sys/socket.h (renamed from sys/socket.h)0
-rw-r--r--include/sys/stat.h (renamed from sys/stat.h)0
-rw-r--r--include/sys/statfs.h (renamed from sys/statfs.h)0
-rw-r--r--include/sys/syslog.h (renamed from sys/syslog.h)0
-rw-r--r--include/sys/termios.h (renamed from sys/termios.h)0
-rw-r--r--include/sys/time.h (renamed from sys/time.h)0
-rw-r--r--include/sys/timeb.h (renamed from sys/timeb.h)0
-rw-r--r--include/sys/times.h (renamed from sys/times.h)0
-rw-r--r--include/sys/types.h (renamed from sys/types.h)0
-rw-r--r--include/sys/uio.h (renamed from sys/uio.h)0
-rw-r--r--include/sys/un.h (renamed from sys/un.h)0
-rw-r--r--include/sys/unistd.h (renamed from sys/unistd.h)0
-rw-r--r--include/sys/utsname.h (renamed from sys/utsname.h)0
-rw-r--r--include/sys/vlimit.h (renamed from sys/vlimit.h)0
-rw-r--r--include/sys/vtimes.h (renamed from sys/vtimes.h)0
-rw-r--r--include/sys/wait.h (renamed from sys/wait.h)0
-rw-r--r--include/syscall.h (renamed from syscall.h)0
-rw-r--r--include/sysexits.h (renamed from sysexits.h)0
-rw-r--r--include/syslog.h (renamed from syslog.h)0
-rw-r--r--include/tar.h (renamed from tar.h)0
-rw-r--r--include/termios.h (renamed from termios.h)0
-rw-r--r--include/time.h (renamed from time.h)0
-rw-r--r--include/ttyent.h (renamed from ttyent.h)0
-rw-r--r--include/unistd.h (renamed from unistd.h)0
-rw-r--r--include/utime.h (renamed from utime.h)0
-rw-r--r--include/utmp.h (renamed from utmp.h)0
-rw-r--r--include/values.h (renamed from values.h)2
-rw-r--r--include/wchar.h (renamed from wchar.h)0
-rw-r--r--include/wctype.h (renamed from wctype.h)0
-rw-r--r--include/wordexp.h (renamed from wordexp.h)0
-rw-r--r--include/xlocale.h (renamed from xlocale.h)0
-rw-r--r--inet/aliases.h2
-rw-r--r--inet/arpa/ftp.h6
-rw-r--r--inet/arpa/inet.h2
-rw-r--r--inet/arpa/telnet.h6
-rw-r--r--inet/arpa/tftp.h6
-rw-r--r--inet/getnameinfo.c2
-rw-r--r--inet/getnetgrent_r.c2
-rw-r--r--inet/inet_ntoa.c2
-rw-r--r--inet/netinet/ether.h4
-rw-r--r--inet/netinet/icmp6.h2
-rw-r--r--inet/netinet/in.h6
-rw-r--r--inet/netinet/ip6.h2
-rw-r--r--inet/protocols/routed.h6
-rw-r--r--inet/protocols/rwhod.h6
-rw-r--r--inet/protocols/talkd.h6
-rw-r--r--inet/protocols/timed.h6
-rw-r--r--intl/libintl.h2
-rw-r--r--io/Makefile4
-rw-r--r--io/fcntl.h6
-rw-r--r--io/fts.h6
-rw-r--r--io/ftw.h4
-rw-r--r--io/sys/poll.h4
-rw-r--r--io/sys/stat.h33
-rw-r--r--io/sys/statfs.h4
-rw-r--r--io/utime.h4
-rw-r--r--libc.map16
-rw-r--r--libio/_G_config.h4
-rw-r--r--libio/libio.h2
-rw-r--r--libio/libioP.h2
-rw-r--r--libio/stdio.h4
-rw-r--r--locale/duplocale.c2
-rw-r--r--locale/freelocale.c2
-rw-r--r--locale/lc-time.c2
-rw-r--r--locale/locale.h2
-rw-r--r--locale/programs/locale.c2
-rw-r--r--locale/setlocale.c2
-rw-r--r--login/Makefile2
-rw-r--r--login/getutent_r.c6
-rw-r--r--login/getutid_r.c2
-rw-r--r--login/getutline_r.c2
-rw-r--r--login/lastlog.h2
-rw-r--r--login/logout.c2
-rw-r--r--login/pty.h4
-rw-r--r--login/utmp-private.h3
-rw-r--r--login/utmp.h7
-rw-r--r--login/utmpname.c2
-rw-r--r--mach/msg-destroy.c24
-rw-r--r--malloc/malloc.h2
-rw-r--r--malloc/mtrace.c2
-rw-r--r--malloc/obstack.h6
-rw-r--r--malloc/thread-m.h2
-rw-r--r--manual/libc.texinfo9
-rw-r--r--math/Makefile12
-rw-r--r--math/bits/cmathcalls.h (renamed from math/cmathcalls.h)2
-rw-r--r--math/bits/mathcalls.h (renamed from math/mathcalls.h)2
-rw-r--r--math/complex.h14
-rw-r--r--math/fenv.h4
-rw-r--r--math/libm-test.c58
-rw-r--r--math/libm.map105
-rw-r--r--math/math.h22
-rw-r--r--math/math_private.h10
-rw-r--r--mathcalls.h1
-rw-r--r--md5-crypt/md5.h2
-rw-r--r--misc/Makefile10
-rw-r--r--misc/ar.h2
-rw-r--r--misc/bits/stab.def (renamed from misc/stab.def)0
-rw-r--r--misc/err.h5
-rw-r--r--misc/error.h6
-rw-r--r--misc/fstab.h6
-rw-r--r--misc/libgen.h2
-rw-r--r--misc/nlist.h2
-rw-r--r--misc/sgtty.h3
-rw-r--r--misc/stab.h2
-rw-r--r--misc/sys/cdefs.h2
-rw-r--r--misc/sys/dir.h2
-rw-r--r--misc/sys/file.h2
-rw-r--r--misc/sys/ioctl.h16
-rw-r--r--misc/sys/queue.h6
-rw-r--r--misc/sys/select.h6
-rw-r--r--misc/sys/syslog.h5
-rw-r--r--misc/sys/uio.h4
-rw-r--r--misc/sys/ustat.h10
-rw-r--r--misc/sysexits.h6
-rw-r--r--misc/syslog.c2
-rw-r--r--misc/ttyent.h6
-rw-r--r--nis/nss_compat/compat-grp.c2
-rw-r--r--nis/nss_compat/compat-pwd.c2
-rw-r--r--nis/nss_compat/compat-spwd.c2
-rw-r--r--nis/nss_nis/nis-alias.c2
-rw-r--r--nis/nss_nis/nis-ethers.c2
-rw-r--r--nis/nss_nis/nis-grp.c2
-rw-r--r--nis/nss_nis/nis-hosts.c2
-rw-r--r--nis/nss_nis/nis-netgrp.c2
-rw-r--r--nis/nss_nis/nis-network.c2
-rw-r--r--nis/nss_nis/nis-proto.c2
-rw-r--r--nis/nss_nis/nis-publickey.c4
-rw-r--r--nis/nss_nis/nis-pwd.c2
-rw-r--r--nis/nss_nis/nis-rpc.c2
-rw-r--r--nis/nss_nis/nis-service.c2
-rw-r--r--nis/nss_nis/nis-spwd.c2
-rw-r--r--nis/nss_nisplus/nisplus-alias.c2
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c2
-rw-r--r--nis/nss_nisplus/nisplus-grp.c8
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c2
-rw-r--r--nis/nss_nisplus/nisplus-netgrp.c24
-rw-r--r--nis/nss_nisplus/nisplus-network.c2
-rw-r--r--nis/nss_nisplus/nisplus-proto.c2
-rw-r--r--nis/nss_nisplus/nisplus-pwd.c2
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c2
-rw-r--r--nis/nss_nisplus/nisplus-service.c2
-rw-r--r--nis/nss_nisplus/nisplus-spwd.c4
-rw-r--r--nis/ypclnt.c2
-rw-r--r--nss/Makefile6
-rw-r--r--nss/function.def95
-rw-r--r--nss/getXXbyYY.c2
-rw-r--r--nss/getXXent.c2
-rw-r--r--nss/getXXent_r.c2
-rw-r--r--nss/nss.h2
-rw-r--r--nss/nss_db/db-XXX.c2
-rw-r--r--nss/nss_db/db-alias.c2
-rw-r--r--nss/nss_db/db-netgrp.c2
-rw-r--r--nss/nss_files/files-XXX.c2
-rw-r--r--nss/nss_files/files-alias.c2
-rw-r--r--nss/nsswitch.c58
-rw-r--r--po/ko.po763
-rw-r--r--posix/Makefile11
-rw-r--r--posix/bits/posix1_lim.h (renamed from posix/posix1_lim.h)11
-rw-r--r--posix/bits/posix2_lim.h (renamed from posix/posix2_lim.h)9
-rw-r--r--posix/fnmatch.h1
-rw-r--r--posix/getopt.h2
-rw-r--r--posix/glob.h1
-rw-r--r--posix/regex.h6
-rw-r--r--posix/sched.h4
-rw-r--r--posix/sys/times.h2
-rw-r--r--posix/sys/types.h29
-rw-r--r--posix/sys/utsname.h5
-rw-r--r--posix/sys/wait.h8
-rw-r--r--posix/tar.h1
-rw-r--r--posix/unistd.h8
-rw-r--r--posix/wordexp.h2
-rw-r--r--posix1_lim.h1
-rw-r--r--posix2_lim.h1
-rw-r--r--pwd/fgetpwent.c2
-rw-r--r--pwd/pwd.h4
-rw-r--r--resolv/Makefile2
-rw-r--r--resolv/arpa/nameser.h6
-rw-r--r--resolv/netdb.h2
-rw-r--r--resolv/resolv.h6
-rw-r--r--resource/Makefile2
-rw-r--r--resource/sys/resource.h6
-rw-r--r--resource/sys/vlimit.h4
-rw-r--r--resource/sys/vtimes.h2
-rw-r--r--setjmp/Makefile2
-rw-r--r--setjmp/setjmp.h7
-rw-r--r--shadow/fgetspent.c2
-rw-r--r--shadow/lckpwdf.c2
-rw-r--r--shadow/sgetspent.c2
-rw-r--r--shadow/shadow.h2
-rw-r--r--signal/Makefile3
-rw-r--r--signal/signal.h10
-rw-r--r--signal/sigsetops.c2
-rw-r--r--socket/Makefile2
-rw-r--r--socket/sys/socket.h4
-rw-r--r--socket/sys/un.h4
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/vfprintf.c2
-rw-r--r--stdio-common/vfscanf.c2
-rw-r--r--stdio/stdio.h4
-rw-r--r--stdlib/alloca.h1
-rw-r--r--stdlib/atexit.c2
-rw-r--r--stdlib/exit.h1
-rw-r--r--stdlib/fmtmsg.c2
-rw-r--r--stdlib/fmtmsg.h2
-rw-r--r--stdlib/monetary.h2
-rw-r--r--stdlib/random.c2
-rw-r--r--stdlib/stdlib.h2
-rw-r--r--string/argz.h4
-rw-r--r--string/endian.h3
-rw-r--r--string/envz.h6
-rw-r--r--string/memory.h2
-rw-r--r--string/string.h2
-rw-r--r--string/strings.h2
-rw-r--r--sunrpc/rpc/auth_unix.h2
-rw-r--r--sunrpc/rpc/clnt.h2
-rw-r--r--sunrpc/rpc/netdb.h2
-rw-r--r--sunrpc/rpc/pmap_clnt.h1
-rw-r--r--sunrpc/rpc/pmap_prot.h2
-rw-r--r--sunrpc/rpc/pmap_rmt.h2
-rw-r--r--sunrpc/rpc/rpc.h7
-rw-r--r--sunrpc/rpc/rpc_msg.h1
-rw-r--r--sunrpc/rpc/svc.h6
-rw-r--r--sunrpc/rpc/svc_auth.h2
-rw-r--r--sunrpc/rpc/types.h6
-rw-r--r--sunrpc/rpc/xdr.h6
-rw-r--r--sysdeps/alpha/bits/endian.h (renamed from sysdeps/alpha/bytesex.h)0
-rw-r--r--sysdeps/alpha/bits/setjmp.h (renamed from sysdeps/alpha/jmp_buf.h)0
-rw-r--r--sysdeps/alpha/fpu/bits/fenv.h (renamed from sysdeps/alpha/fpu/fenvbits.h)9
-rw-r--r--sysdeps/alpha/fpu/bits/mathdef.h64
-rw-r--r--sysdeps/alpha/fpu/bits/mathinline.h (renamed from sysdeps/alpha/__math.h)0
-rw-r--r--sysdeps/alpha/w_sqrt.S2
-rw-r--r--sysdeps/arm/__longjmp.S2
-rw-r--r--sysdeps/arm/bits/endian.h (renamed from sysdeps/arm/bytesex.h)0
-rw-r--r--sysdeps/arm/bits/setjmp.h (renamed from sysdeps/arm/jmp_buf.h)0
-rw-r--r--sysdeps/arm/setjmp.S2
-rw-r--r--sysdeps/generic/Makefile2
-rw-r--r--sysdeps/generic/abort.c2
-rw-r--r--sysdeps/generic/bits/confname.h325
-rw-r--r--sysdeps/generic/bits/ioctl-types.h121
-rw-r--r--sysdeps/generic/bits/mathdef.h40
-rw-r--r--sysdeps/generic/bits/resource.h146
-rw-r--r--sysdeps/generic/bits/sched.h35
-rw-r--r--sysdeps/generic/bits/select.h29
-rw-r--r--sysdeps/generic/bits/sigaction.h50
-rw-r--r--sysdeps/generic/bits/sigset.h81
-rw-r--r--sysdeps/generic/bits/sockaddr.h41
-rw-r--r--sysdeps/generic/bits/socket.h200
-rw-r--r--sysdeps/generic/bits/statfs.h52
-rw-r--r--sysdeps/generic/bits/termios.h230
-rw-r--r--sysdeps/generic/bits/types.h94
-rw-r--r--sysdeps/generic/bits/uio.h32
-rw-r--r--sysdeps/generic/bits/ustat.h (renamed from sysdeps/generic/schedbits.h)27
-rw-r--r--sysdeps/generic/bits/utmp.h53
-rw-r--r--sysdeps/generic/bits/utsname.h3
-rw-r--r--sysdeps/generic/bits/waitstatus.h104
-rw-r--r--sysdeps/generic/iovec.h9
-rw-r--r--sysdeps/generic/netinet/ip.h2
-rw-r--r--sysdeps/generic/setenv.c2
-rw-r--r--sysdeps/generic/statfsbuf.h49
-rw-r--r--sysdeps/generic/sys/mman.h2
-rw-r--r--sysdeps/gnu/bits/utmp.h (renamed from sysdeps/gnu/utmpbits.h)0
-rw-r--r--sysdeps/i386/__longjmp.S2
-rw-r--r--sysdeps/i386/bits/endian.h (renamed from sysdeps/i386/bytesex.h)0
-rw-r--r--sysdeps/i386/bits/huge_val.h (renamed from sysdeps/i386/huge_val.h)8
-rw-r--r--sysdeps/i386/bits/select.h (renamed from sysdeps/i386/selectbits.h)8
-rw-r--r--sysdeps/i386/bits/setjmp.h (renamed from sysdeps/i386/jmp_buf.h)0
-rw-r--r--sysdeps/i386/dl-machine.h4
-rw-r--r--sysdeps/i386/fpu/bits/fenv.h (renamed from sysdeps/i386/fpu/fenvbits.h)8
-rw-r--r--sysdeps/i386/fpu/bits/mathdef.h (renamed from sysdeps/i386/fpu/mathbits.h)8
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h (renamed from sysdeps/i386/fpu/__math.h)6
-rw-r--r--sysdeps/i386/setjmp.S2
-rw-r--r--sysdeps/ieee754/bits/huge_val.h (renamed from sysdeps/ieee754/huge_val.h)13
-rw-r--r--sysdeps/ieee754/bits/nan.h (renamed from sysdeps/ieee754/nan.h)33
-rw-r--r--sysdeps/libm-ieee754/k_standard.c88
-rw-r--r--sysdeps/libm-ieee754/w_gamma.c6
-rw-r--r--sysdeps/libm-ieee754/w_gammaf.c6
-rw-r--r--sysdeps/libm-ieee754/w_gammal.c6
-rw-r--r--sysdeps/m68k/bits/endian.h (renamed from sysdeps/m68k/bytesex.h)0
-rw-r--r--sysdeps/m68k/bits/huge_val.h (renamed from sysdeps/m68k/huge_val.h)26
-rw-r--r--sysdeps/m68k/bits/setjmp.h (renamed from sysdeps/m68k/jmp_buf.h)0
-rw-r--r--sysdeps/m68k/dl-machine.h4
-rw-r--r--sysdeps/m68k/fpu/bits/fenv.h (renamed from sysdeps/m68k/fpu/fenvbits.h)8
-rw-r--r--sysdeps/m68k/fpu/bits/mathdef.h (renamed from sysdeps/m68k/fpu/mathbits.h)8
-rw-r--r--sysdeps/m68k/fpu/bits/mathinline.h (renamed from sysdeps/m68k/fpu/__math.h)0
-rw-r--r--sysdeps/m68k/fpu/switch/bits/mathinline.h (renamed from sysdeps/m68k/fpu/switch/__math.h)0
-rw-r--r--sysdeps/mach/bits/libc-lock.h (renamed from sysdeps/mach/libc-lock.h)6
-rw-r--r--sysdeps/mach/hurd/alpha/bits/sigcontext.h (renamed from sysdeps/mach/hurd/alpha/sigcontext.h)0
-rw-r--r--sysdeps/mach/hurd/bits/errno.h (renamed from sysdeps/mach/hurd/errnos.h)0
-rw-r--r--sysdeps/mach/hurd/bits/fcntl.h (renamed from sysdeps/mach/hurd/fcntlbits.h)10
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h (renamed from sysdeps/mach/hurd/ioctls.h)44
-rw-r--r--sysdeps/mach/hurd/bits/local_lim.h (renamed from sysdeps/mach/hurd/local_lim.h)0
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h (renamed from sysdeps/mach/hurd/posix_opt.h)0
-rw-r--r--sysdeps/mach/hurd/bits/stat.h (renamed from sysdeps/mach/hurd/statbuf.h)17
-rw-r--r--sysdeps/mach/hurd/dirstream.h2
-rw-r--r--sysdeps/mach/hurd/hppa/bits/sigcontext.h (renamed from sysdeps/mach/hurd/hppa/sigcontext.h)0
-rw-r--r--sysdeps/mach/hurd/i386/bits/sigcontext.h (renamed from sysdeps/mach/hurd/i386/sigcontext.h)0
-rw-r--r--sysdeps/mach/hurd/ioctl.c8
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c2
-rw-r--r--sysdeps/mach/hurd/mips/bits/sigcontext.h (renamed from sysdeps/mach/hurd/mips/sigcontext.h)0
-rw-r--r--sysdeps/mach/hurd/mips/dl-machine.c131
-rw-r--r--sysdeps/mach/hurd/mips/exc2signal.c65
-rw-r--r--sysdeps/mach/hurd/mips/init-fault.c41
-rw-r--r--sysdeps/mach/hurd/mips/init-first.c407
-rw-r--r--sysdeps/mach/hurd/mips/intr-msg.h127
-rw-r--r--sysdeps/mach/hurd/mips/longjmp-ctx.c41
-rw-r--r--sysdeps/mach/hurd/mips/longjmp-ts.c34
-rw-r--r--sysdeps/mach/hurd/mips/sigreturn.c100
-rw-r--r--sysdeps/mach/hurd/mips/trampoline.c217
-rw-r--r--sysdeps/mach/hurd/select.c2
-rw-r--r--sysdeps/mach/mips/cacheflush.c30
-rw-r--r--sysdeps/mach/mips/machine-lock.h63
-rw-r--r--sysdeps/mach/mips/machine-sp.h34
-rw-r--r--sysdeps/mach/mips/syscall.S57
-rw-r--r--sysdeps/mach/mips/sysdep.h58
-rw-r--r--sysdeps/mach/mips/thread_state.h33
-rw-r--r--sysdeps/mach/start.c3
-rw-r--r--sysdeps/mips/add_n.S121
-rw-r--r--sysdeps/mips/add_n.s120
-rw-r--r--sysdeps/mips/addmul_1.S98
-rw-r--r--sysdeps/mips/addmul_1.s97
-rw-r--r--sysdeps/mips/bits/endian.h (renamed from sysdeps/mips/bytesex.h)0
-rw-r--r--sysdeps/mips/bits/setjmp.h53
-rw-r--r--sysdeps/mips/bsd-_setjmp.S43
-rw-r--r--sysdeps/mips/bsd-setjmp.S39
-rw-r--r--sysdeps/mips/dec/bits/endian.h (renamed from sysdeps/mips/dec/bytesex.h)0
-rw-r--r--sysdeps/mips/dl-machine.h387
-rw-r--r--sysdeps/mips/elf/start.S181
-rw-r--r--sysdeps/mips/fpu_control.h96
-rw-r--r--sysdeps/mips/init-first.c64
-rw-r--r--sysdeps/mips/jmp_buf.h53
-rw-r--r--sysdeps/mips/lshift.S97
-rw-r--r--sysdeps/mips/lshift.s95
-rw-r--r--sysdeps/mips/machine-gmon.h57
-rw-r--r--sysdeps/mips/mips64/Implies1
-rw-r--r--sysdeps/mips/mips64/__longjmp.c85
-rw-r--r--sysdeps/mips/mips64/add_n.S129
-rw-r--r--sysdeps/mips/mips64/addmul_1.S106
-rw-r--r--sysdeps/mips/mips64/bits/setjmp.h54
-rw-r--r--sysdeps/mips/mips64/bsd-_setjmp.S36
-rw-r--r--sysdeps/mips/mips64/bsd-setjmp.S36
-rw-r--r--sysdeps/mips/mips64/gmp-mparam.h4
-rw-r--r--sysdeps/mips/mips64/lshift.S104
-rw-r--r--sysdeps/mips/mips64/mul_1.S94
-rw-r--r--sysdeps/mips/mips64/rshift.S101
-rw-r--r--sysdeps/mips/mips64/setjmp.S35
-rw-r--r--sysdeps/mips/mips64/setjmp_aux.c67
-rw-r--r--sysdeps/mips/mips64/sub_n.S129
-rw-r--r--sysdeps/mips/mips64/submul_1.S106
-rw-r--r--sysdeps/mips/mipsel/bits/endian.h (renamed from sysdeps/mips/mipsel/bytesex.h)0
-rw-r--r--sysdeps/mips/mul_1.S86
-rw-r--r--sysdeps/mips/mul_1.s85
-rw-r--r--sysdeps/mips/p40/bits/endian.h (renamed from sysdeps/mips/p40/bytesex.h)0
-rw-r--r--sysdeps/mips/rshift.S94
-rw-r--r--sysdeps/mips/rshift.s92
-rw-r--r--sysdeps/mips/setjmp.S43
-rw-r--r--sysdeps/mips/setjmp_aux.c27
-rw-r--r--sysdeps/mips/sub_n.S121
-rw-r--r--sysdeps/mips/sub_n.s120
-rw-r--r--sysdeps/mips/submul_1.S98
-rw-r--r--sysdeps/mips/submul_1.s97
-rw-r--r--sysdeps/posix/Makefile12
-rw-r--r--sysdeps/posix/mk-stdiolim.c8
-rw-r--r--sysdeps/powerpc/__longjmp.S2
-rw-r--r--sysdeps/powerpc/bits/fenv.h (renamed from sysdeps/powerpc/fenvbits.h)8
-rw-r--r--sysdeps/powerpc/bits/mathdef.h (renamed from sysdeps/powerpc/mathbits.h)8
-rw-r--r--sysdeps/powerpc/bits/mathinline.h (renamed from sysdeps/powerpc/__math.h)0
-rw-r--r--sysdeps/powerpc/bits/setjmp.h (renamed from sysdeps/powerpc/jmp_buf.h)2
-rw-r--r--sysdeps/powerpc/dl-machine.h4
-rw-r--r--sysdeps/powerpc/setjmp.S2
-rw-r--r--sysdeps/sparc/__longjmp.S30
-rw-r--r--sysdeps/sparc/bits/endian.h (renamed from sysdeps/sparc/bytesex.h)0
-rw-r--r--sysdeps/sparc/bits/setjmp.h (renamed from sysdeps/sparc/jmp_buf.h)0
-rw-r--r--sysdeps/sparc/setjmp.S2
-rw-r--r--sysdeps/standalone/arm/bits/errno.h (renamed from sysdeps/standalone/arm/errnos.h)0
-rw-r--r--sysdeps/standalone/bits/stdio_lim.h (renamed from sysdeps/standalone/stdio_lim.h)0
-rw-r--r--sysdeps/standalone/close.c2
-rw-r--r--sysdeps/standalone/filedesc.h2
-rw-r--r--sysdeps/standalone/open.c2
-rw-r--r--sysdeps/stub/bits/dirent.h (renamed from sysdeps/stub/direntry.h)0
-rw-r--r--sysdeps/stub/bits/elfclass.h (renamed from sysdeps/stub/elfclass.h)0
-rw-r--r--sysdeps/stub/bits/endian.h (renamed from sysdeps/stub/bytesex.h)4
-rw-r--r--sysdeps/stub/bits/errno.h (renamed from sysdeps/stub/errnos.h)0
-rw-r--r--sysdeps/stub/bits/fcntl.h (renamed from sysdeps/stub/fcntlbits.h)11
-rw-r--r--sysdeps/stub/bits/fenv.h (renamed from sysdeps/stub/fenvbits.h)8
-rw-r--r--sysdeps/stub/bits/huge_val.h (renamed from sysdeps/stub/huge_val.h)8
-rw-r--r--sysdeps/stub/bits/ioctls.h (renamed from sysdeps/stub/ioctls.h)0
-rw-r--r--sysdeps/stub/bits/ipc.h (renamed from sysdeps/stub/sys/ipc_buf.h)0
-rw-r--r--sysdeps/stub/bits/libc-lock.h (renamed from sysdeps/stub/libc-lock.h)6
-rw-r--r--sysdeps/stub/bits/local_lim.h (renamed from sysdeps/stub/local_lim.h)0
-rw-r--r--sysdeps/stub/bits/mathinline.h (renamed from sysdeps/stub/__math.h)0
-rw-r--r--sysdeps/stub/bits/msq.h47
-rw-r--r--sysdeps/stub/bits/nan.h5
-rw-r--r--sysdeps/stub/bits/posix_opt.h (renamed from sysdeps/stub/posix_opt.h)0
-rw-r--r--sysdeps/stub/bits/sem.h (renamed from sysdeps/stub/sys/sem_buf.h)10
-rw-r--r--sysdeps/stub/bits/setjmp.h (renamed from sysdeps/stub/jmp_buf.h)0
-rw-r--r--sysdeps/stub/bits/shm.h (renamed from sysdeps/stub/sys/shm_buf.h)10
-rw-r--r--sysdeps/stub/bits/sigcontext.h (renamed from sysdeps/stub/sigcontext.h)0
-rw-r--r--sysdeps/stub/bits/signum.h (renamed from sysdeps/stub/signum.h)0
-rw-r--r--sysdeps/stub/bits/stat.h (renamed from sysdeps/stub/statbuf.h)13
-rw-r--r--sysdeps/stub/bits/stdio_lim.h (renamed from sysdeps/stub/stdio_lim.h)0
-rw-r--r--sysdeps/stub/bits/time.h (renamed from sysdeps/stub/timebits.h)12
-rw-r--r--sysdeps/stub/bits/waitflags.h (renamed from sysdeps/stub/waitflags.h)9
-rw-r--r--sysdeps/stub/nan.h6
-rw-r--r--sysdeps/stub/sys/msq_buf.h47
-rw-r--r--sysdeps/unix/Makefile49
-rw-r--r--sysdeps/unix/bsd/bits/dirent.h (renamed from sysdeps/unix/bsd/direntry.h)0
-rw-r--r--sysdeps/unix/bsd/bits/fcntl.h (renamed from sysdeps/unix/bsd/fcntlbits.h)11
-rw-r--r--sysdeps/unix/bsd/bits/posix_opt.h (renamed from sysdeps/unix/bsd/posix_opt.h)0
-rw-r--r--sysdeps/unix/bsd/bits/signum.h (renamed from sysdeps/unix/bsd/signum.h)0
-rw-r--r--sysdeps/unix/bsd/bits/stat.h (renamed from sysdeps/unix/bsd/statbuf.h)11
-rw-r--r--sysdeps/unix/bsd/bits/waitflags.h (renamed from sysdeps/unix/bsd/waitflags.h)9
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/dirent.h (renamed from sysdeps/unix/bsd/bsd4.4/direntry.h)0
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/errno.h (renamed from sysdeps/unix/bsd/bsd4.4/errnos.h)0
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/fcntl.h (renamed from sysdeps/unix/bsd/bsd4.4/fcntlbits.h)11
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/ioctls.h (renamed from sysdeps/unix/bsd/bsd4.4/ioctls.h)0
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/sockaddr.h (renamed from sysdeps/unix/bsd/bsd4.4/sockaddrcom.h)10
-rw-r--r--sysdeps/unix/bsd/bsd4.4/tcgetattr.c2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/tcsetattr.c2
-rw-r--r--sysdeps/unix/bsd/m68k/sysdep.S2
-rw-r--r--sysdeps/unix/bsd/osf/alpha/bits/stat.h (renamed from sysdeps/unix/bsd/osf/alpha/statbuf.h)14
-rw-r--r--sysdeps/unix/bsd/osf/bits/sigaction.h (renamed from sysdeps/unix/bsd/osf/sigaction.h)0
-rw-r--r--sysdeps/unix/bsd/osf/sys/mman.h2
-rw-r--r--sysdeps/unix/bsd/sun/bits/signum.h (renamed from sysdeps/unix/bsd/sun/signum.h)0
-rw-r--r--sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h (renamed from sysdeps/unix/bsd/sun/m68k/sigcontext.h)0
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sethostid.S2
-rw-r--r--sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h (renamed from sysdeps/unix/bsd/sun/sparc/sigcontext.h)0
-rw-r--r--sysdeps/unix/bsd/sun/sparc/sethostid.S4
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h (renamed from sysdeps/unix/bsd/sun/sunos4/fcntlbits.h)11
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h (renamed from sysdeps/unix/bsd/sun/sunos4/resourcebits.h)0
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/termios.h (renamed from sysdeps/unix/bsd/sun/sunos4/termbits.h)0
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/utsname.h (renamed from sysdeps/unix/bsd/sun/sunos4/utsnamelen.h)0
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/sys/mman.h2
-rw-r--r--sysdeps/unix/bsd/ultrix4/bits/fcntl.h (renamed from sysdeps/unix/bsd/ultrix4/fcntlbits.h)11
-rw-r--r--sysdeps/unix/bsd/ultrix4/bits/posix_opt.h (renamed from sysdeps/unix/bsd/ultrix4/posix_opt.h)0
-rw-r--r--sysdeps/unix/bsd/ultrix4/bits/utsname.h (renamed from sysdeps/unix/bsd/ultrix4/utsnamelen.h)0
-rw-r--r--sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h (renamed from sysdeps/unix/bsd/ultrix4/mips/sigcontext.h)0
-rw-r--r--sysdeps/unix/bsd/ultrix4/sys/mman.h2
-rw-r--r--sysdeps/unix/bsd/vax/sysdep.S2
-rw-r--r--sysdeps/unix/common/bits/dirent.h (renamed from sysdeps/unix/common/direntry.h)0
-rw-r--r--sysdeps/unix/common/bits/fcntl.h (renamed from sysdeps/unix/common/fcntlbits.h)11
-rw-r--r--sysdeps/unix/dirstream.h2
-rw-r--r--sysdeps/unix/i386/sysdep.S2
-rw-r--r--sysdeps/unix/mips/sysdep.S2
-rw-r--r--sysdeps/unix/mk-local_lim.c3
-rw-r--r--sysdeps/unix/sparc/sysdep.S2
-rw-r--r--sysdeps/unix/sysv/bits/dirent.h (renamed from sysdeps/unix/sysv/direntry.h)0
-rw-r--r--sysdeps/unix/sysv/bits/fcntl.h (renamed from sysdeps/unix/sysv/fcntlbits.h)10
-rw-r--r--sysdeps/unix/sysv/bits/local_lim.h (renamed from sysdeps/unix/sysv/local_lim.h)0
-rw-r--r--sysdeps/unix/sysv/bits/signum.h (renamed from sysdeps/unix/sysv/signum.h)0
-rw-r--r--sysdeps/unix/sysv/bits/stat.h (renamed from sysdeps/unix/sysv/statbuf.h)12
-rw-r--r--sysdeps/unix/sysv/bits/utmp.h57
-rw-r--r--sysdeps/unix/sysv/bits/utsname.h (renamed from sysdeps/unix/sysv/utsnamelen.h)0
-rw-r--r--sysdeps/unix/sysv/irix4/bits/confname.h (renamed from sysdeps/unix/sysv/irix4/confname.h)0
-rw-r--r--sysdeps/unix/sysv/irix4/bits/fcntl.h (renamed from sysdeps/unix/sysv/irix4/fcntlbits.h)11
-rw-r--r--sysdeps/unix/sysv/irix4/bits/signum.h (renamed from sysdeps/unix/sysv/irix4/signum.h)0
-rw-r--r--sysdeps/unix/sysv/irix4/bits/stat.h (renamed from sysdeps/unix/sysv/irix4/statbuf.h)12
-rw-r--r--sysdeps/unix/sysv/irix4/sys/mman.h2
-rw-r--r--sysdeps/unix/sysv/linux/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (renamed from sysdeps/unix/sysv/linux/alpha/fcntlbits.h)8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ioctls.h (renamed from sysdeps/unix/sysv/linux/sparc/ioctls.h)12
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ipc.h (renamed from sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h)0
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/sigaction.h (renamed from sysdeps/unix/sysv/linux/alpha/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/signum.h (renamed from sysdeps/unix/sysv/linux/alpha/signum.h)0
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/stat.h (renamed from sysdeps/unix/sysv/linux/alpha/statbuf.h)10
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/termios.h (renamed from sysdeps/unix/sysv/linux/alpha/termbits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/time.h (renamed from sysdeps/unix/sysv/linux/alpha/timebits.h)12
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h (renamed from sysdeps/unix/sysv/linux/alpha/gnu/types.h)33
-rw-r--r--sysdeps/unix/sysv/linux/alpha/brk.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_termios.h (renamed from sysdeps/unix/sysv/linux/powerpc/sys/kernel_termios.h)15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h25
-rw-r--r--sysdeps/unix/sysv/linux/arm/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/arm/profil-counter.h2
-rw-r--r--sysdeps/unix/sysv/linux/arm/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/bits/dirent.h (renamed from sysdeps/unix/sysv/linux/direntry.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/errno.h (renamed from sysdeps/unix/sysv/linux/errnos.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h (renamed from sysdeps/unix/sysv/linux/fcntlbits.h)8
-rw-r--r--sysdeps/unix/sysv/linux/bits/ioctl-types.h (renamed from sysdeps/unix/sysv/linux/ioctl-types.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/ioctls.h (renamed from sysdeps/unix/sysv/linux/ioctls.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/ipc.h (renamed from sysdeps/unix/sysv/linux/sys/ipc_buf.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/local_lim.h (renamed from sysdeps/unix/sysv/linux/local_lim.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h (renamed from sysdeps/unix/sysv/linux/sys/msq_buf.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/posix_opt.h (renamed from sysdeps/unix/sysv/linux/posix_opt.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h (renamed from sysdeps/unix/sysv/linux/resourcebits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h (renamed from sysdeps/unix/sysv/linux/schedbits.h)9
-rw-r--r--sysdeps/unix/sysv/linux/bits/sem.h (renamed from sysdeps/unix/sysv/linux/sys/sem_buf.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h (renamed from sysdeps/unix/sysv/linux/sys/shm_buf.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigaction.h (renamed from sysdeps/unix/sysv/linux/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigcontext.h (renamed from sysdeps/unix/sysv/linux/sigcontext.h)9
-rw-r--r--sysdeps/unix/sysv/linux/bits/signum.h (renamed from sysdeps/unix/sysv/linux/signum.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigset.h (renamed from sysdeps/unix/sysv/linux/sigset.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h (renamed from sysdeps/unix/sysv/linux/socketbits.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h (renamed from sysdeps/unix/sysv/linux/statbuf.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/statfs.h (renamed from sysdeps/unix/sysv/linux/statfsbuf.h)12
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h (renamed from sysdeps/unix/sysv/linux/termbits.h)11
-rw-r--r--sysdeps/unix/sysv/linux/bits/time.h (renamed from sysdeps/unix/sysv/linux/timebits.h)10
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h (renamed from sysdeps/unix/sysv/linux/gnu/types.h)20
-rw-r--r--sysdeps/unix/sysv/linux/bits/uio.h (renamed from sysdeps/unix/sysv/linux/iovec.h)7
-rw-r--r--sysdeps/unix/sysv/linux/bits/ustat.h (renamed from sysdeps/unix/sysv/linux/ustatbits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/utsname.h (renamed from sysdeps/unix/sysv/linux/utsnamelen.h)0
-rw-r--r--sysdeps/unix/sysv/linux/bits/waitflags.h (renamed from sysdeps/unix/sysv/linux/waitflags.h)9
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/profil-counter.h2
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/kernel_termios.h38
-rw-r--r--sysdeps/unix/sysv/linux/m68k/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip.h4
-rw-r--r--sysdeps/unix/sysv/linux/netinet/tcp.h2
-rw-r--r--sysdeps/unix/sysv/linux/netipx/ipx.h90
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h (renamed from sysdeps/unix/sysv/linux/powerpc/ioctl-types.h)0
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/termios.h (renamed from sysdeps/unix/sysv/linux/powerpc/termbits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/kernel_termios.h26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/socketcall.h (renamed from sysdeps/unix/sysv/linux/sys/socketcall.h)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h (renamed from sysdeps/unix/sysv/linux/sparc/fcntlbits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ioctls.h (renamed from sysdeps/unix/sysv/linux/alpha/ioctls.h)12
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/sigaction.h (renamed from sysdeps/unix/sysv/linux/sparc/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/signum.h (renamed from sysdeps/unix/sysv/linux/sparc/signum.h)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/termios.h (renamed from sysdeps/unix/sysv/linux/sparc/termbits.h)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/profil-counter.h2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/socket.S2
-rw-r--r--sysdeps/unix/sysv/linux/sys/kernel_termios.h20
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h2
-rw-r--r--sysdeps/unix/sysv/linux/sys/syscall.h4
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c2
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c2
-rw-r--r--sysdeps/unix/sysv/minix/bits/sigaction.h (renamed from sysdeps/unix/sysv/minix/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/bits/confname.h (renamed from sysdeps/unix/sysv/sco3.2.4/confname.h)0
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h (renamed from sysdeps/unix/sysv/sco3.2.4/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sysconf.S2
-rw-r--r--sysdeps/unix/sysv/sco3.2/bits/local_lim.h (renamed from sysdeps/unix/sysv/sco3.2/local_lim.h)6
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/sigaction.h (renamed from sysdeps/unix/sysv/sysv4/sigaction.h)0
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/signum.h (renamed from sysdeps/unix/sysv/sysv4/signum.h)0
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/sigset.h (renamed from sysdeps/unix/sysv/sysv4/sigset.h)0
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/utsname.h (renamed from sysdeps/unix/sysv/sysv4/utsnamelen.h)0
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/waitflags.h (renamed from sysdeps/unix/sysv/sysv4/waitflags.h)9
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/bits/stat.h (renamed from sysdeps/unix/sysv/sysv4/i386/statbuf.h)12
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h (renamed from sysdeps/unix/sysv/sysv4/solaris2/signum.h)0
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h (renamed from sysdeps/unix/sysv/sysv4/solaris2/statbuf.h)14
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h1
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h1
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S2
-rw-r--r--sysdeps/unix/sysv/utmpbits.h58
-rw-r--r--sysdeps/vax/bits/huge_val.h (renamed from sysdeps/vax/huge_val.h)8
-rw-r--r--sysdeps/vax/bits/setjmp.h (renamed from sysdeps/vax/jmp_buf.h)0
-rw-r--r--sysdeps/wordsize-32/bits/elfclass.h (renamed from sysdeps/wordsize-32/elfclass.h)0
-rw-r--r--sysdeps/wordsize-32/inttypes.h5
-rw-r--r--sysdeps/wordsize-64/bits/elfclass.h (renamed from sysdeps/wordsize-64/elfclass.h)0
-rw-r--r--sysdeps/wordsize-64/inttypes.h5
-rw-r--r--sysvipc/Makefile2
-rw-r--r--sysvipc/sys/ipc.h4
-rw-r--r--sysvipc/sys/msg.h2
-rw-r--r--sysvipc/sys/sem.h6
-rw-r--r--sysvipc/sys/shm.h6
-rw-r--r--termios/Makefile4
-rw-r--r--termios/sys/ttychars.h10
-rw-r--r--termios/termios.h10
-rw-r--r--time/Makefile2
-rw-r--r--time/localtime.c2
-rw-r--r--time/sys/time.h4
-rw-r--r--time/sys/timeb.h2
-rw-r--r--time/time.h6
-rw-r--r--time/tzset.c2
-rw-r--r--wcsmbs/wchar.h2
-rw-r--r--wctype/wctype.h7
723 files changed, 8826 insertions, 3027 deletions
diff --git a/ChangeLog b/ChangeLog
index cb09bdf38b..1c133418a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,808 @@
+1997-06-21 02:48  Ulrich Drepper  <drepper@cygnus.com>
+
+	* config.h.in: Add DO_STATIC_NSS.
+	* config.make.in: Add build-static-nss.
+
+	* elf/eval.c: Use __getdelim instead of __getline.
+
+	* locale/programs/locale.c: Correct comment.
+
+	* manual/libc.texinfo: Update copyright and date.
+	Remove A4 option.
+
+	* sysdeps/libm-ieee754/k_standard.c: Always return HUGE_VAL
+	for gamma overflow.
+	* sysdeps/libm-ieee754/w_gamma.c: Handle SVID and ISO C behaviour.
+	* sysdeps/libm-ieee754/w_gammaf.c: Likewise.
+	* sysdeps/libm-ieee754/w_gammalp.c: Likewise.
+
+	* po/ko.po: Update.
+
+1997-06-13 10:06  Richard Henderson  <rth@tamu.edu>
+
+	The Great Bit File Move:
+	* configure.in (AC_INIT): Look in include/ for features.h.
+	(sysnames): Add include as the final search directory.
+	(AC_OUTPUT): Create a bits directory in the build directory.
+	* Makeconfig (CPPFLAGS): Look in include/ for libc-symbols.h.
+	* Makefile: Make sure the target directory exists when installing
+	<gnu/stubs.h> and <gnu/lib-names.h>.
+	* csu/Makefile: Use $(compile.S) and $(compile.c) instead of
+	invoking $(CC) directly, as the former have the full include path.
+
+	* ansidecl.h: Removed.
+
+	* aliases.h: Moved to include/.
+	* alloca.h: Likewise.
+	* argp.h: Likewise.
+	* argz.h: Likewise.
+	* arpa/ftp.h: Likewise.
+	* arpa/inet.h: Likewise.
+	* arpa/nameser.h: Likewise.
+	* arpa/telnet.h: Likewise.
+	* arpa/tftp.h: Likewise.
+	* assert.h: Likewise.
+	* ctype.h: Likewise.
+	* db.h: Likewise.
+	* dirent.h: Likewise.
+	* dlfcn.h: Likewise.
+	* elf.h: Likewise.
+	* endian.h: Likewise.
+	* envz.h: Likewise.
+	* err.h: Likewise.
+	* errno.h: Likewise.
+	* error.h: Likewise.
+	* fcntl.h: Likewise.
+	* features.h: Likewise.
+	* fnmatch.h: Likewise.
+	* ftw.h: Likewise.
+	* getopt.h: Likewise.
+	* glob.h: Likewise.
+	* gnu-versions.h: Likewise.
+	* grp.h: Likewise.
+	* langinfo.h: Likewise.
+	* libc-symbols.h: Likewise.
+	* libgen.h: Likewise.
+	* libintl.h: Likewise.
+	* limits.h: Likewise.
+	* linewrap.h: Likewise.
+	* link.h: Likewise.
+	* locale.h: Likewise.
+	* malloc.h: Likewise.
+	* math.h: Likewise.
+	* mathcalls.h: Likewise.
+	* mcheck.h: Likewise.
+	* memory.h: Likewise.
+	* netdb.h: Likewise.
+	* netgroup.h: Likewise.
+	* netinet/ether.h: Likewise.
+	* netinet/in.h: Likewise.
+	* nlist.h: Likewise.
+	* nss.h: Likewise.
+	* nsswitch.h: Likewise.
+	* obstack.h: Likewise.
+	* poll.h: Likewise.
+	* posix1_lim.h: Likewise.
+	* posix2_lim.h: Likewise.
+	* printf.h: Likewise.
+	* protocols/routed.h: Likewise.
+	* protocols/rwhod.h: Likewise.
+	* protocols/talkd.h: Likewise.
+	* protocols/timed.h: Likewise.
+	* pwd.h: Likewise.
+	* regex.h: Likewise.
+	* resolv.h: Likewise.
+	* rpc/auth_unix.h: Likewise.
+	* rpc/clnt.h: Likewise.
+	* rpc/netdb.h: Likewise.
+	* rpc/pmap_clnt.h: Likewise.
+	* rpc/pmap_prot.h: Likewise.
+	* rpc/pmap_rmt.h: Likewise.
+	* rpc/rpc.h: Likewise.
+	* rpc/rpc_msg.h: Likewise.
+	* rpc/svc.h: Likewise.
+	* rpc/svc_auth.h: Likewise.
+	* rpc/types.h: Likewise.
+	* rpc/xdr.h: Likewise.
+	* sched.h: Likewise.
+	* search.h: Likewise.
+	* set-hooks.h: Likewise.
+	* setjmp.h: Likewise.
+	* sgtty.h: Likewise.
+	* shadow.h: Likewise.
+	* signal.h: Likewise.
+	* stab.def: Likewise.
+	* stab.h: Likewise.
+	* stdio.h: Likewise.
+	* stdlib.h: Likewise.
+	* string.h: Likewise.
+	* strings.h: Likewise.
+	* sys/bitypes.h: Likewise.
+	* sys/cdefs.h: Likewise.
+	* sys/dir.h: Likewise.
+	* sys/errno.h: Likewise.
+	* sys/fcntl.h: Likewise.
+	* sys/file.h: Likewise.
+	* sys/gmon.h: Likewise.
+	* sys/ioctl.h: Likewise.
+	* sys/ipc.h: Likewise.
+	* sys/msg.h: Likewise.
+	* sys/poll.h: Likewise.
+	* sys/queue.h: Likewise.
+	* sys/resource.h: Likewise.
+	* sys/select.h: Likewise.
+	* sys/sem.h: Likewise.
+	* sys/shm.h: Likewise.
+	* sys/signal.h: Likewise.
+	* sys/socket.h: Likewise.
+	* sys/stat.h: Likewise.
+	* sys/statfs.h: Likewise.
+	* sys/syslog.h: Likewise.
+	* sys/termios.h: Likewise.
+	* sys/time.h: Likewise.
+	* sys/timeb.h: Likewise.
+	* sys/times.h: Likewise.
+	* sys/types.h: Likewise.
+	* sys/uio.h: Likewise.
+	* sys/un.h: Likewise.
+	* sys/unistd.h: Likewise.
+	* sys/utsname.h: Likewise.
+	* sys/vlimit.h: Likewise.
+	* sys/vtimes.h: Likewise.
+	* sys/wait.h: Likewise.
+	* syscall.h: Likewise.
+	* syslog.h: Likewise.
+	* tar.h: Likewise.
+	* termios.h: Likewise.
+	* time.h: Likewise.
+	* ttyent.h: Likewise.
+	* unistd.h: Likewise.
+	* utime.h: Likewise.
+	* utmp.h: Likewise.
+	* values.h: Likewise.
+	* wchar.h: Likewise.
+	* wctype.h: Likewise.
+	* wordexp.h: Likewise.
+	* xlocale.h: Likewise.
+	* xopen_lim.h: Likewise.
+
+	* linuxthreads/sysdeps/alpha/semaphorebits.h: -> .../bits/semaphore.h.
+	* linuxthreads/sysdeps/powerpc/semaphorebits.h: Likewise.
+	* linuxthreads/sysdeps/pthread/cmpxchg/semaphorebits.h: Likewise.
+	* linuxthreads/sysdeps/pthread/no-cmpxchg/semaphorebits.h: Likewise.
+	* linuxthreads/sysdeps/pthread/libc-lock.h: -> bits/
+	* sysdeps/mach/libc-lock.h: Likewise.
+	* sysdeps/stub/libc-lock.h: Likewise.
+	* linuxthreads/sysdeps/pthread/stdio-lock.h: Likewise.
+	* linuxthreads/sysdeps/unix/sysv/linux/local_lim.h: Likewise.
+	* sysdeps/mach/hurd/local_lim.h: Likewise.
+	* sysdeps/stub/local_lim.h: Likewise.
+	* sysdeps/unix/sysv/linux/local_lim.h: Likewise.
+	* sysdeps/unix/sysv/local_lim.h: Likewise.
+	* sysdeps/unix/sysv/sco3.2/local_lim.h: Likewise.
+	* linuxthreads/sysdeps/unix/sysv/linux/posix_opt.h: Likewise.
+	* sysdeps/mach/hurd/posix_opt.h: Likewise.
+	* sysdeps/stub/posix_opt.h: Likewise.
+	* sysdeps/unix/bsd/posix_opt.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/posix_opt.h: Likewise.
+	* sysdeps/unix/sysv/linux/posix_opt.h: Likewise.
+	* math/cmathcalls.h: -> bits/
+	* math/mathcalls.h: Likewise.
+	* misc/stab.def: -> bits/
+	* posix/posix1_lim.h: -> bits/
+	* posix/posix2_lim.h: Likewise.
+	* sysdeps/alpha/__math.h: -> .../fpu/bits/mathinline.h
+	* sysdeps/i386/fpu/__math.h: Likewise.
+	* sysdeps/m68k/fpu/__math.h: Likewise.
+	* sysdeps/m68k/fpu/switch/__math.h: Likewise.
+	* sysdeps/powerpc/__math.h: Likewise.
+	* sysdeps/stub/__math.h: Likewise.
+	* sysdeps/alpha/bytesex.h: -> .../bits/endian.h
+	* sysdeps/arm/bytesex.h: Likewise.
+	* sysdeps/i386/bytesex.h: Likewise.
+	* sysdeps/m68k/bytesex.h: Likewise.
+	* sysdeps/mips/bytesex.h: Likewise.
+	* sysdeps/mips/dec/bytesex.h: Likewise.
+	* sysdeps/mips/mipsel/bytesex.h: Likewise.
+	* sysdeps/mips/p40/bytesex.h: Likewise.
+	* sysdeps/sparc/bytesex.h: Likewise.
+	* sysdeps/stub/bytesex.h: Likewise.
+	* sysdeps/alpha/fpu/fenvbits.h: -> .../bits/fenv.h
+	* sysdeps/i386/fpu/fenvbits.h: Likewise.
+	* sysdeps/m68k/fpu/fenvbits.h: Likewise.
+	* sysdeps/powerpc/fenvbits.h: Likewise.
+	* sysdeps/stub/fenvbits.h: Likewise.
+	* sysdeps/alpha/jmp_buf.h: -> .../bits/setenv.h
+	* sysdeps/arm/jmp_buf.h: Likewise.
+	* sysdeps/i386/jmp_buf.h: Likewise.
+	* sysdeps/m68k/jmp_buf.h: Likewise.
+	* sysdeps/mips/jmp_buf.h: Likewise.
+	* sysdeps/sparc/jmp_buf.h: Likewise.
+	* sysdeps/powerpc/jmp_buf.h: Likewise.
+	* sysdeps/stub/jmp_buf.h: Likewise.
+	* sysdeps/vax/jmp_buf.h: Likewise.
+	* sysdeps/generic/confname.h: -> bits/
+	* sysdeps/unix/sysv/irix4/confname.h: Likewise.
+	* sysdeps/unix/sysv/sco3.2.4/confname.h: Likewise.
+	* sysdeps/generic/gnu/types.h: -> ../bits/types.h
+	* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/gnu/types.h: Likewise.
+	* sysdeps/generic/ioctl-types.h: -> bits/
+	* sysdeps/unix/sysv/linux/ioctl-types.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/ioctl-types.h: Likewise.
+	* sysdeps/generic/iovec.h: -> .../bits/uio.h
+	* sysdeps/unix/sysv/linux/iovec.h: Likewise.
+	* sysdeps/generic/mathbits.h: -> .../bits/mathdef.h
+	* sysdeps/i386/fpu/mathbits.h: Likewise.
+	* sysdeps/m68k/fpu/mathbits.h: Likewise.
+	* sysdeps/powerpc/mathbits.h: Likewise.
+	* sysdeps/generic/resourcebits.h: -> .../bits/resource.h
+	* sysdeps/unix/bsd/sun/sunos4/resourcebits.h: Likewise.
+	* sysdeps/unix/sysv/linux/resourcebits.h: Likewise.
+	* sysdeps/generic/schedbits.h: -> .../bits/sched.h
+	* sysdeps/unix/sysv/linux/schedbits.h: Likewise.
+	* sysdeps/generic/selectbits.h: -> .../bits/select.h
+	* sysdeps/i386/selectbits.h: Likewise.
+	* sysdeps/generic/sigaction.h: -> bits/
+	* sysdeps/unix/bsd/osf/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/minix/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/sco3.2.4/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/sigaction.h: Likewise.
+	* sysdeps/generic/sigset.h: -> bits/
+	* sysdeps/unix/sysv/linux/sigset.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/sigset.h: Likewise.
+	* sysdeps/generic/sockaddrcom.h: -> .../bits/sockaddr.h
+	* sysdeps/unix/bsd/bsd4.4/sockaddrcom.h: Likewise.
+	* sysdeps/generic/socketbits.h: -> .../bits/socket.h
+	* sysdeps/unix/sysv/linux/socketbits.h: Likewise.
+	* sysdeps/generic/statfsbuf.h: -> .../bits/statfs.h
+	* sysdeps/unix/sysv/linux/statfsbuf.h: Likewise.
+	* sysdeps/generic/termbits.h: -> .../bits/termios.h
+	* sysdeps/unix/bsd/sun/sunos4/termbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/termbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/termbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/termbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/termbits.h: Likewise.
+	* sysdeps/generic/ustatbits.h: -> .../bits/ustat.h
+	* sysdeps/unix/sysv/linux/ustatbits.h: Likewise.
+	* sysdeps/generic/utmpbits.h: -> .../bits/utmp.h
+	* sysdeps/gnu/utmpbits.h: Likewise.
+	* sysdeps/unix/sysv/utmpbits.h: Likewise.
+	* sysdeps/generic/utsnamelen.h: -> .../bits/utsname.h
+	* sysdeps/unix/bsd/sun/sunos4/utsnamelen.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/utsnamelen.h: Likewise.
+	* sysdeps/unix/sysv/linux/utsnamelen.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/utsnamelen.h: Likewise.
+	* sysdeps/unix/sysv/utsnamelen.h: Likewise.
+	* sysdeps/generic/waitstatus.h: -> bits/
+	* sysdeps/i386/huge_val.h: -> bits/
+	* sysdeps/ieee754/huge_val.h: Likewise.
+	* sysdeps/m68k/huge_val.h: Likewise.
+	* sysdeps/stub/huge_val.h: Likewise.
+	* sysdeps/vax/huge_val.h: Likewise.
+	* sysdeps/ieee754/nan.h: Likewise.
+	* sysdeps/stub/nan.h: Likewise.
+	* sysdeps/mach/hurd/alpha/sigcontext.h: -> bits/
+	* sysdeps/mach/hurd/hppa/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/i386/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/mips/sigcontext.h: Likewise.
+	* sysdeps/stub/sigcontext.h: Likewise.
+	* sysdeps/unix/bsd/sun/m68k/sigcontext.h: Likewise.
+	* sysdeps/unix/bsd/sun/sparc/sigcontext.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/mips/sigcontext.h: Likewise.
+	* sysdeps/unix/sysv/linux/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/errnos.h: -> .../bits/errno.h
+	* sysdeps/standalone/arm/errnos.h: Likewise.
+	* sysdeps/stub/errnos.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/errnos.h: Likewise.
+	* sysdeps/unix/sysv/linux/errnos.h: Likewise.
+	* sysdeps/mach/hurd/fcntlbits.h: -> .../bits/fcntl.h
+	* sysdeps/stub/fcntlbits.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/fcntlbits.h: Likewise.
+	* sysdeps/unix/bsd/fcntlbits.h: Likewise.
+	* sysdeps/unix/bsd/sun/sunos4/fcntlbits.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/fcntlbits.h: Likewise.
+	* sysdeps/unix/common/fcntlbits.h: Likewise.
+	* sysdeps/unix/sysv/fcntlbits.h: Likewise.
+	* sysdeps/unix/sysv/irix4/fcntlbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/fcntlbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/fcntlbits.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/fcntlbits.h: Likewise.
+	* sysdeps/mach/hurd/ioctls.h: -> bits/
+	* sysdeps/stub/ioctls.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/ioctls.h: Likewise.
+	* sysdeps/mach/hurd/statbuf.h: -> .../bits/stat.h
+	* sysdeps/stub/statbuf.h: Likewise.
+	* sysdeps/unix/bsd/osf/alpha/statbuf.h: Likewise.
+	* sysdeps/unix/bsd/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/irix4/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/linux/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/i386/statbuf.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/statbuf.h: Likewise.
+	* sysdeps/standalone/stdio_lim.h: -> bits/
+	* sysdeps/stub/stdio_lim.h: Likewise.
+	* sysdeps/stub/direntry.h: -> ../bits/dirent.h
+	* sysdeps/unix/bsd/bsd4.4/direntry.h: Likewise.
+	* sysdeps/unix/bsd/direntry.h: Likewise.
+	* sysdeps/unix/common/direntry.h: Likewise.
+	* sysdeps/unix/sysv/direntry.h: Likewise.
+	* sysdeps/unix/sysv/linux/direntry.h: Likewise.
+	* sysdeps/stub/elfclass.h: -> bits/
+	* sysdeps/wordsize-32/elfclass.h: Likewise.
+	* sysdeps/wordsize-64/elfclass.h: Likewise.
+	* sysdeps/stub/signum.h: -> bits/
+	* sysdeps/unix/bsd/signum.h: Likewise.
+	* sysdeps/unix/bsd/sun/signum.h: Likewise.
+	* sysdeps/unix/sysv/irix4/signum.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/signum.h: Likewise.
+	* sysdeps/unix/sysv/linux/signum.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/signum.h: Likewise.
+	* sysdeps/unix/sysv/signum.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/signum.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/signum.h: Likewise.
+	* sysdeps/stub/sys/ipc_buf.h: -> .../bits/ipc.h
+	* sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h: Likewise.
+	* sysdeps/unix/sysv/linux/sys/ipc_buf.h: Likewise.
+	* sysdeps/stub/sys/msq_buf.h: -> .../bits/msq.h
+	* sysdeps/unix/sysv/linux/sys/msq_buf.h: Likewise.
+	* sysdeps/stub/sys/sem_buf.h: -> .../bits/sem.h
+	* sysdeps/unix/sysv/linux/sys/sem_buf.h: Likewise.
+	* sysdeps/stub/sys/shm_buf.h: -> .../bits/shm.h
+	* sysdeps/unix/sysv/linux/sys/shm_buf.h: Likewise.
+	* sysdeps/stub/timebits.h: -> .../bits/time.h
+	* sysdeps/unix/sysv/linux/alpha/timebits.h: Likewise.
+	* sysdeps/unix/sysv/linux/timebits.h: Likewise.
+	* sysdeps/stub/waitflags.h: -> bits/
+	* sysdeps/unix/bsd/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/linux/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h: -> ../
+	* sysdeps/unix/sysv/linux/powerpc/sys/kernel_termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/sys/kernel_termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/sys/socketcall.h: -> ../
+
+	* argp/argp-fmtstream.h: Standardize the multiple-include protect.
+	* argp/argp.h: Likewise.
+	* catgets/nl_types.h: Likewise.
+	* crypt/sysdeps/unix/crypt.h: Likewise.
+	* ctype/ctype.h: Likewise.
+	* db/db.h: Likewise.
+	* db/mpool.h: Likewise.
+	* db/ndbm.h: Likewise.
+	* dirent/dirent.h: Likewise.
+	* elf/dlfcn.h: Likewise.
+	* elf/elf.h: Likewise.
+	* elf/link.h: Likewise.
+	* gmon/sys/gmon.h: Likewise.
+	* gmon/sys/gmon_out.h: Likewise.
+	* grp/grp.h: Likewise.
+	* inet/aliases.h: Likewise.
+	* inet/arpa/ftp.h: Likewise.
+	* inet/arpa/inet.h: Likewise.
+	* inet/arpa/telnet.h: Likewise.
+	* inet/arpa/tftp.h: Likewise.
+	* inet/netinet/ether.h: Likewise.
+	* inet/netinet/icmp6.h: Likewise.
+	* inet/netinet/in.h: Likewise.
+	* inet/netinet/ip6.h: Likewise.
+	* inet/protocols/routed.h: Likewise.
+	* inet/protocols/rwhod.h: Likewise.
+	* inet/protocols/talkd.h: Likewise.
+	* inet/protocols/timed.h: Likewise.
+	* intl/libintl.h: Likewise.
+	* io/fcntl.h: Likewise.
+	* io/fts.h: Likewise.
+	* io/ftw.h: Likewise.
+	* io/sys/poll.h: Likewise.
+	* io/sys/stat.h: Likewise.
+	* io/sys/statfs.h: Likewise.
+	* io/utime.h: Likewise.
+	* linuxthreads/semaphore.h: Likewise.
+	* linuxthreads/sysdeps/pthread/pthread.h: Likewise.
+	* locale/locale.h: Likewise.
+	* login/pty.h: Likewise.
+	* login/utmp.h: Likewise.
+	* malloc/malloc.h: Likewise.
+	* malloc/obstack.h: Likewise.
+	* math/complex.h: Likewise.
+	* math/fenv.h: Likewise.
+	* math/math.h: Likewise.
+	* md5-crypt/md5.h: Likewise.
+	* misc/ar.h: Likewise.
+	* misc/err.h: Likewise.
+	* misc/error.h: Likewise.
+	* misc/fstab.h: Likewise.
+	* misc/libgen.h: Likewise.
+	* misc/nlist.h: Likewise.
+	* misc/sys/cdefs.h: Likewise.
+	* misc/sys/file.h: Likewise.
+	* misc/sys/ioctl.h: Likewise.
+	* misc/sys/queue.h: Likewise.
+	* misc/sys/select.h: Likewise.
+	* misc/sys/syslog.h: Likewise.
+	* misc/sys/uio.h: Likewise.
+	* misc/sysexits.h: Likewise.
+	* misc/ttyent.h: Likewise.
+	* nss/nss.h: Likewise.
+	* posix/fnmatch.h: Likewise.
+	* posix/getopt.h: Likewise.
+	* posix/glob.h: Likewise.
+	* posix/regex.h: Likewise.
+	* posix/sys/times.h: Likewise.
+	* posix/sys/types.h: Likewise.
+	* posix/sys/utsname.h: Likewise.
+	* posix/sys/wait.h: Likewise.
+	* posix/tar.h: Likewise.
+	* posix/unistd.h: Likewise.
+	* posix/wordexp.h: Likewise.
+	* pwd/pwd.h: Likewise.
+	* resolv/arpa/nameser.h: Likewise.
+	* resolv/netdb.h: Likewise.
+	* resolv/resolv.h: Likewise.
+	* resource/sys/resource.h: Likewise.
+	* resource/sys/vlimit.h: Likewise.
+	* resource/sys/vtimes.h: Likewise.
+	* setjmp/setjmp.h: Likewise.
+	* shadow/shadow.h: Likewise.
+	* socket/sys/socket.h: Likewise.
+	* socket/sys/un.h: Likewise.
+	* stdlib/exit.h: Likewise.
+	* stdlib/fmtmsg.h: Likewise.
+	* stdlib/monetary.h: Likewise.
+	* stdlib/stdlib.h: Likewise.
+	* string/argz.h: Likewise.
+	* string/envz.h: Likewise.
+	* string/memory.h: Likewise.
+	* string/string.h: Likewise.
+	* string/strings.h: Likewise.
+	* sunrpc/rpc/rpc.h: Likewise.
+	* sunrpc/rpc/svc.h: Likewise.
+	* sunrpc/rpc/types.h: Likewise.
+	* sunrpc/rpc/xdr.h: Likewise.
+	* termios/sys/ttychars.h: Likewise.
+	* termios/termios.h: Likewise.
+
+	* argp/argp-parse.c: <foo.h> -> <bits/foo.h>.
+	* crypt/sysdeps/unix/crypt_util.c: Likewise.
+	* dirent/dirent.h: Likewise.
+	* elf/link.h: Likewise.
+	* grp/fgetgrent.c: Likewise.
+	* grp/grp.h: Likewise.
+	* hurd/hurd/ioctl.h: Likewise.
+	* inet/getnameinfo.c: Likewise.
+	* inet/getnetgrent_r.c: Likewise.
+	* inet/inet_ntoa.c: Likewise.
+	* inet/netinet/in.h: Likewise.
+	* io/fcntl.h: Likewise.
+	* io/ftw.h: Likewise.
+	* io/sys/stat.h: Likewise.
+	* io/sys/statfs.h: Likewise.
+	* io/utime.h: Likewise.
+	* libio/_G_config.h: Likewise.
+	* libio/libio.h: Likewise.
+	* libio/libioP.h: Likewise.
+	* libio/stdio.h: Likewise.
+	* linuxthreads/lockfile.c: Likewise.
+	* linuxthreads/semaphore.h: Likewise.
+	* locale/duplocale.c: Likewise.
+	* locale/freelocale.c: Likewise.
+	* locale/lc-time.c: Likewise.
+	* locale/setlocale.c: Likewise.
+	* login/getutent_r.c: Likewise.
+	* login/getutid_r.c: Likewise.
+	* login/getutline_r.c: Likewise.
+	* login/lastlog.h: Likewise.
+	* login/pty.h: Likewise.
+	* login/utmp.h: Likewise.
+	* login/utmpname.c: Likewise.
+	* malloc/mtrace.c: Likewise.
+	* malloc/thread-m.h: Likewise.
+	* math/complex.h: Likewise.
+	* math/fenv.h: Likewise.
+	* math/libm-test.c: Likewise.
+	* math/math.h: Likewise.
+	* misc/sgtty.h: Likewise.
+	* misc/stab.h: Likewise.
+	* misc/sys/ioctl.h: Likewise.
+	* misc/sys/select.h: Likewise.
+	* misc/sys/uio.h: Likewise.
+	* misc/sys/ustat.h: Likewise.
+	* misc/syslog.c: Likewise.
+	* nis/nss_compat/compat-grp.c: Likewise.
+	* nis/nss_compat/compat-pwd.c: Likewise.
+	* nis/nss_compat/compat-spwd.c: Likewise.
+	* nis/nss_nis/nis-alias.c: Likewise.
+	* nis/nss_nis/nis-ethers.c: Likewise.
+	* nis/nss_nis/nis-grp.c: Likewise.
+	* nis/nss_nis/nis-hosts.c: Likewise.
+	* nis/nss_nis/nis-netgrp.c: Likewise.
+	* nis/nss_nis/nis-network.c: Likewise.
+	* nis/nss_nis/nis-proto.c: Likewise.
+	* nis/nss_nis/nis-publickey.c: Likewise.
+	* nis/nss_nis/nis-pwd.c: Likewise.
+	* nis/nss_nis/nis-rpc.c: Likewise.
+	* nis/nss_nis/nis-service.c: Likewise.
+	* nis/nss_nis/nis-spwd.c: Likewise.
+	* nss_nisplus/nisplus-alias.c: Likewise.
+	* nis/nss_nisplus/nisplus-ethers.c: Likewise.
+	* nis/nss_nisplus/nisplus-grp.c: Likewise.
+	* nis/nss_nisplus/nisplus-hosts.c: Likewise.
+	* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
+	* nis/nss_nisplus/nisplus-netgrp.c: Likewise.
+	* nis/nss_nisplus/nisplus-proto.c: Likewise.
+	* nis/nss_nisplus/nisplus-pwd.c: Likewise.
+	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
+	* nis/nss_nisplus/nisplus-service.c: Likewise.
+	* nis/nss_nisplus/nisplus-spwd.c: Likewise.
+	* nis/ypclnt.c: Likewise.
+	* nss/getXXbyYY.c: Likewise.
+	* nss/getXXent.c: Likewise.
+	* nss/getXXent_r.c: Likewise.
+	* nss/nss_db/db-XXX.c: Likewise.
+	* nss/nss_db/db-alias.c: Likewise.
+	* nss/nss_db/db-netgrp.c: Likewise.
+	* nss/nss_files/files-XXX.c: Likewise.
+	* nss/nss_files/files-alias.c: Likewise.
+	* nss/nsswitch.c: Likewise.
+	* posix/sched.h: Likewise.
+	* posix/sys/types.h: Likewise.
+	* posix/sys/utsname.h: Likewise.
+	* posix/sys/wait.h: Likewise.
+	* posix/unistd.h: Likewise.
+	* pwd/fgetpwent.c: Likewise.
+	* pwd/pwd.h: Likewise.
+	* resource/sys/resource.h: Likewise.
+	* setjmp/setjmp.h: Likewise.
+	* shadow/fgetspent.c: Likewise.
+	* shadow/lckpwdf.c: Likewise.
+	* shadow/sgetspent.c: Likewise.
+	* signal/signal.h: Likewise.
+	* signal/sigsetops.c: Likewise.
+	* socket/sys/socket.h: Likewise.
+	* socket/sys/un.h: Likewise.
+	* stdio/stdio.h: Likewise.
+	* stdio-common/vfprintf.c: Likewise.
+	* stdio-common/vfscanf.c: Likewise.
+	* stdlib/atexit.c: Likewise.
+	* stdlib/fmtmsg.c: Likewise.
+	* stdlib/random.c: Likewise.
+	* string/endian.h: Likewise.
+	* sysdeps/alpha/w_sqrt.S: Likewise.
+	* sysdeps/arm/__longjmp.S: Likewise.
+	* sysdeps/arm/setjmp.S: Likewise.
+	* sysdeps/generic/abort.c: Likewise.
+	* sysdeps/generic/netinet/ip.h: Likewise.
+	* sysdeps/generic/setenv.c: Likewise.
+	* generic/sys/mman.h: Likewise.
+	* sysdeps/i386/__longjmp.S: Likewise.
+	* sysdeps/i386/setjmp.S: Likewise.
+	* sysdeps/mach/hurd/dirstream.h: Likewise.
+	* sysdeps/mach/hurd/jmp-unwind.c: Likewise.
+	* sysdeps/posix/mk-stdiolim.c: Likewise.
+	* sysdeps/powerpc/__longjmp.S: Likewise.
+	* sysdeps/powerpc/setjmp.S: Likewise.
+	* sysdeps/sparc/__longjmp.S: Likewise.
+	* sysdeps/sparc/setjmp.S: Likewise.
+	* sysdeps/standalone/close.c: Likewise.
+	* sysdeps/standalone/filedesc.h: Likewise.
+	* sysdeps/standalone/open.c: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/tcsetattr.c: Likewise.
+	* sysdeps/unix/bsd/m68k/sysdep.S: Likewise.
+	* sysdeps/unix/bsd/osf/sys/mman.h: Likewise.
+	* sysdeps/unix/bsd/sun/m68k/sethostid.S: Likewise.
+	* sysdeps/unix/bsd/sun/sparc/sethostid.S: Likewise.
+	* sysdeps/unix/bsd/sun/sunos4/sys/mman.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/sys/mman.h: Likewise.
+	* sysdeps/unix/bsd/vax/sysdep.S: Likewise.
+	* sysdeps/unix/dirstream.h: Likewise.
+	* sysdeps/unix/i386/sysdep.S: Likewise.
+	* sysdeps/unix/mips/sysdep.S: Likewise.
+	* sysdeps/unix/mk-local_lim.c: Likewise.
+	* sysdeps/unix/sparc/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/irix4/sys/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/brk.S: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/netinet/ip.h: Likewise.
+	* sysdeps/unix/sysv/linux/netinet/tcp.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sys/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/sys/syscall.h: Likewise.
+	* sysdeps/unix/sysv/linux/tcgetattr.c: Likewise.
+	* sysdeps/unix/sysv/sco3.2.4/sysconf.S: Likewise.
+	* sysdeps/unix/sysv/sysv4/i386/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S: Likewise.
+	* sysvipc/sys/ipc.h: Likewise.
+	* sysvipc/sys/msg.h: Likewise.
+	* sysvipc/sys/sem.h: Likewise.
+	* sysvipc/sys/shm.h: Likewise.
+	* termios/termios.h: Likewise.
+	* time/localtime.c: Likewise.
+	* time/sys/time.h: Likewise.
+	* time/time.h: Likewise.
+	* time/tzset.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/arm/socket.S: socketcall.h change.
+	* sysdeps/unix/sysv/linux/i386/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/socket.S: Likewise.
+
+	* Makefile (headers): foo.h -> bits/foo.h.
+	* dirent/Makefile: Likewise.
+	* elf/Makefile: Likewise.
+	* io/Makefile: Likewise.
+	* linuxthreads/Makefile: Likewise.
+	* linuxthreads/sysdeps/pthread/Makefile: Likewise.
+	* login/Makefile: Likewise.
+	* math/Makefile: Likewise.
+	* misc/Makefile: Likewise.
+	* posix/Makefile: Likewise.
+	* resource/Makefile: Likewise.
+	* setjmp/Makefile: Likewise.
+	* signal/Makefile: Likewise.
+	* socket/Makefile: Likewise.
+	* stdio-common/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/Makefile: Likewise.
+	* sysvipc/Makefile: Likewise.
+	* termios/Makefile: Likewise.
+	* time/Makefile: Likewise.
+	* sysdeps/generic/Makefile (make_siglist-CFLAGS): Likewise.
+	* sysdeps/posix/Makefile: stdio_lim.h -> bits/stdio_lim.h
+	* sysdeps/unix/Makefile: Likewise with local_lim.h, errnos.h,
+	ioctls.h, termbits.h.
+
+	* sysdeps/unix/sysv/linux/Dist: sys/kernel_termios.h
+	-> kernel_termios.h, sys/socketcall.h -> socketcall.h
+
+	* elf/elf.h: Use <inttypes.h> definitions instead of __attribute__
+	for getting the proper length on the ELF types to be friendly to
+	non-gcc compilers.
+	* posix/sys/types.h: Notice when int8_t and friends are defined
+	and don't redefine them.
+	* sysdeps/wordsize-32/inttypes.h: Likewise.
+	* sysdeps/wordsize-64/inttypes.h: Likewise.
+
+	* sysdeps/unix/sysv/linux/arm/profil-counter.h: Get sigcontext
+	via <signal.h> instead.
+	* sysdeps/unix/sysv/linux/i386/profil-counter.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/profil-counter.h: Likewise.
+
+1997-06-20 17:59  Kazumoto Kojima  <kkojima@kk.info.kanagawa-u.ac.jp>
+
+	* hurd/intr-msg.c: More 64bit changes.
+	* mach/msg-destroy.c: Likewise.
+	* sysdeps/mach/hurd/ioctl.c: Likewise.
+	* sysdeps/mach/hurd/ioctls.h: Likewise.
+	* sysdeps/mach/hurd/select.c: Likewise.
+	* sysdeps/mach/hurd/statbuf.h: Likewise.
+
+	* sysdeps/mach/hurd/mips/dl-machine.c: Hurd/MIPS64 patches.
+	* sysdeps/mach/hurd/mips/exc2signal.c: Likewise.
+	* sysdeps/mach/hurd/mips/init-fault.c: Likewise.
+	* sysdeps/mach/hurd/mips/init-first.c: Likewise.
+	* sysdeps/mach/hurd/mips/intr-msg.h: Likewise.
+	* sysdeps/mach/hurd/mips/longjmp-ctx.c: Likewise.
+	* sysdeps/mach/hurd/mips/longjmp-ts.c: Likewise.
+	* sysdeps/mach/hurd/mips/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/mips/sigreturn.c: Likewise.
+	* sysdeps/mach/hurd/mips/trampoline.c: Likewise.
+	* sysdeps/mach/mips/cacheflush.c: Likewise.
+	* sysdeps/mach/mips/machine-lock.h: Likewise.
+	* sysdeps/mach/mips/machine-sp.h: Likewise.
+	* sysdeps/mach/mips/syscall.S: Likewise.
+	* sysdeps/mach/mips/sysdep.h: Likewise.
+	* sysdeps/mach/mips/thread_state.h: Likewise.
+	* sysdeps/mach/start.c: Likewise.
+
+	* sysdeps/mips/dl-machine.h: MIPS changes.
+	* sysdeps/mips/elf/start.S: Likewise.
+	* sysdeps/mips/init-first.c: Likewise.
+	* sysdeps/mips/fpu_control.h: Likewise.
+	* sysdeps/mips/machine-gmon.h: Likewise.
+	* sysdeps/mips/jmp_buf.h: Likewise.
+	* sysdeps/mips/__longjmp.c: Likewise.
+	* sysdeps/mips/bsd-_setjmp.S: Likewise.
+	* sysdeps/mips/bsd-setjmp.S: Likewise.
+	* sysdeps/mips/setjmp.S: Likewise.
+	* sysdeps/mips/setjmp_aux.c: Likewise.
+	* sysdeps/mips/mips64/gmp-mparam.h: Likewise.
+	* sysdeps/mips/add_n.S: New file.
+	* sysdeps/mips/addmul_1.S: Likewise.
+	* sysdeps/mips/lshift.S: Likewise.
+	* sysdeps/mips/mul_1.S: Likewise.
+	* sysdeps/mips/rshift.S: Likewise.
+	* sysdeps/mips/sub_n.S: Likewise.
+	* sysdeps/mips/submul_1.S: Likewise.
+	* sysdeps/mips/mips64/Implies: Likewise.
+	* sysdeps/mips/mips64/add_n.S: Likewise.
+	* sysdeps/mips/mips64/addmul_1.S: Likewise.
+	* sysdeps/mips/mips64/lshift.S: Likewise.
+	* sysdeps/mips/mips64/mul_1.S: Likewise.
+	* sysdeps/mips/mips64/rshift.S: Likewise.
+	* sysdeps/mips/mips64/sub_n.S: Likewise.
+	* sysdeps/mips/mips64/submul_1.S: Likewise.
+	* sysdeps/mips/add_n.S: Removed.
+	* sysdeps/mips/addmul_1.S: Likewise.
+	* sysdeps/mips/lshift.S: Likewise.
+	* sysdeps/mips/mul_1.S: Likewise.
+	* sysdeps/mips/rshift.S: Likewise.
+	* sysdeps/mips/sub_n.S: Likewise.
+	* sysdeps/mips/submul_1.S: Likewise.
+
+	* nss/Makefile: Prepare for static NSS.
+	* resolv/Makefile: Likewise.
+	* nss/nsswitch.c: Add code for static NSS.
+	* nss/function.def: Define functions for static NSS.
+
+1997-06-19 11:10  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* libc.map: Add yet more symbols.
+
+1997-06-19 20:33  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* elf/dl-lookup.c (_dl_lookup_versioned_symbol): Don't pass NULL
+	as object name to _dl_signal_error.
+	(do_lookup): Skip objects that could not be opened.
+
+	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Check that the
+	symbol was found.
+	* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
+	* sysdeps/powerpc/dl-machine.h (elf_machine_rela): Likewise.
+
+1997-06-20 03:13  Kazumoto Kojima  <kkojima@kk.info.kanagawa-u.ac.jp>
+
+	* ctype/ctype-info.c: Use int32_t where `int' with 4 bytes is
+	assumed.
+	* ctype/ctype.h: Likewise.
+	* math/math_private.h: Likewise.
+	* inet/netinet/in.h: Likewise.
+	* wctype/wctype.h: Likewise.
+
+	* nss/Makefile: Only inhibit nss_files and nss_db modules if static
+	NSS modules are not enabled.
+	* resolv/Makefile: Likewise for nss_dns.
+	* nss/function.def: New file.  List all available lookup functions
+	for static NSS.
+	* nss/nsswitch.c: Add code for static NSS.
+
+1997-06-15 21:15  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm-test.c (gamma_test): Test for _SVID_ and for normal
+	behaviour.
+
+1997-06-15 20:32  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm.map: Add all necessary functions, correct existing entries.
+
+1997-06-20 02:35  a sun  <asun@zoology.washington.edu>
+
+	* sysdeps/unix/sysv/linux/netipx/ipx.h: Don't use kernel header.
+
+1997-06-19 18:43  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_parse_spent):
+	Compare pointer with NULL.
+
+	* login/logout.c (logout): Compare pututline result with NULL.
+
 1997-06-19 19:38  Ulrich Drepper  <drepper@cygnus.com>
 
 	* features.h: Define __STDC_IEC_559__ and _STDC_IEC_559_COMPLEX__.
 
 	* elf/dl-minimal.c (__dcgettext): Remove assertion.
 
-	* inet/rcmd.c: Correct a few typos.  Reported by Eric Troan.
+	* inet/rcmd.c: Correct a few typos.  Reported by Erik Troan.
 
 	* manual/Makefile (distribute): Add dir.
 	* manual/dir: New file.
diff --git a/Makeconfig b/Makeconfig
index fbff6b3d3e..29d06caa33 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -491,14 +491,14 @@ endif	# $(+cflags) == ""
 # and in the parent library source directory.
 # `+sysdep-includes' will be defined by Makerules.
 +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) $($(stdio)-include) \
-	    $(includes) $(+sysdep-includes) $(last-includes)
+		$(includes) $(+sysdep-includes) $(last-includes)
 
 # Since libio has several internal header files, we use a -I instead
 # of many little headers in the top level source directory.
 libio-include = -I$(..)libio
 
 # These are the variables that the implicit compilation rules use.
-CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
+CPPFLAGS = $(+includes) $(defines) -include $(..)include/libc-symbols.h \
 	   $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) \
 	   $(CPPFLAGS-$(@F))
 override CFLAGS	= $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) \
diff --git a/Makefile b/Makefile
index 7c5ba3bf31..bedfc8f138 100644
--- a/Makefile
+++ b/Makefile
@@ -82,8 +82,8 @@ subdirs	:= $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
 		   subdir_install					\
 		   $(addprefix install-, no-libc.a bin lib data headers others)
 
-headers := errno.h sys/errno.h errnos.h limits.h values.h	\
-	   features.h gnu-versions.h libc-lock.h xopen_lim.h
+headers := errno.h sys/errno.h bits/errno.h limits.h values.h	\
+	   features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h
 aux	 = sysdep $(libc-init) version
 before-compile += $(objpfx)version-info.h
 
@@ -181,6 +181,7 @@ subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)stub-$(dir))
 # the subdir's stubs file.  Having more direct dependencies would result in
 # extra iterations over the list for subdirs and many recursive makes.
 $(inst_includedir)/gnu/stubs.h: subdir_install
+	$(make-target-directory)
 	@rm -f $(objpfx)stubs.h
 	(echo '/* This file is automatically generated.';\
 	 echo '   It defines a symbol `__stub_FUNCTION'\'' for each function';\
@@ -195,6 +196,7 @@ $(inst_includedir)/gnu/stubs.h: subdir_install
 ifeq (yes,$(build-shared))
 
 $(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h
+	$(make-target-directory)
 	if test -r $@ && cmp -s $< $@; \
 	then echo 'gnu/lib-names.h unchanged'; \
 	else $(INSTALL_DATA) $< $@; fi
diff --git a/ansidecl.h b/ansidecl.h
deleted file mode 100644
index c351653b62..0000000000
--- a/ansidecl.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with the GNU C Library; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
-
-/* ANSI and traditional C compatibility macros
-
-   ANSI C is assumed if __STDC__ is #defined.
-
-   Macro	ANSI C definition	Traditional C definition
-   -----	---- - ----------	----------- - ----------
-   PTR		`void *'		`char *'
-   LONG_DOUBLE	`long double'		`double'
-   CONST	`const'			`'
-   VOLATILE	`volatile'		`'
-   SIGNED	`signed'		`'
-   PTRCONST	`void *const'		`char *'
-
-   DEFUN(name, arglist, args)
-
-	Defines function NAME.
-
-	ARGLIST lists the arguments, separated by commas and enclosed in
-	parentheses.  ARGLIST becomes the argument list in traditional C.
-
-	ARGS list the arguments with their types.  It becomes a prototype in
-	ANSI C, and the type declarations in traditional C.  Arguments should
-	be separated with `AND'.  For functions with a variable number of
-	arguments, the last thing listed should be `DOTS'.
-
-   DEFUN_VOID(name)
-
-	Defines a function NAME, which takes no arguments.
-
-   EXFUN(name, prototype)
-
-	Is used in an external function declaration.
-	In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
-	parentheses).  In traditional C it is `NAME()'.
-	For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
-
-    For example:
-	extern int EXFUN(printf, (CONST char *format DOTS));
-	int DEFUN(fprintf, (stream, format),
-		  FILE *stream AND CONST char *format DOTS) { ... }
-	void DEFUN_VOID(abort) { ... }
-*/
-
-#ifndef	_ANSIDECL_H
-
-#define	_ANSIDECL_H	1
-
-
-/* Every source file includes this file,
-   so they will all get the switch for lint.  */
-/* LINTLIBRARY */
-
-
-#ifdef	__STDC__
-
-#define	PTR		void *
-#define	PTRCONST	void *CONST
-#define	LONG_DOUBLE	long double
-
-#define	AND		,
-#define	NOARGS		void
-#define	CONST		const
-#define	VOLATILE	volatile
-#define	SIGNED		signed
-#define	DOTS		, ...
-
-#define	EXFUN(name, proto)		name proto
-#define	DEFUN(name, arglist, args)	name(args)
-#define	DEFUN_VOID(name)		name(NOARGS)
-
-#else	/* Not ANSI C.  */
-
-#define	PTR		char *
-#define	PTRCONST	PTR
-#define	LONG_DOUBLE	double
-
-#define	AND		;
-#define	NOARGS
-#define	CONST
-#define	VOLATILE
-#define	SIGNED
-#define	DOTS
-
-#define	EXFUN(name, proto)		name()
-#define	DEFUN(name, arglist, args)	name arglist args;
-#define	DEFUN_VOID(name)		name()
-
-#endif	/* ANSI C.  */
-
-
-#endif	/* ansidecl.h	*/
diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h
index d1a262a786..ebc68380c0 100644
--- a/argp/argp-fmtstream.h
+++ b/argp/argp-fmtstream.h
@@ -23,8 +23,8 @@
    that.  This header file is only used internally while compiling argp, and
    shouldn't be installed.  */
 
-#ifndef __ARGP_FMTSTREAM_H__
-#define __ARGP_FMTSTREAM_H__
+#ifndef _ARGP_FMTSTREAM_H
+#define _ARGP_FMTSTREAM_H
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -294,4 +294,4 @@ __argp_fmtstream_point (argp_fmtstream_t __fs)
 
 #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
 
-#endif /* __ARGP_FMTSTREAM_H__ */
+#endif /* argp-fmtstream.h */
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 018a97807e..553dd88552 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -42,7 +42,7 @@
 #endif
 
 #if _LIBC - 0
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #else
 #ifdef HAVE_CTHREADS_H
 #include <cthreads.h>
diff --git a/argp/argp.h b/argp/argp.h
index 2305590a5d..600264e6b7 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -18,8 +18,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __ARGP_H__
-#define __ARGP_H__
+#ifndef _ARGP_H
+#define _ARGP_H
 
 #include <stdio.h>
 #include <ctype.h>
@@ -551,7 +551,7 @@ __option_is_end (__const struct argp_option *__opt)
 # undef __option_is_short
 # undef __option_is_end
 #endif
-
+#endif /* argp.h */
 #endif /* __OPTIMIZE__ */
 
 #ifdef  __cplusplus
diff --git a/sysdeps/generic/confname.h b/bits/confname.h
index 5b5cf742b6..5b5cf742b6 100644
--- a/sysdeps/generic/confname.h
+++ b/bits/confname.h
diff --git a/sysdeps/generic/ioctl-types.h b/bits/ioctl-types.h
index 50fe19adcf..1d5c8a002f 100644
--- a/sysdeps/generic/ioctl-types.h
+++ b/bits/ioctl-types.h
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOCTL_TYPES_H
-#define _IOCTL_TYPES_H 1
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTL_TYPES_H
+#define _BITS_IOCTL_TYPES_H 1
 
 
 #if	defined(TIOCGETC) || defined(TIOCSETC)
@@ -114,4 +118,4 @@ struct ttysize
 #endif
 
 
-#endif /* ioctl-types.h */
+#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/generic/mathbits.h b/bits/mathdef.h
index b14b52d901..93b60bd25f 100644
--- a/sysdeps/generic/mathbits.h
+++ b/bits/mathdef.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _MATHBITS_H
-#define _MATHBITS_H	1
+#ifndef _MATH_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
 
 /* Normally, there is no long double type and the `float' and `double'
    expressions are evaluated as `double'.  */
@@ -36,5 +38,3 @@ typedef double double_t;	/* `double' expressions are evaluated as
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 #define FP_ILOGB0	0x80000001
 #define FP_ILOGBNAN	0x7fffffff
-
-#endif /* mathbits.h */
diff --git a/sysdeps/generic/resourcebits.h b/bits/resource.h
index 2c35c12a47..2c35c12a47 100644
--- a/sysdeps/generic/resourcebits.h
+++ b/bits/resource.h
diff --git a/bits/sched.h b/bits/sched.h
new file mode 100644
index 0000000000..bb5da5676f
--- /dev/null
+++ b/bits/sched.h
@@ -0,0 +1,35 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+   scheduling interface.
+   Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, write to the Free Software Foundation, Inc., 59 Temple Place
+   Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _SCHED_H
+#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+#endif
+
+
+/* Scheduling algorithms.  */
+#define SCHED_OTHER	0
+#define SCHED_FIFO	1
+#define SCHED_RR	2
+
+/* Data structure to describe a process' schedulability.  */
+struct sched_param
+{
+  int sched_priority;
+};
diff --git a/sysdeps/generic/selectbits.h b/bits/select.h
index e2bdf6049e..613919577c 100644
--- a/sysdeps/generic/selectbits.h
+++ b/bits/select.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SELECTBITS_H
-#define _SELECTBITS_H	1
+#ifndef _SYS_SELECT_H
+#error "Never use <bits/select.h> directly; include <sys/select.h> instead."
+#endif
+
 
 /* This line MUST be split!  Otherwise m4 will not change it.  */
 #define __FD_ZERO(set)  \
@@ -25,5 +27,3 @@
 #define __FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
 #define __FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
 #define __FD_ISSET(d, set)	((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
-
-#endif /* selectbits.h */
diff --git a/sysdeps/generic/sigaction.h b/bits/sigaction.h
index 1676b1ce8e..1676b1ce8e 100644
--- a/sysdeps/generic/sigaction.h
+++ b/bits/sigaction.h
diff --git a/sysdeps/generic/sigset.h b/bits/sigset.h
index 9fad4538d7..9fad4538d7 100644
--- a/sysdeps/generic/sigset.h
+++ b/bits/sigset.h
diff --git a/sysdeps/generic/sockaddrcom.h b/bits/sockaddr.h
index 8b1de11c15..73a0e26ec4 100644
--- a/sysdeps/generic/sockaddrcom.h
+++ b/bits/sockaddr.h
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SOCKADDRCOM_H
-#define _SOCKADDRCOM_H	1
+/*
+ * Never include this file directly; use <sys/socket.h> instead.
+ */
+
+#ifndef _BITS_SOCKADDR_H
+#define _BITS_SOCKADDR_H	1
 
 
 /* POSIX.1g specifies this type name for the `sa_family' member.  */
@@ -34,4 +38,4 @@ typedef unsigned short int sa_family_t;
 #define __SOCKADDR_COMMON_SIZE	(sizeof (unsigned short int))
 
 
-#endif	/* sockaddrcom.h */
+#endif	/* bits/sockaddr.h */
diff --git a/sysdeps/generic/socketbits.h b/bits/socket.h
index 5d85a8e079..d12d96cc14 100644
--- a/sysdeps/generic/socketbits.h
+++ b/bits/socket.h
@@ -17,9 +17,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_SOCKETBITS_H
+#ifndef _SYS_SOCKET_H
+#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
 
-#define	_SOCKETBITS_H	1
 #include <features.h>
 
 __BEGIN_DECLS
@@ -114,7 +116,7 @@ enum __socket_type
 
 
 /* Get the definition of the macro to define the common sockaddr members.  */
-#include <sockaddrcom.h>
+#include <bits/sockaddr.h>
 
 /* Structure describing a generic socket address.  */
 struct sockaddr
@@ -196,5 +198,3 @@ struct linger
   };
 
 __END_DECLS
-
-#endif /* socketbits.h */
diff --git a/bits/statfs.h b/bits/statfs.h
new file mode 100644
index 0000000000..10bc0728b2
--- /dev/null
+++ b/bits/statfs.h
@@ -0,0 +1,52 @@
+/* Definition of `struct statfs', information about a filesystem.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/statfs.h> instead.
+ */
+
+#ifndef	_BITS_STATFS_H
+#define	_BITS_STATFS_H	1
+
+#include <bits/types.h>
+
+/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
+   <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC.  MiG
+   does not cope at all well with the passed C structure not being of the
+   expected size.  There are some filler words at the end to allow for
+   future expansion.  To increase the size of the structure used in the RPC
+   and retain binary compatibility, we would need to assign a new message
+   number.  */
+
+struct statfs
+  {
+    unsigned int f_type;
+    unsigned int f_bsize;
+    unsigned int f_blocks;
+    unsigned int f_bfree;
+    unsigned int f_bavail;
+    unsigned int f_files;
+    unsigned int f_ffree;
+    __fsid_t f_fsid;
+    unsigned int f_namelen;
+    unsigned int f_spare[6];
+  };
+
+
+#endif /* bits/statfs.h */
diff --git a/sysdeps/generic/termbits.h b/bits/termios.h
index adf0ee2f75..9a6aed2bba 100644
--- a/sysdeps/generic/termbits.h
+++ b/bits/termios.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* These macros are also defined in some ioctls.h files (with numerically
-   identical values), but this serves to shut up cpp's complaining. */
+/* These macros are also defined in some <bits/ioctls.h> files (with
+   numerically identical values), but this serves to shut up cpp's
+   complaining. */
 #ifdef __USE_BSD
 
 #ifdef MDMBUF
diff --git a/sysdeps/generic/gnu/types.h b/bits/types.h
index 85f17a4fb1..c264adc917 100644
--- a/sysdeps/generic/gnu/types.h
+++ b/bits/types.h
@@ -16,9 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_GNU_TYPES_H
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
 
-#define	_GNU_TYPES_H	1
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
 
 
 /* Convenience types.  */
@@ -39,6 +42,16 @@ typedef struct
   __u_long __val[2];
 } __u_quad_t;
 #endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+typedef signed long long int __int64_t;
+typedef unsigned long long int __uint64_t;
+#endif
 typedef __quad_t *__qaddr_t;
 typedef int __dev_t;		/* Type of device numbers.  */
 typedef unsigned int __uid_t;	/* Type of user identifications.  */
@@ -78,4 +91,4 @@ typedef struct
 
 typedef unsigned long int __fd_mask;
 
-#endif /* gnu/types.h */
+#endif /* bits/types.h */
diff --git a/bits/uio.h b/bits/uio.h
new file mode 100644
index 0000000000..1a12697008
--- /dev/null
+++ b/bits/uio.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_UIO_H
+#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+#endif
+
+
+/* `struct iovec' -- Structure describing a section of memory.  */
+
+struct iovec
+{
+  /* Starting address.  */
+  __ptr_t iov_base;
+  /* Length in bytes.  */
+  size_t iov_len;
+};
diff --git a/sysdeps/generic/ustatbits.h b/bits/ustat.h
index aa5d493e63..aa5d493e63 100644
--- a/sysdeps/generic/ustatbits.h
+++ b/bits/ustat.h
diff --git a/sysdeps/generic/utmpbits.h b/bits/utmp.h
index cbd3457bd4..b8decb0598 100644
--- a/sysdeps/generic/utmpbits.h
+++ b/bits/utmp.h
@@ -1,5 +1,5 @@
 /* The `struct utmp' type, describing entries in the utmp file.  Generic/BSDish
-   Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -16,9 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _UTMPBITS_H
+#ifndef _UTMP_H
+#error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+#endif
+
 
-#define _UTMPBITS_H	1
 #include <features.h>
 
 #include <paths.h>
@@ -49,5 +51,3 @@ struct utmp {
 
 
 __END_DECLS
-
-#endif /* utmpbits.h */
diff --git a/sysdeps/generic/utsnamelen.h b/bits/utsname.h
index 5594bcc4da..5594bcc4da 100644
--- a/sysdeps/generic/utsnamelen.h
+++ b/bits/utsname.h
diff --git a/sysdeps/generic/waitstatus.h b/bits/waitstatus.h
index 4fbcbe87aa..8e97f2702c 100644
--- a/sysdeps/generic/waitstatus.h
+++ b/bits/waitstatus.h
@@ -1,5 +1,5 @@
 /* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,10 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead."
+#endif
+
+
 /* Everything extant so far uses these same bits.  */
 
-#ifndef	_WAITSTATUS_H
-#define	_WAITSTATUS_H
 
 /* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
 #define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
@@ -99,6 +102,3 @@ union wait
 #define	w_stopval	__wait_stopped.__w_stopval
 
 #endif	/* Use BSD.  */
-
-
-#endif	/* waitstatus.h */
diff --git a/catgets/nl_types.h b/catgets/nl_types.h
index 40fb965508..bf07fcd1e4 100644
--- a/catgets/nl_types.h
+++ b/catgets/nl_types.h
@@ -18,6 +18,7 @@
 
 #ifndef _NL_TYPES_H
 #define _NL_TYPES_H 1
+
 #include <features.h>
 
 /* The default message set used by the gencat program.  */
diff --git a/config.h.in b/config.h.in
index 2b9ca028af..390b228529 100644
--- a/config.h.in
+++ b/config.h.in
@@ -46,6 +46,9 @@
 /* Define if versioning of the library is wanted.  */
 #undef	DO_VERSIONING
 
+/* Define if static NSS modules are wanted.  */
+#undef	DO_STATIC_NSS
+
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index e807a4cba2..2bf33b487f 100644
--- a/config.make.in
+++ b/config.make.in
@@ -40,6 +40,7 @@ build-shared = @shared@
 build-profile = @profile@
 build-omitfp = @omitfp@
 build-bounded = @bounded@
+build-static-nss = @static_nss@
 stdio = @stdio@
 add-ons = @subdirs@
 cross-compiling = @cross_compiling@
diff --git a/configure b/configure
index 3d8b4a224c..13545165ad 100755
--- a/configure
+++ b/configure
@@ -45,6 +45,8 @@ ac_help="$ac_help
   --enable-bounded        build with runtime bounds checking [default=no]"
 ac_help="$ac_help
   --enable-add-ons=DIR... configure and build named extra directories"
+ac_help="$ac_help
+  --enable-static-nss     build static NSS modules [default=no]"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -484,7 +486,7 @@ echo > confdefs.h
 
 # A filename unique to this package, relative to the directory that
 # configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=features.h
+ac_unique_file=include/features.h
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
@@ -727,6 +729,21 @@ if test x"$add_ons" != x; then
   done
 fi
 
+# Check whether --enable-static-nss or --disable-static-nss was given.
+if test "${enable_static_nss+set}" = set; then
+  enableval="$enable_static_nss"
+  static_nss=$enableval
+else
+  static_nss=no
+fi
+
+if test x"$static_nss" = xyes; then
+  cat >> confdefs.h <<\EOF
+#define DO_STATIC_NSS 1
+EOF
+
+fi
+
 
 # Make sure we can run config.sub.
 if $ac_config_sub sun4 >/dev/null 2>&1; then :
@@ -734,7 +751,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:738: checking host system type" >&5
+echo "configure:755: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -816,7 +833,7 @@ esac
 # This can take a while to compute.
 sysdep_dir=$srcdir/sysdeps
 echo $ac_n "checking sysdep dirs""... $ac_c" 1>&6
-echo "configure:820: checking sysdep dirs" >&5
+echo "configure:837: checking sysdep dirs" >&5
 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
 
@@ -998,10 +1015,10 @@ while test $# -gt 0; do
 done
 
 # Add the default directories.
-sysnames="$names sysdeps/generic sysdeps/stub"
+sysnames="$names sysdeps/generic sysdeps/stub include"
 
 # The other names were emitted during the scan.
-echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
+echo "$ac_t""sysdeps/generic sysdeps/stub include" 1>&6
 
 
 ### Locate tools.
@@ -1017,7 +1034,7 @@ echo "$ac_t""sysdeps/generic sysdeps/stub" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1021: checking for a BSD compatible install" >&5
+echo "configure:1038: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1071,7 +1088,7 @@ if test "$INSTALL" = "${srcdir}/install-sh -c"; then
   INSTALL='$(..)./install-sh -c'
 fi
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1075: checking whether ln -s works" >&5
+echo "configure:1092: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1096,7 +1113,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1100: checking for $ac_word" >&5
+echo "configure:1117: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MSGFMT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1129,7 +1146,7 @@ test -n "$MSGFMT" || MSGFMT=":"
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1133: checking for $ac_word" >&5
+echo "configure:1150: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1158,7 +1175,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1162: checking for $ac_word" >&5
+echo "configure:1179: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1206,7 +1223,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1210: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1227: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1216,11 +1233,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1220 "configure"
+#line 1237 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1243,13 +1260,13 @@ else
  cross_linkable=yes
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1247: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1264: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1253: checking whether we are using GNU C" >&5
+echo "configure:1270: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1258,7 +1275,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1275,7 +1292,7 @@ if test $ac_cv_prog_gcc = yes; then
   yes;
 #endif
 EOF
-  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
     if test -z "$CFLAGS"; then
       CFLAGS="-g -O2"
     fi
@@ -1287,7 +1304,7 @@ else
 fi
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1291: checking build system type" >&5
+echo "configure:1308: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1310,7 +1327,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1314: checking for $ac_word" >&5
+echo "configure:1331: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1341,7 +1358,7 @@ done
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1345: checking how to run the C preprocessor" >&5
+echo "configure:1362: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1356,13 +1373,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1360 "configure"
+#line 1377 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1373,13 +1390,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1377 "configure"
+#line 1394 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1410,7 +1427,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1414: checking for $ac_word" >&5
+echo "configure:1431: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1441,7 +1458,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1445: checking for $ac_word" >&5
+echo "configure:1462: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1472,7 +1489,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1476: checking for $ac_word" >&5
+echo "configure:1493: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1507,7 +1524,7 @@ fi
 # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1511: checking for $ac_word" >&5
+echo "configure:1528: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1548,7 +1565,7 @@ if test "$BASH" = no; then
   # Extract the first word of "ksh", so it can be a program name with args.
 set dummy ksh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1552: checking for $ac_word" >&5
+echo "configure:1569: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1590,7 +1607,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1594: checking for signed size_t type" >&5
+echo "configure:1611: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1614,12 +1631,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1618: checking for libc-friendly stddef.h" >&5
+echo "configure:1635: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1623 "configure"
+#line 1640 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1634,7 +1651,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1653,7 +1670,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1657: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1674: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1676,7 +1693,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1680: checking for assembler global-symbol directive" >&5
+echo "configure:1697: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1706,7 +1723,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1710: checking for .set assembler directive" >&5
+echo "configure:1727: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1740,7 +1757,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1744: checking for .symver assembler directive" >&5
+echo "configure:1761: checking for .symver assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1759,7 +1776,7 @@ fi
 
 echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1763: checking for ld --version-script" >&5
+echo "configure:1780: checking for ld --version-script" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1776,7 +1793,7 @@ VERS {
 EOF
   if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
     if { ac_try='${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
-					-Wl,--version-script,conftest.map'; { (eval echo configure:1780: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+					-Wl,--version-script,conftest.map'; { (eval echo configure:1797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -1806,7 +1823,7 @@ fi
 
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1810: checking for .previous assembler directive" >&5
+echo "configure:1827: checking for .previous assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1814,7 +1831,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1830,7 +1847,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1834: checking for .popsection assembler directive" >&5
+echo "configure:1851: checking for .popsection assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1838,7 +1855,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1858,12 +1875,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1862: checking for .init and .fini sections" >&5
+echo "configure:1879: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1867 "configure"
+#line 1884 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1872,7 +1889,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1897,19 +1914,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1901: checking for _ prefix on C symbol names" >&5
+echo "configure:1918: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1906 "configure"
+#line 1923 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1936,7 +1953,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1940: checking for assembler .weak directive" >&5
+echo "configure:1957: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1959,7 +1976,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1963: checking for assembler .weakext directive" >&5
+echo "configure:1980: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1996,7 +2013,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2000: checking for ld --no-whole-archive" >&5
+echo "configure:2017: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2007,7 +2024,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c'; { (eval echo configure:2011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -2018,7 +2035,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:2022: checking for gcc -fno-exceptions" >&5
+echo "configure:2039: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2029,7 +2046,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c'; { (eval echo configure:2033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -2081,7 +2098,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2085: checking OS release for uname" >&5
+echo "configure:2102: checking OS release for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2103,7 +2120,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
   uname_release="$libc_cv_uname_release"
 
   echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2107: checking OS version for uname" >&5
+echo "configure:2124: checking OS version for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2125,7 +2142,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2129: checking stdio selection" >&5
+echo "configure:2146: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -2178,6 +2195,7 @@ fi
 
 
 
+
 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
   config_makefile=
 else
@@ -2365,6 +2383,7 @@ s%@shared@%$shared%g
 s%@profile@%$profile%g
 s%@omitfp@%$omitfp%g
 s%@bounded@%$bounded%g
+s%@static_nss@%$static_nss%g
 s%@DEFINES@%$DEFINES%g
 s%@VERSION@%$VERSION%g
 
@@ -2621,7 +2640,7 @@ while test -n "$ac_sources"; do
 done
 EOF
 cat >> $CONFIG_STATUS <<EOF
-echo '$config_vars' >> config.make
+echo '$config_vars' >> config.make; test -d bits || mkdir bits
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 
diff --git a/configure.in b/configure.in
index 667ac7e0c2..150843c54b 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
 Dnl Process this file with autoconf to produce a configure script.
 AC_REVISION([$CVSid$])
 AC_PREREQ(2.11)dnl		dnl Minimum Autoconf version required.
-AC_INIT(features.h)
+AC_INIT(include/features.h)
 AC_CONFIG_HEADER(config.h)
 
 # This will get text that should go into config.make.
@@ -92,6 +92,15 @@ if test x"$add_ons" != x; then
   done
 fi
 
+dnl On some platforms we cannot use dynamic loading.  We must provide
+dnl static NSS modules.
+AC_ARG_ENABLE(static-nss, dnl
+[  --enable-static-nss     build static NSS modules [default=no]],
+	      static_nss=$enableval, static_nss=no)
+if test x"$static_nss" = xyes; then
+  AC_DEFINE(DO_STATIC_NSS)
+fi
+
 AC_CANONICAL_HOST
 
 # The way shlib-versions is used to generate soversions.mk uses a
@@ -345,10 +354,10 @@ changequote([,])dnl
 done
 
 # Add the default directories.
-sysnames="$names sysdeps/generic sysdeps/stub"
+sysnames="$names sysdeps/generic sysdeps/stub include"
 AC_SUBST(sysnames)
 # The other names were emitted during the scan.
-AC_MSG_RESULT(sysdeps/generic sysdeps/stub)
+AC_MSG_RESULT(sysdeps/generic sysdeps/stub include)
 
 
 ### Locate tools.
@@ -811,6 +820,7 @@ fi
 AC_SUBST(profile)
 AC_SUBST(omitfp)
 AC_SUBST(bounded)
+AC_SUBST(static_nss)
 
 AC_SUBST(DEFINES)
 
@@ -823,5 +833,5 @@ fi
 VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
 AC_SUBST(VERSION)
 
-AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
+          [echo '$config_vars' >> config.make; test -d bits || mkdir bits])
           [echo '$config_vars' >> config.make])
diff --git a/csu/Makefile b/csu/Makefile
index 5888d1098e..c13ec1ec88 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -59,11 +59,11 @@ omit-deps += $(crtstuff)
 
 # Special rules for the building of crti.o and crtn.o
 $(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
-	$(CC) -c -fPIC -g0 -I$(..) -I$(common-objpfx) -DASSEMBLER $< -o $@
+	$(compile.S) -fPIC -g0 -o $@
 
 $(objpfx)initfini.s: initfini.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -g0 -S -fPIC -finhibit-size-directive \
-              $(no-exceptions) $< -o $@
+	$(compile.c) -g0 -S -fPIC -finhibit-size-directive \
+		$(no-exceptions) -o $@
 
 $(objpfx)crti.S: $(objpfx)initfini.s
 	sed -n -e '1,/@HEADER_ENDS/p' \
diff --git a/ctype/ctype-info.c b/ctype/ctype-info.c
index a7688f7d00..30b1cce6ff 100644
--- a/ctype/ctype-info.c
+++ b/ctype/ctype-info.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <ctype.h>
-#include "../locale/localeinfo.h"
+#include <locale/localeinfo.h>
 
 /* Defined in locale/C-ctype.c.  */
 extern const char _nl_C_LC_CTYPE_class[];
@@ -30,8 +30,8 @@ extern const char _nl_C_LC_CTYPE_width[];
 #define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o);
 
 const unsigned short int *__ctype_b = b (unsigned short int, class, 128);
-const unsigned int *__ctype32_b = b (unsigned int, class32, 0);
-const int *__ctype_tolower = b (int, tolower, 128);
-const int *__ctype_toupper = b (int, toupper, 128);
-const unsigned int *__ctype_names = b (unsigned int, names, 0);
+const __uint32_t *__ctype32_b = b (__uint32_t, class32, 0);
+const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128);
+const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128);
+const __uint32_t *__ctype_names = b (__uint32_t, names, 0);
 const unsigned char *__ctype_width = b (unsigned char, width, 0);
diff --git a/ctype/ctype.h b/ctype/ctype.h
index bd128445bc..22b17c1ed7 100644
--- a/ctype/ctype.h
+++ b/ctype/ctype.h
@@ -21,9 +21,10 @@
  */
 
 #ifndef	_CTYPE_H
-
 #define	_CTYPE_H	1
+
 #include <features.h>
+#include <gnu/types.h>
 
 __BEGIN_DECLS
 
@@ -72,8 +73,8 @@ enum
    doesn't fit into an `unsigned char'.  But today more important is that
    the arrays are also used for multi-byte character sets.  */
 extern __const unsigned short int *__ctype_b;	/* Characteristics.  */
-extern __const int *__ctype_tolower; /* Case conversions.  */
-extern __const int *__ctype_toupper; /* Case conversions.  */
+extern __const __int32_t *__ctype_tolower; /* Case conversions.  */
+extern __const __int32_t *__ctype_toupper; /* Case conversions.  */
 
 #define	__isctype(c, type) \
   (__ctype_b[(int) (c)] & (unsigned short int) type)
diff --git a/db/db.h b/db/db.h
index 8f1a9de9e2..f00c4df9f9 100644
--- a/db/db.h
+++ b/db/db.h
@@ -33,8 +33,8 @@
  *	@(#)db.h	8.7 (Berkeley) 6/16/94
  */
 
-#ifndef _DB_H_
-#define	_DB_H_
+#ifndef _DB_H
+#define	_DB_H 1
 
 #include <sys/types.h>
 #include <sys/cdefs.h>
@@ -234,4 +234,5 @@ DB	*__rec_open __P((const char *, int, int, const RECNOINFO *, int));
 void	 __dbpanic __P((DB *dbp));
 #endif
 __END_DECLS
-#endif /* !_DB_H_ */
+
+#endif /* db.h */
diff --git a/db/mpool.h b/db/mpool.h
index e533072a65..56f17f90db 100644
--- a/db/mpool.h
+++ b/db/mpool.h
@@ -33,6 +33,9 @@
  *	@(#)mpool.h	8.2 (Berkeley) 7/14/94
  */
 
+#ifndef _MPOOL_H
+#define _MPOOL_H 1
+
 #include <sys/queue.h>
 
 /*
@@ -105,3 +108,5 @@ int	 mpool_close __P((MPOOL *));
 void	 mpool_stat __P((MPOOL *));
 #endif
 __END_DECLS
+
+#endif /* mpool.h */
diff --git a/db/ndbm.h b/db/ndbm.h
index 48c4083a2b..db14dff2ed 100644
--- a/db/ndbm.h
+++ b/db/ndbm.h
@@ -36,8 +36,8 @@
  *	@(#)ndbm.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _NDBM_H_
-#define	_NDBM_H_
+#ifndef _NDBM_H
+#define	_NDBM_H 1
 
 #include <db.h>
 
@@ -76,4 +76,4 @@ int	 dbm_error __P((DBM *));
 int	 dbm_clearerr __P((DBM *));
 __END_DECLS
 
-#endif /* !_NDBM_H_ */
+#endif /* ndbm.h */
diff --git a/dirent/Makefile b/dirent/Makefile
index 4b64498d28..a7f3553df0 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -21,7 +21,7 @@
 #
 subdir		:= dirent
 
-headers		:= dirent.h direntry.h
+headers		:= dirent.h bits/dirent.h
 routines	:= opendir closedir readdir readdir_r rewinddir \
 		   seekdir telldir scandir alphasort versionsort \
 		   getdents dirfd
diff --git a/dirent/dirent.h b/dirent/dirent.h
index 9caf272aa1..a9a9a39e97 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -21,13 +21,13 @@
  */
 
 #ifndef	_DIRENT_H
-
 #define	_DIRENT_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* This file defines `struct dirent'.
 
@@ -44,7 +44,7 @@ __BEGIN_DECLS
    member that gives the type of the file.
  */
 
-#include <direntry.h>
+#include <bits/dirent.h>
 
 #if (defined __USE_BSD || defined __USE_MISC) && !defined d_fileno
 # define d_ino	d_fileno		 /* Backward compatibility.  */
@@ -142,7 +142,7 @@ extern int dirfd __P ((DIR *__dirp));
 
 # ifndef MAXNAMLEN
 /* Get the definitions of the POSIX.1 limits.  */
-#  include <posix1_lim.h>
+#  include <bits/posix1_lim.h>
 
 /* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'.  */
 #  ifdef NAME_MAX
@@ -152,7 +152,7 @@ extern int dirfd __P ((DIR *__dirp));
 #  endif
 # endif
 
-# include <gnu/types.h>
+# include <bits/types.h>
 # define __need_size_t
 # include <stddef.h>
 
diff --git a/elf/Makefile b/elf/Makefile
index 489a565945..ef9207c07b 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -20,7 +20,7 @@
 
 subdir		:= elf
 
-headers		= elf.h elfclass.h link.h dlfcn.h
+headers		= elf.h bits/elfclass.h link.h dlfcn.h
 routines	= $(dl-routines) dl-open dl-close dl-symbol dl-support \
 		  dl-version enbl-secure
 
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index f2ce4c9c3c..15da23d95c 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -83,6 +83,11 @@ do_lookup (const char *undef_name, unsigned long int hash,
       if (skip != NULL && map == skip)
 	continue;
 
+      /* Skip objects that could not be opened, which can occur in trace
+	 mode.  */
+      if (map->l_opencount == 0)
+	continue;
+
       /* Don't search the executable when resolving a copy reloc.  */
       if (elf_machine_lookup_noexec_p (reloc_type) &&
 	  map->l_type == lt_executable)
@@ -285,7 +290,7 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
       if (res < 0)
 	/* Oh, oh.  The file named in the relocation entry does not
 	   contain the needed symbol.  */
-	_dl_signal_error (0, *reference_name ? reference_name : NULL,
+	_dl_signal_error (0, reference_name,
 			  make_string ("symbol ", undef_name, ", version ",
 				       version->name,
 				       " not defined in file ",
diff --git a/elf/dlfcn.h b/elf/dlfcn.h
index 94e1fae8a4..9b06988e96 100644
--- a/elf/dlfcn.h
+++ b/elf/dlfcn.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_DLFCN_H
-
 #define	_DLFCN_H 1
+
 #include <features.h>
 
 /* The MODE argument to `dlopen' contains one of the following: */
diff --git a/elf/elf.h b/elf/elf.h
index 76f6c6865d..63d36b141c 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -19,46 +19,47 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _ELF_H
-
 #define	_ELF_H 1
+
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
 
-/* Standard ELF types.  Using __attribute__ mode ensures that GCC
-   will choose the right number of bits for these types.  */
+/* Standard ELF types.  */
+
+#include <inttypes.h>
 
 /* Type for a 16-bit quantity.  */
-typedef unsigned int Elf32_Half    __attribute__ ((mode (HI)));
-typedef unsigned int Elf64_Half    __attribute__ ((mode (HI)));
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
 
 /* Types for signed and unsigned 32-bit quantities.  */
-typedef unsigned int Elf32_Word    __attribute__ ((mode (SI)));
-typedef		 int Elf32_Sword   __attribute__ ((mode (SI)));
-typedef unsigned int Elf64_Word    __attribute__ ((mode (SI)));
-typedef		 int Elf64_Sword   __attribute__ ((mode (SI)));
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
 
 /* Types for signed and unsigned 64-bit quantities.  */
-typedef unsigned int Elf32_Xword   __attribute__ ((mode (DI)));
-typedef		 int Elf32_Sxword  __attribute__ ((mode (DI)));
-typedef unsigned int Elf64_Xword   __attribute__ ((mode (DI)));
-typedef		 int Elf64_Sxword  __attribute__ ((mode (DI)));
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
 
 /* Type of addresses.  */
-typedef unsigned int Elf32_Addr    __attribute__ ((mode (SI)));
-typedef unsigned int Elf64_Addr    __attribute__ ((mode (DI)));
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
 
 /* Type of file offsets.  */
-typedef unsigned int Elf32_Off     __attribute__ ((mode (SI)));
-typedef unsigned int Elf64_Off     __attribute__ ((mode (DI)));
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
 
 /* Type for section indices, which are 16-bit quantities.  */
-typedef unsigned int Elf32_Section __attribute__ ((mode (HI)));
-typedef unsigned int Elf64_Section __attribute__ ((mode (HI)));
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
 
 /* Type of symbol indices.  */
-typedef unsigned int Elf32_Symndx  __attribute__ ((mode (SI)));
-typedef unsigned int Elf64_Symndx  __attribute__ ((mode (DI)));
+typedef uint32_t Elf32_Symndx;
+typedef uint64_t Elf64_Symndx;
 
 
 /* The ELF file header.  This appears at the start of every ELF file.  */
diff --git a/elf/eval.c b/elf/eval.c
index 7d53671f6c..ce452b722c 100644
--- a/elf/eval.c
+++ b/elf/eval.c
@@ -1,5 +1,5 @@
 /* You don't really want to know what this hack is for.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -128,7 +128,7 @@ _start (void)
   char *buf = NULL;
   size_t bufsz = 0;
 
-  while (__getline (&buf, &bufsz, stdin) > 0)
+  while (__getdelim (&buf, &bufsz, '\n', stdin) > 0)
     {
       char *p = buf;
       eval (&p);
diff --git a/elf/link.h b/elf/link.h
index c894540e5e..6c272fe054 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_LINK_H
-
 #define	_LINK_H	1
+
 #include <features.h>
 
 #define __need_size_t
@@ -36,7 +36,8 @@ __BEGIN_DECLS
 #define ELFW(type)	_ElfW (ELF, __ELF_NATIVE_CLASS, type)
 #define _ElfW(e,w,t)	_ElfW_1 (e, w, _##t)
 #define _ElfW_1(e,w,t)	e##w##t
-#include <elfclass.h>		/* Defines __ELF_NATIVE_CLASS.  */
+
+#include <bits/elfclass.h>		/* Defines __ELF_NATIVE_CLASS.  */
 
 /* Rendezvous structure used by the run-time dynamic linker to communicate
    details of shared object loading to the debugger.  If the executable's
diff --git a/gmon/sys/gmon.h b/gmon/sys/gmon.h
index d963797cd2..2eff69b01c 100644
--- a/gmon/sys/gmon.h
+++ b/gmon/sys/gmon.h
@@ -33,9 +33,9 @@
  *	@(#)gmon.h	8.2 (Berkeley) 1/4/94
  */
 
-#ifndef	_SYS_GMON_H_
+#ifndef	_SYS_GMON_H
+#define	_SYS_GMON_H	1
 
-#define	_SYS_GMON_H_	1
 #include <features.h>
 
 #include <sys/types.h>
@@ -176,4 +176,4 @@ void _mcleanup __P ((void));
 
 __END_DECLS
 
-#endif /* !_SYS_GMON_H_ */
+#endif /* sys/gmon.h */
diff --git a/gmon/sys/gmon_out.h b/gmon/sys/gmon_out.h
index 36059cc572..bb80a1a16f 100644
--- a/gmon/sys/gmon_out.h
+++ b/gmon/sys/gmon_out.h
@@ -26,8 +26,8 @@
    identifying the type of records, followed by records specific data. */
 
 #ifndef _SYS_GMON_OUT_H
-
 #define _SYS_GMON_OUT_H	1
+
 #include <features.h>
 
 #define	GMON_MAGIC	"gmon"	/* magic cookie */
@@ -74,4 +74,4 @@ struct gmon_cg_arc_record
 
 __END_DECLS
 
-#endif /* _SYS_GMON_OUT_H */
+#endif /* sys/gmon_out.h */
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c
index 0b461ad5fe..24fdcd86d9 100644
--- a/grp/fgetgrent.c
+++ b/grp/fgetgrent.c
@@ -18,7 +18,7 @@
 
 #include <errno.h>
 #include <grp.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 
 
diff --git a/grp/grp.h b/grp/grp.h
index 292bd26ec0..72b8925a8c 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -21,13 +21,13 @@
  */
 
 #ifndef	_GRP_H
-
 #define	_GRP_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 #define __need_size_t
 #include <stddef.h>
diff --git a/hurd/hurd/ioctl.h b/hurd/hurd/ioctl.h
index 8c6dbfd0be..b18f8a1586 100644
--- a/hurd/hurd/ioctl.h
+++ b/hurd/hurd/ioctl.h
@@ -22,7 +22,7 @@
 
 #define	__need___va_list
 #include <stdarg.h>
-#include <ioctls.h>
+#include <bits/ioctls.h>
 
 
 /* Type of handler function, called like ioctl to do its entire job.  */
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 533099223a..eb7adbef66 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -132,8 +132,8 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	      int i;
 	    } check =
 	      { t: {
-		MACH_MSG_TYPE_INTEGER_32,
-		32,
+		MACH_MSG_TYPE_INTEGER_T,
+		MACH_MSG_TYPE_INTEGER_T,
 		1,
 		TRUE,
 		FALSE,
diff --git a/aliases.h b/include/aliases.h
index cfe459d02d..cfe459d02d 100644
--- a/aliases.h
+++ b/include/aliases.h
diff --git a/alloca.h b/include/alloca.h
index 34eeeab78e..34eeeab78e 100644
--- a/alloca.h
+++ b/include/alloca.h
diff --git a/argp.h b/include/argp.h
index 92be5f90f1..92be5f90f1 100644
--- a/argp.h
+++ b/include/argp.h
diff --git a/argz.h b/include/argz.h
index 179e693106..179e693106 100644
--- a/argz.h
+++ b/include/argz.h
diff --git a/arpa/ftp.h b/include/arpa/ftp.h
index c716d68156..c716d68156 100644
--- a/arpa/ftp.h
+++ b/include/arpa/ftp.h
diff --git a/arpa/inet.h b/include/arpa/inet.h
index 65733b618c..65733b618c 100644
--- a/arpa/inet.h
+++ b/include/arpa/inet.h
diff --git a/arpa/nameser.h b/include/arpa/nameser.h
index 944fe732a6..944fe732a6 100644
--- a/arpa/nameser.h
+++ b/include/arpa/nameser.h
diff --git a/arpa/telnet.h b/include/arpa/telnet.h
index 742c04cfe3..742c04cfe3 100644
--- a/arpa/telnet.h
+++ b/include/arpa/telnet.h
diff --git a/arpa/tftp.h b/include/arpa/tftp.h
index 21d5197f24..21d5197f24 100644
--- a/arpa/tftp.h
+++ b/include/arpa/tftp.h
diff --git a/assert.h b/include/assert.h
index e2fa7020c1..e2fa7020c1 100644
--- a/assert.h
+++ b/include/assert.h
diff --git a/include/bits/mathcalls.h b/include/bits/mathcalls.h
new file mode 100644
index 0000000000..d75b598cc7
--- /dev/null
+++ b/include/bits/mathcalls.h
@@ -0,0 +1 @@
+#include <math/bits/mathcalls.h>
diff --git a/include/bits/posix1_lim.h b/include/bits/posix1_lim.h
new file mode 100644
index 0000000000..c3c67d1c84
--- /dev/null
+++ b/include/bits/posix1_lim.h
@@ -0,0 +1 @@
+#include <posix/bits/posix1_lim.h>
diff --git a/include/bits/posix2_lim.h b/include/bits/posix2_lim.h
new file mode 100644
index 0000000000..49a539438c
--- /dev/null
+++ b/include/bits/posix2_lim.h
@@ -0,0 +1 @@
+#include <posix/bits/posix2_lim.h>
diff --git a/include/bits/stab.def b/include/bits/stab.def
new file mode 100644
index 0000000000..d153eba4de
--- /dev/null
+++ b/include/bits/stab.def
@@ -0,0 +1 @@
+#include <misc/bits/stab.def>
diff --git a/xopen_lim.h b/include/bits/xopen_lim.h
index 04a11ba320..c8b847fbc2 100644
--- a/xopen_lim.h
+++ b/include/bits/xopen_lim.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/*
+ * Never include this file directly; use <limits.h> instead.
+ */
+
 /* Additional definitions from X/Open Portability Guide, Issue 4, Version 2
    System Interfaces and Headers, 4.16 <limits.h>
 
@@ -87,4 +91,4 @@
 /* Default process priority.  */
 #define NZERO		20
 
-#endif /* xopen_lim.h */
+#endif /* bits/xopen_lim.h */
diff --git a/ctype.h b/include/ctype.h
index 7b51e1f5eb..7b51e1f5eb 100644
--- a/ctype.h
+++ b/include/ctype.h
diff --git a/db.h b/include/db.h
index a04f7746ef..a04f7746ef 100644
--- a/db.h
+++ b/include/db.h
diff --git a/dirent.h b/include/dirent.h
index f59a6b778b..f59a6b778b 100644
--- a/dirent.h
+++ b/include/dirent.h
diff --git a/dlfcn.h b/include/dlfcn.h
index 92804a1c1c..92804a1c1c 100644
--- a/dlfcn.h
+++ b/include/dlfcn.h
diff --git a/elf.h b/include/elf.h
index 8a1764f956..8a1764f956 100644
--- a/elf.h
+++ b/include/elf.h
diff --git a/endian.h b/include/endian.h
index cacf2fe9b7..cacf2fe9b7 100644
--- a/endian.h
+++ b/include/endian.h
diff --git a/envz.h b/include/envz.h
index 0a476ed62a..0a476ed62a 100644
--- a/envz.h
+++ b/include/envz.h
diff --git a/err.h b/include/err.h
index 915720aa4c..915720aa4c 100644
--- a/err.h
+++ b/include/err.h
diff --git a/errno.h b/include/errno.h
index b8486728b7..23e0b8f9a9 100644
--- a/errno.h
+++ b/include/errno.h
@@ -33,16 +33,16 @@ __BEGIN_DECLS
 
 /* Get the error number constants from the system-specific file.
    This file will test __need_Emath and _ERRNO_H.  */
-#include <errnos.h>
+#include <bits/errno.h>
 #undef	__need_Emath
 
 #ifdef	_ERRNO_H
 
 /* Declare the `errno' variable, unless it's defined as a macro by
-   errnos.h.  This is the case in GNU, where it is a per-thread variable.
-   This redeclaration using the macro still works, but it will be a
-   function declaration without a prototype and may trigger a
-   -Wstrict-prototypes warning.  */
+   bits/errno.h.  This is the case in GNU, where it is a per-thread
+   variable.  This redeclaration using the macro still works, but it
+   will be a function declaration without a prototype and may trigger
+   a -Wstrict-prototypes warning.  */
 #ifndef	errno
 extern int errno;
 #endif
@@ -60,8 +60,8 @@ __END_DECLS
 
 #endif /* _ERRNO_H */
 
-/* The Hurd <errnos.h> defines `error_t' as an enumerated type so that
-   printing `error_t' values in the debugger shows the names.  We
+/* The Hurd <bits/errno.h> defines `error_t' as an enumerated type so
+   that printing `error_t' values in the debugger shows the names.  We
    might need this definition sometimes even if this file was included
    before.  */
 #if defined __USE_GNU || defined __need_error_t
diff --git a/error.h b/include/error.h
index 70f3192fa6..70f3192fa6 100644
--- a/error.h
+++ b/include/error.h
diff --git a/fcntl.h b/include/fcntl.h
index bac1e8685d..bac1e8685d 100644
--- a/fcntl.h
+++ b/include/fcntl.h
diff --git a/features.h b/include/features.h
index c38480e637..d1f4ae3d29 100644
--- a/features.h
+++ b/include/features.h
@@ -17,7 +17,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FEATURES_H
-
 #define	_FEATURES_H	1
 
 /* These are defined by the user (or the compiler)
@@ -105,20 +104,20 @@
 
 /* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
 #ifdef _GNU_SOURCE
-#undef	_ISOC9X_SOURCE
-#define	_ISOC9X_SOURCE	1
-#undef	_POSIX_SOURCE
-#define	_POSIX_SOURCE	1
-#undef	_POSIX_C_SOURCE
-#define	_POSIX_C_SOURCE	199309L
-#undef	_XOPEN_SOURCE
-#define	_XOPEN_SOURCE	1
-#undef	_XOPEN_SOURCE_EXTENDED
-#define	_XOPEN_SOURCE_EXTENDED	1
-#undef	_BSD_SOURCE
-#define	_BSD_SOURCE	1
-#undef	_SVID_SOURCE
-#define	_SVID_SOURCE	1
+# undef  _ISOC9X_SOURCE
+# define _ISOC9X_SOURCE	1
+# undef  _POSIX_SOURCE
+# define _POSIX_SOURCE	1
+# undef  _POSIX_C_SOURCE
+# define _POSIX_C_SOURCE	199309L
+# undef  _XOPEN_SOURCE
+# define _XOPEN_SOURCE	1
+# undef  _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE_EXTENDED	1
+# undef  _BSD_SOURCE
+# define _BSD_SOURCE	1
+# undef  _SVID_SOURCE
+# define _SVID_SOURCE	1
 #endif
 
 /* If nothing (other than _GNU_SOURCE) is defined,
@@ -127,65 +126,65 @@
      !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
      !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
      !defined _BSD_SOURCE && !defined _SVID_SOURCE)
-#define	_BSD_SOURCE	1
-#define	_SVID_SOURCE	1
+# define _BSD_SOURCE	1
+# define _SVID_SOURCE	1
 #endif
 
 /* This is to enable the ISO C 9x extension.  It will go away as soon
    as this standard is officially released.  */
 #ifdef _ISOC9X_SOURCE
-#define __USE_ISOC9X	1
+# define __USE_ISOC9X	1
 #endif
 
 /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
    (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined).  */
 #if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
      !defined _POSIX_C_SOURCE)
-#define	_POSIX_SOURCE	1
-#ifdef _XOPEN_SOURCE
-#define	_POSIX_C_SOURCE	2
-#else
-#define	_POSIX_C_SOURCE	199309L
-#endif
+# define _POSIX_SOURCE	1
+# ifdef _XOPEN_SOURCE
+#  define _POSIX_C_SOURCE	2
+# else
+#  define _POSIX_C_SOURCE	199309L
+# endif
 #endif
 
 #if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
-#define	__USE_POSIX	1
+# define __USE_POSIX	1
 #endif
 
 #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
-#define	__USE_POSIX2	1
+# define __USE_POSIX2	1
 #endif
 
 #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L
-#define	__USE_POSIX199309	1
+# define __USE_POSIX199309	1
 #endif
 
 #ifdef	_XOPEN_SOURCE
-#define	__USE_XOPEN	1
-#ifdef	_XOPEN_SOURCE_EXTENDED
-#define	__USE_XOPEN_EXTENDED	1
-#endif
+# define __USE_XOPEN	1
+# ifdef _XOPEN_SOURCE_EXTENDED
+#  define __USE_XOPEN_EXTENDED	1
+# endif
 #endif
 
 #if defined _BSD_SOURCE || defined _SVID_SOURCE
-#define	__USE_MISC	1
+# define __USE_MISC	1
 #endif
 
 #ifdef	_BSD_SOURCE
-#define	__USE_BSD	1
+# define __USE_BSD	1
 #endif
 
 #ifdef	_SVID_SOURCE
-#define	__USE_SVID	1
+# define __USE_SVID	1
 #endif
 
 #ifdef	_GNU_SOURCE
-#define	__USE_GNU	1
+# define __USE_GNU	1
 #endif
 
 #if defined _REENTRANT || defined _THREAD_SAFE
-#define __USE_REENTRANT	1
+# define __USE_REENTRANT	1
 #endif
 
 /* We do support the IEC 559 math functionality, real and complex.  */
@@ -210,13 +209,13 @@
 #if !defined __GNUC__ || __GNUC__ < 2
 /* In GCC version 2, (__extension__ EXPR) will not complain
    about GCC extensions used in EXPR under -ansi or -pedantic.  */
-#define	__extension__
+# define __extension__
 #endif
 
 
 /* This is here only because every header file already includes this one.  */
 #ifndef __ASSEMBLER__
-#include <sys/cdefs.h>
+# include <sys/cdefs.h>
 #endif
 
 /* This is here only because every header file already includes this one.  */
@@ -230,7 +229,7 @@
    this #include were done for the library source code, then every object
    file would depend on stubs.h.  */
 
-#include <gnu/stubs.h>
+# include <gnu/stubs.h>
 #endif
 
 #endif	/* features.h  */
diff --git a/fnmatch.h b/include/fnmatch.h
index b12b786df0..b12b786df0 100644
--- a/fnmatch.h
+++ b/include/fnmatch.h
diff --git a/ftw.h b/include/ftw.h
index 4fb654cf22..4fb654cf22 100644
--- a/ftw.h
+++ b/include/ftw.h
diff --git a/getopt.h b/include/getopt.h
index 74ca6d453a..74ca6d453a 100644
--- a/getopt.h
+++ b/include/getopt.h
diff --git a/glob.h b/include/glob.h
index ce047bb177..ce047bb177 100644
--- a/glob.h
+++ b/include/glob.h
diff --git a/gnu-versions.h b/include/gnu-versions.h
index 7085895a0a..7085895a0a 100644
--- a/gnu-versions.h
+++ b/include/gnu-versions.h
diff --git a/grp.h b/include/grp.h
index 250092cbf1..250092cbf1 100644
--- a/grp.h
+++ b/include/grp.h
diff --git a/langinfo.h b/include/langinfo.h
index 2a81c6ddaf..2a81c6ddaf 100644
--- a/langinfo.h
+++ b/include/langinfo.h
diff --git a/libc-symbols.h b/include/libc-symbols.h
index 07a35f1b53..07a35f1b53 100644
--- a/libc-symbols.h
+++ b/include/libc-symbols.h
diff --git a/libgen.h b/include/libgen.h
index 4795d8e561..4795d8e561 100644
--- a/libgen.h
+++ b/include/libgen.h
diff --git a/libintl.h b/include/libintl.h
index be1062ca03..be1062ca03 100644
--- a/libintl.h
+++ b/include/libintl.h
diff --git a/limits.h b/include/limits.h
index c7b1278638..31d8792d9d 100644
--- a/limits.h
+++ b/include/limits.h
@@ -24,15 +24,15 @@
 
 #ifdef	__USE_POSIX
 /* POSIX adds things to <limits.h>.  */
-# include <posix1_lim.h>
+# include <bits/posix1_lim.h>
 #endif
 
 #ifdef	__USE_POSIX2
-# include <posix2_lim.h>
+# include <bits/posix2_lim.h>
 #endif
 
 #ifdef	__USE_XOPEN
-# include <xopen_lim.h>
+# include <bits/xopen_lim.h>
 #endif
 
 
diff --git a/linewrap.h b/include/linewrap.h
index 03ca090301..03ca090301 100644
--- a/linewrap.h
+++ b/include/linewrap.h
diff --git a/link.h b/include/link.h
index 0999f0bbfc..0999f0bbfc 100644
--- a/link.h
+++ b/include/link.h
diff --git a/locale.h b/include/locale.h
index 6e0bd916dc..6e0bd916dc 100644
--- a/locale.h
+++ b/include/locale.h
diff --git a/malloc.h b/include/malloc.h
index 448e0a8c6b..448e0a8c6b 100644
--- a/malloc.h
+++ b/include/malloc.h
diff --git a/math.h b/include/math.h
index f837293f81..f837293f81 100644
--- a/math.h
+++ b/include/math.h
diff --git a/mcheck.h b/include/mcheck.h
index 90a48d5f9a..90a48d5f9a 100644
--- a/mcheck.h
+++ b/include/mcheck.h
diff --git a/memory.h b/include/memory.h
index 1ec3e63fc9..1ec3e63fc9 100644
--- a/memory.h
+++ b/include/memory.h
diff --git a/monetary.h b/include/monetary.h
index 4735dc6c8a..4735dc6c8a 100644
--- a/monetary.h
+++ b/include/monetary.h
diff --git a/netdb.h b/include/netdb.h
index e2e1868cbb..e2e1868cbb 100644
--- a/netdb.h
+++ b/include/netdb.h
diff --git a/netgroup.h b/include/netgroup.h
index 4b2b284cdb..4b2b284cdb 100644
--- a/netgroup.h
+++ b/include/netgroup.h
diff --git a/netinet/ether.h b/include/netinet/ether.h
index 60ef5a3abf..60ef5a3abf 100644
--- a/netinet/ether.h
+++ b/include/netinet/ether.h
diff --git a/netinet/in.h b/include/netinet/in.h
index 9139cfaeee..9139cfaeee 100644
--- a/netinet/in.h
+++ b/include/netinet/in.h
diff --git a/nlist.h b/include/nlist.h
index 897a93c7fe..897a93c7fe 100644
--- a/nlist.h
+++ b/include/nlist.h
diff --git a/nss.h b/include/nss.h
index 0541335c18..0541335c18 100644
--- a/nss.h
+++ b/include/nss.h
diff --git a/nsswitch.h b/include/nsswitch.h
index a876d23185..a876d23185 100644
--- a/nsswitch.h
+++ b/include/nsswitch.h
diff --git a/obstack.h b/include/obstack.h
index 2339cbc4d5..2339cbc4d5 100644
--- a/obstack.h
+++ b/include/obstack.h
diff --git a/poll.h b/include/poll.h
index 778488accb..778488accb 100644
--- a/poll.h
+++ b/include/poll.h
diff --git a/printf.h b/include/printf.h
index 777e958fb9..777e958fb9 100644
--- a/printf.h
+++ b/include/printf.h
diff --git a/protocols/routed.h b/include/protocols/routed.h
index 2e97bfd187..2e97bfd187 100644
--- a/protocols/routed.h
+++ b/include/protocols/routed.h
diff --git a/protocols/rwhod.h b/include/protocols/rwhod.h
index 6fc35a0c41..6fc35a0c41 100644
--- a/protocols/rwhod.h
+++ b/include/protocols/rwhod.h
diff --git a/protocols/talkd.h b/include/protocols/talkd.h
index 4fd7a34fdf..4fd7a34fdf 100644
--- a/protocols/talkd.h
+++ b/include/protocols/talkd.h
diff --git a/protocols/timed.h b/include/protocols/timed.h
index 58dbafeaf2..58dbafeaf2 100644
--- a/protocols/timed.h
+++ b/include/protocols/timed.h
diff --git a/pwd.h b/include/pwd.h
index 28d59a6a0a..28d59a6a0a 100644
--- a/pwd.h
+++ b/include/pwd.h
diff --git a/regex.h b/include/regex.h
index 22bfc89e77..22bfc89e77 100644
--- a/regex.h
+++ b/include/regex.h
diff --git a/resolv.h b/include/resolv.h
index 95b9eebef8..95b9eebef8 100644
--- a/resolv.h
+++ b/include/resolv.h
diff --git a/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 36299392ba..36299392ba 100644
--- a/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
diff --git a/rpc/clnt.h b/include/rpc/clnt.h
index b4493d1d90..b4493d1d90 100644
--- a/rpc/clnt.h
+++ b/include/rpc/clnt.h
diff --git a/rpc/netdb.h b/include/rpc/netdb.h
index a9d93e13ad..a9d93e13ad 100644
--- a/rpc/netdb.h
+++ b/include/rpc/netdb.h
diff --git a/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index dfe537c96f..dfe537c96f 100644
--- a/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
diff --git a/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index 06d7d378cf..06d7d378cf 100644
--- a/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
diff --git a/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index 1585c13039..1585c13039 100644
--- a/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
diff --git a/rpc/rpc.h b/include/rpc/rpc.h
index 1b5c5cd8de..1b5c5cd8de 100644
--- a/rpc/rpc.h
+++ b/include/rpc/rpc.h
diff --git a/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index 3c63730c1f..3c63730c1f 100644
--- a/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
diff --git a/rpc/svc.h b/include/rpc/svc.h
index 68aa67b429..68aa67b429 100644
--- a/rpc/svc.h
+++ b/include/rpc/svc.h
diff --git a/rpc/svc_auth.h b/include/rpc/svc_auth.h
index e2c226312e..e2c226312e 100644
--- a/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
diff --git a/rpc/types.h b/include/rpc/types.h
index 53df7e666b..53df7e666b 100644
--- a/rpc/types.h
+++ b/include/rpc/types.h
diff --git a/rpc/xdr.h b/include/rpc/xdr.h
index 4c9083d08a..4c9083d08a 100644
--- a/rpc/xdr.h
+++ b/include/rpc/xdr.h
diff --git a/sched.h b/include/sched.h
index b9bebc9dee..b9bebc9dee 100644
--- a/sched.h
+++ b/include/sched.h
diff --git a/search.h b/include/search.h
index ff24508172..ff24508172 100644
--- a/search.h
+++ b/include/search.h
diff --git a/set-hooks.h b/include/set-hooks.h
index 10d0b10176..995bdf4120 100644
--- a/set-hooks.h
+++ b/include/set-hooks.h
@@ -1,23 +1,24 @@
 /* Macros for using symbol sets for running lists of functions.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _SET_HOOKS_H
+#define _SET_HOOKS_H 1
 
 #define __need_size_t
 #include <stddef.h>
@@ -53,4 +54,4 @@ do {									      \
 DEFINE_HOOK (name, proto); void runner proto { RUN_HOOK (name, args); }
 
 
-#endif
+#endif /* set-hooks.h */
diff --git a/setjmp.h b/include/setjmp.h
index c78a964566..c78a964566 100644
--- a/setjmp.h
+++ b/include/setjmp.h
diff --git a/sgtty.h b/include/sgtty.h
index ffb62401cb..ffb62401cb 100644
--- a/sgtty.h
+++ b/include/sgtty.h
diff --git a/shadow.h b/include/shadow.h
index 4848197be1..4848197be1 100644
--- a/shadow.h
+++ b/include/shadow.h
diff --git a/signal.h b/include/signal.h
index d9939c4e83..d9939c4e83 100644
--- a/signal.h
+++ b/include/signal.h
diff --git a/include/stab.h b/include/stab.h
new file mode 100644
index 0000000000..2e278fc778
--- /dev/null
+++ b/include/stab.h
@@ -0,0 +1 @@
+#include <misc/stab.h>
diff --git a/stdio.h b/include/stdio.h
index 457eabe32f..457eabe32f 100644
--- a/stdio.h
+++ b/include/stdio.h
diff --git a/stdlib.h b/include/stdlib.h
index c0887a99e9..c0887a99e9 100644
--- a/stdlib.h
+++ b/include/stdlib.h
diff --git a/string.h b/include/string.h
index b557c65f39..b557c65f39 100644
--- a/string.h
+++ b/include/string.h
diff --git a/strings.h b/include/strings.h
index b1bb339d3d..b1bb339d3d 100644
--- a/strings.h
+++ b/include/strings.h
diff --git a/sys/bitypes.h b/include/sys/bitypes.h
index 137945172d..137945172d 100644
--- a/sys/bitypes.h
+++ b/include/sys/bitypes.h
diff --git a/sys/cdefs.h b/include/sys/cdefs.h
index 200abb4f02..200abb4f02 100644
--- a/sys/cdefs.h
+++ b/include/sys/cdefs.h
diff --git a/sys/dir.h b/include/sys/dir.h
index 5453e743fc..5453e743fc 100644
--- a/sys/dir.h
+++ b/include/sys/dir.h
diff --git a/sys/errno.h b/include/sys/errno.h
index 339f4fc10c..339f4fc10c 100644
--- a/sys/errno.h
+++ b/include/sys/errno.h
diff --git a/sys/fcntl.h b/include/sys/fcntl.h
index dec2157be6..dec2157be6 100644
--- a/sys/fcntl.h
+++ b/include/sys/fcntl.h
diff --git a/sys/file.h b/include/sys/file.h
index fb3cd7544e..fb3cd7544e 100644
--- a/sys/file.h
+++ b/include/sys/file.h
diff --git a/sys/gmon.h b/include/sys/gmon.h
index 987589fcfe..987589fcfe 100644
--- a/sys/gmon.h
+++ b/include/sys/gmon.h
diff --git a/sys/ioctl.h b/include/sys/ioctl.h
index 8cc77757f6..8cc77757f6 100644
--- a/sys/ioctl.h
+++ b/include/sys/ioctl.h
diff --git a/sys/ipc.h b/include/sys/ipc.h
index 7bd257684b..7bd257684b 100644
--- a/sys/ipc.h
+++ b/include/sys/ipc.h
diff --git a/sys/msg.h b/include/sys/msg.h
index 0f8026dda1..0f8026dda1 100644
--- a/sys/msg.h
+++ b/include/sys/msg.h
diff --git a/sys/poll.h b/include/sys/poll.h
index 5231e6845e..5231e6845e 100644
--- a/sys/poll.h
+++ b/include/sys/poll.h
diff --git a/sys/queue.h b/include/sys/queue.h
index 5c9823b7eb..5c9823b7eb 100644
--- a/sys/queue.h
+++ b/include/sys/queue.h
diff --git a/sys/resource.h b/include/sys/resource.h
index 33e6f4de9e..33e6f4de9e 100644
--- a/sys/resource.h
+++ b/include/sys/resource.h
diff --git a/sys/select.h b/include/sys/select.h
index f793af7bf0..f793af7bf0 100644
--- a/sys/select.h
+++ b/include/sys/select.h
diff --git a/sys/sem.h b/include/sys/sem.h
index b0fb201bd0..b0fb201bd0 100644
--- a/sys/sem.h
+++ b/include/sys/sem.h
diff --git a/sys/shm.h b/include/sys/shm.h
index 1878fcc5be..1878fcc5be 100644
--- a/sys/shm.h
+++ b/include/sys/shm.h
diff --git a/sys/signal.h b/include/sys/signal.h
index b2110df1ae..b2110df1ae 100644
--- a/sys/signal.h
+++ b/include/sys/signal.h
diff --git a/sys/socket.h b/include/sys/socket.h
index 999a683016..999a683016 100644
--- a/sys/socket.h
+++ b/include/sys/socket.h
diff --git a/sys/stat.h b/include/sys/stat.h
index 37a526069f..37a526069f 100644
--- a/sys/stat.h
+++ b/include/sys/stat.h
diff --git a/sys/statfs.h b/include/sys/statfs.h
index d42df4b65d..d42df4b65d 100644
--- a/sys/statfs.h
+++ b/include/sys/statfs.h
diff --git a/sys/syslog.h b/include/sys/syslog.h
index 247528b430..247528b430 100644
--- a/sys/syslog.h
+++ b/include/sys/syslog.h
diff --git a/sys/termios.h b/include/sys/termios.h
index 27e4de5f4b..27e4de5f4b 100644
--- a/sys/termios.h
+++ b/include/sys/termios.h
diff --git a/sys/time.h b/include/sys/time.h
index 5595a957a0..5595a957a0 100644
--- a/sys/time.h
+++ b/include/sys/time.h
diff --git a/sys/timeb.h b/include/sys/timeb.h
index 9f4509c35e..9f4509c35e 100644
--- a/sys/timeb.h
+++ b/include/sys/timeb.h
diff --git a/sys/times.h b/include/sys/times.h
index 16ca91138a..16ca91138a 100644
--- a/sys/times.h
+++ b/include/sys/times.h
diff --git a/sys/types.h b/include/sys/types.h
index 716732f4d4..716732f4d4 100644
--- a/sys/types.h
+++ b/include/sys/types.h
diff --git a/sys/uio.h b/include/sys/uio.h
index 03afd84b87..03afd84b87 100644
--- a/sys/uio.h
+++ b/include/sys/uio.h
diff --git a/sys/un.h b/include/sys/un.h
index bdbee99980..bdbee99980 100644
--- a/sys/un.h
+++ b/include/sys/un.h
diff --git a/sys/unistd.h b/include/sys/unistd.h
index 8ca19e5516..8ca19e5516 100644
--- a/sys/unistd.h
+++ b/include/sys/unistd.h
diff --git a/sys/utsname.h b/include/sys/utsname.h
index ff81bdf48e..ff81bdf48e 100644
--- a/sys/utsname.h
+++ b/include/sys/utsname.h
diff --git a/sys/vlimit.h b/include/sys/vlimit.h
index 8a76d2fd00..8a76d2fd00 100644
--- a/sys/vlimit.h
+++ b/include/sys/vlimit.h
diff --git a/sys/vtimes.h b/include/sys/vtimes.h
index dd666ca443..dd666ca443 100644
--- a/sys/vtimes.h
+++ b/include/sys/vtimes.h
diff --git a/sys/wait.h b/include/sys/wait.h
index 379d5cc7a5..379d5cc7a5 100644
--- a/sys/wait.h
+++ b/include/sys/wait.h
diff --git a/syscall.h b/include/syscall.h
index 8c53cfb204..8c53cfb204 100644
--- a/syscall.h
+++ b/include/syscall.h
diff --git a/sysexits.h b/include/sysexits.h
index 139e3cfa13..139e3cfa13 100644
--- a/sysexits.h
+++ b/include/sysexits.h
diff --git a/syslog.h b/include/syslog.h
index 4cfb7723bb..4cfb7723bb 100644
--- a/syslog.h
+++ b/include/syslog.h
diff --git a/tar.h b/include/tar.h
index 05efa1fc0e..05efa1fc0e 100644
--- a/tar.h
+++ b/include/tar.h
diff --git a/termios.h b/include/termios.h
index 3f754ac900..3f754ac900 100644
--- a/termios.h
+++ b/include/termios.h
diff --git a/time.h b/include/time.h
index b2a33bf5c3..b2a33bf5c3 100644
--- a/time.h
+++ b/include/time.h
diff --git a/ttyent.h b/include/ttyent.h
index ba790e3542..ba790e3542 100644
--- a/ttyent.h
+++ b/include/ttyent.h
diff --git a/unistd.h b/include/unistd.h
index 77901d9846..77901d9846 100644
--- a/unistd.h
+++ b/include/unistd.h
diff --git a/utime.h b/include/utime.h
index 6dadc53ad6..6dadc53ad6 100644
--- a/utime.h
+++ b/include/utime.h
diff --git a/utmp.h b/include/utmp.h
index c0c21a4436..c0c21a4436 100644
--- a/utmp.h
+++ b/include/utmp.h
diff --git a/values.h b/include/values.h
index 3c82842870..26421724c4 100644
--- a/values.h
+++ b/include/values.h
@@ -21,8 +21,8 @@
    <limits.h> and/or <float.h> instead of <values.h>.  */
 
 #ifndef	_VALUES_H
-
 #define	_VALUES_H	1
+
 #include <features.h>
 
 #include <limits.h>
diff --git a/wchar.h b/include/wchar.h
index c87ffb851b..c87ffb851b 100644
--- a/wchar.h
+++ b/include/wchar.h
diff --git a/wctype.h b/include/wctype.h
index c76f50c866..c76f50c866 100644
--- a/wctype.h
+++ b/include/wctype.h
diff --git a/wordexp.h b/include/wordexp.h
index 64e036e062..64e036e062 100644
--- a/wordexp.h
+++ b/include/wordexp.h
diff --git a/xlocale.h b/include/xlocale.h
index 5280ef0bc4..5280ef0bc4 100644
--- a/xlocale.h
+++ b/include/xlocale.h
diff --git a/inet/aliases.h b/inet/aliases.h
index 4c89a04113..c6e829007e 100644
--- a/inet/aliases.h
+++ b/inet/aliases.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _ALIASES_H
-
 #define _ALIASES_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
diff --git a/inet/arpa/ftp.h b/inet/arpa/ftp.h
index 64532b9e25..ac864aa708 100644
--- a/inet/arpa/ftp.h
+++ b/inet/arpa/ftp.h
@@ -33,8 +33,8 @@
  *	@(#)ftp.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _FTP_H_
-#define	_FTP_H_
+#ifndef _ARPA_FTP_H
+#define	_ARPA_FTP_H 1
 
 /* Definitions for FTP; see RFC-765. */
 
@@ -106,4 +106,4 @@ char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
 
 #define	BLK_BYTECOUNT	2	/* Bytes in this block */
 
-#endif /* !_FTP_H_ */
+#endif /* arpa/ftp.h */
diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h
index 0593c8fad6..ab4f0c9ea6 100644
--- a/inet/arpa/inet.h
+++ b/inet/arpa/inet.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _ARPA_INET_H
-
 #define	_ARPA_INET_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
diff --git a/inet/arpa/telnet.h b/inet/arpa/telnet.h
index 17255a1c7b..3309e5d727 100644
--- a/inet/arpa/telnet.h
+++ b/inet/arpa/telnet.h
@@ -33,8 +33,8 @@
  *	@(#)telnet.h	8.2 (Berkeley) 12/15/93
  */
 
-#ifndef _TELNET_H_
-#define	_TELNET_H_
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H 1
 
 /*
  * Definitions for the TELNET protocol.
@@ -317,4 +317,4 @@ extern char *enctype_names[];
 #define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
 #define	ENCTYPE_NAME(x)		enctype_names[x]
 
-#endif /* !_TELNET_H_ */
+#endif /* arpa/telnet.h */
diff --git a/inet/arpa/tftp.h b/inet/arpa/tftp.h
index e2651a5019..0904407c73 100644
--- a/inet/arpa/tftp.h
+++ b/inet/arpa/tftp.h
@@ -33,8 +33,8 @@
  *	@(#)tftp.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _TFTP_H_
-#define	_TFTP_H_
+#ifndef _ARPA_TFTP_H
+#define	_ARPA_TFTP_H 1
 
 /*
  * Trivial File Transfer Protocol (IEN-133)
@@ -77,4 +77,4 @@ struct	tftphdr {
 #define	EEXISTS		6		/* file already exists */
 #define	ENOUSER		7		/* no such user */
 
-#endif /* !_TFTP_H_ */
+#endif /* arpa/tftp.h */
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 95ed6bf3f9..7c28e551b3 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -61,7 +61,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <stdio.h>
 #include <unistd.h>
 #include <alloca.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <arpa/inet.h>
 
 #ifndef AF_LOCAL
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 1ef043a326..5afe82561c 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -16,7 +16,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <netdb.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c
index b6087a982f..3e9636c5df 100644
--- a/inet/inet_ntoa.c
+++ b/inet/inet_ntoa.c
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <arpa/inet.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 /* The interface of this function is completely stupid, it requires a
    static buffer.  We relax this a bit in that we allow at least one
diff --git a/inet/netinet/ether.h b/inet/netinet/ether.h
index 06d01b1508..c7985d7acc 100644
--- a/inet/netinet/ether.h
+++ b/inet/netinet/ether.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __NETINET_ETHER_H
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H	1
 
-#define __NETINET_ETHER_H	1
 #include <features.h>
 
 /* Get definition of `struct ether_addr'.  */
diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h
index 90c61afda8..7d8d86665e 100644
--- a/inet/netinet/icmp6.h
+++ b/inet/netinet/icmp6.h
@@ -185,4 +185,4 @@ struct nd6_opt_mtu 		/* MTU option */
     u_int32_t		opt_mtu;
   };
 
-#endif /* _NETINET6_ICMPV6_H */
+#endif /* netinet/icmpv6.h */
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index a85dccd6de..7a9d42d5fa 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_NETINET_IN_H
-
 #define	_NETINET_IN_H	1
+
 #include <features.h>
 
 #include <sys/socket.h>
@@ -90,7 +90,7 @@ enum
 /* Internet address.  */
 struct in_addr
   {
-    unsigned int s_addr;
+    u_int32_t s_addr;
   };
 
 
@@ -164,7 +164,7 @@ extern const struct in6_addr in6addr_loopback;   /* ::1 */
 #define INET6_ADDRSTRLEN 46
 
 /* Get the definition of the macro to define the common sockaddr members.  */
-#include <sockaddrcom.h>
+#include <bits/sockaddr.h>
 
 
 /* Structure describing an Internet socket address.  */
diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h
index 65bf7211e8..e4e0e672ff 100644
--- a/inet/netinet/ip6.h
+++ b/inet/netinet/ip6.h
@@ -42,4 +42,4 @@ struct ipv6hdr
   struct in6_addr ipv6_dst;
 };
 
-#endif /* _NETINET_IP6_H */
+#endif /* netinet/ip6.h */
diff --git a/inet/protocols/routed.h b/inet/protocols/routed.h
index f41fc2182a..f342239db9 100644
--- a/inet/protocols/routed.h
+++ b/inet/protocols/routed.h
@@ -33,8 +33,8 @@
  *	@(#)routed.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _ROUTED_H_
-#define	_ROUTED_H_
+#ifndef _PROTOCOLS_ROUTED_H
+#define	_PROTOCOLS_ROUTED_H 1
 
 /*
  * Routing Information Protocol
@@ -101,4 +101,4 @@ char *ripcmds[RIPCMD_MAX] =
 #define	EXPIRE_TIME		180	/* time to mark entry invalid */
 #define	GARBAGE_TIME		240	/* time to garbage collect */
 
-#endif /* !_ROUTED_H_ */
+#endif /* protocols/routed.h */
diff --git a/inet/protocols/rwhod.h b/inet/protocols/rwhod.h
index 4ce44906a0..e5d9f991a8 100644
--- a/inet/protocols/rwhod.h
+++ b/inet/protocols/rwhod.h
@@ -33,8 +33,8 @@
  *	@(#)rwhod.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _RWHOD_H_
-#define	_RWHOD_H_
+#ifndef _PROTOCOLS_RWHOD_H
+#define	_PROTOCOLS_RWHOD_H 1
 
 #include <sys/types.h>
 
@@ -67,4 +67,4 @@ struct	whod {
 
 #define	_PATH_RWHODIR	"/var/rwho"
 
-#endif /* !_RWHOD_H_ */
+#endif /* protocols/rwhod.h */
diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index 6d893adfb5..5bec984d1f 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -33,8 +33,8 @@
  *	@(#)talkd.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _TALKD_H_
-#define	_TALKD_H_
+#ifndef _PROTOCOLS_TALKD_H
+#define	_PROTOCOLS_TALKD_H 1
 
 /*
  * This describes the protocol used by the talk server and clients.
@@ -113,4 +113,4 @@ typedef struct {
 /* RING_WAIT should be 10's of seconds less than MAX_LIFE */
 #define RING_WAIT	30	/* time to wait before resending invitation */
 
-#endif /* !_TALKD_H_ */
+#endif /* protocols/talkd.h */
diff --git a/inet/protocols/timed.h b/inet/protocols/timed.h
index 1b569f5312..a2c9fb8ce4 100644
--- a/inet/protocols/timed.h
+++ b/inet/protocols/timed.h
@@ -33,8 +33,8 @@
  *	@(#)timed.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef	_TIMED_H_
-#define	_TIMED_H_
+#ifndef	_PROTOCOLS_TIMED_H
+#define	_PROTOCOLS_TIMED_H 1
 
 /*
  * Time Synchronization Protocol
@@ -96,4 +96,4 @@ char *tsptype[TSPTYPENUMBER] =
   "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
 #endif
 
-#endif /* !_TIMED_H_ */
+#endif /* protocols/timed.h */
diff --git a/intl/libintl.h b/intl/libintl.h
index 34cd5e0d51..86b44650e8 100644
--- a/intl/libintl.h
+++ b/intl/libintl.h
@@ -22,8 +22,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _LIBINTL_H
-
 #define _LIBINTL_H	1
+
 #include <features.h>
 
 /* We define an additional symbol to signal that we use the GNU
diff --git a/io/Makefile b/io/Makefile
index d199f9110b..055dabeba6 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -21,8 +21,8 @@
 #
 subdir	:= io
 
-headers := sys/stat.h statbuf.h sys/statfs.h statfsbuf.h sys/vfs.h \
-	   fcntl.h sys/fcntl.h fcntlbits.h \
+headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
+	   fcntl.h sys/fcntl.h bits/fcntl.h \
 	   poll.h sys/poll.h \
 	   utime.h ftw.h fts.h
 
diff --git a/io/fcntl.h b/io/fcntl.h
index 4e1b38a58e..519230019c 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -21,16 +21,16 @@
  */
 
 #ifndef	_FCNTL_H
-
 #define	_FCNTL_H	1
+
 #include <features.h>
 
-/* This must be early so <fcntlbits.h> can define types winningly.  */
+/* This must be early so <bits/fcntl.h> can define types winningly.  */
 __BEGIN_DECLS
 
 /* Get the definitions of O_*, F_*, FD_*: all the
    numbers and flag bits for `open', `fcntl', et al.  */
-#include <fcntlbits.h>
+#include <bits/fcntl.h>
 
 #ifdef	__USE_MISC
 #ifndef	R_OK			/* Verbatim from <unistd.h>.  Ugh.  */
diff --git a/io/fts.h b/io/fts.h
index a6548c2d79..55194db9e2 100644
--- a/io/fts.h
+++ b/io/fts.h
@@ -33,8 +33,8 @@
  *	@(#)fts.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef	_FTS_H_
-#define	_FTS_H_
+#ifndef	_FTS_H
+#define	_FTS_H 1
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
@@ -123,4 +123,4 @@ FTSENT	*fts_read __P((FTS *));
 int	 fts_set __P((FTS *, FTSENT *, int));
 __END_DECLS
 
-#endif /* !_FTS_H_ */
+#endif /* fts.h */
diff --git a/io/ftw.h b/io/ftw.h
index d283e6937e..d788b39d16 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -21,12 +21,12 @@
  */
 
 #ifndef _FTW_H
-
 #define	_FTW_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
-#include <statbuf.h>
+#include <bits/stat.h>
 
 
 __BEGIN_DECLS
diff --git a/io/sys/poll.h b/io/sys/poll.h
index f9880a140c..e694fe37d5 100644
--- a/io/sys/poll.h
+++ b/io/sys/poll.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_POLL_H
-
 #define	_SYS_POLL_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
@@ -64,4 +64,4 @@ extern int poll __P ((struct pollfd *__fds, unsigned long int __nfds,
 
 __END_DECLS
 
-#endif	/* _SYS_POLL_H */
+#endif	/* sys/poll.h */
diff --git a/io/sys/stat.h b/io/sys/stat.h
index f51c56aabd..5485976ca6 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -21,15 +21,15 @@
  */
 
 #ifndef	_SYS_STAT_H
-
 #define	_SYS_STAT_H	1
+
 #include <features.h>
 
-#include <gnu/types.h>		/* For __mode_t and __dev_t.  */
+#include <bits/types.h>		/* For __mode_t and __dev_t.  */
 
 __BEGIN_DECLS
 
-#include <statbuf.h>
+#include <bits/stat.h>
 
 #if defined(__USE_BSD) || defined(__USE_MISC)
 #define	S_IFMT		__S_IFMT
@@ -173,19 +173,20 @@ extern int mknod __P ((__const char *__path,
 /* Create a new FIFO named PATH, with permission bits MODE.  */
 extern int mkfifo __P ((__const char *__path, __mode_t __mode));
 
-/* To allow the `struct stat' structure and the file type `mode_t' bits to
-   vary without changing shared library major version number, the `stat'
-   family of functions and `mknod' are in fact inline wrappers around calls
-   to `xstat', `fxstat', `lxstat', and `xmknod', which all take a leading
-   version-number argument designating the data structure and bits used.
-   <statbuf.h> defines _STAT_VER with the version number corresponding to
-   `struct stat' as defined in that file; and _MKNOD_VER with the version
-   number corresponding to the S_IF* macros defined therein.  It is
-   arranged that when not inlined these function are always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
+/* To allow the `struct stat' structure and the file type `mode_t'
+   bits to vary without changing shared library major version number,
+   the `stat' family of functions and `mknod' are in fact inline
+   wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod',
+   which all take a leading version-number argument designating the
+   data structure and bits used.  <bits/stat.h> defines _STAT_VER with
+   the version number corresponding to `struct stat' as defined in
+   that file; and _MKNOD_VER with the version number corresponding to
+   the S_IF* macros defined therein.  It is arranged that when not
+   inlined these function are always statically linked; that way a
+   dynamically-linked executable always encodes the version number
+   corresponding to the data structures it uses, so the `x' functions
+   in the shared library can adapt without needing to recompile all
+   callers.  */
 
 #ifndef _STAT_VER
 #define _STAT_VER	0
diff --git a/io/sys/statfs.h b/io/sys/statfs.h
index 4871e50723..49c154d216 100644
--- a/io/sys/statfs.h
+++ b/io/sys/statfs.h
@@ -18,12 +18,12 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_STATFS_H
-
 #define	_SYS_STATFS_H	1
+
 #include <features.h>
 
 /* Get the system-specific definition of `struct statfs'.  */
-#include <statfsbuf.h>
+#include <bits/statfs.h>
 
 __BEGIN_DECLS
 
diff --git a/io/utime.h b/io/utime.h
index 7ab772b042..7cb4724f93 100644
--- a/io/utime.h
+++ b/io/utime.h
@@ -21,13 +21,13 @@
  */
 
 #ifndef	_UTIME_H
-
 #define	_UTIME_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Structure describing file times.  */
 struct utimbuf
diff --git a/libc.map b/libc.map
index c5100b829a..3254be9343 100644
--- a/libc.map
+++ b/libc.map
@@ -6,7 +6,11 @@ GLIBC_2.0 {
     _IO_stderr_; _IO_stdin_; _IO_stdout_;
     _nl_msg_cat_cntr; __environ; _environ; _res;
     ___brk_addr; __curbrk; _nl_current_LC_CTYPE; _libc_intl_domainname;
-    _sys_errlist; _sys_siglist; __progname;
+    _sys_errlist; _sys_siglist; __progname; _nl_default_dirname;
+    __timezone; __daylight;
+    _nl_current_LC_COLLATE; __collate_element_hash;
+    __collate_element_strings; __collate_symbol_classes;
+    __collate_symbol_hash; __collate_symbol_strings;
 
     # helper functions
     __errno_location; __libc_init_first; __h_errno_location;
@@ -28,7 +32,9 @@ GLIBC_2.0 {
     __libc_valloc;
 
     # functions with required interface outside normal name space
-    _exit; __ivaliduser;
+    _exit; __ivaliduser; __open_catalog;
+    __argz_count; __argz_stringify; __argz_next;
+    __check_rhosts_file; __rcmd_errstr;
 
     # functions from the experimental locale implementation
     __*_l; __newlocale; __duplocale; __freelocale;
@@ -42,16 +48,18 @@ GLIBC_2.0 {
     _obstack_free; _obstack_memory_used; _obstack_newchunk;
     __assert_fail; __assert_perror_fail;
     _IO_getc; _IO_peekc_unlocked; _IO_putc; _IO_feof; _IO_ferror;
+    __xstat; __fxstat; __lxstat; __xmknod; __dcgettext;
+    __uflow; __underflow; __overflow; __iswctype; __sigpause;
 
     # functions used in other libraries
-    __printf_fp; __stpncpy; _dcgettext;
+    __printf_fp; __stpncpy;
     _nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
     __nss_database_lookup; __internal_endnetgrent; __internal_getnetgrent_r;
     __internal_setnetgrent; __gmtime_r; __secure_getenv;
     __select; __sched_get_priority_max; __sched_get_priority_min;
     __sched_getparam; __sched_getscheduler; __sched_setscheduler;
     __sched_yield; __on_exit; __gettimeofday; __fork; __clone;
-    __nss_configure_lookup; _dl_open; _IO_file_setbuf;
+    __nss_configure_lookup; _dl_open; _dl_close; _IO_file_setbuf;
     _IO_file_init; _IO_file_attach; _IO_do_write; _IO_seekoff;
     _IO_link_in; _IO_file_open; _IO_file_doallocate; _IO_file_fopen;
     _IO_file_overflow; _IO_file_underflow; _IO_file_sync; _IO_file_seekoff;
diff --git a/libio/_G_config.h b/libio/_G_config.h
index 64738886b8..84a552b41e 100644
--- a/libio/_G_config.h
+++ b/libio/_G_config.h
@@ -6,7 +6,7 @@
 
 /* Define types for libio in terms of the standard internal type names.  */
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #define __need_wint_t
 #include <stddef.h>
@@ -45,7 +45,7 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_HAVE_MMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
 
-/* This is defined by <statbuf.h> if `st_blksize' exists.  */
+/* This is defined by <bits/stat.h> if `st_blksize' exists.  */
 #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
 
 #define _G_BUFSIZ 8192
diff --git a/libio/libio.h b/libio/libio.h
index 20eb5a9e1a..88bd0ae576 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -153,7 +153,7 @@ struct _IO_jump_t;  struct _IO_FILE;
 
 /* Handle lock.  */
 #ifdef _IO_MTSAFE_IO
-#include <stdio-lock.h>
+#include <bits/stdio-lock.h>
 #else
 typedef void _IO_lock_t;
 #endif
diff --git a/libio/libioP.h b/libio/libioP.h
index 8fe11084df..c93f0b9aad 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -26,7 +26,7 @@ the executable file might be covered by the GNU General Public License. */
 #ifndef errno
 extern int errno;
 #endif
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 #include "iolibio.h"
 
diff --git a/libio/stdio.h b/libio/stdio.h
index 8ab11e6a91..a85062d5c2 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -32,7 +32,7 @@ __BEGIN_DECLS
 #define	__need_NULL
 #include <stddef.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #endif /* Don't need FILE.  */
 #undef	__need_FILE
 
@@ -110,7 +110,7 @@ extern void __libc_fatal __P ((__const char *__message))
    L_cuserid	How long an array to pass to `cuserid'.
    FOPEN_MAX	Minimum number of files that can be open at once.
    FILENAME_MAX	Maximum length of a filename.  */
-#include <stdio_lim.h>
+#include <bits/stdio_lim.h>
 
 
 /* Standard streams.  */
diff --git a/locale/duplocale.c b/locale/duplocale.c
index 7b188efc6d..b3aa4af68c 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <locale.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 
 #include <localeinfo.h>
diff --git a/locale/freelocale.c b/locale/freelocale.c
index 26860aa15a..a09a744ebf 100644
--- a/locale/freelocale.c
+++ b/locale/freelocale.c
@@ -20,7 +20,7 @@
 
 #include <locale.h>
 #include <stdlib.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 #include "localeinfo.h"
 
diff --git a/locale/lc-time.c b/locale/lc-time.c
index 7bed6aea13..5090e6d905 100644
--- a/locale/lc-time.c
+++ b/locale/lc-time.c
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
diff --git a/locale/locale.h b/locale/locale.h
index c16d83bb7b..18771d7da8 100644
--- a/locale/locale.h
+++ b/locale/locale.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_LOCALE_H
-
 #define	_LOCALE_H	1
+
 #include <features.h>
 
 #define __need_NULL
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 52ae56a819..cf2789c9d9 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -1,4 +1,4 @@
-/* Implementation of the locale program according to POSIX 1003.2.
+/* Implementation of the locale program according to POSIX 9945-2.
    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 3e63b25ac2..0964b8387c 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -19,7 +19,7 @@
 #include <alloca.h>
 #include <argz.h>
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <locale.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/login/Makefile b/login/Makefile
index e4f9a9e9be..6ee21d2285 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -22,7 +22,7 @@
 
 subdir	:= login
 
-headers	:= utmp.h utmpbits.h lastlog.h pty.h
+headers	:= utmp.h bits/utmp.h lastlog.h pty.h
 
 routines := getutent getutent_r getutid getutline getutid_r getutline_r \
 	    utmp_file utmp_daemon utmpname updwtmp
diff --git a/login/getutent_r.c b/login/getutent_r.c
index 9e1d4e8768..340e4747bd 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <assert.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -52,7 +52,7 @@ struct utfuncs *__libc_utmp_jump_table = &__libc_utmp_unknown_functions;
 /* We need to protect the opening of the file.  */
 __libc_lock_define_initialized (, __libc_utmp_lock)
 
-     
+
 void
 __setutent (void)
 {
@@ -90,7 +90,7 @@ setutent_unknown (int reset)
       (*__libc_utmp_file_functions.setutent) (reset);
       __libc_utmp_jump_table = &__libc_utmp_file_functions;
     }
-  
+
   return 0;
 }
 
diff --git a/login/getutid_r.c b/login/getutid_r.c
index 52b83cd862..ee3a39a3bd 100644
--- a/login/getutid_r.c
+++ b/login/getutid_r.c
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <string.h>
 #include <unistd.h>
 #include <utmp.h>
diff --git a/login/getutline_r.c b/login/getutline_r.c
index 2285248ece..9b4180fe4a 100644
--- a/login/getutline_r.c
+++ b/login/getutline_r.c
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <string.h>
 #include <unistd.h>
 #include <utmp.h>
diff --git a/login/lastlog.h b/login/lastlog.h
index f2443eb702..8cc4254364 100644
--- a/login/lastlog.h
+++ b/login/lastlog.h
@@ -1,4 +1,4 @@
 /* This header file is used in 4.3BSD to define `struct lastlog',
-   which we define in <utmpbits.h>.  */
+   which we define in <bits/utmp.h>.  */
 
 #include <utmp.h>
diff --git a/login/logout.c b/login/logout.c
index 5ab5e618fb..8a406c01ca 100644
--- a/login/logout.c
+++ b/login/logout.c
@@ -59,7 +59,7 @@ logout (const char *line)
       ut->ut_type = DEAD_PROCESS;
 #endif
 
-      if (pututline (ut) >= 0)
+      if (pututline (ut) != NULL)
 	result = 1;
     }
 
diff --git a/login/pty.h b/login/pty.h
index 731ab12d82..0005f10e2d 100644
--- a/login/pty.h
+++ b/login/pty.h
@@ -18,11 +18,11 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _PTY_H
-
 #define _PTY_H	1
+
 #include <features.h>
 
-#include <ioctl-types.h>
+#include <bits/ioctl-types.h>
 #include <termios.h>
 
 
diff --git a/login/utmp-private.h b/login/utmp-private.h
index c5e7742a4d..87860d5d33 100644
--- a/login/utmp-private.h
+++ b/login/utmp-private.h
@@ -49,6 +49,3 @@ extern struct utfuncs *__libc_utmp_jump_table;
 extern const char *__libc_utmp_file_name;
 
 #endif /* utmp-private.h */
-
-
-
diff --git a/login/utmp.h b/login/utmp.h
index 799b1a17ac..82f3fcce9a 100644
--- a/login/utmp.h
+++ b/login/utmp.h
@@ -16,10 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef	_UTMP_H
+#define	_UTMP_H	1
 
-#ifndef	_UTMP_H_
-
-#define	_UTMP_H_	1
 #include <features.h>
 
 #include <sys/types.h>
@@ -28,7 +27,7 @@
 __BEGIN_DECLS
 
 /* Get system dependent values and data structures.  */
-#include <utmpbits.h>
+#include <bits/utmp.h>
 
 /* Compatibility names for the strings of the canonical file names.  */
 #define UTMP_FILE	_PATH_UTMP
diff --git a/login/utmpname.c b/login/utmpname.c
index 2692b71ff9..c0b6df2ce7 100644
--- a/login/utmpname.c
+++ b/login/utmpname.c
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 #include <string.h>
 #include <utmp.h>
diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c
index 585b9e2a54..1e618df0bf 100644
--- a/mach/msg-destroy.c
+++ b/mach/msg-destroy.c
@@ -1,31 +1,34 @@
-/* 
+/*
  * Mach Operating System
  * Copyright (c) 1991,1990 Carnegie Mellon University
  * All Rights Reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
+ *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
- * 
+ *
  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  *  School of Computer Science
  *  Carnegie Mellon University
  *  Pittsburgh PA 15213-3890
- * 
+ *
  * any improvements or extensions that they make and grant Carnegie Mellon
  * the rights to redistribute these changes.
  */
 /*
  * HISTORY
  * $Log$
+ * Revision 1.5  1997/06/21 01:40:07  drepper
+ * More 64bit changes.
+ *
  * Revision 1.4  1996/11/15 19:44:43  thomas
  * Tue Nov 12 16:58:41 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
  *
@@ -45,14 +48,14 @@
  *
  * Revision 2.4  91/05/14  17:53:15  mrt
  * 	Correcting copyright
- * 
+ *
  * Revision 2.3  91/02/14  14:17:43  mrt
  * 	Added new Mach copyright
  * 	[91/02/13  12:44:15  mrt]
- * 
+ *
  * Revision 2.2  90/08/06  17:24:22  rpd
  * 	Created.
- * 
+ *
  */
 
 #if 1
@@ -118,7 +121,8 @@ __mach_msg_destroy(msg)
 	    }
 
 	    /* calculate length of data in bytes, rounding up */
-	    length = ((((number * size) + 7) >> 3) + 3) &~ 3;
+	    length = (((((number * size) + 7) >> 3) + sizeof (int) - 1)
+		      &~ (sizeof (int) - 1));
 
 	    addr = is_inline ? saddr : * (vm_offset_t *) saddr;
 
diff --git a/malloc/malloc.h b/malloc/malloc.h
index 53b9d1b206..a72102e607 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -199,4 +199,4 @@ extern void __malloc_check_init __MALLOC_P ((void));
 }; /* end of extern "C" */
 #endif
 
-#endif /* !defined(_MALLOC_H) */
+#endif /* malloc.h */
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 35380a09a1..3f0cbb9726 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -25,7 +25,7 @@
 #define	_MALLOC_INTERNAL
 #include <malloc.h>
 #include <mcheck.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #endif
 
 #include <stdio.h>
diff --git a/malloc/obstack.h b/malloc/obstack.h
index b60828b6ae..ad6b830fcb 100644
--- a/malloc/obstack.h
+++ b/malloc/obstack.h
@@ -104,8 +104,8 @@ Summary:
 
 /* Don't do the contents of this file more than once.  */
 
-#ifndef __OBSTACK_H__
-#define __OBSTACK_H__
+#ifndef _OBSTACK_H
+#define _OBSTACK_H 1
 
 #ifdef __cplusplus
 extern "C" {
@@ -587,4 +587,4 @@ __extension__								\
 }	/* C++ */
 #endif
 
-#endif /* not __OBSTACK_H__ */
+#endif /* obstack.h */
diff --git a/malloc/thread-m.h b/malloc/thread-m.h
index 8307f256ff..9afd058ccb 100644
--- a/malloc/thread-m.h
+++ b/malloc/thread-m.h
@@ -28,7 +28,7 @@
 
 #if defined(_LIBC) /* The GNU C library, a special case of Posix threads */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 #ifdef PTHREAD_MUTEX_INITIALIZER
 
diff --git a/manual/libc.texinfo b/manual/libc.texinfo
index 2951f66fcc..7d81247cdb 100644
--- a/manual/libc.texinfo
+++ b/manual/libc.texinfo
@@ -14,15 +14,12 @@
 @c place of the node name, when no section title is explicitly given.
 @set xref-automatic-section-title
 @c @smallbook
-@iftex
-@afourpaper
-@end iftex
 @comment %**end of header (This is for running Texinfo on a region.)
 
 @c sold 0.06/1.09, print run out 21may96
 @set EDITION 0.07 DRAFT
 @set VERSION 2.00 Beta
-@set UPDATED 4 Oct 1996
+@set UPDATED 20 Jun 1997
 @set ISBN 1-882114-53-1
 
 @ifinfo
@@ -31,7 +28,7 @@ This file documents the GNU C library.
 This is Edition @value{EDITION}, last updated @value{UPDATED},
 of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}.
 
-Copyright (C) 1993, '94, '95, '96 Free Software Foundation, Inc.
+Copyright (C) 1993, '94, '95, '96, '97 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -77,7 +74,7 @@ Foundation.
 @center for version @value{VERSION}
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1993, '94, '95, '96 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, '94, '95, '96, '97 Free Software Foundation, Inc.
 @sp 2
 Published by the Free Software Foundation @*
 59 Temple Place -- Suite 330, @*
diff --git a/math/Makefile b/math/Makefile
index bd4506b99e..4f2537d680 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -21,15 +21,17 @@
 subdir		:= math
 
 # Installed header files.
-headers		:= math.h mathcalls.h __math.h huge_val.h nan.h		\
-		   fpu_control.h complex.h cmathcalls.h fenv.h		\
-		   fenvbits.h mathbits.h
+headers		:= math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
+		   bits/nan.h fpu_control.h complex.h bits/cmathcalls.h \
+		   fenv.h bits/fenv.h bits/mathdef.h
 
 # Internal header files.
 distribute	:= math_private.h machine/asm.h machine/endian.h
 
 # FPU support code.
-aux		:= fpu_control setfpucw
+aux		:= fpu_control setfpucw s_matherr
+
+static-only-routines := s_matherr
 
 # Build the -lm library.
 
@@ -38,7 +40,7 @@ extra-libs-others = $(extra-libs)
 
 libm-map	:= libm.map
 
-libm-support = k_standard s_lib_version s_matherr s_signgam		\
+libm-support = k_standard s_lib_version s_signgam			\
 	       s_lrint s_llrint s_lround s_llround			\
 	       fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg		\
 	       ftestexcept fegetround fesetround fegetenv feholdexcpt	\
diff --git a/math/cmathcalls.h b/math/bits/cmathcalls.h
index 1f74f56e0b..d94e764930 100644
--- a/math/cmathcalls.h
+++ b/math/bits/cmathcalls.h
@@ -42,7 +42,7 @@
    both a `NAME' and a `NAMEf' that takes `float' arguments.  */
 
 #ifndef _COMPLEX_H
- #error "Never include cmathcalls.h directly; include <complex.h> instead."
+#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
 #endif
 
 #define _Mdouble_complex_ _Mdouble_ complex
diff --git a/math/mathcalls.h b/math/bits/mathcalls.h
index 735b5953a7..e0bf1008d3 100644
--- a/math/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -41,7 +41,7 @@
    both a `NAME' and a `NAMEf' that takes `float' arguments.  */
 
 #ifndef _MATH_H
- #error "Never include mathcalls.h directly; include <math.h> instead."
+ #error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
 #endif
 
 
diff --git a/math/complex.h b/math/complex.h
index 938823b5fb..fe4c4ce545 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef _COMPLEX_H
-
 #define _COMPLEX_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
@@ -52,9 +52,9 @@ __BEGIN_DECLS
 #define CX_LIMITED_RANGE_DEFAULT
 
 
-/* The file <cmathcalls.h> contains the prototypes for all the actual
-   math functions.  These macros are used for those prototypes, so
-   we can easily declare each function as both `name' and `__name',
+/* The file <bits/cmathcalls.h> contains the prototypes for all the
+   actual math functions.  These macros are used for those prototypes,
+   so we can easily declare each function as both `name' and `__name',
    and can declare the float versions `namef' and `__namef'.  */
 
 #define __MATHCALL(function, args)	\
@@ -67,7 +67,7 @@ __BEGIN_DECLS
 
 #define _Mdouble_ 		double
 #define __MATH_PRECNAME(name)	name
-#include <cmathcalls.h>
+#include <bits/cmathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
@@ -81,7 +81,7 @@ __BEGIN_DECLS
 #else
 #define __MATH_PRECNAME(name)	name/**/f
 #endif
-#include <cmathcalls.h>
+#include <bits/cmathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
@@ -96,7 +96,7 @@ __BEGIN_DECLS
 #else
 #define __MATH_PRECNAME(name)	name/**/l
 #endif
-#include <cmathcalls.h>
+#include <bits/cmathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 #undef	__MATHDECL_1
diff --git a/math/fenv.h b/math/fenv.h
index e4dff29a2e..aa524b7a16 100644
--- a/math/fenv.h
+++ b/math/fenv.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef _FENV_H
-
 #define _FENV_H	1
+
 #include <features.h>
 
 /* Get the architecture dependend definitions.  The following definitions
@@ -55,7 +55,7 @@
    FE_DOWNWARD		round toward -Inf
    FE_TOWARDZERO	round toward 0
 */
-#include <fenvbits.h>
+#include <bits/fenv.h>
 
 __BEGIN_DECLS
 
diff --git a/math/libm-test.c b/math/libm-test.c
index 5bf968f844..2b149f739a 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -56,7 +56,7 @@
    ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctanh.
 
    At the moment the following functions aren't tested:
-   cabs, carg, conj, cproj, cimag, creal, drem,
+   cabs, carg, conj, cproj, cimag, creal, ctan, drem,
    j0, j1, jn, y0, y1, yn,
    significand,
    nan, comparison macros (isless,isgreater,...).
@@ -814,6 +814,14 @@ check_isinfn_exc (const char *test_name, MATHTYPE computed,
 }
 
 
+/* This is to prevent messages from the SVID libm emulation.  */
+int
+matherr (struct exception *x __attribute__ ((unused)))
+{
+  return 1;
+}
+
+
 /****************************************************************************
   Test for single functions of libm
 ****************************************************************************/
@@ -1298,10 +1306,15 @@ signbit_test (void)
 }
 
 
-
+/*
+   gamma has different semantics depending on _LIB_VERSION:
+   if _LIB_VERSION is _SVID, gamma is just an alias for lgamma,
+   otherwise gamma is the real gamma function as definied in ISO C 9X.
+*/
 static void
 gamma_test (void)
 {
+  int save_lib_version = _LIB_VERSION;
   errno = 0;
   FUNC(gamma) (0);
   if (errno == ENOSYS)
@@ -1309,6 +1322,40 @@ gamma_test (void)
     return;
   feclearexcept (FE_ALL_EXCEPT);
 
+
+  _LIB_VERSION = _SVID_;
+
+  check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
+  check_isinfp_exc ("gamma (0) == +inf plus divide by zero exception",
+		    FUNC(gamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
+
+  check_isinfp_exc ("gamma (x) == +inf plus divide by zero exception for integer x <= 0",
+		    FUNC(gamma) (-3), DIVIDE_BY_ZERO_EXCEPTION);
+  check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
+                   FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
+
+  signgam = 0;
+  check ("gamma (1) == 0", FUNC(gamma) (1), 0);
+  check_int ("gamma (0) sets signgam to 1", signgam, 1);
+
+  signgam = 0;
+  check ("gamma (3) == M_LN2", FUNC(gamma) (3), M_LN2);
+  check_int ("gamma (3) sets signgam to 1", signgam, 1);
+
+  signgam = 0;
+  check_eps ("gamma (0.5) == log(sqrt(pi))", FUNC(gamma) (0.5),
+             FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
+  check_int ("gamma (0.5) sets signgam to 1", signgam, 1);
+
+  signgam = 0;
+  check_eps ("gamma (-0.5) == log(2*sqrt(pi))", FUNC(gamma) (-0.5),
+             FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
+
+  check_int ("gamma (-0.5) sets signgam to -1", signgam, -1);
+
+
+  _LIB_VERSION = _IEEE_;
+
   check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
   check_isnan_exc ("gamma (0) == NaN plus invalid exception",
                     FUNC(gamma) (0), INVALID_EXCEPTION);
@@ -1326,6 +1373,7 @@ gamma_test (void)
   check ("gamma (1) == 1", FUNC(gamma) (1), 1);
   check ("gamma (4) == 6", FUNC(gamma) (4), 6);
 
+  _LIB_VERSION = save_lib_version;
 }
 
 
@@ -1348,16 +1396,20 @@ lgamma_test (void)
   check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
                    FUNC(lgamma) (minus_infty), INVALID_EXCEPTION);
 
+  signgam = 0;
   check ("lgamma (1) == 0", FUNC(lgamma) (1), 0);
   check_int ("lgamma (0) sets signgam to 1", signgam, 1);
 
+  signgam = 0;
   check ("lgamma (3) == M_LN2", FUNC(lgamma) (3), M_LN2);
   check_int ("lgamma (3) sets signgam to 1", signgam, 1);
 
+  signgam = 0;
   check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma) (0.5),
              FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
   check_int ("lgamma (0.5) sets signgam to 1", signgam, 1);
 
+  signgam = 0;
   check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma) (-0.5),
              FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
 
@@ -4725,7 +4777,7 @@ basic_tests (void)
   check_bool ("NaN != NaN", NaN_var != NaN_var);
 
   /*
-     the same tests but this time with NAN from <nan.h>
+     the same tests but this time with NAN from <bits/nan.h>
      NAN is a double const
    */
   check_bool ("isnan (NAN)", isnan (NAN));
diff --git a/math/libm.map b/math/libm.map
index b7c9b363d9..aff0ccd73f 100644
--- a/math/libm.map
+++ b/math/libm.map
@@ -1,16 +1,111 @@
 GLIBC_2.0 {
   global:
-    # all functions and variables in the normal name space
-    a*; b*; c*; d*; e*; f*; g*; h*; i*; j*; k*; l*; m*;
-    n*; o*; p*; q*; r*; s*; t*; u*; v*; w*; x*; y*; z*;
+    # mathematical functions
+    acos; acosf; acosl;
+    acosh; acoshf; acoshl;
+    asin; asinf; asinl;
+    asinh; asinhf; asinhl;
+    atan2; atan2f; atan2l;
+    atan; atanf; atanl;
+    atanh; atanhf; atanhl;
+    cbrt; cbrtf; cbrtl;
+    ceil; ceilf; ceill;
+    copysign; copysignf; copysignl;
+    cos; cosf; cosl;
+    coshf; cosh; coshl;
+    drem; dremf; dreml;
+    erf; erff; erfl;
+    erfc; erfcf; erfcl;
+    exp2; exp2f; exp2l;
+    exp; expf; expl;
+    expm1; expm1f; expm1l;
+    fabs; fabsf; fabsl;
+    fdim; fdimf; fdiml;
+    finite; finitef; finitel;
+    floor; floorf; floorl;
+    fmax; fmaxf; fmaxl;
+    fmin; fminf; fminl;
+    fmod; fmodf; fmodl;
+    frexp; frexpf; frexpl;
+    gamma; gammaf; gammal;
+    gamma_r; gammaf_r; gammal_r;
+    hypot; hypotf; hypotl;
+    ilogb; ilogbf; ilogbl;
+    j0; j0f; j0l;
+    j1; j1f; j1l;
+    jn; jnf; jnl;
+    ldexp; ldexpf; ldexpl;
+    lgamma; lgammaf; lgammal;
+    lgamma_r; lgammaf_r; lgammal_r;
+    log10; log10f; log10l;
+    log1p; log1pf; log1pl;
+    log2; log2f; log2l;
+    log; logf; logl;
+    logb; logbf; logbl;
+    matherr;
+    modf; modff; modfl;
+    nan; nanf; nanl;
+    nearbyint; nearbyintf; nearbyintl;
+    nextafter; nextafterf; nextafterl;
+    pow; powf; powl;
+    remainder; remainderf; remainderl;
+    remquo; remquof; remquol;
+    rint; rintf; rintl;
+    lrint; llrint;
+    round; roundf; roundl;
+    lround; llround;
+    scalb; scalbf; scalbl;
+    scalbn; scalbnf; scalbnl;
+    significand; significandf; significandl;
+    sin; sinf; sinl;
+    sincos; sincosf; sincosl;
+    sinh; sinhf; sinhl;
+    sqrt; sqrtf; sqrtl;
+    tan; tanf; tanl;
+    tanh; tanhf; tanhl;
+    trunc; truncf; truncl;
+    y0; y0f; y0l;
+    y1; y1f; y1l;
+    yn; ynf; ynl;
+
+    # complex functions
+    cabs; cabsf; cabsl;
+    cacos; cacosf; cacosl;
+    cacosh; cacoshf; cacoshl;
+    carg; cargf; cargl;
+    casin; casinf; casinl;
+    casinh; casinhf; casinhl;
+    catan; catanf; catanl;
+    catanh; catanhf; catanhl;
+    ccos; ccosf; ccosl;
+    ccosh; ccoshf; ccoshl;
+    cexp; cexpf; cexpl;
+    cimag; cimagf; cimagl;
+    clog; clogf; clogl;
+    conj; conjf; conjl;
+    cpow; cpowf; cpowl;
+    cproj; cprojf; cprojl;
+    creal; crealf; creall;
+    csin; csinf; csinl;
+    csinh; csinhf; csinhl;
+    csqrt; csqrtf; csqrtl;
+    ctan; ctanf; ctanl;
+    ctanh; ctanhf; ctanhl;
+
+    # fp environment functions
+    feclearexcept; fegetenv; fegetexceptflag;
+    fegetround; feholdexcept; feraiseexcept;
+    fesetenv; fesetexceptflag; fesetround;
+    fetestexcept; feupdateenv;
+
 
     # global variables
-    _LIB_VERSION;
+    _LIB_VERSION; signgam;
 
     # functions used in inline functions or macros
     __fpclassify; __fpclassifyf; __fpclassifyl;
     __signbit; __signbitf; __signbitl;
-    __finite; __finitef; __fintitel;
+    __finite; __finitef; __finitel;
 
     __log1p;
 
diff --git a/math/math.h b/math/math.h
index aa37f71f3c..2007509035 100644
--- a/math/math.h
+++ b/math/math.h
@@ -22,25 +22,25 @@
  */
 
 #ifndef	_MATH_H
-
 #define	_MATH_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
 /* Get machine-dependent HUGE_VAL value (returned on overflow).
    On all IEEE754 machines, this is +Infinity.  */
-#include <huge_val.h>
+#include <bits/huge_val.h>
 
 /* Get machine-dependent NAN value (returned for some domain errors).  */
 #ifdef	 __USE_GNU
-#include <nan.h>
+#include <bits/nan.h>
 #endif
 
 
-/* The file <mathcalls.h> contains the prototypes for all the actual
-   math functions.  These macros are used for those prototypes, so
-   we can easily declare each function as both `name' and `__name',
+/* The file <bits/mathcalls.h> contains the prototypes for all the
+   actual math functions.  These macros are used for those prototypes,
+   so we can easily declare each function as both `name' and `__name',
    and can declare the float versions `namef' and `__namef'.  */
 
 #define __MATHCALL(function,suffix, args)	\
@@ -58,7 +58,7 @@ __BEGIN_DECLS
 
 #define _Mdouble_ 		double
 #define __MATH_PRECNAME(name,r)	__CONCAT(name,r)
-#include <mathcalls.h>
+#include <bits/mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
@@ -77,7 +77,7 @@ __BEGIN_DECLS
 #else
 #define __MATH_PRECNAME(name,r) name/**/f/**/r
 #endif
-#include <mathcalls.h>
+#include <bits/mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
@@ -94,7 +94,7 @@ __BEGIN_DECLS
 #else
 #define __MATH_PRECNAME(name,r) name/**/l/**/r
 #endif
-#include <mathcalls.h>
+#include <bits/mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
@@ -132,7 +132,7 @@ extern int signgam;
 
      INFINITY	representation of the infinity value of type `float_t'
 */
-#include <mathbits.h>
+#include <bits/mathdef.h>
 
 /* All floating-point numbers can be put in one of these categories.  */
 enum
@@ -318,7 +318,7 @@ extern int matherr __P ((struct exception *));
 /* Get machine-dependent inline versions (if there are any).  */
 #if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
     || defined __LIBC_M81_MATH_INLINES
-#include <__math.h>
+#include <bits/mathinline.h>
 #endif
 
 
diff --git a/math/math_private.h b/math/math_private.h
index a7a4f3d74e..74b729d419 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -269,7 +269,7 @@ extern double __ieee754_y1 __P((double));
 extern double __ieee754_jn __P((int,double));
 extern double __ieee754_yn __P((int,double));
 extern double __ieee754_remainder __P((double,double));
-extern int    __ieee754_rem_pio2 __P((double,double*));
+extern int32_t __ieee754_rem_pio2 __P((double,double*));
 extern double __ieee754_scalb __P((double,double));
 
 /* fdlibm kernel function */
@@ -277,7 +277,8 @@ extern double __kernel_standard __P((double,double,int));
 extern double __kernel_sin __P((double,double,int));
 extern double __kernel_cos __P((double,double));
 extern double __kernel_tan __P((double,double,int));
-extern int    __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
+extern int    __kernel_rem_pio2 __P((double*,double*,int,int,int,
+				     const int32_t*));
 
 
 /* ieee style elementary float functions */
@@ -306,14 +307,15 @@ extern float __ieee754_y1f __P((float));
 extern float __ieee754_jnf __P((int,float));
 extern float __ieee754_ynf __P((int,float));
 extern float __ieee754_remainderf __P((float,float));
-extern int   __ieee754_rem_pio2f __P((float,float*));
+extern int32_t __ieee754_rem_pio2f __P((float,float*));
 extern float __ieee754_scalbf __P((float,float));
 
 /* float versions of fdlibm kernel functions */
 extern float __kernel_sinf __P((float,float,int));
 extern float __kernel_cosf __P((float,float));
 extern float __kernel_tanf __P((float,float,int));
-extern int   __kernel_rem_pio2f __P((float*,float*,int,int,int,const int*));
+extern int   __kernel_rem_pio2f __P((float*,float*,int,int,int,
+				     const int32_t*));
 
 
 /* ieee style elementary long double functions */
diff --git a/mathcalls.h b/mathcalls.h
deleted file mode 100644
index 20e0854402..0000000000
--- a/mathcalls.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <math/mathcalls.h>
diff --git a/md5-crypt/md5.h b/md5-crypt/md5.h
index f7babfb5ed..b668a64284 100644
--- a/md5-crypt/md5.h
+++ b/md5-crypt/md5.h
@@ -143,7 +143,7 @@ extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
 extern int __md5_stream __P ((FILE *stream, void *resblock));
-extern int md5_stream __P ((FILE *stream, void *resblock));
+#endif /* md5.h */
 
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
    result is always in little endian byte order, so that a byte-wise
diff --git a/misc/Makefile b/misc/Makefile
index e2db14daa0..4cca2f32c1 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -22,14 +22,14 @@
 
 subdir	:= misc
 
-headers	:= sys/uio.h iovec.h sys/ioctl.h ioctls.h ioctl-types.h \
+headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
-	   ar.h a.out.h libgen.h stab.h stab.def sgtty.h \
+	   ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
 	   ttyent.h syslog.h sys/syslog.h paths.h sys/reboot.h \
-	   sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h\
+	   sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h \
 	   sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \
-	   sys/select.h ustat.h sys/ustat.h ustatbits.h sys/sysinfo.h \
-	   regexp.h selectbits.h
+	   sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \
+	   regexp.h bits/select.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev \
diff --git a/misc/ar.h b/misc/ar.h
index 5e131f2586..2b54ecb87f 100644
--- a/misc/ar.h
+++ b/misc/ar.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _AR_H
-
 #define _AR_H 1
+
 #include <sys/cdefs.h>
 
 /* Archive files start with the ARMAG identifying string.  Then follows a
diff --git a/misc/stab.def b/misc/bits/stab.def
index dd4fbf0e8b..dd4fbf0e8b 100644
--- a/misc/stab.def
+++ b/misc/bits/stab.def
diff --git a/misc/err.h b/misc/err.h
index 403ef7f701..fa971cabf0 100644
--- a/misc/err.h
+++ b/misc/err.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_ERR_H_
-#define	_ERR_H_	1
+#ifndef	_ERR_H
+#define	_ERR_H	1
+
 #include <features.h>
 
 #define	__need___va_list
diff --git a/misc/error.h b/misc/error.h
index 25784c22ce..0d3bcb7ae3 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -19,8 +19,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _error_h_
-#define _error_h_
+#ifndef _ERROR_H
+#define _ERROR_H 1
 
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
@@ -74,4 +74,4 @@ extern int error_one_per_line;
 }
 #endif
 
-#endif /* _error_h_ */
+#endif /* error.h */
diff --git a/misc/fstab.h b/misc/fstab.h
index d45ce62d2b..d2e27d9711 100644
--- a/misc/fstab.h
+++ b/misc/fstab.h
@@ -33,9 +33,9 @@
  *	@(#)fstab.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _FSTAB_H_
+#ifndef _FSTAB_H
+#define _FSTAB_H	1
 
-#define _FSTAB_H_	1
 #include <features.h>
 
 /*
@@ -79,4 +79,4 @@ extern void endfsent __P ((void));
 
 __END_DECLS
 
-#endif /* !_FSTAB_H_ */
+#endif /* fstab.h */
diff --git a/misc/libgen.h b/misc/libgen.h
index 4eb4d15ff8..87c9d3f967 100644
--- a/misc/libgen.h
+++ b/misc/libgen.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _LIBGEN_H
-
 #define _LIBGEN_H	1
+
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
diff --git a/misc/nlist.h b/misc/nlist.h
index 7e2ebc01e7..53cd468658 100644
--- a/misc/nlist.h
+++ b/misc/nlist.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_NLIST_H
-
 #define	_NLIST_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
diff --git a/misc/sgtty.h b/misc/sgtty.h
index c232dfc823..86e15b0afc 100644
--- a/misc/sgtty.h
+++ b/misc/sgtty.h
@@ -18,11 +18,12 @@
 
 #ifndef	_SGTTY_H
 #define	_SGTYY_H	1
+
 #include <features.h>
 
 #include <sys/ioctl.h>
 
-/* On some systems this type is not defined by <ioctl-types.h>;
+/* On some systems this type is not defined by <bits/ioctl-types.h>;
    in that case, the functions are just stubs that return ENOSYS.  */
 struct sgttyb;
 
diff --git a/misc/stab.h b/misc/stab.h
index 80bd594a36..9dc3c32ecb 100644
--- a/misc/stab.h
+++ b/misc/stab.h
@@ -8,7 +8,7 @@
 
 enum __stab_debug_code
 {
-#include "stab.def"
+#include <bits/stab.def>
 LAST_UNUSED_STAB_CODE
 };
 
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index f9dcce4c8d..602779ebb7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_CDEFS_H
-
 #define	_SYS_CDEFS_H	1
+
 #include <features.h>
 
 /* Some user header file might have defined this before.  */
diff --git a/misc/sys/dir.h b/misc/sys/dir.h
index a6384e6cc6..96b36c78df 100644
--- a/misc/sys/dir.h
+++ b/misc/sys/dir.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_DIR_H
-
 #define	_SYS_DIR_H	1
+
 #include <features.h>
 
 #include <dirent.h>
diff --git a/misc/sys/file.h b/misc/sys/file.h
index 4120882476..9f946fb327 100644
--- a/misc/sys/file.h
+++ b/misc/sys/file.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_FILE_H
-
 #define	_SYS_FILE_H	1
+
 #include <features.h>
 
 #ifndef	_FCNTL_H
diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h
index 4e940bd29f..644ac5b02f 100644
--- a/misc/sys/ioctl.h
+++ b/misc/sys/ioctl.h
@@ -17,23 +17,23 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_IOCTL_H
-
 #define	_SYS_IOCTL_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
 /* Get the list of `ioctl' requests and related constants.  */
-#include <ioctls.h>
+#include <bits/ioctls.h>
 
 /* Define some types used by `ioctl' requests.  */
-#include <ioctl-types.h>
+#include <bits/ioctl-types.h>
 
-/* On a Unix system, the system <sys/ioctl.h> probably defines some of the
-   symbols we define in <sys/ttydefaults.h> (usually with the same values).
-   The code to generate <ioctls.h> has omitted these symbols to avoid the
-   conflict, but a Unix program expects <sys/ioctl.h> to define them, so we
-   must include <sys/ttydefaults.h> here.  */
+/* On a Unix system, the system <sys/ioctl.h> probably defines some of
+   the symbols we define in <sys/ttydefaults.h> (usually with the same
+   values).  The code to generate <bits/ioctls.h> has omitted these
+   symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h>
+   to define them, so we must include <sys/ttydefaults.h> here.  */
 #include <sys/ttydefaults.h>
 
 /* Perform the I/O control operation specified by REQUEST on FD.
diff --git a/misc/sys/queue.h b/misc/sys/queue.h
index 65612ce6f3..e675521273 100644
--- a/misc/sys/queue.h
+++ b/misc/sys/queue.h
@@ -33,8 +33,8 @@
  *	@(#)queue.h	8.3 (Berkeley) 12/13/93
  */
 
-#ifndef	_QUEUE_H_
-#define	_QUEUE_H_
+#ifndef	_SYS_QUEUE_H
+#define	_SYS_QUEUE_H 1
 
 /*
  * This file defines three types of data structures: lists, tail queues,
@@ -242,4 +242,4 @@ struct {								\
 		(elm)->field.cqe_prev->field.cqe_next =			\
 		    (elm)->field.cqe_next;				\
 }
-#endif	/* !_QUEUE_H_ */
+#endif	/* sys/queue.h */
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 2e102dd9fe..a151570bc6 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -20,15 +20,15 @@
 /*	POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h>  */
 
 #ifndef _SYS_SELECT_H
-
 #define _SYS_SELECT_H	1
+
 #include <features.h>
 
 /* Get definition of needed basic types.  */
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Get __FD_* definitions.  */
-#include <selectbits.h>
+#include <bits/select.h>
 
 /* Get definition of timer specification structures.  */
 #define __need_timespec
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index 6da3a3b4c3..48f01e2d74 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -33,6 +33,9 @@
  *	@(#)syslog.h	8.1 (Berkeley) 6/2/93
  */
 
+#ifndef _SYS_SYSLOG_H
+#define _SYS_SYSLOG_H 1
+
 #define	_PATH_LOG	"/dev/log"
 
 /*
@@ -208,3 +211,5 @@ extern void vsyslog __P ((int __pri, __const char *__fmt, _BSD_VA_LIST_ __ap));
 __END_DECLS
 
 #endif /* !KERNEL */
+
+#endif /* sys/syslog.h */
diff --git a/misc/sys/uio.h b/misc/sys/uio.h
index 901f9bbc25..3b11276362 100644
--- a/misc/sys/uio.h
+++ b/misc/sys/uio.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_UIO_H
-
 #define _SYS_UIO_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
@@ -26,7 +26,7 @@
 __BEGIN_DECLS
 
 /* This file defines `struct iovec'.  */
-#include <iovec.h>
+#include <bits/uio.h>
 
 
 /* Read data from file descriptor FD, and put the result in the
diff --git a/misc/sys/ustat.h b/misc/sys/ustat.h
index 24e0746688..239d70b25d 100644
--- a/misc/sys/ustat.h
+++ b/misc/sys/ustat.h
@@ -17,15 +17,17 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This interface is obsolete.  Use <sys/statfs.h> instead.  */
+/*
+ * This interface is obsolete.  Use <sys/statfs.h> instead.
+ */
 
 #ifndef _SYS_USTAT_H
-
 #define	_SYS_USTAT_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
-#include <ustatbits.h>
+#include <bits/ustat.h>
 
 __BEGIN_DECLS
 
@@ -34,4 +36,4 @@ extern int ustat __P ((__dev_t __dev, struct ustat *__ubuf));
 
 __END_DECLS
 
-#endif /* _SYS_USTAT_H */
+#endif /* sys/ustat.h */
diff --git a/misc/sysexits.h b/misc/sysexits.h
index 464cb11bab..e77efedd56 100644
--- a/misc/sysexits.h
+++ b/misc/sysexits.h
@@ -33,8 +33,8 @@
  *	@(#)sysexits.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef	_SYSEXITS_H_
-#define	_SYSEXITS_H_
+#ifndef	_SYSEXITS_H
+#define	_SYSEXITS_H 1
 
 /*
  *  SYSEXITS.H -- Exit status codes for system programs.
@@ -115,4 +115,4 @@
 
 #define EX__MAX	78	/* maximum listed value */
 
-#endif /* !_SYSEXITS_H_ */
+#endif /* sysexits.h */
diff --git a/misc/syslog.c b/misc/syslog.c
index 5521ceb9d0..acb1b69e00 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -49,7 +49,7 @@ static char sccsid[] = "@(#)syslog.c	8.4 (Berkeley) 3/18/94";
 #include <time.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <signal.h>
 
 #if __STDC__
diff --git a/misc/ttyent.h b/misc/ttyent.h
index a3b4550776..58a1d7a179 100644
--- a/misc/ttyent.h
+++ b/misc/ttyent.h
@@ -33,9 +33,9 @@
  *	@(#)ttyent.h	8.1 (Berkeley) 6/2/93
  */
 
-#ifndef	_TTYENT_H_
+#ifndef	_TTYENT_H
+#define	_TTYENT_H	1
 
-#define	_TTYENT_H_	1
 #include <features.h>
 
 #define	_PATH_TTYS	"/etc/ttys"
@@ -66,4 +66,4 @@ extern int endttyent __P ((void));
 
 __END_DECLS
 
-#endif /* !_TTYENT_H_ */
+#endif /* ttyent.h */
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 68f852d19a..40a190eea7 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -21,7 +21,7 @@
 #include <nss.h>
 #include <grp.h>
 #include <ctype.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <string.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index b47a8b13c1..d0d230bb1e 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include <netdb.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 #include <rpcsvc/nis.h>
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index 30c4e407d2..066f707ebb 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -23,7 +23,7 @@
 #include <netdb.h>
 #include <shadow.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 #include <rpcsvc/nis.h>
diff --git a/nis/nss_nis/nis-alias.c b/nis/nss_nis/nis-alias.c
index 733e1508c5..80c49ff5dd 100644
--- a/nis/nss_nis/nis-alias.c
+++ b/nis/nss_nis/nis-alias.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <string.h>
 #include <aliases.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index 32c683415d..149910bfab 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -21,7 +21,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 #include <netinet/if_ether.h>
diff --git a/nis/nss_nis/nis-grp.c b/nis/nss_nis/nis-grp.c
index cbe4d35555..9577499670 100644
--- a/nis/nss_nis/nis-grp.c
+++ b/nis/nss_nis/nis-grp.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index 5823c71a80..d26b4f5ccc 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -24,7 +24,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <resolv.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index aa51c2f0df..ce8762a1e5 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -20,7 +20,7 @@
 #include <nss.h>
 #include <ctype.h>
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <netdb.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/nis/nss_nis/nis-network.c b/nis/nss_nis/nis-network.c
index 0253ac8453..284e479401 100644
--- a/nis/nss_nis/nis-network.c
+++ b/nis/nss_nis/nis-network.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index 3df99190a2..ceed40e036 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-publickey.c b/nis/nss_nis/nis-publickey.c
index f50f7095fc..52d1783d63 100644
--- a/nis/nss_nis/nis-publickey.c
+++ b/nis/nss_nis/nis-publickey.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <string.h>
 #include <syslog.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpc/rpc.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
@@ -40,7 +40,7 @@ _nss_nis_getpublickey (const char *netname, char *pkey)
   enum nss_status retval;
   char *domain, *result;
   int len;
-  
+
   pkey[0] = 0;
 
   if (netname == NULL)
diff --git a/nis/nss_nis/nis-pwd.c b/nis/nss_nis/nis-pwd.c
index b273332d03..39c2948b65 100644
--- a/nis/nss_nis/nis-pwd.c
+++ b/nis/nss_nis/nis-pwd.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index c20988312a..073284865e 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index ae7667f231..054bc33169 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nis/nis-spwd.c b/nis/nss_nis/nis-spwd.c
index cc4cf3a0ba..21221fd7e5 100644
--- a/nis/nss_nis/nis-spwd.c
+++ b/nis/nss_nis/nis-spwd.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <string.h>
 #include <shadow.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
 
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index b27f1a87ab..1784778ca0 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <aliases.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index 2cdc2dfd7a..d83c7b2e11 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <ctype.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <netdb.h>
 #include <netinet/ether.h>
 #include <rpcsvc/nis.h>
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index 1c73ca555b..bf851e0cea 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
@@ -47,10 +47,10 @@ _nss_nisplus_parse_grent (nis_result * result, struct group *gr,
   size_t room_left = buflen;
   char *line;
   int count;
-  
+
   if (result == NULL)
     return 0;
-  
+
   if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
       result->objects.objects_len != 1 ||
       result->objects.objects_val[0].zo_data.zo_type != ENTRY_OBJ ||
@@ -66,7 +66,7 @@ _nss_nisplus_parse_grent (nis_result * result, struct group *gr,
       __set_errno (ERANGE);
       return 0;
     }
-  
+
   strncpy (first_unused, NISENTRYVAL (0, 0, result),
 	   NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 0fdeb8f3f1..ee87a78225 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-netgrp.c b/nis/nss_nisplus/nisplus-netgrp.c
index f2a1b301b9..5907882725 100644
--- a/nis/nss_nisplus/nisplus-netgrp.c
+++ b/nis/nss_nisplus/nisplus-netgrp.c
@@ -23,7 +23,7 @@
 #include <netdb.h>
 #include <string.h>
 #include <netgroup.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
@@ -42,7 +42,7 @@ static unsigned long position = 0;
         ((res)->objects.objects_val[(idx)].zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_len)
 
 static enum nss_status
-_nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer, 
+_nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
 			     size_t buflen)
 {
   enum nss_status status;
@@ -51,14 +51,14 @@ _nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
   if (data == NULL || data_size == 0)
     /* User bug.  setnetgrent() wasn't called before.  */
     abort ();
-  
+
   if (position == data_size)
     return result->first ? NSS_STATUS_NOTFOUND : NSS_STATUS_RETURN;
-  
+
   if (NISENTRYLEN (position, 1, data) > 0)
     {
       /* We have a list of other netgroups.  */
-      
+
       result->type = group_val;
       if (NISENTRYLEN (position, 1, data) >= buflen)
 	{
@@ -71,13 +71,13 @@ _nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
       result->val.group = buffer;
       ++position;
       result->first = 0;
-      
+
       return NSS_STATUS_SUCCESS;
     }
 
-  /* Before we can copy the entry to the private buffer we have to make 
+  /* Before we can copy the entry to the private buffer we have to make
      sure it is big enough.  */
-  if (NISENTRYLEN (position, 2, data) + NISENTRYLEN (position, 3, data) + 
+  if (NISENTRYLEN (position, 2, data) + NISENTRYLEN (position, 3, data) +
       NISENTRYLEN (position, 4, data) + 6 > buflen)
     {
       __set_errno (ERANGE);
@@ -86,9 +86,9 @@ _nss_nisplus_parse_netgroup (struct __netgrent *result, char *buffer,
   else
     {
       char *cp = buffer;
-      
+
       result->type = triple_val;
-      
+
       if (NISENTRYLEN (position, 2, data) == 0)
 	result->val.triple.host = NULL;
       else
@@ -166,9 +166,9 @@ _nss_nisplus_setnetgrent (char *group)
     }
   else
     data_size = data->objects.objects_len;
-  
+
   __libc_lock_unlock (lock);
-  
+
   return status;
 }
 
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 7f849e21e9..8d6e08b2c6 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <arpa/inet.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index 1399748846..ee0341d0b9 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <netdb.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index b65a9fe395..89b0eff7a7 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <pwd.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 435da5792c..180e9169f2 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <ctype.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpc/netdb.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index c95507a468..6cad42d4f6 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include <netdb.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
diff --git a/nis/nss_nisplus/nisplus-spwd.c b/nis/nss_nisplus/nisplus-spwd.c
index 568a1c4006..e6ff674f30 100644
--- a/nis/nss_nisplus/nisplus-spwd.c
+++ b/nis/nss_nisplus/nisplus-spwd.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <shadow.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpcsvc/nis.h>
 #include <rpcsvc/nislib.h>
 
@@ -84,7 +84,7 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
   sp->sp_lstchg = sp->sp_min = sp->sp_max = sp->sp_warn = sp->sp_inact =
     sp->sp_expire = sp->sp_flag = -1;
 
-  if (NISENTRYVAL (0, 7, result) > 0)
+  if (NISENTRYVAL (0, 7, result) != NULL)
     {
       char *line, *cp;
 
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 01bf8bc6b0..cc510b9541 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -20,7 +20,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <rpc/rpc.h>
 #include <rpcsvc/yp.h>
 #include <rpcsvc/ypclnt.h>
diff --git a/nss/Makefile b/nss/Makefile
index 02af5009bc..90e5521d5b 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -24,7 +24,8 @@ subdir	:= nss
 headers			:= nss.h
 distribute		:= nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \
 			   getXXent.c getXXent_r.c databases.def \
-			   nsswitch.conf db-Makefile digits_dots.c
+			   nsswitch.conf db-Makefile digits_dots.c \
+			   function.def
 
 # This is the trivial part which goes into libc itself.
 routines		= nsswitch $(addsuffix -lookup,$(databases))
@@ -59,8 +60,11 @@ generated		+= $(filter-out db-alias.c db-netgrp.c, \
 					$(addsuffix .c,$(libnss_db-routines)))
 distribute		+= db-XXX.c
 
+
+ifneq ($(build-static-nss),yes)
 libnss_files-inhibit-o	= $(filter-out .so,$(object-suffixes))
 libnss_db-inhibit-o	= $(filter-out .so,$(object-suffixes))
+endif
 
 
 include ../Rules
diff --git a/nss/function.def b/nss/function.def
new file mode 100644
index 0000000000..430f4fa5d0
--- /dev/null
+++ b/nss/function.def
@@ -0,0 +1,95 @@
+/* List of all functions defined for the NSS in GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* aliases */
+DEFINE_ENT (files, alias)
+DEFINE_GETBY (files, alias, name)
+DEFINE_ENT (db, alias)
+DEFINE_GETBY (db, alias, name)
+
+/* ethers */
+DEFINE_ENT (files, ether)
+DEFINE_ENT (db, ether)
+
+/* group */
+DEFINE_ENT (files, gr)
+DEFINE_GET (files, grgid)
+DEFINE_GET (files, grnam)
+DEFINE_ENT (db, gr)
+DEFINE_GET (db, grgid)
+DEFINE_GET (db, grnam)
+
+/* hosts */
+DEFINE_ENT (files, host)
+DEFINE_GETBY (files, host, addr)
+DEFINE_GETBY (files, host, name)
+DEFINE_GET (files, hostton)
+DEFINE_GET (files, ntohost)
+DEFINE_GETBY (dns, host, addr)
+DEFINE_GETBY (dns, host, name)
+DEFINE_GETBY (dns, host, name2)
+
+/* netgroup */
+DEFINE_ENT (files, netgr)
+DEFINE_ENT (db, netgr)
+
+/* networks */
+DEFINE_ENT (files, net)
+DEFINE_GETBY (files, net, name)
+DEFINE_GETBY (files, net, addr)
+DEFINE_GETBY (dns, net, name)
+DEFINE_GETBY (dns, net, addr)
+
+/* protocols */
+DEFINE_ENT (files, proto)
+DEFINE_GETBY (files, proto, name)
+DEFINE_GETBY (files, proto, number)
+DEFINE_ENT (db, proto)
+DEFINE_GETBY (db, proto, name)
+DEFINE_GETBY (db, proto, number)
+
+/* passwd */
+DEFINE_ENT (files, pw)
+DEFINE_GET (files, pwnam)
+DEFINE_GET (files, pwuid)
+DEFINE_ENT (db, pw)
+DEFINE_GET (db, pwnam)
+DEFINE_GET (db, pwuid)
+
+/* rpc */
+DEFINE_ENT (files, rpc)
+DEFINE_GETBY (files, rpc, name)
+DEFINE_GETBY (files, rpc, number)
+DEFINE_ENT (db, rpc)
+DEFINE_GETBY (db, rpc, name)
+DEFINE_GETBY (db, rpc, number)
+
+/* services */
+DEFINE_ENT (files, serv)
+DEFINE_GETBY (files, serv, name)
+DEFINE_GETBY (files, serv, port)
+DEFINE_ENT (db, serv)
+DEFINE_GETBY (db, serv, name)
+DEFINE_GETBY (db, serv, port)
+
+/* shadow */
+DEFINE_ENT (files, sp)
+DEFINE_GET (files, spnam)
+DEFINE_ENT (db, sp)
+DEFINE_GET (db, spnam)
diff --git a/nss/getXXbyYY.c b/nss/getXXbyYY.c
index f81df05381..47df15b034 100644
--- a/nss/getXXbyYY.c
+++ b/nss/getXXbyYY.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 
 #include "nsswitch.h"
diff --git a/nss/getXXent.c b/nss/getXXent.c
index eeb03dfa37..491ab4d275 100644
--- a/nss/getXXent.c
+++ b/nss/getXXent.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 
 #include "nsswitch.h"
diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c
index 1df51ab768..f2cca259f0 100644
--- a/nss/getXXent_r.c
+++ b/nss/getXXent_r.c
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 #include "nsswitch.h"
 
diff --git a/nss/nss.h b/nss/nss.h
index b36c53d05c..dc50cf7320 100644
--- a/nss/nss.h
+++ b/nss/nss.h
@@ -20,8 +20,8 @@
    and for implementors of new services.  */
 
 #ifndef _NSS_H
-
 #define _NSS_H	1
+
 #include <features.h>
 
 
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index f4ecb981ab..0c1b1ada37 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -19,7 +19,7 @@
 
 #include <db.h>
 #include <fcntl.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include "nsswitch.h"
 
 /* These symbols are defined by the including source file:
diff --git a/nss/nss_db/db-alias.c b/nss/nss_db/db-alias.c
index 51a63a8103..8b8cb41238 100644
--- a/nss/nss_db/db-alias.c
+++ b/nss/nss_db/db-alias.c
@@ -24,7 +24,7 @@
 #include <db.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <paths.h>
 #include <string.h>
 
diff --git a/nss/nss_db/db-netgrp.c b/nss/nss_db/db-netgrp.c
index c27c8de9ca..e716dd00b2 100644
--- a/nss/nss_db/db-netgrp.c
+++ b/nss/nss_db/db-netgrp.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <paths.h>
 #include "nsswitch.h"
 #include "netgroup.h"
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 7472496a10..3281580b8f 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -21,7 +21,7 @@
 #include <ctype.h>
 #include <assert.h>
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include "nsswitch.h"
 
 /* These symbols are defined by the including source file:
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 341e9d4d68..99217fa7c5 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -21,7 +21,7 @@
 #include <aliases.h>
 #include <ctype.h>
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index f36fe9607d..16cf0e8040 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -21,13 +21,16 @@
 #include <dlfcn.h>
 #include <errno.h>
 #include <netdb.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <link.h>	/* We need some help from ld.so.  */
 #include <search.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <gnu/lib-names.h>
+
+#if !defined DO_STATIC_NSS || defined PIC
+# include <gnu/lib-names.h>
+#endif
 
 #include "nsswitch.h"
 
@@ -64,8 +67,10 @@ static struct
 __libc_lock_define_initialized (static, lock)
 
 
+#if !defined DO_STATIC_NSS || defined PIC
 /* String with revision number of the shared object files.  */
 static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
+#endif
 
 /* The root of the whole data base.  */
 static name_database *service_table;
@@ -240,6 +245,7 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
 }
 
 
+#if !defined DO_STATIC_NSS || defined PIC
 static int
 nss_dlerror_run (void (*operate) (void *), void *args)
 {
@@ -292,6 +298,7 @@ get_sym (void *a)
   args->loadbase = _dl_lookup_symbol (args->name, &args->ref,
 				      scope, args->map->l_name, 0);
 }
+#endif
 
 /* Comparison function for searching NI->known tree.  */
 static int
@@ -363,6 +370,7 @@ nss_lookup_function (service_user *ni, const char *fct_name)
 		}
 	    }
 
+#if !defined DO_STATIC_NSS || defined PIC
 	  if (ni->library->lib_handle == NULL)
 	    {
 	      /* Load the shared library.  */
@@ -407,6 +415,52 @@ nss_lookup_function (service_user *ni, const char *fct_name)
 	      result = (nss_dlerror_run (get_sym, &args) ? NULL
 			: (void *) (args.loadbase + args.ref->st_value));
 	    }
+#else
+	  /* We can't get function address dynamically in static linking. */
+	  {
+# define DEFINE_ENT(h,nm)						      \
+	    extern void _nss_##h##_get##nm##ent_r (void);		      \
+	    extern void _nss_##h##_end##nm##ent (void);			      \
+	    extern void _nss_##h##_set##nm##ent (void);
+# define DEFINE_GET(h,nm)						      \
+	    extern void _nss_##h##_get##nm##_r (void);
+# define DEFINE_GETBY(h,nm,ky)						      \
+	    extern void _nss_##h##_get##nm##by##ky##_r (void);
+# include "functions.def"
+# undef DEFINE_ENT
+# undef DEFINE_GET
+# undef DEFINE_GETBY
+# define DEFINE_ENT(h,nm)						      \
+	    { #h"_get"#nm"ent_r", _nss_##h##_get##nm##ent_r },	      \
+	    { #h"_end"#nm"ent", _nss_##h##_end##nm##ent },	      \
+	    { #h"_set"#nm"ent", _nss_##h##_set##nm##ent },
+# define DEFINE_GET(h,nm)						      \
+	    { #h"_get"#nm"_r", _nss_##h##_get##nm##_r },
+# define DEFINE_GETBY(h,nm,ky)						      \
+	    { #h"_get"#nm"by"#ky"_r", _nss_##h##_get##nm##by##ky##_r },
+	    static struct fct_tbl { const char *fname; void *fp; } *tp, tbl[] =
+	      {
+# include "functions.def"
+		{ NULL, NULL }
+	      };
+	    size_t namlen = (5 + strlen (ni->library->name) + 1
+			     + strlen (fct_name) + 1);
+	    char name[namlen];
+
+	    /* Construct the function name.  */
+	    __stpcpy (__stpcpy (__stpcpy (name, ni->library->name),
+				"_"),
+		      fct_name);
+
+	    result = NULL;
+	    for (tp = &tbl[0]; tp->fname; tp++)
+	      if (strcmp (tp->fname, name) == 0)
+		{
+		  result = tp->fp;
+		  break;
+		}
+	  }
+#endif
 
 	  /* Remember function pointer for later calls.  Even if null, we
 	     record it so a second try needn't search the library again.  */
diff --git a/po/ko.po b/po/ko.po
index 6ff671cbb0..5e17d9ffd3 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -1,13 +1,13 @@
 # GNU libcÀÇ Çѱ¹¾î ¸Þ½ÃÁö
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>, 1996.
+# Copyright (C) 1996, 97 Free Software Foundation, Inc.
+# Bang Jun-Young <bangjy@nownuri.net>, 1996-97.
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: GNU libc 1.98\n"
-"POT-Creation-Date: 1996-12-03 13:50+0100\n"
-"PO-Revision-Date: 1996-12-15 14:17+0900\n"
-"Last-Translator: Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>\n"
+"Project-Id-Version: GNU libc 2.0.3\n"
+"POT-Creation-Date: 1997-03-30 19:08+0200\n"
+"PO-Revision-Date: 1997-06-05 18:33+0900\n"
+"Last-Translator: Bang Jun-Young <bangjy@nownuri.net>\n"
 "Language-Team: Korean <ko@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=EUC-KR\n"
@@ -33,31 +33,31 @@ msgstr "       rpcinfo [ -n Æ÷Æ®¹øÈ£ ] -t È£½ºÆ® ÇÁ·Î±×·¥¹øÈ£ [ ¹öÀü¹øÈ£ ]\n"
 msgid "   program vers proto   port\n"
 msgstr "   ÇÁ·Î±×·¥ ¹öÀü ¿øÇü   Æ÷Æ®\n"
 
-#: time/zic.c:424
+#: time/zic.c:419
 #, c-format
 msgid " (rule from \"%s\", line %d)"
-msgstr " (\"%s\"¿¡ ÀÖ´Â ±ÔÄ¢, %d Çà)"
+msgstr " (\"%s\"¿¡ ÀÖ´Â ±ÔÄ¢, Çà %d)"
 
-#: locale/programs/ld-collate.c:360 locale/programs/ld-ctype.c:1234
+#: locale/programs/ld-collate.c:363 locale/programs/ld-ctype.c:1242
 msgid " done\n"
 msgstr " ¿Ï·á\n"
 
-#: time/zic.c:421
+#: time/zic.c:416
 #, c-format
 msgid "\"%s\", line %d: %s"
 msgstr "\"%s\", Çà %d: %s"
 
-#: time/zic.c:945
+#: time/zic.c:943
 #, c-format
 msgid "\"Zone %s\" line and -l option are mutually exclusive"
-msgstr "\"Áö¿ª %s\" Çà°ú -l ¿É¼ÇÀº ¼­·Î ¹èŸÀûÀÔ´Ï´Ù"
+msgstr "\"Áö¿ª %s\" Çà°ú -l ¿É¼ÇÀº »óÈ£ ¹èŸÀûÀÔ´Ï´Ù"
 
-#: time/zic.c:953
+#: time/zic.c:951
 #, c-format
 msgid "\"Zone %s\" line and -p option are mutually exclusive"
-msgstr "\"Áö¿ª %s\" Çà°ú -p ¿É¼ÇÀº ¼­·Î ¹èŸÀûÀÔ´Ï´Ù"
+msgstr "\"Áö¿ª %s\" Çà°ú -p ¿É¼ÇÀº »óÈ£ ¹èŸÀûÀÔ´Ï´Ù"
 
-#: time/zic.c:758
+#: time/zic.c:754
 #, c-format
 msgid "%s in ruleless zone"
 msgstr "±ÔÄ¢¾ø´Â Áö¿ª¿¡ %s°¡ ÀÖÀ½"
@@ -77,7 +77,7 @@ msgstr "%s%s%s:%u: %s%s¿¹±âÄ¡ ¸øÇÑ ¿À·ù: %s.\n"
 msgid "%s%sUnknown signal %d\n"
 msgstr "%s%s¾Ë ¼ö ¾ø´Â ½ÅÈ£ %d\n"
 
-#: time/zic.c:2139
+#: time/zic.c:2172
 #, c-format
 msgid "%s: %d did not sign extend correctly\n"
 msgstr "%s: %d´Â ºÎÈ£ È®ÀåÀÌ Á¦´ë·Î µÇÁö ¾Ê¾Ò½À´Ï´Ù\n"
@@ -87,137 +87,142 @@ msgstr "%s: %d´Â ºÎÈ£ È®ÀåÀÌ Á¦´ë·Î µÇÁö ¾Ê¾Ò½À´Ï´Ù\n"
 msgid "%s: <mb_cur_max> must be greater than <mb_cur_min>\n"
 msgstr "%s: <mb_cur_max>´Â <mb_cur_min>º¸´Ù Ä¿¾ß ÇÕ´Ï´Ù\n"
 
-#: time/zic.c:1430
+#: time/zic.c:1443
 #, c-format
 msgid "%s: Can't create %s: %s\n"
 msgstr "%s: %s¸¦ ¸¸µé ¼ö ¾ø½À´Ï´Ù: %s\n"
 
-#: time/zic.c:2118
+#: time/zic.c:2150
 #, c-format
 msgid "%s: Can't create directory %s: %s\n"
 msgstr "%s: %s µð·ºÅ丮¸¦ ¸¸µé ¼ö ¾ø½À´Ï´Ù: %s\n"
 
-#: time/zic.c:612
+#: time/zic.c:608
 #, c-format
 msgid "%s: Can't link from %s to %s: %s\n"
-msgstr "%s: %s¸¦ %s·Î ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù: %s\n"
+msgstr "%s: %s¸¦ %s·Î ¸µÅ©ÇÒ ¼ö ¾ø½À´Ï´Ù: %s\n"
 
-#: time/zic.c:783
+#: time/zic.c:780
 #, c-format
 msgid "%s: Can't open %s: %s\n"
 msgstr "%s: %s¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù: %s\n"
 
-#: time/zic.c:851
+#: time/zic.c:1433
+#, c-format
+msgid "%s: Can't remove %s: %s\n"
+msgstr "%s: %s¸¦ Áö¿ï ¼ö ¾ø½À´Ï´Ù: %s\n"
+
+#: time/zic.c:849
 #, c-format
 msgid "%s: Error closing %s: %s\n"
 msgstr "%s: %s¸¦ ´Ý´Â µµÁß ¿À·ù ¹ß»ý: %s\n"
 
-#: time/zic.c:845
+#: time/zic.c:842
 #, c-format
 msgid "%s: Error reading %s\n"
 msgstr "%s: %s¸¦ Àд µµÁß ¿À·ù ¹ß»ý\n"
 
-#: time/zic.c:1494
+#: time/zic.c:1507
 #, c-format
 msgid "%s: Error writing %s\n"
 msgstr "%s: %s¸¦ ¾²´Â µµÁß ¿À·ù ¹ß»ý\n"
 
-#: time/zdump.c:258
+#: time/zdump.c:266
 #, c-format
 msgid "%s: Error writing standard output "
 msgstr "%s: Ç¥ÁØ Ãâ·Â¿¡ ¾²´Â µµÁß ¿À·ù ¹ß»ý "
 
-#: time/zic.c:830
+#: time/zic.c:827
 #, c-format
 msgid "%s: Leap line in non leap seconds file %s\n"
 msgstr ""
 
-#: time/zic.c:362
+#: time/zic.c:357
 #, c-format
 msgid "%s: Memory exhausted: %s\n"
 msgstr "%s: ¸Þ¸ð¸®°¡ ¹Ù´Ú³²: %s\n"
 
-#: time/zic.c:527
+#: time/zic.c:522
 #, c-format
 msgid "%s: More than one -L option specified\n"
 msgstr "%s: Çϳª ÀÌ»óÀÇ -L ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ½\n"
 
-#: time/zic.c:487
+#: time/zic.c:482
 #, c-format
 msgid "%s: More than one -d option specified\n"
 msgstr "%s: Çϳª ÀÌ»óÀÇ -d ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ½\n"
 
-#: time/zic.c:497
+#: time/zic.c:492
 #, c-format
 msgid "%s: More than one -l option specified\n"
 msgstr "%s: Çϳª ÀÌ»óÀÇ -l ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ½\n"
 
-#: time/zic.c:507
+#: time/zic.c:502
 #, c-format
 msgid "%s: More than one -p option specified\n"
 msgstr "%s: Çϳª ÀÌ»óÀÇ -p ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ½\n"
 
-#: time/zic.c:517
+#: time/zic.c:512
 #, c-format
 msgid "%s: More than one -y option specified\n"
 msgstr "%s: Çϳª ÀÌ»óÀÇ -y ¿É¼ÇÀÌ ÁöÁ¤µÇ¾úÀ½\n"
 
-#: time/zic.c:1845
+#: time/zic.c:1872
 #, c-format
 msgid "%s: command was '%s', result was %d\n"
 msgstr "%s: ¸í·ÉÀº '%s'¿´°í, °á°ú´Â %d¿´½À´Ï´Ù\n"
 
-#: locale/programs/charmap.c:593 locale/programs/locfile.c:878
+#: locale/programs/charmap.c:593 locale/programs/locfile.c:900
 #, c-format
 msgid "%s: error in state machine"
-msgstr "%s: ½ºÅ×ÀÌÆ® ±â°è¿¡ ¿À·ù ¹ß»ý"
+msgstr "%s: »óÅ ±â°è¿¡ ¿À·ù ¹ß»ý"
 
-#: posix/getopt.c:687
+#: posix/getopt.c:783
 #, c-format
 msgid "%s: illegal option -- %c\n"
 msgstr "%s: À߸øµÈ ¿É¼Ç -- %c\n"
 
-#: posix/getopt.c:690
+#: posix/getopt.c:786
 #, c-format
 msgid "%s: invalid option -- %c\n"
 msgstr "%s: ºÎÀûÀýÇÑ ¿É¼Ç -- %c\n"
 
-#: posix/getopt.c:611
+#: posix/getopt.c:707
 #, c-format
 msgid "%s: option `%c%s' doesn't allow an argument\n"
 msgstr "%s: `%c%s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n"
 
-#: posix/getopt.c:582
+#: posix/getopt.c:678
 #, c-format
 msgid "%s: option `%s' is ambiguous\n"
 msgstr "%s: `%s'´Â ¸ðÈ£ÇÑ ¿É¼ÇÀÔ´Ï´Ù\n"
 
-#: posix/getopt.c:628 posix/getopt.c:801
+#: posix/getopt.c:724 posix/getopt.c:897
 #, c-format
 msgid "%s: option `%s' requires an argument\n"
 msgstr "%s: `%s' ¿É¼ÇÀº Àμö°¡ ÇÊ¿äÇÕ´Ï´Ù\n"
 
-#: posix/getopt.c:606
+#: posix/getopt.c:702
 #, c-format
 msgid "%s: option `--%s' doesn't allow an argument\n"
 msgstr "%s: `--%s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n"
 
-#: posix/getopt.c:786
+#: posix/getopt.c:881
 #, c-format
 msgid "%s: option `-W %s' doesn't allow an argument\n"
 msgstr "%s: `-W %s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n"
 
-#: posix/getopt.c:767
+#: posix/getopt.c:863
 #, c-format
 msgid "%s: option `-W %s' is ambiguous\n"
 msgstr "%s: `-W %s'´Â ¸ðÈ£ÇÑ ¿É¼ÇÀÔ´Ï´Ù\n"
 
-#: posix/getopt.c:721 posix/getopt.c:850
+#: posix/getopt.c:816 posix/getopt.c:946
 #, c-format
 msgid "%s: option requires an argument -- %c\n"
 msgstr "%s: ÀÌ ¿É¼ÇÀº Àμö°¡ ÇÊ¿äÇÕ´Ï´Ù -- %c\n"
 
-#: time/zic.c:837 time/zic.c:1248 time/zic.c:1268
+#: time/zic.c:834 time/zic.c:1246 time/zic.c:1266
 #, c-format
 msgid "%s: panic: Invalid l_value %d\n"
 msgstr "%s: panic: ºÎÀûÀýÇÑ ÁÂÇ×°ª %d\n"
@@ -227,17 +232,17 @@ msgstr "%s: panic: ºÎÀûÀýÇÑ ÁÂÇ×°ª %d\n"
 msgid "%s: premature end of file"
 msgstr "%s: ÆÄÀÏÀÌ ¿Ï°áµÇÁö ¾ÊÀº ä ³¡³²"
 
-#: posix/getopt.c:661
+#: posix/getopt.c:757
 #, c-format
 msgid "%s: unrecognized option `%c%s'\n"
 msgstr "%s: ÀνÄÇÒ ¼ö ¾ø´Â ¿É¼Ç `%c%s'\n"
 
-#: posix/getopt.c:657
+#: posix/getopt.c:753
 #, c-format
 msgid "%s: unrecognized option `--%s'\n"
 msgstr "%s: ÀνÄÇÒ ¼ö ¾ø´Â ¿É¼Ç `--%s'\n"
 
-#: time/zic.c:446
+#: time/zic.c:441
 #, c-format
 msgid ""
 "%s: usage is %s [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] [ -d "
@@ -246,12 +251,12 @@ msgid ""
 msgstr ""
 "%s: »ç¿ë¹ýÀº %s [ -s ] [ -v ] [ -l Áö¿ª½Ã°¢ ] [ -p Æ÷½Ä½º±ÔÄ¢ ] [ -d "
 "µð·ºÅ丮 ]\n"
-"\t[ -L À±ÃÊ ] [ -y yearistype ] [ ÆÄÀÏÀ̸§ ... ]\n"
+"\t[ -L À±ÃÊ ] [ -y  ¿¬µµÀÇÇüÅ ] [ ÆÄÀÏÀ̸§ ... ] ÀÔ´Ï´Ù\n"
 
-#: time/zdump.c:165
+#: time/zdump.c:174
 #, c-format
 msgid "%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"
-msgstr "%s: »ç¿ë¹ýÀº %s [ -v ] [ -c cutoff ] Áö¿ª¸í ... ÀÔ´Ï´Ù\n"
+msgstr "%s: »ç¿ë¹ýÀº %s [ -v ] [ -c Àý´Ü ] Áö¿ª¸í ... ÀÔ´Ï´Ù\n"
 
 #: sunrpc/clnt_perr.c:125
 #, c-format
@@ -262,7 +267,7 @@ msgstr "(¾Ë ¼ö ¾ø´Â ÀÎÁõ ¿À·ù - %d)"
 msgid "(unknown)"
 msgstr "(¾Ë ¼ö ¾øÀ½)"
 
-#: catgets/gencat.c:253
+#: catgets/gencat.c:254
 msgid "*standard input*"
 msgstr "*Ç¥ÁØ ÀÔ·Â*"
 
@@ -270,19 +275,19 @@ msgstr "*Ç¥ÁØ ÀÔ·Â*"
 msgid ".lib section in a.out corrupted"
 msgstr "a.outÀÇ .lib ÀýÀÌ ¼Õ»óµÇ¾úÀ½"
 
-#: inet/rcmd.c:358
+#: inet/rcmd.c:363
 msgid ".rhosts fstat failed"
 msgstr ".rhosts fstat ½ÇÆÐ"
 
-#: inet/rcmd.c:354
+#: inet/rcmd.c:359
 msgid ".rhosts lstat failed"
 msgstr ".rhosts lstat ½ÇÆÐ"
 
-#: inet/rcmd.c:356
+#: inet/rcmd.c:361
 msgid ".rhosts not regular file"
 msgstr ".rhosts´Â ÀÏ¹Ý ÆÄÀÏÀÌ ¾Æ´Ô"
 
-#: inet/rcmd.c:362
+#: inet/rcmd.c:367
 msgid ".rhosts writeable by other than owner"
 msgstr ".rhosts´Â ¼ÒÀ¯ÀÚ°¡ ¾Æ´Ñ »ç¶÷ÀÌ º¯°æÇÒ ¼ö ÀÖÀ½"
 
@@ -295,12 +300,12 @@ msgstr "; ³·Àº ¹öÀü = %lu, ³ôÀº ¹öÀü = %lu"
 msgid "; why = "
 msgstr "; ÀÌÀ¯ = "
 
-#: locale/programs/ld-ctype.c:326
+#: locale/programs/ld-ctype.c:331
 #, c-format
 msgid "<SP> character must not be in class `%s'"
 msgstr "<SP> ¹®ÀÚ´Â `%s' Ŭ·¡½º¿¡ ÀÖÀ¸¸é ¾ÈµË´Ï´Ù"
 
-#: locale/programs/ld-ctype.c:317
+#: locale/programs/ld-ctype.c:321
 #, c-format
 msgid "<SP> character not in class `%s'"
 msgstr "<SP> ¹®ÀÚ´Â `%s' Ŭ·¡½º¿¡ ¾øÀ½"
@@ -312,6 +317,10 @@ msgstr "<SP> ¹®ÀÚ´Â `%s' Ŭ·¡½º¿¡ ¾øÀ½"
 msgid "?"
 msgstr "?"
 
+#: sysdeps/unix/sysv/linux/siglist.h:27
+msgid "Aborted"
+msgstr "ÁßÁöµÊ"
+
 #: stdio-common/../sysdeps/gnu/errlist.c:762
 msgid "Accessing a corrupted shared library"
 msgstr "¼Õ»óµÈ °øÀ¯ ¶óÀ̺귯¸®¿¡ Á¢±ÙÇÔ"
@@ -331,6 +340,8 @@ msgstr "ÁÖ¼Ò±ºÀÌ ±Ô¾à¿¡¼­ Áö¿øµÇÁö ¾ÊÀ½"
 msgid "Advertise error"
 msgstr ""
 
+#: stdio-common/../sysdeps/unix/siglist.c:43
+#: sysdeps/unix/sysv/linux/siglist.h:33
 msgid "Alarm clock"
 msgstr "ÀÚ¸íÁ¾ ½Ã°è"
 
@@ -348,7 +359,7 @@ msgstr ""
 
 #: sunrpc/clnt_perr.c:276
 msgid "Authentication OK"
-msgstr "ÀÎÁõ ½ÂÀεÊ"
+msgstr "ÀÎÁõ ¼º°ø"
 
 #. TRANS ???
 #: stdio-common/../sysdeps/gnu/errlist.c:549
@@ -376,14 +387,19 @@ msgstr "À߸øµÈ ÆùÆ® ÆÄÀÏ Çü½Ä"
 msgid "Bad message"
 msgstr "À߸øµÈ ¸Þ½ÃÁö"
 
+#: stdio-common/../sysdeps/unix/siglist.c:41
+#: sysdeps/unix/sysv/linux/siglist.h:56
+msgid "Bad system call"
+msgstr "À߸øµÈ ½Ã½ºÅÛ È£Ãâ"
+
 #. TRANS A file that isn't a block special file was given in a situation that
 #. TRANS requires one.  For example, trying to mount an ordinary file as a file
 #. TRANS system in Unix gives this error.
 #: stdio-common/../sysdeps/gnu/errlist.c:109
 msgid "Block device required"
-msgstr "ºí·Ï ÀåÄ¡°¡ ÇÊ¿äÇÔ"
+msgstr "ºí·° ÀåÄ¡°¡ ÇÊ¿äÇÔ"
 
-#: sunrpc/pmap_rmt.c:337
+#: sunrpc/pmap_rmt.c:338
 msgid "Broadcast select problem"
 msgstr "ºê·Îµåij½ºÆ® ¼±Åà ¹®Á¦"
 
@@ -393,12 +409,17 @@ msgstr "ºê·Îµåij½ºÆ® ¼±Åà ¹®Á¦"
 #. TRANS or blocked.  Thus, your program will never actually see @code{EPIPE}
 #. TRANS unless it has handled or blocked @code{SIGPIPE}.
 #: stdio-common/../sysdeps/gnu/errlist.c:222
+#: stdio-common/../sysdeps/unix/siglist.c:42
+#: sysdeps/unix/sysv/linux/siglist.h:32
 msgid "Broken pipe"
-msgstr "±ú¾îÁø ÆÄÀÌÇÁ"
+msgstr "ÆÄÀÌÇÁ°¡ ±ú¾îÁü"
 
+#: stdio-common/../sysdeps/unix/siglist.c:39
+#: sysdeps/unix/sysv/linux/siglist.h:30
 msgid "Bus error"
 msgstr "¹ö½º ¿À·ù"
 
+#: sysdeps/unix/sysv/linux/siglist.h:43
 msgid "CPU time limit exceeded"
 msgstr "CPU ½Ã°£ Á¦ÇÑ ÃÊ°úÇÔ"
 
@@ -406,19 +427,19 @@ msgstr "CPU ½Ã°£ Á¦ÇÑ ÃÊ°úÇÔ"
 msgid "Can not access a needed shared library"
 msgstr "ÇÊ¿äÇÑ °øÀ¯ ¶óÀ̺귯¸®¿¡ Á¢±ÙÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: nis/ypclnt.c:637
+#: nis/ypclnt.c:695
 msgid "Can't bind to server which serves this domain"
 msgstr "ÀÌ µµ¸ÞÀÎÀ» Á¦°øÇÏ´Â ¼­¹ö¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: nis/ypclnt.c:649
+#: nis/ypclnt.c:707
 msgid "Can't communicate with portmapper"
 msgstr "rpcinfo: Æ÷Æ®¸ÅÆÛ¿Í Åë½ÅÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: nis/ypclnt.c:651
+#: nis/ypclnt.c:709
 msgid "Can't communicate with ypbind"
 msgstr "ypbind¿Í Åë½ÅÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: nis/ypclnt.c:653
+#: nis/ypclnt.c:711
 msgid "Can't communicate with ypserv"
 msgstr "ypserv¿Í Åë½ÅÇÒ ¼ö ¾ø½À´Ï´Ù"
 
@@ -443,7 +464,7 @@ msgstr "ºê·Îµåij½ºÆ® rpc¸¦ À§ÇÑ ¼ÒÄÏÀ» ¸¸µé ¼ö ¾ø½À´Ï´Ù"
 msgid "Cannot exec a shared library directly"
 msgstr "°øÀ¯ ¶óÀ̺귯¸®¸¦ Á÷Á¢ ½ÇÇàÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: sunrpc/pmap_rmt.c:349
+#: sunrpc/pmap_rmt.c:350
 msgid "Cannot receive reply to broadcast"
 msgstr "ºê·Îµåij½ºÆ®¿¡ ´ëÇÑ ÀÀ´äÀ» ¹ÞÀ» ¼ö ¾ø½À´Ï´Ù"
 
@@ -468,6 +489,8 @@ msgstr "¼ÒÄÏ ¿É¼Ç SO_BROADCAST¸¦ ¼³Á¤ÇÒ ¼ö ¾ø½À´Ï´Ù"
 msgid "Channel number out of range"
 msgstr "¹üÀ§¸¦ ¹þ¾î³­ ä³Î ¹øÈ£"
 
+#: stdio-common/../sysdeps/unix/siglist.c:49
+#: sysdeps/unix/sysv/linux/siglist.h:39
 msgid "Child exited"
 msgstr "ÀÚ½ÄÀÌ Á¾·áµÊ"
 
@@ -484,11 +507,11 @@ msgstr "Àü¼Û Áß Åë½Å ¿À·ù"
 msgid "Computer bought the farm"
 msgstr "ÄÄÇ»ÅÍ°¡ ³óÀåÀ» »ò½À´Ï´Ù"
 
-#: locale/programs/ld-ctype.c:1197
+#: locale/programs/ld-ctype.c:1204
 msgid "Computing table size for character classes might take a while..."
 msgstr "¹®ÀÚ Å¬·¡½ºÀÇ Ç¥ Å©±â °è»êÀº ½Ã°£ÀÌ ¾à°£ °É¸± ¼ö ÀÖ½À´Ï´Ù..."
 
-#: locale/programs/ld-collate.c:327
+#: locale/programs/ld-collate.c:329
 msgid "Computing table size for collation information might take a while..."
 msgstr "Á¶»ç Á¤º¸ÀÇ Ç¥ Å©±â °è»êÀº ½Ã°£ÀÌ ¾à°£ °É¸± ¼ö ÀÖ½À´Ï´Ù... "
 
@@ -511,11 +534,13 @@ msgstr ""
 msgid "Connection timed out"
 msgstr "¿¬°á ½Ã°£ ÃÊ°ú"
 
+#: stdio-common/../sysdeps/unix/siglist.c:48
+#: sysdeps/unix/sysv/linux/siglist.h:38
 msgid "Continued"
 msgstr "°è¼ÓµÊ"
 
 #: catgets/gencat.c:169 db/makedb.c:120 locale/programs/locale.c:187
-#: locale/programs/localedef.c:177
+#: locale/programs/localedef.c:180
 #, c-format
 msgid ""
 "Copyright (C) %s Free Software Foundation, Inc.\n"
@@ -523,7 +548,12 @@ msgid ""
 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
 msgstr ""
 
-#: nis/ypclnt.c:663
+#: stdio-common/../sysdeps/unix/siglist.c:53
+#, fuzzy
+msgid "Cputime limit exceeded"
+msgstr "CPU ½Ã°£ Á¦ÇÑ ÃÊ°úÇÔ"
+
+#: nis/ypclnt.c:721
 msgid "Database is busy"
 msgstr "µ¥ÀÌÅͺ£À̽º°¡ ÀÛ¾÷ ÁßÀÔ´Ï´Ù"
 
@@ -565,10 +595,15 @@ msgstr "µð·ºÅ丮°¡ ºñ¾îÀÖÁö ¾ÊÀ½"
 msgid "Disc quota exceeded"
 msgstr "µð½ºÅ© ÇÒ´ç·®ÀÌ ÃÊ°úµÊ"
 
-#: nis/ypclnt.c:709
+#: nis/ypclnt.c:767
 msgid "Domain not bound"
 msgstr "µµ¸ÞÀÎÀÌ ¹Ù¿îµåµÇÁö ¾ÊÀ½"
 
+#: stdio-common/../sysdeps/unix/siglist.c:36
+#: sysdeps/unix/sysv/linux/siglist.h:53
+msgid "EMT trap"
+msgstr "EMT Æ®·¦"
+
 #: sunrpc/clnt_perr.c:254
 #, c-format
 msgid "Error %d"
@@ -592,7 +627,7 @@ msgstr "±³È¯ÀÌ °¡µæÂü"
 msgid "Exec format error"
 msgstr "Exec Çü½Ä ¿À·ù"
 
-#: locale/programs/localedef.c:213
+#: locale/programs/localedef.c:216
 msgid "FATAL: system does not define `_POSIX2_LOCALEDEF'"
 msgstr "Áß¿ä: ½Ã½ºÅÛ¿¡ `_POSIX2_LOCALEDEF'°¡ Á¤ÀǵǾî ÀÖÁö ¾Ê½À´Ï´Ù"
 
@@ -612,7 +647,7 @@ msgstr "ÆÄÀÏÀÌ Á¸ÀçÇÕ´Ï´Ù"
 
 #: stdio-common/../sysdeps/gnu/errlist.c:714
 msgid "File locking deadlock error"
-msgstr ""
+msgstr "ÆÄÀÏ Àá±Ý ±³Âø»óÅ ¿À·ù"
 
 #. TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for
 #. TRANS Files}) or host name too long (in @code{gethostname} or
@@ -621,6 +656,7 @@ msgstr ""
 msgid "File name too long"
 msgstr "ÆÄÀÏ À̸§ÀÌ ³Ê¹« ±é´Ï´Ù"
 
+#: sysdeps/unix/sysv/linux/siglist.h:44
 msgid "File size limit exceeded"
 msgstr "ÆÄÀÏ Å©±â Á¦ÇÑÀ» ÃÊ°úÇÔ"
 
@@ -629,6 +665,12 @@ msgstr "ÆÄÀÏ Å©±â Á¦ÇÑÀ» ÃÊ°úÇÔ"
 msgid "File too large"
 msgstr "ÆÄÀÏÀÌ ³Ê¹« Å®´Ï´Ù"
 
+#: stdio-common/../sysdeps/unix/siglist.c:54
+msgid "Filesize limit exceeded"
+msgstr "ÆÄÀÏÅ©±â Á¦ÇÑÀ» ÃÊ°úÇÔ"
+
+#: stdio-common/../sysdeps/unix/siglist.c:37
+#: sysdeps/unix/sysv/linux/siglist.h:28
 msgid "Floating point exception"
 msgstr "ºÎµ¿ ¼Ò¼öÁ¡ ¿¹¿Ü"
 
@@ -644,6 +686,8 @@ msgstr "ÇÔ¼ö°¡ ±¸ÇöµÇÁö ¾Ê¾ÒÀ½"
 msgid "Gratuitous error"
 msgstr "ÀÌÀ¯¾ø´Â ¿À·ù"
 
+#: stdio-common/../sysdeps/unix/siglist.c:30
+#: sysdeps/unix/sysv/linux/siglist.h:22
 msgid "Hangup"
 msgstr "²÷¾îÁü"
 
@@ -656,9 +700,12 @@ msgstr "È£½ºÆ®°¡ Á×¾ú½À´Ï´Ù"
 msgid "Host name lookup failure"
 msgstr "È£½ºÆ® À̸§ Ž»ö ½ÇÆÐ"
 
+#: stdio-common/../sysdeps/unix/siglist.c:52
+#: sysdeps/unix/sysv/linux/siglist.h:42
 msgid "I/O possible"
 msgstr "ÀÔÃâ·Â °¡´É"
 
+#: stdio-common/../sysdeps/unix/siglist.c:35
 msgid "IOT trap"
 msgstr "IOT Æ®·¦"
 
@@ -666,9 +713,15 @@ msgstr "IOT Æ®·¦"
 msgid "Identifier removed"
 msgstr "½Äº°ÀÚ Á¦°ÅµÊ"
 
+#: sysdeps/unix/sysv/linux/siglist.h:25
 msgid "Illegal Instruction"
 msgstr "À߸øµÈ ¸í·É¾î"
 
+#: stdio-common/../sysdeps/unix/siglist.c:33
+#, fuzzy
+msgid "Illegal instruction"
+msgstr "À߸øµÈ ¸í·É¾î"
+
 #. TRANS Invalid seek operation (such as on a pipe).
 #: stdio-common/../sysdeps/gnu/errlist.c:201
 msgid "Illegal seek"
@@ -699,23 +752,29 @@ msgstr "ÀåÄ¡¿¡ ´ëÇØ ºÎÀûÀýÇÑ ioctl"
 msgid "Inappropriate operation for background process"
 msgstr "¹è°æ ÇÁ·Î¼¼½º·Î ºÎÀûÇÕÇÑ µ¿ÀÛ"
 
+#: sysdeps/unix/sysv/linux/siglist.h:62
+msgid "Information request"
+msgstr "Á¤º¸ ¿äû"
+
 #. TRANS Input/output error; usually used for physical read or write errors.
 #: stdio-common/../sysdeps/gnu/errlist.c:40
 msgid "Input/output error"
 msgstr "ÀÔ·Â/Ãâ·Â ¿À·ù"
 
-#: nis/ypclnt.c:643
+#: nis/ypclnt.c:701
 msgid "Internal NIS error"
 msgstr "³»ºÎ NIS ¿À·ù"
 
-#: nis/ypclnt.c:707
+#: nis/ypclnt.c:765
 msgid "Internal ypbind error"
 msgstr "³»ºÎ ypbind ¿À·ù"
 
+#: stdio-common/../sysdeps/unix/siglist.c:31
+#: sysdeps/unix/sysv/linux/siglist.h:23
 msgid "Interrupt"
 msgstr "ÀÎÅÍ·´Æ®"
 
-#. TRANS Interrupted function call; an asynchronous signal occured and prevented
+#. TRANS Interrupted function call; an asynchronous signal occurred and prevented
 #. TRANS completion of the call.  When this happens, you should try the call
 #. TRANS again.
 #. TRANS
@@ -736,11 +795,11 @@ msgstr "Áß´ÜµÈ ½Ã½ºÅÛ È£ÃâÀº Àç½ÃÀ۵Ǿî¾ß ÇÕ´Ï´Ù"
 msgid "Invalid argument"
 msgstr "ºÎÀûÀýÇÑ Àμö"
 
-#: posix/regex.c:946
+#: posix/regex.c:960
 msgid "Invalid back reference"
 msgstr "ºÎÀûÀýÇÑ ÈĹæ ÂüÁ¶"
 
-#: posix/regex.c:944
+#: posix/regex.c:958
 msgid "Invalid character class name"
 msgstr "ºÎÀûÀýÇÑ ¹®ÀÚ Å¬·¡½º À̸§"
 
@@ -752,11 +811,11 @@ msgstr "ºÎÀûÀýÇÑ Å¬¶óÀ̾ðÆ® ÀÚ°Ý ºÎ¿©"
 msgid "Invalid client verifier"
 msgstr "ºÎÀûÀýÇÑ Å¬¶óÀ̾ðÆ® °ËÁõ±â"
 
-#: posix/regex.c:943
+#: posix/regex.c:957
 msgid "Invalid collation character"
 msgstr "ºÎÀûÀýÇÑ ´ëÁ¶ ¹®ÀÚ"
 
-#: posix/regex.c:950
+#: posix/regex.c:964
 msgid "Invalid content of \\{\\}"
 msgstr "\\{\\}¿¡ ºÎÀûÀýÇÑ ³»¿ë¹°ÀÌ ÀÖÀ½"
 
@@ -765,7 +824,7 @@ msgstr "\\{\\}¿¡ ºÎÀûÀýÇÑ ³»¿ë¹°ÀÌ ÀÖÀ½"
 #. TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}).
 #: stdio-common/../sysdeps/gnu/errlist.c:129
 msgid "Invalid cross-device link"
-msgstr "ÀåÄ¡°£ ¿¬°áÀÌ ºÎÀûÀýÇÔ"
+msgstr "ºÎÀûÀýÇÑ ÀåÄ¡°£ ¿¬°á"
 
 #: stdio-common/../sysdeps/gnu/errlist.c:690
 msgid "Invalid exchange"
@@ -777,15 +836,15 @@ msgstr "ºÎÀûÀýÇÑ ±³È¯"
 msgid "Invalid or incomplete multibyte or wide character"
 msgstr "ºÎÀûÀýÇϰųª ºÒ¿ÏÀüÇÑ ´ÙÁß¹ÙÀÌÆ® ¶Ç´Â ±¤¿ª ¹®ÀÚ"
 
-#: posix/regex.c:953
+#: posix/regex.c:967
 msgid "Invalid preceding regular expression"
 msgstr "¾Õ¼± Á¤±Ô½ÄÀÌ ºÎÀûÀýÇÔ"
 
-#: posix/regex.c:951
+#: posix/regex.c:965
 msgid "Invalid range end"
 msgstr "ºÎÀûÀýÇÑ ¹üÀ§ ³¡"
 
-#: posix/regex.c:942
+#: posix/regex.c:956
 msgid "Invalid regular expression"
 msgstr "ºÎÀûÀýÇÑ Á¤±Ô½Ä"
 
@@ -815,6 +874,8 @@ msgstr "µð·ºÅ丮ÀÔ´Ï´Ù"
 msgid "Is a named type file"
 msgstr ""
 
+#: stdio-common/../sysdeps/unix/siglist.c:38
+#: sysdeps/unix/sysv/linux/siglist.h:29
 msgid "Killed"
 msgstr "Á×¾úÀ½"
 
@@ -836,25 +897,25 @@ msgstr "µî±Þ 3 ¸®¼Â"
 
 #: stdio-common/../sysdeps/gnu/errlist.c:626
 msgid "Link has been severed"
-msgstr ""
+msgstr "¸µÅ©°¡ ¼Õ»óµÇ¾ú½À´Ï´Ù"
 
 #: stdio-common/../sysdeps/gnu/errlist.c:674
 msgid "Link number out of range"
 msgstr "¹üÀ§¸¦ ¹þ¾î³­ ¸µÅ© ¹øÈ£"
 
-#: nis/ypclnt.c:655
+#: nis/ypclnt.c:713
 msgid "Local domain name not set"
 msgstr "Áö¿ª µµ¸ÞÀθíÀÌ ¼³Á¤µÇÁö ¾Ê¾ÒÀ½"
 
-#: nis/ypclnt.c:645
+#: nis/ypclnt.c:703
 msgid "Local resource allocation failure"
 msgstr "Áö¿ª ÀÚ¿ø ÇÒ´ç ½ÇÆÐ"
 
 #: stdio-common/../sysdeps/gnu/errlist.c:722
 msgid "Machine is not on the network"
-msgstr "±â±â°¡ ³×Æ®¿öÅ© »ó¿¡ ÀÖÁö ¾Ê½À´Ï´Ù"
+msgstr "±â°è°¡ ³×Æ®¿öÅ© »ó¿¡ ÀÖÁö ¾Ê½À´Ï´Ù"
 
-#: posix/regex.c:952
+#: posix/regex.c:966
 msgid "Memory exhausted"
 msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²"
 
@@ -868,11 +929,11 @@ msgstr "¸Þ½ÃÁö°¡ ³Ê¹« ±é´Ï´Ù"
 msgid "Multihop attempted"
 msgstr ""
 
-#: nis/ypclnt.c:659
+#: nis/ypclnt.c:717
 msgid "NIS client/server version mismatch - can't supply service"
 msgstr "NIS Ŭ¶óÀ̾ðÆ®/¼­¹ö ¹öÀü ºÒÀÏÄ¡ - ¼­ºñ½º¸¦ Á¦°øÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: nis/ypclnt.c:657
+#: nis/ypclnt.c:715
 msgid "NIS map data base is bad"
 msgstr "NIS Áöµµ µ¥ÀÌÅͺ£À̽º°¡ À߸øµÇ¾ú½À´Ï´Ù"
 
@@ -943,7 +1004,7 @@ msgstr "»ç¿ë °¡´ÉÇÑ ÀÚ·á°¡ ¾øÀ½"
 msgid "No locks available"
 msgstr "»ç¿ë°¡´ÉÇÑ Àá±ÝÀåÄ¡°¡ ¾øÀ½"
 
-#: posix/regex.c:941
+#: posix/regex.c:955
 msgid "No match"
 msgstr "¸Â´Â ¦ ¾øÀ½"
 
@@ -951,13 +1012,13 @@ msgstr "¸Â´Â ¦ ¾øÀ½"
 msgid "No message of desired type"
 msgstr "Àû´çÇÑ ÇüÀ» °¡Áø ¸Þ½ÃÁö°¡ ¾øÀ½"
 
-#: nis/ypclnt.c:647
+#: nis/ypclnt.c:705
 msgid "No more records in map database"
 msgstr "Áöµµ µ¥ÀÌÅͺ£À̽º¿¡ ´õ ÀÌ»óÀÇ ±â·ÏÀÌ ¾øÀ½"
 
-#: posix/regex.c:5204
+#: posix/regex.c:5324
 msgid "No previous regular expression"
-msgstr "ÀüÀÇ Á¤±Ô½ÄÀÌ ¾øÀ½"
+msgstr "ÀÌÀüÀÇ Á¤±Ô½ÄÀÌ ¾øÀ½"
 
 #: sunrpc/rpcinfo.c:515
 msgid "No remote programs registered.\n"
@@ -981,11 +1042,11 @@ msgstr "ÀåÄ¡¿¡ ³²Àº °ø°£ÀÌ ¾øÀ½"
 msgid "No such file or directory"
 msgstr "±×·± ÆÄÀÏÀ̳ª µð·ºÅ丮°¡ ¾øÀ½"
 
-#: nis/ypclnt.c:641
+#: nis/ypclnt.c:699
 msgid "No such key in map"
 msgstr "Áöµµ¿¡ ±×·± Å°°¡ ¾øÀ½"
 
-#: nis/ypclnt.c:639
+#: nis/ypclnt.c:697
 msgid "No such map in server's domain"
 msgstr "¼­¹öÀÇ µµ¸ÞÀο¡ ±×·± Áöµµ°¡ ¾øÀ½"
 
@@ -1023,7 +1084,7 @@ msgstr "¹üÀ§¸¦ ¹þ¾î³­ ¼öÄ¡ °á°ú"
 msgid "Object is remote"
 msgstr "¿ø°Ý °³Ã¼ÀÔ´Ï´Ù"
 
-#: time/zic.c:1939
+#: time/zic.c:1966
 msgid "Odd number of quotation marks"
 msgstr "µû¿ÈÇ¥°¡ Ȧ¼ö °³ÀÔ´Ï´Ù"
 
@@ -1085,17 +1146,20 @@ msgid "Package not installed"
 msgstr "ÆÐÅ°Áö°¡ ¼³Ä¡µÇÁö ¾ÊÀ½"
 
 #. TRANS Permission denied; the file permissions do not allow the attempted operation.
-#: nis/ypclnt.c:661 stdio-common/../sysdeps/gnu/errlist.c:96
+#: nis/ypclnt.c:719 stdio-common/../sysdeps/gnu/errlist.c:96
 msgid "Permission denied"
 msgstr "Çã°¡ °ÅºÎµÊ"
 
+#: sysdeps/unix/sysv/linux/siglist.h:64
 msgid "Power failure"
 msgstr "Àü·ÂÀÌ ²÷¾îÁü"
 
-#: posix/regex.c:954
+#: posix/regex.c:968
 msgid "Premature end of regular expression"
 msgstr "Á¤±Ô½ÄÀÌ ¿Ï°áµÇÁö ¾ÊÀº ä ³¡³²"
 
+#: stdio-common/../sysdeps/unix/siglist.c:56
+#: sysdeps/unix/sysv/linux/siglist.h:46
 msgid "Profiling timer expired"
 msgstr "ÇÁ·ÎÆÄÀϸµ ŸÀ̸ÓÀÇ ½Ã°£ÀÌ ÃÊ°úµÊ"
 
@@ -1130,6 +1194,8 @@ msgstr "±Ô¾àÀÌ Áö¿øµÇÁö ¾ÊÀ½"
 msgid "Protocol wrong type for socket"
 msgstr "¼ÒÄÏ¿¡ ´ëÇÑ ±Ô¾àÀÌ À߸øµÊ"
 
+#: stdio-common/../sysdeps/unix/siglist.c:32
+#: sysdeps/unix/sysv/linux/siglist.h:24
 msgid "Quit"
 msgstr "Á¾·á"
 
@@ -1142,9 +1208,9 @@ msgstr "RFS¿¡ ±¹ÇÑµÈ ¿À·ù"
 msgid "RPC bad procedure for program"
 msgstr "RPC ÇÁ·Î±×·¥ÀÇ ÇÁ·Î½ÃÁ®°¡ À߸øµÊ"
 
-#: nis/ypclnt.c:635
+#: nis/ypclnt.c:693
 msgid "RPC failure on NIS operation"
-msgstr ""
+msgstr "NIS ¿¬»ê Áß RPC ½ÇÆÐÇÔ"
 
 #. TRANS ???
 #: stdio-common/../sysdeps/gnu/errlist.c:517
@@ -1176,7 +1242,7 @@ msgstr "RPC: ÀÎÁõ ¿À·ù"
 
 #: sunrpc/clnt_perr.c:169
 msgid "RPC: Can't decode result"
-msgstr "RPC: °á°ú¸¦ º¹È£È­ÇÒ ¼ö ¾ø½À´Ï´Ù"
+msgstr "RPC: °á°ú¸¦ Çص¶ÇÒ ¼ö ¾ø½À´Ï´Ù"
 
 #: sunrpc/clnt_perr.c:167
 msgid "RPC: Can't encode arguments"
@@ -1216,7 +1282,7 @@ msgstr "RPC: ¿ø°Ý ½Ã½ºÅÛ ¿À·ù"
 
 #: sunrpc/clnt_perr.c:187
 msgid "RPC: Server can't decode arguments"
-msgstr "RPC: ¼­¹ö°¡ Àμö¸¦ º¹È£È­ÇÒ ¼ö ¾ø½À´Ï´Ù"
+msgstr "RPC: ¼­¹ö°¡ Àμö¸¦ Çص¶ÇÒ ¼ö ¾ø½À´Ï´Ù"
 
 #: sunrpc/clnt_perr.c:165
 msgid "RPC: Success"
@@ -1251,7 +1317,7 @@ msgstr "µ¿ÀûÀ¸·Î ÀûÀçµÇÁö ¾ÊÀº Äڵ忡 RTLD_NEXT°¡ »ç¿ëµÊ"
 msgid "Read-only file system"
 msgstr "ÀбâÀü¿ë ÆÄÀÏ ½Ã½ºÅÛ"
 
-#: posix/regex.c:955
+#: posix/regex.c:969
 msgid "Regular expression too big"
 msgstr "Á¤±Ô½ÄÀÌ ³Ê¹« Å®´Ï´Ù"
 
@@ -1268,13 +1334,14 @@ msgid "Remove password or make file unreadable by others."
 msgstr "¾ÏÈ£¸¦ Áö¿ì°Å³ª ´Ù¸¥ »ç¶÷ÀÌ ÀÐÀ» ¼ö ¾ø´Â ÆÄÀÏÀ» ¸¸µì´Ï´Ù."
 
 #: catgets/gencat.c:224 db/makedb.c:227 locale/programs/locale.c:257
-#: locale/programs/localedef.c:408
-msgid "Report bugs to <bug-glibc@prep.ai.mit.edu>.\n"
+#: locale/programs/localedef.c:412
+#, fuzzy
+msgid "Report bugs using the `glibcbug' script to <bugs@gnu.ai.mit.edu>.\n"
 msgstr "¹ö±×´Â <bug-glibc@prep.ai.mit.edu>¿¡ º¸°íÇϽʽÿÀ.\n"
 
-#: nis/ypclnt.c:633
+#: nis/ypclnt.c:691
 msgid "Request arguments bad"
-msgstr ""
+msgstr "¿äûµÈ Àμö°¡ À߸øµÊ"
 
 #: resolv/herror.c:73
 msgid "Resolver Error 0 (no error)"
@@ -1290,7 +1357,11 @@ msgstr "ÇØ°á±â ³»ºÎ ¿À·ù"
 #. TRANS noticed; it might just hang.  @xref{File Locks}, for an example.
 #: stdio-common/../sysdeps/gnu/errlist.c:85
 msgid "Resource deadlock avoided"
-msgstr ""
+msgstr "ÀÚ¿ø ±³Âø»óŸ¦ ÇÇÇß½À´Ï´Ù"
+
+#: stdio-common/../sysdeps/unix/siglist.c:58
+msgid "Resource lost"
+msgstr "ÀÚ¿øÀ» ¼Õ½ÇÇßÀ½"
 
 #. TRANS Resource temporarily unavailable; the call might work if you try again
 #. TRANS later.  The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN};
@@ -1325,6 +1396,8 @@ msgstr ""
 msgid "Resource temporarily unavailable"
 msgstr "ÀÚ¿øÀÌ ÀϽÃÀûÀ¸·Î »ç¿ë ºÒ°¡´ÉÇÔ"
 
+#: stdio-common/../sysdeps/unix/siglist.c:40
+#: sysdeps/unix/sysv/linux/siglist.h:31
 msgid "Segmentation fault"
 msgstr ""
 
@@ -1336,6 +1409,10 @@ msgstr "¼­¹ö°¡ ÀÚ°Ý ºÎ¿©¸¦ °ÅºÎÇß½À´Ï´Ù"
 msgid "Server rejected verifier"
 msgstr "¼­¹ö°¡ °ËÁõ±â¸¦ °ÅºÎÇß½À´Ï´Ù"
 
+#: stdio-common/../sysdeps/unix/siglist.c:29
+msgid "Signal 0"
+msgstr "½ÅÈ£ 0"
+
 #. TRANS A file that isn't a socket was specified when a socket is required.
 #: stdio-common/../sysdeps/gnu/errlist.c:299
 msgid "Socket operation on non-socket"
@@ -1355,6 +1432,10 @@ msgstr "¼ÒÇÁÆ®¿þ¾î°¡ ¿¬°á Áß´ÜÀ» ÃÊ·¡Çß½À´Ï´Ù"
 msgid "Srmount error"
 msgstr ""
 
+#: sysdeps/unix/sysv/linux/siglist.h:59
+msgid "Stack fault"
+msgstr "½ºÅà ¿À·ù"
+
 #. TRANS Stale NFS file handle.  This indicates an internal confusion in the NFS
 #. TRANS system which is due to file system rearrangements on the server host.
 #. TRANS Repairing this condition usually requires unmounting and remounting
@@ -1363,15 +1444,23 @@ msgstr ""
 msgid "Stale NFS file handle"
 msgstr "²÷¾îÁø NFS ÆÄÀÏ ÇÚµé"
 
+#: stdio-common/../sysdeps/unix/siglist.c:47
+#: sysdeps/unix/sysv/linux/siglist.h:37
 msgid "Stopped"
 msgstr "Á¤ÁöµÊ"
 
+#: stdio-common/../sysdeps/unix/siglist.c:46
+#: sysdeps/unix/sysv/linux/siglist.h:36
 msgid "Stopped (signal)"
 msgstr "Á¤ÁöµÊ (½ÅÈ£)"
 
+#: stdio-common/../sysdeps/unix/siglist.c:50
+#: sysdeps/unix/sysv/linux/siglist.h:40
 msgid "Stopped (tty input)"
 msgstr "Á¤ÁöµÊ (tty ÀÔ·Â)"
 
+#: stdio-common/../sysdeps/unix/siglist.c:51
+#: sysdeps/unix/sysv/linux/siglist.h:41
 msgid "Stopped (tty output)"
 msgstr "Á¤ÁöµÊ (tty Ãâ·Â)"
 
@@ -1383,15 +1472,17 @@ msgstr "½ºÆ®¸² ÆÄÀÌÇÁ ¿À·ù"
 msgid "Structure needs cleaning"
 msgstr "±¸Á¶¿¡ û¼Ò°¡ ÇÊ¿äÇÕ´Ï´Ù"
 
-#: nis/ypclnt.c:631 nis/ypclnt.c:705 posix/regex.c:940
+#: nis/ypclnt.c:689 nis/ypclnt.c:763 posix/regex.c:954
 #: stdio-common/../sysdeps/gnu/errlist.c:7
 msgid "Success"
 msgstr "¼º°ø"
 
-#: nis/ypclnt.c:711
+#: nis/ypclnt.c:769
 msgid "System resource allocation failure"
 msgstr "½Ã½ºÅÛ ÀÚ¿ø ÇÒ´ç ½ÇÆÐ"
 
+#: stdio-common/../sysdeps/unix/siglist.c:44
+#: sysdeps/unix/sysv/linux/siglist.h:34
 msgid "Terminated"
 msgstr "Á¾·áµÊ"
 
@@ -1457,10 +1548,15 @@ msgstr "ÂüÁ¶°¡ ³Ê¹« ¸¹À½: ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù"
 msgid "Too many users"
 msgstr "»ç¿ëÀÚ°¡ ³Ê¹« ¸¹À½"
 
+#: stdio-common/../sysdeps/unix/siglist.c:34
+msgid "Trace/BPT trap"
+msgstr ""
+
+#: sysdeps/unix/sysv/linux/siglist.h:26
 msgid "Trace/breakpoint trap"
 msgstr "ÃßÀû/Áß´ÜÁ¡ ÇÔÁ¤"
 
-#: posix/regex.c:945
+#: posix/regex.c:959
 msgid "Trailing backslash"
 msgstr "µû¶óºÙ´Â ¿ª½½·¡½¬"
 
@@ -1469,7 +1565,7 @@ msgstr "µû¶óºÙ´Â ¿ª½½·¡½¬"
 #. TRANS up, before it has connected to the file.
 #: stdio-common/../sysdeps/gnu/errlist.c:584
 msgid "Translator died"
-msgstr "¹ø¿ª±â°¡ Á×¾úÀ½"
+msgstr "º¯È¯±â°¡ Á×¾úÀ½"
 
 #. TRANS You tried to connect a socket that is already connected.
 #. TRANS @xref{Connecting}.
@@ -1486,12 +1582,12 @@ msgid "Transport endpoint is not connected"
 msgstr "Àü¼Û Á¾·áÁöÁ¡ÀÌ ¿¬°áµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù"
 
 #: catgets/gencat.c:208 db/makedb.c:209 locale/programs/locale.c:241
-#: locale/programs/localedef.c:389
+#: locale/programs/localedef.c:393
 #, c-format
 msgid "Try `%s --help' for more information.\n"
 msgstr "´õ ¸¹Àº Á¤º¸¸¦ º¸·Á¸é `%s --help' ÇϽʽÿÀ.\n"
 
-#: inet/rcmd.c:136
+#: inet/rcmd.c:137
 #, c-format
 msgid "Trying %s...\n"
 msgstr "%s ½ÃµµÁß...\n"
@@ -1501,7 +1597,7 @@ msgstr "%s ½ÃµµÁß...\n"
 msgid "Unknown .netrc keyword %s"
 msgstr "¾Ë ¼ö ¾ø´Â .netrc Å°¿öµå %s"
 
-#: nis/ypclnt.c:665
+#: nis/ypclnt.c:723
 msgid "Unknown NIS error code"
 msgstr "¾Ë ¼ö ¾ø´Â NIS ¿À·ù ÄÚµå"
 
@@ -1516,7 +1612,7 @@ msgstr "¾Ë ¼ö ¾ø´Â È£½ºÆ®"
 
 #: resolv/herror.c:120
 msgid "Unknown resolver error"
-msgstr "¾Ë ¼ö ¾ø´Â ¸®¼Ö¹ö ¿À·ù"
+msgstr "¾Ë ¼ö ¾ø´Â ÇØ°á±â ¿À·ù"
 
 #: resolv/herror.c:76
 msgid "Unknown server error"
@@ -1527,27 +1623,27 @@ msgstr "¾Ë ¼ö ¾ø´Â ¼­¹ö ¿À·ù"
 msgid "Unknown signal %d"
 msgstr "¾Ë ¼ö ¾ø´Â ½ÅÈ£ %d"
 
-#: misc/error.c:95
+#: misc/error.c:100
 msgid "Unknown system error"
 msgstr "¾Ë ¼ö ¾ø´Â ½Ã½ºÅÛ ¿À·ù"
 
-#: nis/ypclnt.c:713
+#: nis/ypclnt.c:771
 msgid "Unknown ypbind error"
 msgstr "¾Ë ¼ö ¾ø´Â ypbind ¿À·ù"
 
-#: posix/regex.c:948
+#: posix/regex.c:962
 msgid "Unmatched ( or \\("
 msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â ( ¶Ç´Â \\("
 
-#: posix/regex.c:956
+#: posix/regex.c:970
 msgid "Unmatched ) or \\)"
 msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â ) ¶Ç´Â \\)"
 
-#: posix/regex.c:947
+#: posix/regex.c:961
 msgid "Unmatched [ or [^"
 msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â [ ¶Ç´Â [^"
 
-#: posix/regex.c:949
+#: posix/regex.c:963
 msgid "Unmatched \\{"
 msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â \\{"
 
@@ -1556,6 +1652,8 @@ msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â \\{"
 msgid "Unrecognized variable `%s'"
 msgstr "ÀνÄÇÒ ¼ö ¾ø´Â º¯¼ö `%s'"
 
+#: stdio-common/../sysdeps/unix/siglist.c:45
+#: sysdeps/unix/sysv/linux/siglist.h:35
 msgid "Urgent I/O condition"
 msgstr "½Ã±ÞÇÑ ÀÔÃâ·Â »óȲ"
 
@@ -1612,7 +1710,7 @@ msgstr ""
 "  -V, --version       ¹öÀü Á¤º¸¸¦ Ãâ·ÂÇÏ°í ¸¶Ä¨´Ï´Ù\n"
 "ÀÔ·Â-ÆÄÀÏÀÌ - À̸é Ç¥ÁØ ÀÔ·ÂÀ¸·ÎºÎÅÍ ÀÔ·ÂÀ» ÀÐ°Ô µË´Ï´Ù.\n"
 
-#: locale/programs/localedef.c:393
+#: locale/programs/localedef.c:397
 #, c-format
 msgid ""
 "Usage: %s [OPTION]... name\n"
@@ -1636,12 +1734,13 @@ msgstr ""
 "  -h, --help                ÀÌ µµ¿ò¸»À» Ç¥½ÃÇÏ°í ¸¶Ä¨´Ï´Ù\n"
 "  -f, --charmaps=FILE       FILE¿¡ Á¤ÀÇµÈ ±âÈ£ ¹®ÀÚ À̸§\n"
 "  -i, --inputfile=FILE      ¼Ò½º Á¤ÀÇ°¡ FILE ¾È¿¡ ÀÖÀ½À» ³ªÅ¸³À´Ï´Ù\n"
-"  -u, --code-set-name=NAME  ISO 10646 ¿ø¼Ò¿¡ ´ëÀÀÇÏ´Â ÄÚµå ÁýÇÕÀ» ÁöÁ¤ÇÕ´Ï´Ù\n"
+"  -u, --code-set-name=NAME  ISO 10646 ¿ø¼Ò¿¡ ´ëÀÀÇÏ´Â ÄÚµå ÁýÇÕÀ» "
+"ÁöÁ¤ÇÕ´Ï´Ù\n"
 "  -v, --verbose             ´õ ¸¹Àº ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÕ´Ï´Ù\n"
 "  -V, --version             ¹öÀü Á¤º¸¸¦ Ãâ·ÂÇÏ°í ¸¶Ä¨´Ï´Ù\n"
 "      --posix               POSIX ¾ÈÀ» ¾ö°ÝÈ÷ ÁؼöÇÕ´Ï´Ù\n"
 "\n"
-"¹®ÀÚ ÁöµµÀÇ ½Ã½ºÅÛ µð·ºÅ丮: %s\n"
+"  ¹®ÀÚ ÁöµµÀÇ ½Ã½ºÅÛ µð·ºÅ丮: %s\n"
 "·ÎÄÉÀÏ ÆÄÀÏÀÇ ½Ã½ºÅÛ µð·ºÅ丮: %s\n"
 
 #: locale/programs/locale.c:245
@@ -1678,9 +1777,13 @@ msgstr "»ç¿ë¹ý: %s º¯¼ö¸í [°æ·Î¸í]\n"
 msgid "Usage: rpcinfo [ -n portnum ] -u host prognum [ versnum ]\n"
 msgstr "»ç¿ë¹ý: rpcinfo [ -n Æ÷Æ®¹øÈ£ ] -u È£½ºÆ® ÇÁ·Î±×·¥¹øÈ£ [ ¹öÀü¹øÈ£ ]\n"
 
+#: stdio-common/../sysdeps/unix/siglist.c:59
+#: sysdeps/unix/sysv/linux/siglist.h:48
 msgid "User defined signal 1"
 msgstr "»ç¿ëÀÚ Á¤ÀÇ ½ÅÈ£ 1"
 
+#: stdio-common/../sysdeps/unix/siglist.c:60
+#: sysdeps/unix/sysv/linux/siglist.h:49
 msgid "User defined signal 2"
 msgstr "»ç¿ëÀÚ ½ÅÈ£ ½ÅÈ£ 2"
 
@@ -1688,36 +1791,40 @@ msgstr "»ç¿ëÀÚ ½ÅÈ£ ½ÅÈ£ 2"
 msgid "Value too large for defined data type"
 msgstr "Á¤ÀÇµÈ ÀÚ·áÇüÀ¸·Î ¾²±â¿£ ³Ê¹« Å« °ª"
 
+#: stdio-common/../sysdeps/unix/siglist.c:55
+#: sysdeps/unix/sysv/linux/siglist.h:45
 msgid "Virtual timer expired"
 msgstr "°¡»ó ŸÀÌ¸Ó ½Ã°£ ÃÊ°ú"
 
-#: time/zic.c:1844
+#: time/zic.c:1871
 msgid "Wild result from command execution"
 msgstr ""
 
+#: stdio-common/../sysdeps/unix/siglist.c:57
+#: sysdeps/unix/sysv/linux/siglist.h:47
 msgid "Window changed"
 msgstr "À©µµ¿ì º¯°æµÊ"
 
 #: catgets/gencat.c:174 db/makedb.c:125 locale/programs/locale.c:192
-#: locale/programs/localedef.c:182
+#: locale/programs/localedef.c:185
 #, c-format
 msgid "Written by %s.\n"
-msgstr "ÀúÀÚ: %s.\n"
+msgstr "%sÀÌ ¸¸µé¾ú½À´Ï´Ù.\n"
 
-#: nis/ypclnt.c:146
+#: nis/ypclnt.c:142
 msgid "YPBINDPROC_DOMAIN: Internal error\n"
 msgstr "YPBINDPROC_DOMAIN: ³»ºÎ ¿À·ù\n"
 
-#: nis/ypclnt.c:150
+#: nis/ypclnt.c:146
 #, c-format
 msgid "YPBINDPROC_DOMAIN: No server for domain %s\n"
 msgstr "YPBINDPROC_DOMAIN: µµ¸ÞÀÎ %s¿¡ ´ëÇÑ ¼­¹ö°¡ ¾øÀ½\n"
 
-#: nis/ypclnt.c:154
+#: nis/ypclnt.c:150
 msgid "YPBINDPROC_DOMAIN: Resource allocation failure\n"
 msgstr "YPBINDPROC_DOMAIN: ÀÚ¿ø ÇÒ´ç ½ÇÆÐ\n"
 
-#: nis/ypclnt.c:158
+#: nis/ypclnt.c:154
 msgid "YPBINDPROC_DOMAIN: Unknown error\n"
 msgstr "YPBINDPROC_DOMAIN: ¾Ë ¼ö ¾ø´Â ¿À·ù\n"
 
@@ -1726,29 +1833,29 @@ msgstr "YPBINDPROC_DOMAIN: ¾Ë ¼ö ¾ø´Â ¿À·ù\n"
 msgid "You really blew it this time"
 msgstr "À̹ø¿£ Á¤¸»·Î ³¯·Á¹ö·È½À´Ï´Ù"
 
-#: time/zic.c:1050
+#: time/zic.c:1048
 msgid "Zone continuation line end time is not after end time of previous line"
 msgstr ""
 
-#: locale/programs/charmap.c:397 locale/programs/locfile.c:341
+#: locale/programs/charmap.c:397 locale/programs/locfile.c:363
 #, c-format
 msgid "`%1$s' definition does not end with `END %1$s'"
 msgstr "`%1%s' Á¤ÀÇ°¡ `END %1$s'·Î ³¡³ªÁö ¾Ê½À´Ï´Ù"
 
-#: locale/programs/ld-monetary.c:358 locale/programs/ld-numeric.c:190
+#: locale/programs/ld-monetary.c:359 locale/programs/ld-numeric.c:190
 #, c-format
 msgid "`-1' must be last entry in `%s' field in `%s' category"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1652
+#: locale/programs/ld-collate.c:1655
 msgid "`...' must only be used in `...' and `UNDEFINED' entries"
 msgstr "`...'´Â `...'¿Í `UNDEFINED' Ç׸ñ¿¡¸¸ ¾²¿©¾ß ÇÕ´Ï´Ù"
 
-#: locale/programs/locfile.c:538
+#: locale/programs/locfile.c:560
 msgid "`from' expected after first argument to `collating-element'"
-msgstr ""
+msgstr "`collating-element'¿¡ ´ëÇÑ Ã¹¹ø° Àμö µÚ¿¡ `from'ÀÌ ¿Í¾ß ÇÕ´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1109
+#: locale/programs/ld-collate.c:1112
 msgid ""
 "`from' string in collation element declaration contains unknown character"
 msgstr ""
@@ -1758,36 +1865,36 @@ msgstr ""
 msgid "argument to <%s> must be a single character"
 msgstr "<%s>¿¡ ´ëÇÑ Àμö´Â ´ÜÀÏ ¹®ÀÚ¿©¾ß ÇÕ´Ï´Ù"
 
-#: locale/programs/locfile.c:215
+#: locale/programs/locfile.c:237
 #, c-format
 msgid "argument to `%s' must be a single character"
 msgstr "`%s'¿¡ ´ëÇÑ Àμö´Â ´ÜÀÏ ¹®ÀÚ¿©¾ß ÇÕ´Ï´Ù"
 
-#: sunrpc/auth_unix.c:322
+#: sunrpc/auth_unix.c:323
 msgid "auth_none.c - Fatal marshalling problem"
 msgstr ""
 
-#: inet/rcmd.c:360
+#: inet/rcmd.c:365
 msgid "bad .rhosts owner"
 msgstr "À߸øµÈ .rhosts ¼ÒÀ¯ÀÚ"
 
-#: locale/programs/charmap.c:212 locale/programs/locfile.c:209
+#: locale/programs/charmap.c:212 locale/programs/locfile.c:231
 msgid "bad argument"
 msgstr "À߸øµÈ Àμö"
 
-#: time/zic.c:1172
+#: time/zic.c:1170
 msgid "blank FROM field on Link line"
 msgstr ""
 
-#: time/zic.c:1176
+#: time/zic.c:1174
 msgid "blank TO field on Link line"
 msgstr ""
 
-#: malloc/mcheck.c:189
+#: malloc/mcheck.c:191
 msgid "block freed twice"
 msgstr "ºí·°ÀÌ µÎ¹ø ºñ¿öÁ³À½"
 
-#: malloc/mcheck.c:192
+#: malloc/mcheck.c:194
 msgid "bogus mcheck_status, library is buggy"
 msgstr "¾ûÅ͸® mcheck_status, ¶óÀ̺귯¸®´Â ¹ö±×°¡ ¹ö±Û¹ö±ÛÇÕ´Ï´Ù"
 
@@ -1803,8 +1910,8 @@ msgstr ""
 msgid "cache_set: victim not found"
 msgstr "cache_set: ¹ö¸±°ÍÀ» ãÁö ¸øÇßÀ½"
 
-#: time/zic.c:1685
-msgid "can't determine time zone abbrevation to use just after until time"
+#: time/zic.c:1698
+msgid "can't determine time zone abbreviation to use just after until time"
 msgstr ""
 
 #: sunrpc/svc_simple.c:64
@@ -1812,21 +1919,21 @@ msgstr ""
 msgid "can't reassign procedure number %d\n"
 msgstr "ÇÁ·Î½ÃÁ® ¹øÈ£ %d¸¦ ÀçÁöÁ¤ÇÒ ¼ö ¾ø½À´Ï´Ù\n"
 
-#: locale/programs/localedef.c:287
+#: locale/programs/localedef.c:291
 #, c-format
 msgid "cannot `stat' locale file `%s'"
 msgstr "·ÎÄÉÀÏ ÆÄÀÏ `%s'¸¦ `stat'ÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1314
+#: locale/programs/ld-collate.c:1317
 #, c-format
 msgid "cannot insert collation element `%.*s'"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1493 locale/programs/ld-collate.c:1498
+#: locale/programs/ld-collate.c:1496 locale/programs/ld-collate.c:1501
 msgid "cannot insert into result table"
 msgstr "°á°úÇ¥¿¡ »ðÀÔÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1166 locale/programs/ld-collate.c:1208
+#: locale/programs/ld-collate.c:1169 locale/programs/ld-collate.c:1211
 #, c-format
 msgid "cannot insert new collating symbol definition: %s"
 msgstr ""
@@ -1836,84 +1943,84 @@ msgstr ""
 msgid "cannot open database file `%s': %s"
 msgstr "µ¥ÀÌÅͺ£À̽º ÆÄÀÏ `%s'¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù: %s"
 
-#: catgets/gencat.c:259 db/makedb.c:180
+#: catgets/gencat.c:260 db/makedb.c:180
 #, c-format
 msgid "cannot open input file `%s'"
 msgstr "ÀÔ·Â ÆÄÀÏ `%s'¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/localedef.c:221
+#: locale/programs/localedef.c:224
 #, c-format
 msgid "cannot open locale definition file `%s'"
 msgstr "·ÎÄÉÀÏ Á¤ÀÇ ÆÄÀÏ `%s'¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù"
 
-#: catgets/gencat.c:764 catgets/gencat.c:805 db/makedb.c:189
+#: catgets/gencat.c:765 catgets/gencat.c:806 db/makedb.c:189
 #, c-format
 msgid "cannot open output file `%s'"
 msgstr "Ãâ·Â ÆÄÀÏ `%s'¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/locfile.c:986
+#: locale/programs/locfile.c:1008
 #, c-format
 msgid "cannot open output file `%s' for category `%s'"
 msgstr "Ãâ·Â ÆÄÀÏ `%s'¸¦ ¹üÁÖ `%s'¿¡ ´ëÇØ ¿­ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1360
+#: locale/programs/ld-collate.c:1363
 msgid "cannot process order specification"
 msgstr ""
 
-#: locale/programs/locale.c:303
+#: locale/programs/locale.c:304
 #, c-format
 msgid "cannot read character map directory `%s'"
 msgstr "¹®ÀÚ Áöµµ µð·ºÅ丮 `%s'¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/locale.c:278
+#: locale/programs/locale.c:279
 #, c-format
 msgid "cannot read locale directory `%s'"
 msgstr "·ÎÄÉÀÏ µð·ºÅ丮 `%s'¸¦ ÀÐÀ» ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/localedef.c:309
+#: locale/programs/localedef.c:313
 #, c-format
 msgid "cannot read locale file `%s'"
 msgstr "·ÎÄÉÀÏ ÆÄÀÏ `%s'¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/localedef.c:334
+#: locale/programs/localedef.c:338
 #, c-format
 msgid "cannot write output files to `%s'"
 msgstr "Ãâ·Â ÆÄÀÏÀ» `%s'¿¡ ±â·ÏÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/localedef.c:377
+#: locale/programs/localedef.c:381
 msgid "category data requested more than once: should not happen"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:265
+#: locale/programs/ld-ctype.c:266
 #, c-format
 msgid "character %s'%s' in class `%s' must be in class `%s'"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:289
+#: locale/programs/ld-ctype.c:291
 #, c-format
 msgid "character %s'%s' in class `%s' must not be in class `%s'"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:310
+#: locale/programs/ld-ctype.c:313
 msgid "character <SP> not defined in character map"
-msgstr "¹®ÀÚ <SP>°¡ ¹®ÀÚ Áöµµ¿¡¼­ Á¤ÀǵÇÁö ¾ÊÀ½"
+msgstr "¹®ÀÚ <SP>°¡ ¹®ÀÚ Áöµµ¿¡¼­ Á¤ÀǵÇÁö ¾Ê¾ÒÀ½"
 
-#: locale/programs/ld-ctype.c:939 locale/programs/ld-ctype.c:1002
-#: locale/programs/ld-ctype.c:1010 locale/programs/ld-ctype.c:1018
-#: locale/programs/ld-ctype.c:1026 locale/programs/ld-ctype.c:1034
-#: locale/programs/ld-ctype.c:1042 locale/programs/ld-ctype.c:1068
-#: locale/programs/ld-ctype.c:1076 locale/programs/ld-ctype.c:1114
-#: locale/programs/ld-ctype.c:1141 locale/programs/ld-ctype.c:1152
+#: locale/programs/ld-ctype.c:944 locale/programs/ld-ctype.c:1007
+#: locale/programs/ld-ctype.c:1015 locale/programs/ld-ctype.c:1023
+#: locale/programs/ld-ctype.c:1031 locale/programs/ld-ctype.c:1039
+#: locale/programs/ld-ctype.c:1047 locale/programs/ld-ctype.c:1073
+#: locale/programs/ld-ctype.c:1081 locale/programs/ld-ctype.c:1119
+#: locale/programs/ld-ctype.c:1146 locale/programs/ld-ctype.c:1157
 #, c-format
 msgid "character `%s' not defined while needed as default value"
 msgstr "¹®ÀÚ `%s'´Â ³»Á¤Ä¡·Î ÇÊ¿äÇÏÁö¸¸ Á¤ÀǵÇÁö ¾Ê¾ÒÀ½"
 
-#: locale/programs/ld-ctype.c:801
+#: locale/programs/ld-ctype.c:806
 #, c-format
 msgid "character class `%s' already defined"
 msgstr "¹®ÀÚ Å¬·¡½º `%s'´Â ÀÌ¹Ì Á¤ÀǵǾúÀ½"
 
-#: locale/programs/ld-ctype.c:833
+#: locale/programs/ld-ctype.c:838
 #, c-format
 msgid "character map `%s' already defined"
 msgstr "¹®ÀÚ Áöµµ `%s'´Â ÀÌ¹Ì Á¤ÀǵǾúÀ½"
@@ -1927,22 +2034,22 @@ msgstr "¹®ÀÚ Áöµµ ÆÄÀÏ `%s'¸¦ ãÁö ¸øÇßÀ½"
 msgid "clnt_raw.c - Fatal header serialization error."
 msgstr ""
 
-#: locale/programs/ld-collate.c:1329
+#: locale/programs/ld-collate.c:1332
 #, c-format
 msgid "collation element `%.*s' appears more than once: ignore line"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1347
+#: locale/programs/ld-collate.c:1350
 #, c-format
 msgid "collation symbol `%.*s' appears more than once: ignore line"
 msgstr ""
 
-#: locale/programs/locfile.c:522
+#: locale/programs/locfile.c:544
 #, c-format
 msgid "collation symbol expected after `%s'"
 msgstr ""
 
-#: inet/rcmd.c:129
+#: inet/rcmd.c:130
 #, c-format
 msgid "connect to address %s: "
 msgstr "ÁÖ¼Ò %s¿¡ ¿¬°á: "
@@ -1980,37 +2087,37 @@ msgstr ""
 msgid "duplicate character name `%s'"
 msgstr "¹®ÀÚ À̸§ `%s'ÀÌ Áߺ¹µÊ"
 
-#: locale/programs/ld-collate.c:1141
+#: locale/programs/ld-collate.c:1144
 msgid "duplicate collating element definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1287
+#: locale/programs/ld-collate.c:1290
 #, c-format
 msgid "duplicate definition for character `%.*s'"
 msgstr "¹®ÀÚ `%.*s'¸¦ Áߺ¹ Á¤ÀÇÇÔ"
 
-#: db/makedb.c:310
+#: db/makedb.c:311
 msgid "duplicate key"
 msgstr "Áߺ¹µÈ Å°"
 
-#: catgets/gencat.c:378
+#: catgets/gencat.c:379
 msgid "duplicate set definition"
 msgstr "Áߺ¹µÈ ÁýÇÕ Á¤ÀÇ"
 
-#: time/zic.c:965
+#: time/zic.c:963
 #, c-format
 msgid "duplicate zone name %s (file \"%s\", line %d)"
 msgstr "Áߺ¹µÈ Áö¿ª¸í %s (ÆÄÀÏ \"%s\", Çà %d)"
 
-#: catgets/gencat.c:541
+#: catgets/gencat.c:542
 msgid "duplicated message identifier"
 msgstr "Áߺ¹µÈ ¸Þ½ÃÁö ½Äº°ÀÚ"
 
-#: catgets/gencat.c:514
+#: catgets/gencat.c:515
 msgid "duplicated message number"
 msgstr "Áߺ¹µÈ ¸Þ½ÃÁö ¹øÈ£"
 
-#: locale/programs/ld-collate.c:1696
+#: locale/programs/ld-collate.c:1699
 msgid "empty weight name: line ignored"
 msgstr ""
 
@@ -2030,32 +2137,36 @@ msgstr "enablecache: ij½¬ ÀڷḦ ÇÒ´çÇÒ ¼ö ¾ø½À´Ï´Ù"
 msgid "enablecache: could not allocate cache fifo"
 msgstr "enablecache: ij½¬ fifo¸¦ ÇÒ´çÇÒ ¼ö ¾ø½À´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1419
+#: locale/programs/ld-collate.c:1422
 msgid "end point of ellipsis range is bigger then start"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1149
+#: locale/programs/ld-collate.c:1152
 msgid "error while inserting collation element into hash table"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1161
+#: locale/programs/ld-collate.c:1164
 msgid "error while inserting to hash table"
 msgstr "Çؽ¬ Å×ÀÌºí¿¡ »ðÀÔÇÏ´Â µµÁß ¿À·ù ¹ß»ý"
 
-#: locale/programs/locfile.c:465
+#: locale/programs/locfile.c:487
 msgid "expect string argument for `copy'"
-msgstr ""
+msgstr "`copy'¿¡ ´ëÇÑ ¹®ÀÚ¿­ Àμö°¡ ÇÊ¿äÇÔ"
 
-#: time/zic.c:856
+#: time/zic.c:854
 msgid "expected continuation line not found"
 msgstr "¿¹»óÇß´ø ¿¬¼Ó ÇàÀ» ãÁö ¸øÇßÀ½"
 
-#: locale/programs/locfile.c:1010
+#: locale/programs/locfile.c:1032
 #, c-format
 msgid "failure while writing data for category `%s'"
 msgstr "¹üÁÖ `%s'ÀÇ ÀڷḦ ¾²´Â µ¥ ½ÇÆÐÇß½À´Ï´Ù"
 
-#: locale/programs/ld-monetary.c:154 locale/programs/ld-numeric.c:95
+#: nis/ypclnt.c:187
+msgid "fcntl: F_SETFD"
+msgstr ""
+
+#: locale/programs/ld-monetary.c:155 locale/programs/ld-numeric.c:95
 #, c-format
 msgid "field `%s' in category `%s' not defined"
 msgstr ""
@@ -2065,7 +2176,7 @@ msgstr ""
 msgid "field `%s' in category `%s' undefined"
 msgstr ""
 
-#: locale/programs/locfile.c:547
+#: locale/programs/locfile.c:569
 msgid "from-value of `collating-element' must be a string"
 msgstr ""
 
@@ -2074,7 +2185,8 @@ msgid "garbage at end of character code specification"
 msgstr "¹®ÀÚ ÄÚµå ¸í¼¼ÀÇ ³¡¿¡ ¾µ¸ð¾ø´Â °ÍÀÌ ÀÖÀ½"
 
 #: locale/programs/linereader.c:214
-msgid "garbage at end of digit"
+#, fuzzy
+msgid "garbage at end of number"
 msgstr "¼ýÀÚÀÇ ³¡¿¡ ¾µ¸ð¾ø´Â °ÍÀÌ ÀÖÀ½"
 
 #: locale/programs/ld-time.c:183
@@ -2089,7 +2201,7 @@ msgid ""
 "garbage at end of starting date in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: locale/programs/ld-time.c:310
+#: locale/programs/ld-time.c:311
 #, c-format
 msgid ""
 "garbage at end of stopping date in string %d in `era' field in category `%s'"
@@ -2099,19 +2211,19 @@ msgstr ""
 msgid "get_myaddress: ioctl (get interface configuration)"
 msgstr ""
 
-#: time/zic.c:1149
+#: time/zic.c:1147
 msgid "illegal CORRECTION field on Leap line"
 msgstr ""
 
-#: time/zic.c:1153
+#: time/zic.c:1151
 msgid "illegal Rolling/Stationary field on Leap line"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1767
+#: locale/programs/ld-collate.c:1770
 msgid "illegal character constant in string"
 msgstr "¹®ÀÚ¿­¿¡ À߸øµÈ ¹®ÀÚ »ó¼ö°¡ ÀÖÀ½"
 
-#: locale/programs/ld-collate.c:1116
+#: locale/programs/ld-collate.c:1119
 msgid "illegal collation element"
 msgstr ""
 
@@ -2125,7 +2237,7 @@ msgstr "À߸øµÈ ºÎȣȭ°¡ ÁÖ¾îÁü"
 
 #: locale/programs/linereader.c:546
 msgid "illegal escape sequence at end of string"
-msgstr "¹®ÀÚ¿­ ³¡¿¡ À߸øµÈ À̽ºÄÉÀÌÇÁ ¿­ÀÌ ÀÖÀ½"
+msgstr "¹®ÀÚ¿­ ³¡¿¡ À߸øµÈ À̽ºÄÉÀÌÇÁ ¼ø¼­¿­ÀÌ ÀÖÀ½"
 
 #: locale/programs/charset.c:101
 msgid "illegal names for character range"
@@ -2136,7 +2248,7 @@ msgstr "¹®ÀÚÀÇ ¹üÀ§·Î À߸øµÈ À̸§"
 msgid "illegal number for offset in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: catgets/gencat.c:351 catgets/gencat.c:428
+#: catgets/gencat.c:352 catgets/gencat.c:429
 msgid "illegal set number"
 msgstr "ÁýÇÕ ¹øÈ£°¡ À߸øµÇ¾úÀ½"
 
@@ -2145,79 +2257,79 @@ msgstr "ÁýÇÕ ¹øÈ£°¡ À߸øµÇ¾úÀ½"
 msgid "illegal starting date in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: locale/programs/ld-time.c:302
+#: locale/programs/ld-time.c:303
 #, c-format
 msgid "illegal stopping date in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:807
+#: locale/programs/ld-ctype.c:812
 #, c-format
 msgid "implementation limit: no more than %d character classes allowed"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:839
+#: locale/programs/ld-ctype.c:844
 #, c-format
 msgid "implementation limit: no more than %d character maps allowed"
-msgstr ""
+msgstr "±¸Çö»óÀÇ Á¦ÇÑ: %d °³ ÀÌ»óÀÇ ¹®ÀÚ Áöµµ´Â Çã¿ëµÇÁö ¾Ê½À´Ï´Ù"
 
 #: db/makedb.c:163
 msgid "incorrectly formatted file"
 msgstr "À߸øµÈ Çü½ÄÀ» °®Ãá ÆÄÀÏ"
 
-#: time/zic.c:814
+#: time/zic.c:811
 msgid "input line of unknown type"
 msgstr "¾Ë ¼ö ¾ø´Â ÇüÅÂÀÇ ÀÔ·ÂÇà"
 
-#: time/zic.c:1733
+#: time/zic.c:1760
 msgid "internal error - addtype called with bad isdst"
 msgstr ""
 
-#: time/zic.c:1741
+#: time/zic.c:1768
 msgid "internal error - addtype called with bad ttisgmt"
 msgstr ""
 
-#: time/zic.c:1737
+#: time/zic.c:1764
 msgid "internal error - addtype called with bad ttisstd"
 msgstr ""
 
-#: locale/programs/ld-ctype.c:301
+#: locale/programs/ld-ctype.c:304
 #, c-format
 msgid "internal error in %s, line %u"
 msgstr "%s, Çà %u¿¡ ³»ºÎ ¿À·ù ¹ß»ý"
 
-#: time/zic.c:1021
+#: time/zic.c:1019
 msgid "invalid GMT offset"
 msgstr "GMT ¿É¼ÂÀÌ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1024
+#: time/zic.c:1022
 msgid "invalid abbreviation format"
 msgstr "¾à¾î Çü½ÄÀÌ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1114 time/zic.c:1313 time/zic.c:1327
+#: time/zic.c:1112 time/zic.c:1313 time/zic.c:1327
 msgid "invalid day of month"
 msgstr "´ÞÀÇ ³¯Â¥ ¼ö°¡ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1272
+#: time/zic.c:1270
 msgid "invalid ending year"
 msgstr "³¡³ª´Â ÇØ°¡ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1086
+#: time/zic.c:1084
 msgid "invalid leaping year"
 msgstr "ºÎÀûÀýÇÑ À±³â"
 
-#: time/zic.c:1101 time/zic.c:1204
+#: time/zic.c:1099 time/zic.c:1202
 msgid "invalid month name"
 msgstr "´Þ À̸§ÀÌ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:920
+#: time/zic.c:918
 msgid "invalid saved time"
 msgstr "Àý¾à ½Ã°£ÀÌ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1252
+#: time/zic.c:1250
 msgid "invalid starting year"
 msgstr "½ÃÀÛÇÏ´Â ÇØ°¡ ºÎÀûÀýÇÔ"
 
-#: time/zic.c:1130 time/zic.c:1232
+#: time/zic.c:1128 time/zic.c:1230
 msgid "invalid time of day"
 msgstr ""
 
@@ -2225,61 +2337,61 @@ msgstr ""
 msgid "invalid weekday name"
 msgstr "ºÎÀûÀýÇÑ ¿äÀÏ À̸§"
 
-#: locale/programs/ld-collate.c:1412
+#: locale/programs/ld-collate.c:1415
 msgid "line after ellipsis must contain character definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1391
+#: locale/programs/ld-collate.c:1394
 msgid "line before ellipsis does not contain definition for character constant"
 msgstr ""
 
-#: time/zic.c:794
+#: time/zic.c:791
 msgid "line too long"
 msgstr "ÇàÀÌ ³Ê¹« ±é´Ï´Ù"
 
-#: locale/programs/localedef.c:281
+#: locale/programs/localedef.c:285
 #, c-format
 msgid "locale file `%s', used in `copy' statement, not found"
 msgstr "`copy' ¹®Àå¿¡¼­ ¾²ÀÌ´Â ·ÎÄÉÀÏ ÆÄÀÏ `%s'À» ãÁö ¸øÇß½À´Ï´Ù"
 
-#: catgets/gencat.c:609
+#: catgets/gencat.c:610
 msgid "malformed line ignored"
 msgstr "À߸øµÈ ÇüŸ¦ °¡Áø ÇàÀº ¹«½ÃµÊ"
 
-#: malloc/mcheck.c:183
+#: malloc/mcheck.c:185
 msgid "memory clobbered before allocated block"
 msgstr ""
 
-#: malloc/mcheck.c:186
+#: malloc/mcheck.c:188
 msgid "memory clobbered past end of allocated block"
 msgstr ""
 
 #: locale/programs/ld-collate.c:167 locale/programs/ld-collate.c:173
-#: locale/programs/ld-collate.c:177 locale/programs/ld-collate.c:1439
-#: locale/programs/ld-collate.c:1468 locale/programs/locfile.c:940
+#: locale/programs/ld-collate.c:177 locale/programs/ld-collate.c:1442
+#: locale/programs/ld-collate.c:1471 locale/programs/locfile.c:962
 #: locale/programs/xmalloc.c:68 posix/getconf.c:250
 msgid "memory exhausted"
 msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²"
 
-#: malloc/obstack.c:425
+#: malloc/obstack.c:462
 msgid "memory exhausted\n"
 msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²\n"
 
-#: malloc/mcheck.c:180
+#: malloc/mcheck.c:182
 msgid "memory is consistent, library is buggy"
 msgstr "¸Þ¸ð¸®´Â °ß°íÇÏÁö¸¸, ¶óÀ̺귯¸®´Â ¹ö±×°¡ ¸¹½À´Ï´Ù"
 
-#: locale/programs/ld-time.c:348
+#: locale/programs/ld-time.c:350
 #, c-format
 msgid "missing era format in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: locale/programs/ld-time.c:337
+#: locale/programs/ld-time.c:339
 #, c-format
-msgid "missing era name in string %d in `era' fieldin category `%s'"
+msgid "missing era name in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: time/zic.c:915
+#: time/zic.c:913
 msgid "nameless rule"
 msgstr "À̸§¾ø´Â ±ÔÄ¢"
 
@@ -2293,26 +2405,26 @@ msgstr "°áÄÚ µî·ÏµÇÁö ¾ÊÀº ÇÁ·Î±×·¥ %d\n"
 msgid "no correct regular expression for field `%s' in category `%s': %s"
 msgstr ""
 
-#: time/zic.c:2059
+#: time/zic.c:2086
 msgid "no day in month matches rule"
 msgstr "±ÔÄ¢¿¡ ºÎÇյǴ ³¯ÀÌ ´Þ ¾È¿¡ ¾øÀ½"
 
-#: locale/programs/ld-collate.c:259
+#: locale/programs/ld-collate.c:260
 msgid "no definition of `UNDEFINED'"
-msgstr ""
+msgstr "`UNDEFINED'ÀÇ Á¤ÀÇ°¡ ¾øÀ½"
 
-#: locale/programs/locfile.c:479
+#: locale/programs/locfile.c:501
 msgid "no other keyword shall be specified when `copy' is used"
-msgstr ""
+msgstr "`copy'°¡ »ç¿ëµÉ ¶© ´Ù¸¥ Å°¿öµå¸¦ ÁöÁ¤ÇÏ¸é ¾È µË´Ï´Ù"
 
-#: locale/programs/localedef.c:340
+#: locale/programs/localedef.c:344
 msgid "no output file produced because warning were issued"
-msgstr ""
+msgstr "°æ°í°¡ Á¦±âµÇ¾ú±â ¶§¹®¿¡ Ãâ·Â ÆÄÀÏÀÌ ¸¸µé¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù"
 
 #: locale/programs/charmap.c:315 locale/programs/charmap.c:466
 #: locale/programs/charmap.c:545
 msgid "no symbolic name given"
-msgstr ""
+msgstr "±âÈ£¸íÀÌ ÁÖ¾îÁöÁö ¾ÊÀ½"
 
 #: locale/programs/charmap.c:380 locale/programs/charmap.c:512
 #: locale/programs/charmap.c:578
@@ -2328,7 +2440,7 @@ msgstr ""
 msgid "only WIDTH definitions are allowed to follow the CHARMAP definition"
 msgstr ""
 
-#: db/makedb.c:326
+#: db/makedb.c:327
 #, c-format
 msgid "problems while reading `%s'"
 msgstr "`%s'¸¦ Àд µ¿¾È ¹®Á¦°¡ ¹ß»ýÇßÀ½"
@@ -2349,16 +2461,16 @@ msgstr "ÇÁ·Î±×·¥ %lu ¹öÀü %lu´Â »ç¿ë ºÒ°¡´ÉÇÕ´Ï´Ù\n"
 msgid "program %lu version %lu ready and waiting\n"
 msgstr "ÇÁ·Î±×·¥ %lu ¹öÀü %lu´Â ÁغñµÇ¾î ±â´Ù¸®°í ÀÖ½À´Ï´Ù\n"
 
-#: inet/rcmd.c:171
+#: inet/rcmd.c:172
 #, c-format
 msgid "rcmd: select (setting up stderr): %m\n"
 msgstr "rcmd: ¼±Åà (Ç¥ÁØ¿À·ù ¼³Á¤): %m\n"
 
-#: inet/rcmd.c:103
+#: inet/rcmd.c:104
 msgid "rcmd: socket: All ports in use\n"
 msgstr "rcmd: socket: ¸ðµç Æ÷Æ®°¡ »ç¿ëÁß\n"
 
-#: inet/rcmd.c:159
+#: inet/rcmd.c:160
 #, c-format
 msgid "rcmd: write (setting up stderr): %m\n"
 msgstr "rcmd: ¾²±â (Ç¥ÁØ¿À·ù ¼³Á¤): %m\n"
@@ -2367,7 +2479,7 @@ msgstr "rcmd: ¾²±â (Ç¥ÁØ¿À·ù ¼³Á¤): %m\n"
 msgid "registerrpc: out of memory\n"
 msgstr "registerrpc: ¸Þ¸ð¸® ºÎÁ·\n"
 
-#: time/zic.c:1794
+#: time/zic.c:1821
 msgid "repeated leap second moment"
 msgstr ""
 
@@ -2399,45 +2511,45 @@ msgstr "rpcinfo: Æ÷Æ®¸ÅÆÛ¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù"
 msgid "rpcinfo: can't contact portmapper: "
 msgstr "rpcinfo: Æ÷Æ®¸ÅÆÛ¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù: "
 
-#: time/zic.c:708 time/zic.c:710
+#: time/zic.c:704 time/zic.c:706
 msgid "same rule name in multiple files"
-msgstr ""
+msgstr "¿©·¯ ÆÄÀÏ¿¡ °°Àº À̸§ÀÇ ±ÔÄ¢ÀÌ ÀÖÀ½"
 
-#: inet/rcmd.c:174
+#: inet/rcmd.c:175
 msgid "select: protocol failure in circuit setup\n"
 msgstr "select: ȸ·Î ¼³Á¤Áß ±Ô¾àÀÌ ºÒÀÌÇàµÊ\n"
 
-#: inet/rcmd.c:192
+#: inet/rcmd.c:193
 msgid "socket: protocol failure in circuit setup\n"
 msgstr "socket: ȸ·Î ¼³Á¤Áß ±Ô¾àÀÌ ºÒÀÌÇàµÊ\n"
 
-#: locale/programs/locfile.c:600
+#: locale/programs/locfile.c:622
 msgid "sorting order `forward' and `backward' are mutually exclusive"
 msgstr "Á¤·Ä ¼ø¼­ `forward'¿Í `backward'´Â ¼­·Î ¹èŸÀûÀÔ´Ï´Ù"
 
-#: locale/programs/ld-collate.c:1568 locale/programs/ld-collate.c:1614
+#: locale/programs/ld-collate.c:1571 locale/programs/ld-collate.c:1617
 msgid ""
 "specification of sorting weight for collation symbol does not make sense"
 msgstr ""
 
-#: time/zic.c:779
+#: time/zic.c:775
 msgid "standard input"
 msgstr "Ç¥ÁØ ÀÔ·Â"
 
-#: time/zdump.c:260
+#: time/zdump.c:268
 msgid "standard output"
 msgstr "Ç¥ÁØ Ãâ·Â"
 
-#: locale/programs/ld-time.c:256
+#: locale/programs/ld-time.c:257
 #, c-format
 msgid "starting date is illegal in string %d in `era' field in category `%s'"
 msgstr ""
 
-#: time/zic.c:1276
+#: time/zic.c:1274
 msgid "starting year greater than ending year"
 msgstr "½ÃÀÛÇÏ´Â ÇØ°¡ ³¡³ª´Â Çغ¸´Ù Å®´Ï´Ù"
 
-#: locale/programs/ld-time.c:328
+#: locale/programs/ld-time.c:330
 #, c-format
 msgid "stopping date is illegal in string %d in `era' field in category `%s'"
 msgstr ""
@@ -2466,35 +2578,35 @@ msgstr "svcudp_create - getsockname ºÒ°¡´É"
 msgid "svcudp_create: socket creation problem"
 msgstr "svcudp_create: ¼ÒÄÏ »ý¼º ¹®Á¦"
 
-#: locale/programs/ld-collate.c:1191
+#: locale/programs/ld-collate.c:1194
 #, c-format
 msgid ""
 "symbol for multicharacter collating element `%.*s' duplicates element "
 "definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1064
+#: locale/programs/ld-collate.c:1067
 #, c-format
 msgid ""
 "symbol for multicharacter collating element `%.*s' duplicates other element "
 "definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1200
+#: locale/programs/ld-collate.c:1203
 #, c-format
 msgid ""
 "symbol for multicharacter collating element `%.*s' duplicates other symbol "
 "definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1073
+#: locale/programs/ld-collate.c:1076
 #, c-format
 msgid ""
 "symbol for multicharacter collating element `%.*s' duplicates symbol "
 "definition"
 msgstr ""
 
-#: locale/programs/ld-collate.c:1055 locale/programs/ld-collate.c:1182
+#: locale/programs/ld-collate.c:1058 locale/programs/ld-collate.c:1185
 #, c-format
 msgid ""
 "symbol for multicharacter collating element `%.*s' duplicates symbolic name "
@@ -2509,51 +2621,51 @@ msgstr ""
 msgid "syntax error in %s definition: %s"
 msgstr "%s Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½: %s"
 
-#: locale/programs/locfile.c:620
+#: locale/programs/locfile.c:642
 msgid "syntax error in `order_start' directive"
 msgstr "`order_start' Áö½ÃÀÚ¿¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:362
+#: locale/programs/locfile.c:384
 msgid "syntax error in character class definition"
 msgstr "¹®ÀÚ Å¬·¡½º Á¤ÀÇ¿¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:420
+#: locale/programs/locfile.c:442
 msgid "syntax error in character conversion definition"
 msgstr "¹®ÀÚ º¯È¯ Á¤ÀÇ¿¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:662
+#: locale/programs/locfile.c:684
 msgid "syntax error in collating order definition"
 msgstr ""
 
-#: locale/programs/locfile.c:512
+#: locale/programs/locfile.c:534
 msgid "syntax error in collation definition"
 msgstr ""
 
-#: locale/programs/locfile.c:335
+#: locale/programs/locfile.c:357
 msgid "syntax error in definition of LC_CTYPE category"
 msgstr "LC_CTYPE ¹üÁÖÀÇ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:278
+#: locale/programs/locfile.c:300
 msgid "syntax error in definition of new character class"
 msgstr ""
 
-#: locale/programs/locfile.c:288
+#: locale/programs/locfile.c:310
 msgid "syntax error in definition of new character map"
 msgstr "»õ·Î¿î ¹®ÀÚ Áöµµ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:873
+#: locale/programs/locfile.c:895
 msgid "syntax error in message locale definition"
 msgstr "¸Þ½ÃÁö ·ÎÄÉÀÏ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:784
+#: locale/programs/locfile.c:806
 msgid "syntax error in monetary locale definition"
 msgstr "È­Æó ·ÎÄÉÀÏ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:811
+#: locale/programs/locfile.c:833
 msgid "syntax error in numeric locale definition"
 msgstr "¼ýÀÚ ·ÎÄÉÀÏ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:722
+#: locale/programs/locfile.c:744
 msgid "syntax error in order specification"
 msgstr ""
 
@@ -2562,57 +2674,57 @@ msgstr ""
 msgid "syntax error in prolog: %s"
 msgstr ""
 
-#: locale/programs/locfile.c:849
+#: locale/programs/locfile.c:871
 msgid "syntax error in time locale definition"
 msgstr "½Ã°£ ·ÎÄÉÀÏ Á¤ÀǺο¡ ¹®¹ý ¿À·ù ÀÖÀ½"
 
-#: locale/programs/locfile.c:255
+#: locale/programs/locfile.c:277
 msgid "syntax error: not inside a locale definition section"
 msgstr ""
 
-#: catgets/gencat.c:380 catgets/gencat.c:516 catgets/gencat.c:543
+#: catgets/gencat.c:381 catgets/gencat.c:517 catgets/gencat.c:544
 msgid "this is the first definition"
 msgstr "ÀÌ°ÍÀº ù¹ø° Á¤ÀÇÀÔ´Ï´Ù"
 
-#: time/zic.c:1119
+#: time/zic.c:1117
 msgid "time before zero"
-msgstr ""
+msgstr "0 ÀÌÀüÀÇ ½Ã°£"
 
-#: time/zic.c:1127 time/zic.c:1959 time/zic.c:1978
+#: time/zic.c:1125 time/zic.c:1986 time/zic.c:2005
 msgid "time overflow"
 msgstr "½Ã°£ Èê·¯³Ñħ"
 
 #: locale/programs/charset.c:44
 msgid "too few bytes in character encoding"
-msgstr ""
+msgstr "¹®ÀÚ ºÎȣȭ¿¡ ÇÊ¿äÇÑ ¹ÙÀÌÆ®°¡ ³Ê¹« ÀûÀ½"
 
 #: locale/programs/charset.c:46
 msgid "too many bytes in character encoding"
-msgstr ""
+msgstr "¹®ÀÚ ºÎȣȭ¿¡ ÇÊ¿äÇÑ ¹ÙÀÌÆ®°¡ ³Ê¹« ¸¹À½"
 
 #: locale/programs/locales.h:72
 msgid "too many character classes defined"
 msgstr "¹®ÀÚ Å¬·¡½º°¡ ³Ê¹« ¸¹ÀÌ Á¤ÀǵǾúÀ½"
 
-#: time/zic.c:1788
+#: time/zic.c:1815
 msgid "too many leap seconds"
 msgstr "À±ÃÊ°¡ ³Ê¹« ¸¹À½"
 
-#: time/zic.c:1760
+#: time/zic.c:1787
 msgid "too many local time types"
 msgstr "Áö¿ª½ÃÀÇ Á¾·ù°¡ ³Ê¹« ¸¹À½"
 
-#: time/zic.c:1714
+#: time/zic.c:1741
 msgid "too many transitions?!"
-msgstr ""
+msgstr "³Ê¹« ¸¹Àº ÀüÀÌ?!"
 
-#: locale/programs/ld-collate.c:1623
+#: locale/programs/ld-collate.c:1626
 msgid "too many weights"
 msgstr ""
 
-#: time/zic.c:2082
+#: time/zic.c:2109
 msgid "too many, or too long, time zone abbreviations"
-msgstr ""
+msgstr "³Ê¹« ¸¹°Å³ª ³Ê¹« ±ä ½Ã°£´ë ¾à¾î"
 
 #: locale/programs/linereader.h:146
 msgid "trailing garbage at end of line"
@@ -2623,11 +2735,11 @@ msgstr ""
 msgid "trouble replying to prog %d\n"
 msgstr "ÇÁ·Î±×·¥ %d¿¡ ÀÀ´äÇÏ´Â µ¥ ¹®Á¦°¡ ÀÖÀ½\n"
 
-#: locale/programs/ld-collate.c:1383
+#: locale/programs/ld-collate.c:1386
 msgid "two lines in a row containing `...' are not allowed"
 msgstr ""
 
-#: time/zic.c:1283
+#: time/zic.c:1281
 msgid "typed single year"
 msgstr ""
 
@@ -2642,39 +2754,36 @@ msgstr "¾Ë ¼ö ¾ø´Â ¹®ÀÚ `%s'"
 
 #: locale/programs/ld-messages.c:193 locale/programs/ld-messages.c:204
 #: locale/programs/ld-messages.c:215 locale/programs/ld-messages.c:226
-#: locale/programs/ld-time.c:696
+#: locale/programs/ld-time.c:698
 #, c-format
 msgid "unknown character in field `%s' of category `%s'"
 msgstr ""
 
-#: locale/programs/locfile.c:585
+#: locale/programs/locfile.c:607
 msgid "unknown collation directive"
 msgstr ""
 
-#: catgets/gencat.c:477
+#: catgets/gencat.c:478
 #, c-format
 msgid "unknown directive `%s': line ignored"
 msgstr "¾Ë ¼ö ¾ø´Â Áö½ÃÀÚ `%s': Çà ¹«½ÃµÊ"
 
-#: catgets/gencat.c:456
+#: catgets/gencat.c:457
 #, c-format
 msgid "unknown set `%s'"
 msgstr "¾Ë ¼ö ¾ø´Â ¼³Á¤ `%s'"
 
-msgid "unknown signal"
-msgstr "¾Ë ¼ö ¾ø´Â ½ÅÈ£"
-
-#: locale/programs/ld-collate.c:1367 locale/programs/ld-collate.c:1558
-#: locale/programs/ld-collate.c:1732
+#: locale/programs/ld-collate.c:1370 locale/programs/ld-collate.c:1561
+#: locale/programs/ld-collate.c:1735
 #, c-format
 msgid "unknown symbol `%.*s': line ignored"
 msgstr "¾Ë ¼ö ¾ø´Â ±âÈ£ `%.*s': Çà ¹«½ÃµÊ"
 
-#: time/zic.c:751
+#: time/zic.c:747
 msgid "unruly zone"
 msgstr ""
 
-#: catgets/gencat.c:961
+#: catgets/gencat.c:962
 msgid "unterminated message"
 msgstr "Á¾·áµÇÁö ¾ÊÀº ¸Þ½ÃÁö"
 
@@ -2686,7 +2795,7 @@ msgstr "Á¾·áµÇÁö ¾ÊÀº ¹®ÀÚ¿­"
 msgid "unterminated symbolic name"
 msgstr "Á¾·áµÇÁö ¾ÊÀº ±âÈ£ À̸§"
 
-#: locale/programs/ld-collate.c:1685
+#: locale/programs/ld-collate.c:1688
 msgid "unterminated weight name"
 msgstr ""
 
@@ -2694,7 +2803,7 @@ msgstr ""
 msgid "upper limit in range is not smaller then lower limit"
 msgstr "¹üÀ§ÀÇ »óÇÑÀº ÇÏÇѺ¸´Ù ÀÛÁö ¾Ê¾Æ¾ß ÇÕ´Ï´Ù"
 
-#: time/zic.c:2025
+#: time/zic.c:2052
 msgid "use of 2/29 in non leap-year"
 msgstr "Æò³â¿¡ 2¿ù 29ÀÏÀ» »ç¿ëÇÔ"
 
@@ -2708,7 +2817,7 @@ msgstr "%s¿¡ ´ëÇÑ °ªÀº Á¤¼ö¿©¾ß ÇÕ´Ï´Ù"
 msgid "value for <%s> must lie between 1 and 4"
 msgstr "<%s>¿¡ ´ëÇÑ °ªÀº 1°ú 4 »çÀÌ¿¡ ÀÖ¾î¾ß ÇÕ´Ï´Ù"
 
-#: locale/programs/ld-monetary.c:148 locale/programs/ld-numeric.c:89
+#: locale/programs/ld-monetary.c:149 locale/programs/ld-numeric.c:89
 #, c-format
 msgid "value for field `%s' in category `%s' must not be the empty string"
 msgstr ""
@@ -2717,7 +2826,7 @@ msgstr ""
 msgid "value of <mb_cur_max> must be greater than the value of <mb_cur_min>"
 msgstr "<mb_cur_max>ÀÇ °ªÀº <mb_cur_min>ÀÇ °ªº¸´Ù Ä¿¾ß ÇÕ´Ï´Ù"
 
-#: locale/programs/ld-monetary.c:138
+#: locale/programs/ld-monetary.c:139
 msgid ""
 "value of field `int_curr_symbol' in category `LC_MONETARY' does not "
 "correspond to a valid name in ISO 4217"
@@ -2728,12 +2837,12 @@ msgid ""
 "value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"
 msgstr ""
 
-#: locale/programs/ld-monetary.c:370 locale/programs/ld-numeric.c:199
+#: locale/programs/ld-monetary.c:371 locale/programs/ld-numeric.c:199
 #, c-format
 msgid "values for field `%s' in category `%s' must be smaller than 127"
 msgstr ""
 
-#: locale/programs/ld-monetary.c:366
+#: locale/programs/ld-monetary.c:367
 #, c-format
 msgid "values for field `%s' in category `%s' must not be zero"
 msgstr ""
@@ -2742,15 +2851,15 @@ msgstr ""
 msgid "while opening UTMP file"
 msgstr "UTMP ÆÄÀÏÀ» ¿©´Â µ¿¾È"
 
-#: catgets/gencat.c:988
+#: catgets/gencat.c:989
 msgid "while opening old catalog file"
 msgstr "¿À·¡µÈ ¸ñ·Ï ÆÄÀÏÀ» ¿©´Â µ¿¾È"
 
-#: db/makedb.c:353
+#: db/makedb.c:354
 msgid "while reading database"
 msgstr "µ¥ÀÌÅͺ£À̽º¸¦ Àд µ¿¾È"
 
-#: db/makedb.c:315
+#: db/makedb.c:316
 msgid "while writing data base file"
 msgstr "µ¥ÀÌÅÍ º£À̽º ÆÄÀÏÀ» ¾²´Â µ¿¾È"
 
@@ -2758,34 +2867,30 @@ msgstr "µ¥ÀÌÅÍ º£À̽º ÆÄÀÏÀ» ¾²´Â µ¿¾È"
 msgid "wrong number of arguments"
 msgstr "ÀμöÀÇ °³¼ö°¡ À߸øµÇ¾úÀ½"
 
-#: time/zic.c:1077
+#: time/zic.c:1075
 msgid "wrong number of fields on Leap line"
 msgstr ""
 
-#: time/zic.c:1168
+#: time/zic.c:1166
 msgid "wrong number of fields on Link line"
 msgstr ""
 
-#: time/zic.c:911
+#: time/zic.c:909
 msgid "wrong number of fields on Rule line"
 msgstr ""
 
-#: time/zic.c:981
+#: time/zic.c:979
 msgid "wrong number of fields on Zone continuation line"
 msgstr ""
 
-#: time/zic.c:939
+#: time/zic.c:937
 msgid "wrong number of fields on Zone line"
 msgstr ""
 
-#: nis/ypclnt.c:570
-msgid "yp_all: clnttcp_create failed"
-msgstr "yp_all: clnttcp_create ½ÇÆÐ"
-
-#: nis/ypclnt.c:772
+#: nis/ypclnt.c:811
 msgid "yp_update: cannot convert host to netname\n"
 msgstr ""
 
-#: nis/ypclnt.c:784
+#: nis/ypclnt.c:823
 msgid "yp_update: cannot get server address\n"
 msgstr "yp_update: ¼­¹ö ÁÖ¼Ò¸¦ ¾òÀ» ¼ö ¾ø½À´Ï´Ù\n"
diff --git a/posix/Makefile b/posix/Makefile
index 53061c0828..0209274fff 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -22,10 +22,11 @@
 subdir	:= posix
 
 headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
-	   glob.h regex.h wordexp.h fnmatch.h gnu/types.h getopt.h	      \
-	   posix1_lim.h posix2_lim.h posix_opt.h local_lim.h tar.h	      \
-	   utsnamelen.h confname.h waitflags.h waitstatus.h sys/unistd.h      \
-	   sched.h schedbits.h re_comp.h wait.h
+	   glob.h regex.h wordexp.h fnmatch.h bits/types.h getopt.h	      \
+	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h 	      \
+	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
+	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
+	   bits/sched.h re_comp.h wait.h
 
 distribute := confstr.h TESTS TESTS2C.sed testcases.h
 
@@ -59,7 +60,7 @@ before-compile	:= testcases.h
 
 include ../Rules
 
-CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes
+CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes -DDEBUG
 CFLAGS-getaddrinfo.c = -DRESOLVER
 
 $(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
diff --git a/posix/posix1_lim.h b/posix/bits/posix1_lim.h
index a23d224332..29d1acf947 100644
--- a/posix/posix1_lim.h
+++ b/posix/bits/posix1_lim.h
@@ -18,11 +18,12 @@
 
 /*
  *	POSIX Standard: 2.9.2 Minimum Values	Added to <limits.h>
+ *
+ *	Never include this file directly; use <limits.h> instead.
  */
 
-#ifndef	_POSIX1_LIMITS_H
-
-#define	_POSIX1_LIMITS_H	1
+#ifndef	_BITS_POSIX1_LIM_H
+#define	_BITS_POSIX1_LIM_H	1
 
 
 /* These are the standard-mandated minimum values.  */
@@ -89,7 +90,7 @@
 
 
 /* Get the implementation-specific values for the above.  */
-#include <local_lim.h>
+#include <bits/local_lim.h>
 
 
 #ifndef	SSIZE_MAX
@@ -104,4 +105,4 @@
 #define	NGROUPS_MAX	_POSIX_NGROUPS_MAX
 #endif
 
-#endif	/* posix1_limits.h  */
+#endif	/* bits/posix1_lim.h  */
diff --git a/posix/posix2_lim.h b/posix/bits/posix2_lim.h
index 08b1e24b76..d2d89694ec 100644
--- a/posix/posix2_lim.h
+++ b/posix/bits/posix2_lim.h
@@ -16,9 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_POSIX2_LIMITS_H
+/*
+ * Never include this file directly; include <limits.h> instead.
+ */
 
-#define	_POSIX2_LIMITS_H	1
+#ifndef	_BITS_POSIX2_LIM_H
+#define	_BITS_POSIX2_LIM_H	1
 
 
 /* The maximum `ibase' and `obase' values allowed by the `bc' utility.  */
@@ -95,4 +98,4 @@
 #endif
 
 
-#endif	/* posix2_limits.h */
+#endif	/* bits/posix2_lim.h */
diff --git a/posix/fnmatch.h b/posix/fnmatch.h
index e9a065a4c7..58880eceec 100644
--- a/posix/fnmatch.h
+++ b/posix/fnmatch.h
@@ -17,7 +17,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FNMATCH_H
-
 #define	_FNMATCH_H	1
 
 #ifdef	__cplusplus
diff --git a/posix/getopt.h b/posix/getopt.h
index d6ceb0eee1..68958c10bc 100644
--- a/posix/getopt.h
+++ b/posix/getopt.h
@@ -128,4 +128,4 @@ extern int _getopt_internal ();
 }
 #endif
 
-#endif /* _GETOPT_H */
+#endif /* getopt.h */
diff --git a/posix/glob.h b/posix/glob.h
index bfe1c9cd01..db44f7a69c 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_GLOB_H
-
 #define	_GLOB_H	1
 
 #ifdef	__cplusplus
diff --git a/posix/regex.h b/posix/regex.h
index 8e2bd8f394..e9a53d1a9c 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -20,8 +20,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__
+#ifndef _REGEX_H
+#define _REGEX_H 1
 
 /* Allow the use in C++ code.  */
 #ifdef __cplusplus
@@ -524,7 +524,7 @@ extern void regfree _RE_ARGS ((regex_t *preg));
 }
 #endif	/* C++ */
 
-#endif /* not __REGEXP_LIBRARY_H__ */
+#endif /* regex.h */
 
 /*
 Local variables:
diff --git a/posix/sched.h b/posix/sched.h
index 277f93eb52..ae0f634fa4 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -23,11 +23,11 @@
 #include <features.h>
 
 /* Get type definitions.  */
-#include <gnu/types.h>
+#include <bits/types.h>
 #include <sys/time.h>		/* for struct timespec */
 
 /* Get system specific constant and data structure definitions.  */
-#include <schedbits.h>
+#include <bits/sched.h>
 
 __BEGIN_DECLS
 
diff --git a/posix/sys/times.h b/posix/sys/times.h
index eea9e3502c..6f2838d6f1 100644
--- a/posix/sys/times.h
+++ b/posix/sys/times.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_SYS_TIMES_H
-
 #define	_SYS_TIMES_H	1
+
 #include <features.h>
 
 #define	__need_clock_t
diff --git a/posix/sys/types.h b/posix/sys/types.h
index ffeeee1ff0..f49c996a04 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -21,13 +21,13 @@
  */
 
 #ifndef	_SYS_TYPES_H
-
 #define	_SYS_TYPES_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 #ifdef	__USE_BSD
 typedef __u_char u_char;
@@ -80,16 +80,25 @@ typedef unsigned int uint;
 
 #if !defined (__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7
 
+/* These types are defined by the ISO C 9x header <inttypes.h>. */
+#ifndef __int8_t_defined
+#define __int8_t_defined
 typedef	char int8_t;
-typedef	unsigned char u_int8_t;
 typedef	short int int16_t;
-typedef	unsigned short int u_int16_t;
 typedef	int int32_t;
-typedef	unsigned int u_int32_t;
 #ifdef __GNUC__
 typedef long long int int64_t;
+#endif
+#endif
+
+/* But these were defined by ISO C without the first `_'.  */
+typedef	unsigned char u_int8_t;
+typedef	unsigned short int u_int16_t;
+typedef	unsigned int u_int32_t;
+#ifdef __GNUC__
 typedef unsigned long long int u_int64_t;
 #endif
+
 typedef int register_t;
 
 #else
@@ -100,13 +109,17 @@ typedef int register_t;
 #define __u_intN_t(N, MODE) \
   typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
 
+#ifndef __int8_t_defined
+#define __int8_t_defined
 __intN_t (8, __QI__);
-__u_intN_t (8, __QI__);
 __intN_t (16, __HI__);
-__u_intN_t (16, __HI__);
 __intN_t (32, __SI__);
-__u_intN_t (32, __SI__);
 __intN_t (64, __DI__);
+#endif
+
+__u_intN_t (8, __QI__);
+__u_intN_t (16, __HI__);
+__u_intN_t (32, __SI__);
 __u_intN_t (64, __DI__);
 
 typedef int register_t __attribute__ ((__mode__ (__word__)));
diff --git a/posix/sys/utsname.h b/posix/sys/utsname.h
index e9891609bc..bebef5d456 100644
--- a/posix/sys/utsname.h
+++ b/posix/sys/utsname.h
@@ -21,13 +21,14 @@
  */
 
 #ifndef	_SYS_UTSNAME_H
-
 #define	_SYS_UTSNAME_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <utsnamelen.h>
+#include <bits/utsname.h>
+
 #ifndef _UTSNAME_NODENAME_LENGTH
 #define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
 #endif
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index a13b825638..f573d778f7 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -21,17 +21,17 @@
  */
 
 #ifndef	_SYS_WAIT_H
-
 #define	_SYS_WAIT_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* This will define the `W*' macros for the flag
    bits to `waitpid', `wait3', and `wait4'.  */
-#include <waitflags.h>
+#include <bits/waitflags.h>
 
 #ifdef	__USE_BSD
 
@@ -79,7 +79,7 @@ typedef union
 #endif /* Use BSD.  */
 
 /* This will define all the `__W*' macros.  */
-#include <waitstatus.h>
+#include <bits/waitstatus.h>
 
 #define	WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
 #define	WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
diff --git a/posix/tar.h b/posix/tar.h
index fef6413ceb..f8264a0f7f 100644
--- a/posix/tar.h
+++ b/posix/tar.h
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_TAR_H
-
 #define	_TAR_H	1
 
 /* A tar archive consists of 512-byte blocks.
diff --git a/posix/unistd.h b/posix/unistd.h
index 8f1dd35ce1..8593b03349 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_UNISTD_H
-
 #define	_UNISTD_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
@@ -135,7 +135,7 @@ __BEGIN_DECLS
    _POSIX_PRIO_IO		Prioritized Asynchronous I/O may be performed.
    */
 
-#include <posix_opt.h>
+#include <bits/posix_opt.h>
 
 
 /* Standard file descriptors.  */
@@ -146,7 +146,7 @@ __BEGIN_DECLS
 
 /* All functions that are not declared anywhere else.  */
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 #ifndef	ssize_t
 typedef __ssize_t ssize_t;
@@ -392,7 +392,7 @@ extern void _exit __P ((int __status)) __attribute__ ((__noreturn__));
 /* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf';
    the `_SC_*' symbols for the NAME argument to `sysconf';
    and the `_CS_*' symbols for the NAME argument to `confstr'.  */
-#include <confname.h>
+#include <bits/confname.h>
 
 /* Get file-specific configuration information about PATH.  */
 extern long int __pathconf __P ((__const char *__path, int __name));
diff --git a/posix/wordexp.h b/posix/wordexp.h
index a90f022c16..6fa02b78c4 100644
--- a/posix/wordexp.h
+++ b/posix/wordexp.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_WORDEXP_H
-
 #define	_WORDEXP_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
diff --git a/posix1_lim.h b/posix1_lim.h
deleted file mode 100644
index 2999802ec3..0000000000
--- a/posix1_lim.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <posix/posix1_lim.h>
diff --git a/posix2_lim.h b/posix2_lim.h
deleted file mode 100644
index 34c4d90df5..0000000000
--- a/posix2_lim.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <posix/posix2_lim.h>
diff --git a/pwd/fgetpwent.c b/pwd/fgetpwent.c
index 63f62fcf6d..0b5a16941f 100644
--- a/pwd/fgetpwent.c
+++ b/pwd/fgetpwent.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <pwd.h>
 #include <stdlib.h>
 
diff --git a/pwd/pwd.h b/pwd/pwd.h
index e2825d8fc6..1910f07f77 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -21,13 +21,13 @@
  */
 
 #ifndef	_PWD_H
-
 #define	_PWD_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 #define __need_size_t
 #include <stddef.h>
diff --git a/resolv/Makefile b/resolv/Makefile
index 4d11b4d366..f48f841b9a 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -39,7 +39,9 @@ vpath %.c nss_dns
 
 libnss_dns-routines	:= dns-host dns-network
 libnss_dns-map		:= libnss_dns.map
+ifneq ($(build-static-nss),yes)
 libnss_dns-inhibit-o	= $(filter-out .so,$(object-suffixes))
+endif
 
 include ../Rules
 
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index 4db67d0602..34597500ed 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -80,8 +80,8 @@
  *	$Id$
  */
 
-#ifndef _NAMESER_H_
-#define	_NAMESER_H_
+#ifndef _ARPA_NAMESER_H
+#define	_ARPA_NAMESER_H 1
 
 #include <sys/param.h>
 #if (!defined(BSD)) || (BSD < 199306)
@@ -389,4 +389,4 @@ extern	u_int32_t	_getlong __P((const u_char *));
 	(cp) += INT32SZ; \
 }
 
-#endif /* !_NAMESER_H_ */
+#endif /* arpa/nameser.h */
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 8f96528504..c59553c7ed 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -21,8 +21,8 @@
    system calls).  */
 
 #ifndef	_NETDB_H
-
 #define	_NETDB_H	1
+
 #include <features.h>
 
 /* This is necessary to make this include file properly replace the
diff --git a/resolv/resolv.h b/resolv/resolv.h
index b14cda0634..4dae715659 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -58,8 +58,8 @@
  *	$Id$
  */
 
-#ifndef _RESOLV_H_
-#define	_RESOLV_H_
+#ifndef _RESOLV_H
+#define	_RESOLV_H 1
 
 #include <sys/param.h>
 #if (!defined(BSD)) || (BSD < 199306)
@@ -293,4 +293,4 @@ int		res_queriesmatch __P((const u_char *, const u_char *,
 void		res_close __P((void));
 __END_DECLS
 
-#endif /* !_RESOLV_H_ */
+#endif /* resolv.h */
diff --git a/resource/Makefile b/resource/Makefile
index f25ef2e971..38d5a2c379 100644
--- a/resource/Makefile
+++ b/resource/Makefile
@@ -18,7 +18,7 @@
 
 subdir := resource
 
-headers	  := sys/resource.h resourcebits.h sys/vlimit.h sys/vtimes.h
+headers	  := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h
 
 routines := getrlimit setrlimit getrusage ulimit vlimit vtimes \
 	    getpriority setpriority nice
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index 9af9b6a438..e0158767f6 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -17,14 +17,14 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_RESOURCE_H
-
 #define	_SYS_RESOURCE_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
 /* Get the system-dependent definitions of structures and bit values.  */
-#include <resourcebits.h>
+#include <bits/resource.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
@@ -68,4 +68,4 @@ extern int setpriority __P ((enum __priority_which __which, int __who,
 
 __END_DECLS
 
-#endif	/* resource.h  */
+#endif	/* sys/resource.h  */
diff --git a/resource/sys/vlimit.h b/resource/sys/vlimit.h
index 4d07fab713..d66368ab92 100644
--- a/resource/sys/vlimit.h
+++ b/resource/sys/vlimit.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_VLIMIT_H
-
 #define _SYS_VLIMIT_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
@@ -65,4 +65,4 @@ extern int vlimit __P ((enum __vlimit_resource __resource, int __value));
 
 __END_DECLS
 
-#endif /* vlimit.h  */
+#endif /* sys/vlimit.h  */
diff --git a/resource/sys/vtimes.h b/resource/sys/vtimes.h
index 8546327d7c..51117d4108 100644
--- a/resource/sys/vtimes.h
+++ b/resource/sys/vtimes.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_VTIMES_H
-
 #define _SYS_VTIMES_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
diff --git a/setjmp/Makefile b/setjmp/Makefile
index 0825dcfaa3..d9eba8718d 100644
--- a/setjmp/Makefile
+++ b/setjmp/Makefile
@@ -21,7 +21,7 @@
 #
 subdir	:= setjmp
 
-headers	:= setjmp.h jmp_buf.h
+headers	:= setjmp.h bits/setjmp.h
 
 routines	:= setjmp sigjmp bsd-setjmp bsd-_setjmp \
 		   longjmp __longjmp jmp-unwind
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index eb4305f5bd..0bb6fd64ca 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -21,15 +21,14 @@
  */
 
 #ifndef	_SETJMP_H
-
 #define	_SETJMP_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
-/* Get the machine-dependent definition of `__jmp_buf'.  */
-#include <jmp_buf.h>
-#include <sigset.h>		/* Get `__sigset_t'.  */
+#include <bits/setjmp.h>		/* Get `__jmp_buf'.  */
+#include <bits/sigset.h>		/* Get `__sigset_t'.  */
 
 /* Calling environment, plus possibly a saved signal mask.  */
 typedef struct __jmp_buf_tag	/* C++ doesn't like tagless structs.  */
diff --git a/shadow/fgetspent.c b/shadow/fgetspent.c
index bd54c7e595..902c95eb04 100644
--- a/shadow/fgetspent.c
+++ b/shadow/fgetspent.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <shadow.h>
 #include <stdlib.h>
 
diff --git a/shadow/lckpwdf.c b/shadow/lckpwdf.c
index ffe157e119..885ac54bf6 100644
--- a/shadow/lckpwdf.c
+++ b/shadow/lckpwdf.c
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fcntl.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <shadow.h>
 #include <signal.h>
 #include <string.h>
diff --git a/shadow/sgetspent.c b/shadow/sgetspent.c
index ecfe01ed1d..f6818aa6c4 100644
--- a/shadow/sgetspent.c
+++ b/shadow/sgetspent.c
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <shadow.h>
 #include <stdlib.h>
 
diff --git a/shadow/shadow.h b/shadow/shadow.h
index 2bd52d8fbf..d32d440c0a 100644
--- a/shadow/shadow.h
+++ b/shadow/shadow.h
@@ -19,8 +19,8 @@
 /* Declaration of types and functions for shadow password suite.  */
 
 #ifndef _SHADOW_H
-
 #define _SHADOW_H	1
+
 #include <features.h>
 
 #include <paths.h>
diff --git a/signal/Makefile b/signal/Makefile
index a8e26ed239..e35fb12345 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -21,7 +21,8 @@
 #
 subdir	:= signal
 
-headers	:= signal.h sys/signal.h signum.h sigcontext.h sigaction.h sigset.h
+headers	:= signal.h sys/signal.h bits/signum.h bits/sigcontext.h \
+	   bits/sigaction.h bits/sigset.h
 
 routines	:= signal raise killpg \
 		   sigaction sigprocmask kill \
diff --git a/signal/signal.h b/signal/signal.h
index 995567eed8..4e5d857d10 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -29,8 +29,8 @@
 
 __BEGIN_DECLS
 
-#include <gnu/types.h>
-#include <sigset.h>		/* __sigset_t, __sig_atomic_t.  */
+#include <bits/types.h>
+#include <bits/sigset.h>		/* __sigset_t, __sig_atomic_t.  */
 
 #if !defined __sig_atomic_t_defined \
     && (defined _SIGNAL_H || defined __need_sig_atomic_t)
@@ -42,7 +42,7 @@ typedef __sig_atomic_t sig_atomic_t;
 
 #ifdef _SIGNAL_H
 
-#include <signum.h>
+#include <bits/signum.h>
 
 /* Type of a signal handler.  */
 typedef void (*__sighandler_t) __P ((int));
@@ -198,7 +198,7 @@ extern int sigorset __P ((sigset_t *__set, __const sigset_t *__left,
 
 /* Get the system-specific definitions of `struct sigaction'
    and the `SA_*' and `SIG_*'. constants.  */
-#include <sigaction.h>
+#include <bits/sigaction.h>
 
 /* Get and/or change the set of blocked signals.  */
 extern int __sigprocmask __P ((int __how,
@@ -264,7 +264,7 @@ extern int sigvec __P ((int __sig, __const struct sigvec *__vec,
 
 
 /* Get machine-dependent `struct sigcontext' and signal subcodes.  */
-#include <sigcontext.h>
+#include <bits/sigcontext.h>
 
 /* Restore the state saved in SCP.  */
 extern int __sigreturn __P ((struct sigcontext *__scp));
diff --git a/signal/sigsetops.c b/signal/sigsetops.c
index 758ddd1e22..9a3a834d5b 100644
--- a/signal/sigsetops.c
+++ b/signal/sigsetops.c
@@ -1,5 +1,5 @@
 /* Define the real-function versions of all inline functions
-   defined in signal.h (or sigset.h).  */
+   defined in signal.h (or bits/sigset.h).  */
 
 #define _EXTERN_INLINE
 
diff --git a/socket/Makefile b/socket/Makefile
index 3af3dc9d39..1651b75e1c 100644
--- a/socket/Makefile
+++ b/socket/Makefile
@@ -21,7 +21,7 @@
 #
 subdir	:= socket
 
-headers	:= sys/socket.h sys/un.h sockaddrcom.h socketbits.h
+headers	:= sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h
 
 routines := accept bind connect getpeername getsockname getsockopt	\
 	    listen recv recvfrom recvmsg send sendmsg sendto		\
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index bb4444d192..aa2309c013 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_SOCKET_H
-
 #define	_SYS_SOCKET_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
@@ -31,7 +31,7 @@ __BEGIN_DECLS
 /* This operating system-specific header file defines the SOCK_*, PF_*,
    AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
    `struct msghdr', and `struct linger' types.  */
-#include <socketbits.h>
+#include <bits/socket.h>
 
 #ifdef __USE_BSD
 /* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
diff --git a/socket/sys/un.h b/socket/sys/un.h
index 331f49650f..03f36058bf 100644
--- a/socket/sys/un.h
+++ b/socket/sys/un.h
@@ -17,14 +17,14 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_UN_H
-
 #define	_SYS_UN_H	1
+
 #include <sys/cdefs.h>
 
 #include <string.h>		/* For prototype of `strlen'.  */
 
 /* Get the definition of the macro to define the common sockaddr members.  */
-#include <sockaddrcom.h>
+#include <bits/sockaddr.h>
 
 __BEGIN_DECLS
 
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 86c64762f5..95a606230a 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -21,7 +21,7 @@
 #
 subdir	:= stdio-common
 
-headers	:= stdio_lim.h printf.h
+headers	:= bits/stdio_lim.h printf.h
 
 routines	:=							      \
 	ctermid cuserid							      \
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 856c65dbb5..db6f3e4842 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <wchar.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <sys/param.h>
 #include "_itoa.h"
 #include "../locale/localeinfo.h"
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 0b24b8bb52..bce319eeaf 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wctype.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 #ifdef	__GNUC__
 #define	HAVE_LONGLONG
diff --git a/stdio/stdio.h b/stdio/stdio.h
index 7171c094e4..c443ecd795 100644
--- a/stdio/stdio.h
+++ b/stdio/stdio.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
 #define	__gnuc_va_list	__ptr_t
 #endif
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #endif /* Don't need FILE.  */
 #undef	__need_FILE
 
@@ -272,7 +272,7 @@ extern int __stdio_check_offset __P ((FILE *__stream));
    L_cuserid	How long an array to pass to `cuserid'.
    FOPEN_MAX	Minimum number of files that can be open at once.
    FILENAME_MAX	Maximum length of a filename.  */
-#include <stdio_lim.h>
+#include <bits/stdio_lim.h>
 
 
 /* All the known streams are in a linked list
diff --git a/stdlib/alloca.h b/stdlib/alloca.h
index 07e794c292..485994226e 100644
--- a/stdlib/alloca.h
+++ b/stdlib/alloca.h
@@ -18,6 +18,7 @@
 
 #ifndef	_ALLOCA_H
 #define	_ALLOCA_H	1
+
 #include <features.h>
 
 #define	__need_size_t
diff --git a/stdlib/atexit.c b/stdlib/atexit.c
index a49f219158..7205f50dc0 100644
--- a/stdlib/atexit.c
+++ b/stdlib/atexit.c
@@ -16,7 +16,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdlib.h>
 #include "exit.h"
 
diff --git a/stdlib/exit.h b/stdlib/exit.h
index 27120aeaa1..dcaa85a442 100644
--- a/stdlib/exit.h
+++ b/stdlib/exit.h
@@ -17,6 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_EXIT_H
+#define _EXIT_H 1
 
 struct exit_function
   {
diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
index 9ce492bdc4..cbe4291246 100644
--- a/stdlib/fmtmsg.c
+++ b/stdlib/fmtmsg.c
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <fmtmsg.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/stdlib/fmtmsg.h b/stdlib/fmtmsg.h
index 5b477a2ecb..b87644f0ee 100644
--- a/stdlib/fmtmsg.h
+++ b/stdlib/fmtmsg.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef __FMTMSG_H
-
 #define __FMTMSG_H	1
+
 #include <features.h>
 
 #define __need_NULL
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index 17edea57e6..aa9aa63986 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_MONETARY_H
-
 #define	_MONETARY_H	1
+
 #include <features.h>
 
 /* Get needed types.  */
diff --git a/stdlib/random.c b/stdlib/random.c
index 370a6105d5..e2f40c112e 100644
--- a/stdlib/random.c
+++ b/stdlib/random.c
@@ -22,7 +22,7 @@
  * Rewritten to use reentrant functions by Ulrich Drepper, 1995.
  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 40c24eb8f0..7963cb6fec 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_STDLIB_H
-
 #define	_STDLIB_H	1
+
 #include <features.h>
 
 /* Get size_t, wchar_t and NULL from <stddef.h>.  */
diff --git a/string/argz.h b/string/argz.h
index 0126235b8f..71e94c9167 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __ARGZ_H__
+#ifndef _ARGZ_H
+#define _ARGZ_H	1
 
-#define __ARGZ_H__	1
 #include <features.h>
 
 #define __need_error_t
diff --git a/string/endian.h b/string/endian.h
index 593b419637..338c42ec35 100644
--- a/string/endian.h
+++ b/string/endian.h
@@ -18,6 +18,7 @@
 
 #ifndef	_ENDIAN_H
 #define	_ENDIAN_H	1
+
 #include <features.h>
 
 /* Definitions for byte order, according to significance of bytes, from low
@@ -31,7 +32,7 @@
 #define	__PDP_ENDIAN	3412
 
 /* This file defines `__BYTE_ORDER' for the particular machine.  */
-#include <bytesex.h>
+#include <bits/endian.h>
 
 #ifdef	__USE_BSD
 #define	LITTLE_ENDIAN	__LITTLE_ENDIAN
diff --git a/string/envz.h b/string/envz.h
index 23aaed6119..dc6f55725d 100644
--- a/string/envz.h
+++ b/string/envz.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __ENVZ_H__
+#ifndef _ENVZ_H
+#define _ENVZ_H	1
 
-#define __ENVZ_H__	1
 #include <features.h>
 
 #include <errno.h>
@@ -60,4 +60,4 @@ extern void envz_strip __P ((char **__envz, size_t *__envz_len));
 
 __END_DECLS
 
-#endif /* __ENVZ_H__ */
+#endif /* envz.h */
diff --git a/string/memory.h b/string/memory.h
index a7634fe90b..952060d431 100644
--- a/string/memory.h
+++ b/string/memory.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_MEMORY_H
-
 #define	_MEMORY_H	1
+
 #include <features.h>
 
 
diff --git a/string/string.h b/string/string.h
index 24beb6caa2..f790a246f9 100644
--- a/string/string.h
+++ b/string/string.h
@@ -21,8 +21,8 @@
  */
 
 #ifndef	_STRING_H
-
 #define	_STRING_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
diff --git a/string/strings.h b/string/strings.h
index f8ede2966c..701132992a 100644
--- a/string/strings.h
+++ b/string/strings.h
@@ -19,8 +19,8 @@
 /* Compatibility with BSD string(3).  */
 
 #ifndef	_STRINGS_H
-
 #define	_STRINGS_H	1
+
 #include <features.h>
 
 
diff --git a/sunrpc/rpc/auth_unix.h b/sunrpc/rpc/auth_unix.h
index d006f51f72..ed3b9322cb 100644
--- a/sunrpc/rpc/auth_unix.h
+++ b/sunrpc/rpc/auth_unix.h
@@ -43,8 +43,8 @@
  */
 
 #ifndef _RPC_AUTH_UNIX_H
-
 #define _RPC_AUTH_UNIX_H	1
+
 #include <features.h>
 #include <sys/types.h>
 #include <rpc/types.h>
diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h
index 43a599ad25..0991eea937 100644
--- a/sunrpc/rpc/clnt.h
+++ b/sunrpc/rpc/clnt.h
@@ -35,8 +35,8 @@
  */
 
 #ifndef _RPC_CLNT_H
-
 #define _RPC_CLNT_H	1
+
 #include <features.h>
 #include <sys/types.h>
 #include <rpc/types.h>
diff --git a/sunrpc/rpc/netdb.h b/sunrpc/rpc/netdb.h
index 914f825ad4..6b820c84d0 100644
--- a/sunrpc/rpc/netdb.h
+++ b/sunrpc/rpc/netdb.h
@@ -34,8 +34,8 @@
    In GNU this file is #include'd by <netdb.h>.  */
 
 #ifndef _RPC_NETDB_H
-
 #define _RPC_NETDB_H	1
+
 #include <features.h>
 
 #define __need_size_t
diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h
index 45639e7dc4..5d732a1b11 100644
--- a/sunrpc/rpc/pmap_clnt.h
+++ b/sunrpc/rpc/pmap_clnt.h
@@ -37,6 +37,7 @@
 
 #ifndef _RPC_PMAP_CLNT_H
 #define _RPC_PMAP_CLNT_H	1
+
 #include <features.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h>
diff --git a/sunrpc/rpc/pmap_prot.h b/sunrpc/rpc/pmap_prot.h
index 227d1a0619..52185d319a 100644
--- a/sunrpc/rpc/pmap_prot.h
+++ b/sunrpc/rpc/pmap_prot.h
@@ -36,8 +36,8 @@
  */
 
 #ifndef _RPC_PMAP_PROT_H
-
 #define _RPC_PMAP_PROT_H	1
+
 #include <features.h>
 
 #include <rpc/xdr.h>
diff --git a/sunrpc/rpc/pmap_rmt.h b/sunrpc/rpc/pmap_rmt.h
index 6d32045c8e..bb35ad63e1 100644
--- a/sunrpc/rpc/pmap_rmt.h
+++ b/sunrpc/rpc/pmap_rmt.h
@@ -36,8 +36,8 @@
  */
 
 #ifndef _RPC_PMAP_RMT_H
-
 #define _RPC_PMAP_RMT_H	1
+
 #include <features.h>
 #include <sys/types.h>
 #include <rpc/types.h>
diff --git a/sunrpc/rpc/rpc.h b/sunrpc/rpc/rpc.h
index f4328ef26f..a966d2e231 100644
--- a/sunrpc/rpc/rpc.h
+++ b/sunrpc/rpc/rpc.h
@@ -34,8 +34,9 @@
  *
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
-#ifndef __RPC_HEADER__
-#define __RPC_HEADER__
+
+#ifndef _RPC_RPC_H
+#define _RPC_RPC_H 1
 
 #include <rpc/types.h>		/* some typedefs */
 #include <netinet/in.h>
@@ -66,4 +67,4 @@
 /* routines for parsing /etc/rpc */
 #include <rpc/netdb.h>		/* structures and routines to parse /etc/rpc */
 
-#endif /* ndef __RPC_HEADER__ */
+#endif /* rpc/rpc.h */
diff --git a/sunrpc/rpc/rpc_msg.h b/sunrpc/rpc/rpc_msg.h
index 73996169d6..e2908ac9c4 100644
--- a/sunrpc/rpc/rpc_msg.h
+++ b/sunrpc/rpc/rpc_msg.h
@@ -31,6 +31,7 @@
 
 #ifndef _RPC_MSG_H
 #define _RPC_MSG_H 1
+
 #include <sys/cdefs.h>
 
 #include <rpc/xdr.h>
diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h
index f7b05452cc..81366aedb6 100644
--- a/sunrpc/rpc/svc.h
+++ b/sunrpc/rpc/svc.h
@@ -34,8 +34,8 @@
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
-#ifndef __SVC_HEADER__
-#define __SVC_HEADER__
+#ifndef _RPC_SVC_H
+#define _RPC_SVC_H 1
 
 #include <features.h>
 #include <rpc/rpc_msg.h>
@@ -307,4 +307,4 @@ extern SVCXPRT *svctcp_create __P ((int __sock, u_int __sendsize,
 
 __END_DECLS
 
-#endif /* !__SVC_HEADER__ */
+#endif /* rpc/svc.h */
diff --git a/sunrpc/rpc/svc_auth.h b/sunrpc/rpc/svc_auth.h
index 320a03a3bd..ad08b71c7b 100644
--- a/sunrpc/rpc/svc_auth.h
+++ b/sunrpc/rpc/svc_auth.h
@@ -36,8 +36,8 @@
  */
 
 #ifndef _RPC_SVC_AUTH_H
-
 #define _RPC_SVC_AUTH_H	1
+
 #include <features.h>
 #include <rpc/svc.h>
 
diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h
index fbfda1a3db..54673d598b 100644
--- a/sunrpc/rpc/types.h
+++ b/sunrpc/rpc/types.h
@@ -32,8 +32,8 @@
 /*
  * Rpc additions to <sys/types.h>
  */
-#ifndef __TYPES_RPC_HEADER__
-#define __TYPES_RPC_HEADER__
+#ifndef _RPC_TYPES_H
+#define _RPC_TYPES_H 1
 
 typedef int bool_t;
 typedef int enum_t;
@@ -71,4 +71,4 @@ typedef int enum_t;
 #define        MAXHOSTNAMELEN  64
 #endif
 
-#endif /* ndef __TYPES_RPC_HEADER__ */
+#endif /* rpc/types.h */
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index e988896196..d0ab0d0cf6 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -35,9 +35,9 @@
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
-#ifndef __XDR_HEADER__
+#ifndef _RPC_XDR_H
+#define _RPC_XDR_H 1
 
-#define __XDR_HEADER__
 #include <features.h>
 #include <sys/types.h>
 #include <rpc/types.h>
@@ -335,4 +335,4 @@ extern void xdr_free __P ((xdrproc_t __proc, char *__objp));
 
 __END_DECLS
 
-#endif /* !__XDR_HEADER__ */
+#endif /* rpc/xdr.h */
diff --git a/sysdeps/alpha/bytesex.h b/sysdeps/alpha/bits/endian.h
index e873d2123c..e873d2123c 100644
--- a/sysdeps/alpha/bytesex.h
+++ b/sysdeps/alpha/bits/endian.h
diff --git a/sysdeps/alpha/jmp_buf.h b/sysdeps/alpha/bits/setjmp.h
index 6e6f6b4727..6e6f6b4727 100644
--- a/sysdeps/alpha/jmp_buf.h
+++ b/sysdeps/alpha/bits/setjmp.h
diff --git a/sysdeps/alpha/fpu/fenvbits.h b/sysdeps/alpha/fpu/bits/fenv.h
index 02414e4c30..7cb0e3e543 100644
--- a/sysdeps/alpha/fpu/fenvbits.h
+++ b/sysdeps/alpha/fpu/bits/fenv.h
@@ -17,10 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This file should never be included directly.  */
+#ifndef _FENV_H
+#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
 
-#ifndef _FENVBITS_H
-#define _FENVBITS_H	1
 
 /* Define the bits representing the exception.
 
@@ -102,6 +102,3 @@ typedef unsigned long fenv_t;
 /* The system calls to talk to the kernel's FP code.  */
 extern unsigned long __ieee_get_fp_control(void);
 extern void __ieee_set_fp_control(unsigned long);
-
-
-#endif /* fenvbits.h */
diff --git a/sysdeps/alpha/fpu/bits/mathdef.h b/sysdeps/alpha/fpu/bits/mathdef.h
new file mode 100644
index 0000000000..0bc9c94ecc
--- /dev/null
+++ b/sysdeps/alpha/fpu/bits/mathdef.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _MATH_H
+#error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+/* FIXME! This file describes properties of the compiler, not the machine;
+   it should not be part of libc!  */
+
+#ifdef __GNUC__
+#if __STDC__ == 1
+
+/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
+typedef float float_t;
+typedef double double_t;
+
+/* Signal that types stay as they were declared.  */
+#define FLT_EVAL_METHOD	0
+
+/* Define `INFINITY' as value of type `float_t'.  */
+#define INFINITY	HUGE_VALF
+
+#else 
+
+/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
+typedef double float_t;
+typedef double double_t;
+
+/* Signal that both types are `double'.  */
+#define FLT_EVAL_METHOD	1
+
+/* Define `INFINITY' as value of type `float_t'.  */
+#define INFINITY	HUGE_VAL
+
+#endif
+#else
+
+/* Wild guess at types for float_t and double_t. */
+typedef double float_t;
+typedef double double_t;
+
+/* Strange compiler, we don't know how it works.  */
+#define FLT_EVAL_METHOD	-1
+
+/* Define `INFINITY' as value of type `float_t'.  */
+#define INFINITY	HUGE_VAL
+
+#endif
diff --git a/sysdeps/alpha/__math.h b/sysdeps/alpha/fpu/bits/mathinline.h
index 0f76027317..0f76027317 100644
--- a/sysdeps/alpha/__math.h
+++ b/sysdeps/alpha/fpu/bits/mathinline.h
diff --git a/sysdeps/alpha/w_sqrt.S b/sysdeps/alpha/w_sqrt.S
index cf5ae097fd..32b06887d5 100644
--- a/sysdeps/alpha/w_sqrt.S
+++ b/sysdeps/alpha/w_sqrt.S
@@ -25,7 +25,7 @@
 #ifndef _IEEE_FP
 
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 #include <sysdep.h>
 
 	.set noreorder
diff --git a/sysdeps/arm/__longjmp.S b/sysdeps/arm/__longjmp.S
index 5443761f0a..b027103d60 100644
--- a/sysdeps/arm/__longjmp.S
+++ b/sysdeps/arm/__longjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 /* __longjmp(jmpbuf, val) */
 
diff --git a/sysdeps/arm/bytesex.h b/sysdeps/arm/bits/endian.h
index 32f8489df2..32f8489df2 100644
--- a/sysdeps/arm/bytesex.h
+++ b/sysdeps/arm/bits/endian.h
diff --git a/sysdeps/arm/jmp_buf.h b/sysdeps/arm/bits/setjmp.h
index 93b0f5f916..93b0f5f916 100644
--- a/sysdeps/arm/jmp_buf.h
+++ b/sysdeps/arm/bits/setjmp.h
diff --git a/sysdeps/arm/setjmp.S b/sysdeps/arm/setjmp.S
index 5891cb9dec..8f99e4fcb4 100644
--- a/sysdeps/arm/setjmp.S
+++ b/sysdeps/arm/setjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 	/* Binary compatibility entry point.  */
 ENTRY (__setjmp)
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index 5513ca998c..110669ccb5 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -41,7 +41,7 @@ $(objpfx)siglist.c: $(objpfx)make_siglist
 	mv $@-tmp $@
 
 make_siglist-CFLAGS = -DSIGNUM_H=\"$(shell pwd)/$(firstword $(wildcard \
-				   $(+sysdep_dirs:%=%/signum.h)))\"
+				   $(+sysdep_dirs:%=%/bits/signum.h)))\"
 $(objpfx)make_siglist: $(sysdep_dir)/generic/make_siglist.c
 	$(native-compile)
 
diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c
index c1969f4d1f..a38022a1a9 100644
--- a/sysdeps/generic/abort.c
+++ b/sysdeps/generic/abort.c
@@ -16,7 +16,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
new file mode 100644
index 0000000000..5b5cf742b6
--- /dev/null
+++ b/sysdeps/generic/bits/confname.h
@@ -0,0 +1,325 @@
+/* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
+   Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Values for the NAME argument to `pathconf' and `fpathconf'.  */
+enum
+  {
+    _PC_LINK_MAX,
+#define	_PC_LINK_MAX			_PC_LINK_MAX
+    _PC_MAX_CANON,
+#define	_PC_MAX_CANON			_PC_MAX_CANON
+    _PC_MAX_INPUT,
+#define	_PC_MAX_INPUT			_PC_MAX_INPUT
+    _PC_NAME_MAX,
+#define	_PC_NAME_MAX			_PC_NAME_MAX
+    _PC_PATH_MAX,
+#define	_PC_PATH_MAX			_PC_PATH_MAX
+    _PC_PIPE_BUF,
+#define	_PC_PIPE_BUF			_PC_PIPE_BUF
+    _PC_CHOWN_RESTRICTED,
+#define	_PC_CHOWN_RESTRICTED		_PC_CHOWN_RESTRICTED
+    _PC_NO_TRUNC,
+#define	_PC_NO_TRUNC			_PC_NO_TRUNC
+    _PC_VDISABLE,
+    _PC_SYNC_IO,
+#define	_PC_SYNC_IO			_PC_SYNC_IO
+    _PC_ASYNC_IO,
+#define	_PC_ASYNC_IO			_PC_ASYNC_IO
+    _PC_PRIO_IO,
+#define	_PC_PRIO_IO			_PC_PRIO_IO
+    _PC_SOCK_MAXBUF
+#define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
+  };
+
+/* Values for the argument to `sysconf'.  */
+enum
+  {
+    _SC_ARG_MAX,
+#define	_SC_ARG_MAX			_SC_ARG_MAX
+    _SC_CHILD_MAX,
+#define	_SC_CHILD_MAX			_SC_CHILD_MAX
+    _SC_CLK_TCK,
+#define	_SC_CLK_TCK			_SC_CLK_TCK
+    _SC_NGROUPS_MAX,
+#define	_SC_NGROUPS_MAX			_SC_NGROUPS_MAX
+    _SC_OPEN_MAX,
+#define	_SC_OPEN_MAX			_SC_OPEN_MAX
+    _SC_STREAM_MAX,
+#define	_SC_STREAM_MAX			_SC_STREAM_MAX
+    _SC_TZNAME_MAX,
+#define	_SC_TZNAME_MAX			_SC_TZNAME_MAX
+    _SC_JOB_CONTROL,
+#define	_SC_JOB_CONTROL			_SC_JOB_CONTROL
+    _SC_SAVED_IDS,
+#define	_SC_SAVED_IDS			_SC_SAVED_IDS
+    _SC_REALTIME_SIGNALS,
+#define	_SC_REALTIME_SIGNALS		_SC_REALTIME_SIGNALS
+    _SC_PRIORITY_SCHEDULING,
+#define	_SC_PRIORITY_SCHEDULING		_SC_PRIORITY_SCHEDULING
+    _SC_TIMERS,
+#define	_SC_TIMERS			_SC_TIMERS
+    _SC_ASYNCHRONOUS_IO,
+#define	_SC_ASYNCHRONOUS_IO		_SC_ASYNCHRONOUS_IO
+    _SC_PRIORITIZED_IO,
+#define	_SC_PRIORITIZED_IO		_SC_PRIORITIZED_IO
+    _SC_SYNCHRONIZED_IO,
+#define	_SC_SYNCHRONIZED_IO		_SC_SYNCHRONIZED_IO
+    _SC_FSYNC,
+#define	_SC_FSYNC			_SC_FSYNC
+    _SC_MAPPED_FILES,
+#define	_SC_MAPPED_FILES		_SC_MAPPED_FILES
+    _SC_MEMLOCK,
+#define	_SC_MEMLOCK			_SC_MEMLOCK
+    _SC_MEMLOCK_RANGE,
+#define	_SC_MEMLOCK_RANGE		_SC_MEMLOCK_RANGE
+    _SC_MEMORY_PROTECTION,
+#define	_SC_MEMORY_PROTECTION		_SC_MEMORY_PROTECTION
+    _SC_MESSAGE_PASSING,
+#define	_SC_MESSAGE_PASSING		_SC_MESSAGE_PASSING
+    _SC_SEMAPHORES,
+#define	_SC_SEMAPHORES			_SC_SEMAPHORES
+    _SC_SHARED_MEMORY_OBJECTS,
+#define	_SC_SHARED_MEMORY_OBJECTS	_SC_SHARED_MEMORY_OBJECTS
+    _SC_AIO_LISTIO_MAX,
+#define	_SC_AIO_LIST_MAX		_SC_AIO_LIST_MAX
+    _SC_AIO_MAX,
+#define	_SC_AIO_MAX			_SC_AIO_MAX
+    _SC_AIO_PRIO_DELTA_MAX,
+#define	_SC_AIO_PRIO_DELTA_MAX		_SC_AIO_PRIO_DELTA_MAX
+    _SC_DELAYTIMER_MAX,
+#define	_SC_DELAYTIMER_MAX		_SC_DELAYTIMER_MAX
+    _SC_MQ_OPEN_MAX,
+#define	_SC_MQ_OPEN_MAX			_SC_MQ_OPEN_MAX
+    _SC_MQ_PRIO_MAX,
+#define	_SC_MQ_PRIO_MAX			_SC_MQ_PRIO_MAX
+    _SC_VERSION,
+#define	_SC_VERSION			_SC_VERSION
+    _SC_PAGESIZE,
+#define	_SC_PAGESIZE			_SC_PAGESIZE
+#define	_SC_PAGE_SIZE			_SC_PAGESIZE
+    _SC_RTSIG_MAX,
+#define	_SC_RTSIG_MAX			_SC_RTSIG_MAX
+    _SC_SEM_NSEMS_MAX,
+#define	_SC_SEM_NSEMS_MAX		_SC_SEM_NSEMS_MAX
+    _SC_SEM_VALUE_MAX,
+#define	_SC_SEM_VALUE_MAX		_SC_SEM_VALUE_MAX
+    _SC_SIGQUEUE_MAX,
+#define	_SC_SIGQUEUE_MAX		_SC_SIGQUEUE_MAX
+    _SC_TIMER_MAX,
+#define	_SC_TIMER_MAX			_SC_TIMER_MAX
+
+    /* Values for the argument to `sysconf'
+       corresponding to _POSIX2_* symbols.  */
+    _SC_BC_BASE_MAX,
+#define	_SC_BC_BASE_MAX			_SC_BC_BASE_MAX
+    _SC_BC_DIM_MAX,
+#define	_SC_BC_DIM_MAX			_SC_BC_DIM_MAX
+    _SC_BC_SCALE_MAX,
+#define	_SC_BC_SCALE_MAX		_SC_BC_SCALE_MAX
+    _SC_BC_STRING_MAX,
+#define	_SC_BC_STRING_MAX		_SC_BC_STRING_MAX
+    _SC_COLL_WEIGHTS_MAX,
+#define	_SC_COLL_WEIGHTS_MAX		_SC_COLL_WEIGHTS_MAX
+    _SC_EQUIV_CLASS_MAX,
+#define	_SC_EQUIV_CLASS_MAX		_SC_EQUIV_CLASS_MAX
+    _SC_EXPR_NEST_MAX,
+#define	_SC_EXPR_NEST_MAX		_SC_EXPR_NEST_MAX
+    _SC_LINE_MAX,
+#define	_SC_LINE_MAX			_SC_LINE_MAX
+    _SC_RE_DUP_MAX,
+#define	_SC_RE_DUP_MAX			_SC_RE_DUP_MAX
+    _SC_CHARCLASS_NAME_MAX,
+#define	_SC_CHARCLASS_NAME_MAX		_SC_CHARCLASS_NAME_MAX
+
+    _SC_2_VERSION,
+#define	_SC_2_VERSION			_SC_2_VERSION
+    _SC_2_C_BIND,
+#define	_SC_2_C_BIND			_SC_2_C_BIND
+    _SC_2_C_DEV,
+#define	_SC_2_C_DEV			_SC_2_C_DEV
+    _SC_2_FORT_DEV,
+#define	_SC_2_FORT_DEV			_SC_2_FORT_DEV
+    _SC_2_FORT_RUN,
+#define	_SC_2_FORT_RUN			_SC_2_FORT_RUN
+    _SC_2_SW_DEV,
+#define	_SC_2_SW_DEV			_SC_2_SW_DEV
+    _SC_2_LOCALEDEF,
+#define	_SC_2_LOCALEDEF			_SC_2_LOCALEDEF
+
+    _SC_PII,
+#define	_SC_PII				_SC_PII
+    _SC_PII_XTI,
+#define	_SC_PII_XTI			_SC_PII_XTI
+    _SC_PII_SOCKET,
+#define	_SC_PII_SOCKET			_SC_PII_SOCKET
+    _SC_PII_INTERNET,
+#define	_SC_PII_INTERNET		_SC_PII_INTERNET
+    _SC_PII_OSI,
+#define	_SC_PII_OSI			_SC_PII_OSI
+    _SC_POLL,
+#define	_SC_POLL			_SC_POLL
+    _SC_SELECT,
+#define	_SC_SELECT			_SC_SELECT
+    _SC_UIO_MAXIOV,
+#define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
+    _SC_PII_INTERNET_STREAM,
+#define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
+    _SC_PII_INTERNET_DGRAM,
+#define	_SC_PII_INTERNET_DGRAM		_SC_PII_INTERNET_DGRAM
+    _SC_PII_OSI_COTS,
+#define	_SC_PII_OSI_COTS		_SC_PII_OSI_COTS
+    _SC_PII_OSI_CLTS,
+#define	_SC_PII_OSI_CLTS		_SC_PII_OSI_CLTS
+    _SC_PII_OSI_M,
+#define	_SC_PII_OSI_M			_SC_PII_OSI_M
+    _SC_T_IOV_MAX,
+#define	_SC_T_IOV_MAX			_SC_T_IOV_MAX
+
+    /* Values according to POSIX 1003.1c (POSIX threads).  */
+    _SC_THREADS,
+#define	_SC_THREADS			_SC_THREADS
+    _SC_THREAD_SAFE_FUNCTIONS,
+#define _SC_THREAD_SAFE_FUNCTIONS	_SC_THREAD_SAFE_FUNCTIONS
+    _SC_GETGR_R_SIZE_MAX,
+#define	_SC_GETGR_R_SIZE_MAX		_SC_GETGR_R_SIZE_MAX
+    _SC_GETPW_R_SIZE_MAX,
+#define	_SC_GETPW_R_SIZE_MAX		_SC_GETPW_R_SIZE_MAX
+    _SC_LOGIN_NAME_MAX,
+#define	_SC_LOGIN_NAME_MAX		_SC_LOGIN_NAME_MAX
+    _SC_TTY_NAME_MAX,
+#define	_SC_TTY_NAME_MAX		_SC_TTY_NAME_MAX
+    _SC_THREAD_DESTRUCTOR_ITERATIONS,
+#define	_SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
+    _SC_THREAD_KEYS_MAX,
+#define	_SC_THREAD_KEYS_MAX		_SC_THREAD_KEYS_MAX
+    _SC_THREAD_STACK_MIN,
+#define	_SC_THREAD_STACK_MIN		_SC_THREAD_STACK_MIN
+    _SC_THREAD_THREADS_MAX,
+#define	_SC_THREAD_THREADS_MAX		_SC_THREAD_THREADS_MAX
+    _SC_THREAD_ATTR_STACKADDR,
+#define	_SC_THREAD_ATTR_STACKADDR	_SC_THREAD_ATTR_STACKADDR
+    _SC_THREAD_ATTR_STACKSIZE,
+#define	_SC_THREAD_ATTR_STACKSIZE	_SC_THREAD_ATTR_STACKSIZE
+    _SC_THREAD_PRIORITY_SCHEDULING,
+#define	_SC_THREAD_PRIORITY_SCHEDULING	_SC_THREAD_PRIORITY_SCHEDULING
+    _SC_THREAD_PRIO_INHERIT,
+#define	_SC_THREAD_PRIO_INHERIT		_SC_THREAD_PRIO_INHERIT
+    _SC_THREAD_PRIO_PROTECT,
+#define	_SC_THREAD_PRIO_PROTECT		_SC_THREAD_PRIO_PROTECT
+    _SC_THREAD_PROCESS_SHARED,
+#define	_SC_THREAD_PROCESS_SHARED	_SC_THREAD_PROCESS_SHARED
+
+    _SC_NPROCESSORS_CONF,
+#define _SC_NPROCESSORS_CONF		_SC_NPROCESSORS_CONF
+    _SC_NPROCESSORS_ONLN,
+#define _SC_NPROCESSORS_ONLN		_SC_NPROCESSORS_ONLN
+    _SC_PHYS_PAGES,
+#define _SC_PHYS_PAGES			_SC_PHYS_PAGES
+    _SC_AVPHYS_PAGES,
+#define _SC_AVPHYS_PAGES		_SC_AVPHYS_PAGES
+    _SC_ATEXIT_MAX,
+#define _SC_ATEXIT_MAX			_SC_ATEXIT_MAX
+    _SC_PASS_MAX,
+#define _SC_PASS_MAX			_SC_PASS_MAX
+
+    _SC_XOPEN_VERSION,
+#define _SC_XOPEN_VERSION		_SC_XOPEN_VERSION
+    _SC_XOPEN_XCU_VERSION,
+#define _SC_XOPEN_XCU_VERSION		_SC_XOPEN_XCU_VERSION
+    _SC_XOPEN_UNIX,
+#define _SC_XOPEN_UNIX			_SC_XOPEN_UNIX
+    _SC_XOPEN_CRYPT,
+#define _SC_XOPEN_CRYPT			_SC_XOPEN_CRYPT
+    _SC_XOPEN_ENH_I18N,
+#define _SC_XOPEN_ENH_I18N		_SC_XOPEN_ENH_I18N
+    _SC_XOPEN_SHM,
+#define _SC_XOPEN_SHM			_SC_XOPEN_SHM
+
+    _SC_2_CHAR_TERM,
+#define _SC_2_CHAR_TERM			_SC_2_CHAR_TERM
+    _SC_2_C_VERSION,
+#define _SC_2_C_VERSION			_SC_2_C_VERSION
+    _SC_2_UPE,
+#define _SC_2_UPE			_SC_2_UPE
+
+    _SC_XOPEN_XPG2,
+#define _SC_XOPEN_XPG2			_SC_XOPEN_XPG2
+    _SC_XOPEN_XPG3,
+#define _SC_XOPEN_XPG3			_SC_XOPEN_XPG3
+    _SC_XOPEN_XPG4,
+#define _SC_XOPEN_XPG4			_SC_XOPEN_XPG4
+
+    _SC_CHAR_BIT,
+#define	_SC_CHAR_BIT			_SC_CHAR_BIT
+    _SC_CHAR_MAX,
+#define	_SC_CHAR_MAX			_SC_CHAR_MAX
+    _SC_CHAR_MIN,
+#define	_SC_CHAR_MIN			_SC_CHAR_MIN
+    _SC_INT_MAX,
+#define	_SC_INT_MAX			_SC_INT_MAX
+    _SC_INT_MIN,
+#define	_SC_INT_MIN			_SC_INT_MIN
+    _SC_LONG_BIT,
+#define	_SC_LONG_BIT			_SC_LONG_BIT
+    _SC_WORD_BIT,
+#define	_SC_WORD_BIT			_SC_WORD_BIT
+    _SC_MB_LEN_MAX,
+#define	_SC_MB_LEN_MAX			_SC_MB_LEN_MAX
+    _SC_NZERO,
+#define	_SC_NZERO			_SC_NZERO
+    _SC_SSIZE_MAX,
+#define	_SC_SSIZE_MAX			_SC_SSIZE_MAX
+    _SC_SCHAR_MAX,
+#define	_SC_SCHAR_MAX			_SC_SCHAR_MAX
+    _SC_SCHAR_MIN,
+#define	_SC_SCHAR_MIN			_SC_SCHAR_MIN
+    _SC_SHRT_MAX,
+#define	_SC_SHRT_MAX			_SC_SHRT_MAX
+    _SC_SHRT_MIN,
+#define	_SC_SHRT_MIN			_SC_SHRT_MIN
+    _SC_UCHAR_MAX,
+#define	_SC_UCHAR_MAX			_SC_UCHAR_MAX
+    _SC_UINT_MAX,
+#define	_SC_UINT_MAX			_SC_UINT_MAX
+    _SC_ULONG_MAX,
+#define	_SC_ULONG_MAX			_SC_ULONG_MAX
+    _SC_USHRT_MAX,
+#define	_SC_USHRT_MAX			_SC_USHRT_MAX
+
+    _SC_NL_ARGMAX,
+#define	_SC_NL_ARGMAX			_SC_NL_ARGMAX
+    _SC_NL_LANGMAX,
+#define	_SC_NL_LANGMAX			_SC_NL_LANGMAX
+    _SC_NL_MSGMAX,
+#define	_SC_NL_MSGMAX			_SC_NL_MSGMAX
+    _SC_NL_NMAX,
+#define	_SC_NL_NMAX			_SC_NL_NMAX
+    _SC_NL_SETMAX,
+#define	_SC_NL_SETMAX			_SC_NL_SETMAX
+    _SC_NL_TEXTMAX
+#define	_SC_NL_TEXTMAX			_SC_NL_TEXTMAX
+  };
+
+#ifdef __USE_POSIX2
+/* Values for the NAME argument to `confstr'.  */
+enum
+  {
+    _CS_PATH			/* The default search path.  */
+  };
+#endif
diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h
new file mode 100644
index 0000000000..1d5c8a002f
--- /dev/null
+++ b/sysdeps/generic/bits/ioctl-types.h
@@ -0,0 +1,121 @@
+/* Structure types for pre-termios terminal ioctls.  Generic Unix version.
+   Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTL_TYPES_H
+#define _BITS_IOCTL_TYPES_H 1
+
+
+#if	defined(TIOCGETC) || defined(TIOCSETC)
+/* Type of ARG for TIOCGETC and TIOCSETC requests.  */
+struct tchars
+{
+  char t_intrc;			/* Interrupt character.  */
+  char t_quitc;			/* Quit character.  */
+  char t_startc;		/* Start-output character.  */
+  char t_stopc;			/* Stop-output character.  */
+  char t_eofc;			/* End-of-file character.  */
+  char t_brkc;			/* Input delimiter character.  */
+};
+
+#define	_IOT_tchars	/* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (char), 6, 0, 0, 0, 0)
+#endif
+
+#if	defined(TIOCGLTC) || defined(TIOCSLTC)
+/* Type of ARG for TIOCGLTC and TIOCSLTC requests.  */
+struct ltchars
+{
+  char t_suspc;			/* Suspend character.  */
+  char t_dsuspc;		/* Delayed suspend character.  */
+  char t_rprntc;		/* Reprint-line character.  */
+  char t_flushc;		/* Flush-output character.  */
+  char t_werasc;		/* Word-erase character.  */
+  char t_lnextc;		/* Literal-next character.  */
+};
+
+#define	_IOT_ltchars	/* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (char), 6, 0, 0, 0, 0)
+#endif
+
+/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty).  */
+struct sgttyb
+{
+  char sg_ispeed;		/* Input speed.  */
+  char sg_ospeed;		/* Output speed.  */
+  char sg_erase;		/* Erase character.  */
+  char sg_kill;			/* Kill character.  */
+  short int sg_flags;		/* Mode flags.  */
+};
+
+#define	_IOT_sgttyb	/* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
+
+#if	defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
+/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests.  */
+struct winsize
+{
+  unsigned short int ws_row;	/* Rows, in characters.  */
+  unsigned short int ws_col;	/* Columns, in characters.  */
+
+  /* These are not actually used.  */
+  unsigned short int ws_xpixel;	/* Horizontal pixels.  */
+  unsigned short int ws_ypixel;	/* Vertical pixels.  */
+};
+
+#define	_IOT_winsize	/* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
+#endif
+
+#if	defined (TIOCGSIZE) || defined (TIOCSSIZE)
+/* The BSD-style ioctl constructor macros use `sizeof', which can't be used
+   in a preprocessor conditional.  Since the commands are always unique
+   regardless of the size bits, we can safely define away `sizeof' for the
+   purpose of the conditional.  */
+#  define sizeof(type) 0
+#  if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ
+/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
+   compatibility with Sun; they define `struct ttysize' to have identical
+   layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
+   (likewise TIOCSSIZE and TIOCSWINSZ).  */
+struct ttysize
+{
+  unsigned short int ts_lines;
+  unsigned short int ts_cols;
+  unsigned short int ts_xxx;
+  unsigned short int ts_yyy;
+};
+#define	_IOT_ttysize	_IOT_winsize
+#  else
+/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
+   TIOCGWINSZ are separate commands that do the same thing with different
+   structures (likewise TIOCSSIZE and TIOCSWINSZ).  */
+struct ttysize
+{
+  int ts_lines, ts_cols;	/* Lines and columns, in characters.  */
+};
+#  endif
+#  undef sizeof			/* See above.  */
+#endif
+
+
+#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/generic/bits/mathdef.h b/sysdeps/generic/bits/mathdef.h
new file mode 100644
index 0000000000..93b60bd25f
--- /dev/null
+++ b/sysdeps/generic/bits/mathdef.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _MATH_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+
+/* Normally, there is no long double type and the `float' and `double'
+   expressions are evaluated as `double'.  */
+typedef double float_t;		/* `float' expressions are evaluated as
+				   `double'.  */
+typedef double double_t;	/* `double' expressions are evaluated as
+				   `double'.  */
+
+/* Signal that both types are `double'.  */
+#define FLT_EVAL_METHOD	1
+
+/* Define `INFINITY' as value of type `float_t'.  */
+#define INFINITY	HUGE_VAL
+
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+#define FP_ILOGB0	0x80000001
+#define FP_ILOGBNAN	0x7fffffff
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
new file mode 100644
index 0000000000..2c35c12a47
--- /dev/null
+++ b/sysdeps/generic/bits/resource.h
@@ -0,0 +1,146 @@
+/* Bit values & structures for resource limits.  4.4 BSD/generic GNU version.
+   Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
+   subset of these kinds of resource limit.  In systems where `getrlimit'
+   and `setrlimit' are not system calls, these are the values used by the C
+   library to emulate them.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+  {
+    /* Per-process CPU limit, in seconds.  */
+    RLIMIT_CPU,
+#define	RLIMIT_CPU	RLIMIT_CPU
+    /* Largest file that can be created, in bytes.  */
+    RLIMIT_FSIZE,
+#define	RLIMIT_FSIZE	RLIMIT_FSIZE
+    /* Maximum size of data segment, in bytes.  */
+    RLIMIT_DATA,
+#define	RLIMIT_DATA	RLIMIT_DATA
+    /* Maximum size of stack segment, in bytes.  */
+    RLIMIT_STACK,
+#define	RLIMIT_STACK	RLIMIT_STACK
+    /* Largest core file that can be created, in bytes.  */
+    RLIMIT_CORE,
+#define	RLIMIT_CORE	RLIMIT_CORE
+    /* Largest resident set size, in bytes.
+       This affects swapping; processes that are exceeding their
+       resident set size will be more likely to have physical memory
+       taken from them.  */
+    RLIMIT_RSS,
+#define	RLIMIT_RSS	RLIMIT_RSS
+    /* Locked-in-memory address space.  */
+    RLIMIT_MEMLOCK,
+#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
+    /* Number of processes.  */
+    RLIMIT_NPROC,
+#define	RLIMIT_NPROC	RLIMIT_NPROC
+    /* Number of open files.  */
+    RLIMIT_OFILE,
+    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
+#define	RLIMIT_OFILE	RLIMIT_OFILE
+#define	RLIMIT_NOFILE	RLIMIT_NOFILE
+
+    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
+    RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same.  */
+
+    RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit.  */
+#define RLIM_INFINITY RLIM_INFINITY
+  };
+
+struct rlimit
+  {
+    /* The current (soft) limit.  */
+    int rlim_cur;
+    /* The hard limit.  */
+    int rlim_max;
+  };
+
+/* Whose usage statistics do you want?  */
+enum __rusage_who
+/* The macro definitions are necessary because some programs want
+   to test for operating system features with #ifdef RUSAGE_SELF.
+   In ISO C the reflexive definition is a no-op.  */
+  {
+    /* The calling process.  */
+    RUSAGE_SELF = 0,
+#define RUSAGE_SELF     RUSAGE_SELF
+    /* All of its terminated child processes.  */
+    RUSAGE_CHILDREN = -1
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+  };
+
+#include <sys/time.h>           /* For `struct timeval'.  */
+
+/* Structure which says how much of each resource has been used.  */
+struct rusage
+  {
+    /* Total amount of user time used.  */
+    struct timeval ru_utime;
+    /* Total amount of system time used.  */
+    struct timeval ru_stime;
+    /* Maximum resident set size (in kilobytes).  */
+    long int ru_maxrss;
+    /* Amount of sharing of text segment memory
+       with other processes (kilobyte-seconds).  */
+    long int ru_ixrss;
+    /* Amount of data segment memory used (kilobyte-seconds).  */
+    long int ru_idrss;
+    /* Amount of stack memory used (kilobyte-seconds).  */
+    long int ru_isrss;
+    /* Number of soft page faults (i.e. those serviced by reclaiming
+       a page from the list of pages awaiting reallocation.  */
+    long int ru_minflt;
+    /* Number of hard page faults (i.e. those that required I/O).  */
+    long int ru_majflt;
+    /* Number of times a process was swapped out of physical memory.  */
+    long int ru_nswap;
+    /* Number of input operations via the file system.  Note: This
+       and `ru_oublock' do not include operations with the cache.  */
+    long int ru_inblock;
+    /* Number of output operations via the file system.  */
+    long int ru_oublock;
+    /* Number of IPC messages sent.  */
+    long int ru_msgsnd;
+    /* Number of IPC messages received.  */
+    long int ru_msgrcv;
+    /* Number of signals delivered.  */
+    long int ru_nsignals;
+    /* Number of voluntary context switches, i.e. because the process
+       gave up the process before it had to (usually to wait for some
+       resource to be available).  */
+    long int ru_nvcsw;
+    /* Number of involuntary context switches, i.e. a higher priority process
+       became runnable or the current process used up its time slice.  */
+    long int ru_nivcsw;
+  };
+
+/* Priority limits.  */
+#define PRIO_MIN        -20     /* Minimum priority a process can have.  */
+#define PRIO_MAX        20      /* Maximum priority a process can have.  */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+   indicating what flavor of entity the WHO argument specifies.  */
+enum __priority_which
+  {
+    PRIO_PROCESS = 0,           /* WHO is a process ID.  */
+    PRIO_PGRP = 1,              /* WHO is a process group ID.  */
+    PRIO_USER = 2               /* WHO is a user ID.  */
+  };
diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h
new file mode 100644
index 0000000000..bb5da5676f
--- /dev/null
+++ b/sysdeps/generic/bits/sched.h
@@ -0,0 +1,35 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+   scheduling interface.
+   Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, write to the Free Software Foundation, Inc., 59 Temple Place
+   Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _SCHED_H
+#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+#endif
+
+
+/* Scheduling algorithms.  */
+#define SCHED_OTHER	0
+#define SCHED_FIFO	1
+#define SCHED_RR	2
+
+/* Data structure to describe a process' schedulability.  */
+struct sched_param
+{
+  int sched_priority;
+};
diff --git a/sysdeps/generic/bits/select.h b/sysdeps/generic/bits/select.h
new file mode 100644
index 0000000000..613919577c
--- /dev/null
+++ b/sysdeps/generic/bits/select.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SELECT_H
+#error "Never use <bits/select.h> directly; include <sys/select.h> instead."
+#endif
+
+
+/* This line MUST be split!  Otherwise m4 will not change it.  */
+#define __FD_ZERO(set)  \
+  ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set)))
+#define __FD_SET(d, set)	((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#define __FD_CLR(d, set)	((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#define __FD_ISSET(d, set)	((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h
new file mode 100644
index 0000000000..1676b1ce8e
--- /dev/null
+++ b/sysdeps/generic/bits/sigaction.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* These definitions match those used by the 4.4 BSD kernel.
+   If the operating system has a `sigaction' system call that correctly
+   implements the POSIX.1 behavior, there should be a system-dependent
+   version of this file that defines `struct sigaction' and the `SA_*'
+   constants appropriately.  */
+
+/* Structure describing the action to be taken when a signal arrives.  */
+struct sigaction
+  {
+    /* Signal handler.  */
+    __sighandler_t sa_handler;
+
+    /* Additional set of signals to be blocked.  */
+    __sigset_t sa_mask;
+
+    /* Special flags.  */
+    int sa_flags;
+  };
+
+/* Bits in `sa_flags'.  */
+#ifdef	__USE_BSD
+#define	SA_ONSTACK	0x1	/* Take signal on signal stack.  */
+#define	SA_RESTART	0x2	/* Don't restart syscall on signal return.  */
+#define	SA_DISABLE	0x4	/* Disable alternate signal stack.  */
+#endif
+#define	SA_NOCLDSTOP	0x8	/* Don't send SIGCHLD when children stop.  */
+
+
+/* Values for the HOW argument to `sigprocmask'.  */
+#define	SIG_BLOCK	1	/* Block signals.  */
+#define	SIG_UNBLOCK	2	/* Unblock signals.  */
+#define	SIG_SETMASK	3	/* Set the set of blocked signals.  */
diff --git a/sysdeps/generic/bits/sigset.h b/sysdeps/generic/bits/sigset.h
new file mode 100644
index 0000000000..9fad4538d7
--- /dev/null
+++ b/sysdeps/generic/bits/sigset.h
@@ -0,0 +1,81 @@
+/* __sig_atomic_t, __sigset_t, and related definitions.  Generic/BSD version.
+   Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef	_SIGSET_H_types
+#define	_SIGSET_H_types	1
+
+typedef int __sig_atomic_t;
+
+/* A `sigset_t' has a bit for each signal.  */
+typedef unsigned long int __sigset_t;
+
+#endif
+
+
+/* We only want to define these functions if <signal.h> was actually
+   included; otherwise we were included just to define the types.  Since we
+   are namespace-clean, it wouldn't hurt to define extra macros.  But
+   trouble can be caused by functions being defined (e.g., any global
+   register vars declared later will cause compilation errors).  */
+
+#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H)
+#define _SIGSET_H_fns 1
+
+#ifndef _EXTERN_INLINE
+#define _EXTERN_INLINE extern __inline
+#endif
+
+/* Return a mask that includes SIG only.  The cast to `sigset_t' avoids
+   overflow if `sigset_t' is wider than `int'.  */
+#define	__sigmask(sig)	(((__sigset_t) 1) << ((sig) - 1))
+
+#define	__sigemptyset(set)	((*(set) = (__sigset_t) 0), 0)
+#define	__sigfillset(set)	((*(set) = ~(__sigset_t) 0), 0)
+
+#ifdef _GNU_SOURCE
+# define __sigisemptyset(set)	(*(set) == (__sigset_t) 0)
+# define __sigandset(dest, left, right) \
+				((*(dest) = (*(left) & *(right))), 0)
+# define __sigorset(dest, left, right) \
+				((*(dest) = (*(left) | *(right))), 0)
+#endif
+
+/* These functions needn't check for a bogus signal number -- error
+   checking is done in the non __ versions.  */
+
+extern int __sigismember (__const __sigset_t *, int);
+extern int __sigaddset (__sigset_t *, int);
+extern int __sigdelset (__sigset_t *, int);
+
+#define __SIGSETFN(NAME, BODY, CONST)					      \
+  _EXTERN_INLINE int							      \
+  NAME (CONST __sigset_t *__set, int __sig)				      \
+  {									      \
+    __sigset_t __mask = __sigmask (__sig);				      \
+    return BODY;							      \
+  }
+
+__SIGSETFN (__sigismember, (*__set & __mask) ? 1 : 0, __const)
+__SIGSETFN (__sigaddset, ((*__set |= __mask), 0), )
+__SIGSETFN (__sigdelset, ((*__set &= ~__mask), 0), )
+
+#undef __SIGSETFN
+
+
+#endif /* ! _SIGSET_H_fns.  */
diff --git a/sysdeps/generic/bits/sockaddr.h b/sysdeps/generic/bits/sockaddr.h
new file mode 100644
index 0000000000..73a0e26ec4
--- /dev/null
+++ b/sysdeps/generic/bits/sockaddr.h
@@ -0,0 +1,41 @@
+/* Definition of `struct sockaddr_*' common members.  Generic/4.2 BSD version.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/socket.h> instead.
+ */
+
+#ifndef _BITS_SOCKADDR_H
+#define _BITS_SOCKADDR_H	1
+
+
+/* POSIX.1g specifies this type name for the `sa_family' member.  */
+typedef unsigned short int sa_family_t;
+
+/* This macro is used to declare the initial common members
+   of the data types used for socket addresses, `struct sockaddr',
+   `struct sockaddr_in', `struct sockaddr_un', etc.  */
+
+#define	__SOCKADDR_COMMON(sa_prefix) \
+  sa_family_t sa_prefix##family
+
+#define __SOCKADDR_COMMON_SIZE	(sizeof (unsigned short int))
+
+
+#endif	/* bits/sockaddr.h */
diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h
new file mode 100644
index 0000000000..d12d96cc14
--- /dev/null
+++ b/sysdeps/generic/bits/socket.h
@@ -0,0 +1,200 @@
+/* System-specific socket constants and types.  Generic/4.3 BSD version.
+   Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SOCKET_H
+#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define	__need_size_t
+#include <stddef.h>
+
+
+/* Types of sockets.  */
+enum __socket_type
+{
+  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
+				   byte streams.  */
+#define SOCK_STREAM SOCK_STREAM
+  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
+				   of fixed maximum length.  */
+#define SOCK_DGRAM SOCK_DGRAM
+  SOCK_RAW = 3,			/* Raw protocol interface.  */
+#define SOCK_RAW SOCK_RAW
+  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
+#define SOCK_RDM SOCK_RDM
+  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
+				   datagrams of fixed maximum length.  */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+};
+
+/* Protocol families.  */
+#define	PF_UNSPEC	0	/* Unspecified.  */
+#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
+#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
+#define	PF_FILE		PF_LOCAL /* POSIX name for PF_LOCAL.  */
+#define	PF_INET		2	/* IP protocol family.  */
+#define	PF_IMPLINK	3	/* ARPAnet IMP protocol.  */
+#define	PF_PUP		4	/* PUP protocols.  */
+#define	PF_CHAOS	5	/* MIT Chaos protocols.  */
+#define	PF_NS		6	/* Xerox NS protocols.  */
+#define	PF_ISO		7	/* ISO protocols.  */
+#define	PF_OSI		PF_ISO
+#define	PF_ECMA		8	/* ECMA protocols.  */
+#define	PF_DATAKIT	9	/* AT&T Datakit protocols.  */
+#define	PF_CCITT	10	/* CCITT protocols (X.25 et al).  */
+#define	PF_SNA		11	/* IBM SNA protocol.  */
+#define	PF_DECnet	12	/* DECnet protocols.  */
+#define	PF_DLI		13	/* Direct data link interface.  */
+#define	PF_LAT		14	/* DEC Local Area Transport protocol.  */
+#define	PF_HYLINK	15	/* NSC Hyperchannel protocol.  */
+#define	PF_APPLETALK	16	/* Don't use this.  */
+#define	PF_ROUTE	17	/* Internal Routing Protocol.  */
+#define	PF_LINK		18	/* Link layer interface.  */
+#define	PF_XTP		19	/* eXpress Transfer Protocol (no AF).  */
+#define	PF_COIP		20	/* Connection-oriented IP, aka ST II.  */
+#define	PF_CNT		21	/* Computer Network Technology.  */
+#define PF_RTIP		22	/* Help Identify RTIP packets.  **/
+#define	PF_IPX		23	/* Novell Internet Protocol.  */
+#define	PF_SIP		24	/* Simple Internet Protocol.  */
+#define PF_PIP		25	/* Help Identify PIP packets.  */
+#define PF_INET6	26	/* IP version 6.  */
+#define	PF_MAX		27
+
+/* Address families.  */
+#define	AF_UNSPEC	PF_UNSPEC
+#define	AF_LOCAL	PF_LOCAL
+#define	AF_UNIX		PF_UNIX
+#define	AF_FILE		PF_FILE
+#define	AF_INET		PF_INET
+#define	AF_IMPLINK	PF_IMPLINK
+#define	AF_PUP		PF_PUP
+#define	AF_CHAOS	PF_CHAOS
+#define	AF_NS		PF_NS
+#define	AF_ISO		PF_ISO
+#define	AF_OSI		PF_OSI
+#define	AF_ECMA		PF_ECMA
+#define	AF_DATAKIT	PF_DATAKIT
+#define	AF_CCITT	PF_CCITT
+#define	AF_SNA		PF_SNA
+#define	AF_DECnet	PF_DECnet
+#define	AF_DLI		PF_DLI
+#define	AF_LAT		PF_LAT
+#define	AF_HYLINK	PF_HYLINK
+#define	AF_APPLETALK	PF_APPLETALK
+#define	AF_ROUTE	PF_ROUTE
+#define	AF_LINK		PF_LINK
+#define	pseudo_AF_XTP	PF_XTP
+#define	AF_COIP		PF_COIP
+#define	AF_CNT		PF_CNT
+#define pseudo_AF_RTIP	PF_RTIP
+#define	AF_IPX		PF_IPX
+#define	AF_SIP		PF_SIP
+#define pseudo_AF_PIP	PF_PIP
+#define AF_INET6	PF_INET6
+#define	AF_MAX		PF_MAX
+
+
+/* Get the definition of the macro to define the common sockaddr members.  */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address.  */
+struct sockaddr
+  {
+    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
+    char sa_data[14];		/* Address data.  */
+  };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al.  */
+enum
+  {
+    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
+    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
+    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
+    MSG_EOR		= 0x08,	/* Data completes record.  */
+    MSG_TRUNC		= 0x10,	/* Data discarded before delivery.  */
+    MSG_CTRUNC		= 0x20,	/* Control data lost before delivery.  */
+    MSG_WAITALL		= 0x40,	/* Wait for full request or error.  */
+    MSG_DONTWAIT	= 0x80,	/* This message should be nonblocking.  */
+  };
+
+
+/* Structure describing messages sent by
+   `sendmsg' and received by `recvmsg'.  */
+struct msghdr
+  {
+    __ptr_t msg_name;		/* Address to send to/receive from.  */
+    size_t msg_namelen;		/* Length of address data.  */
+
+    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+    size_t msg_iovlen;		/* Number of elements in the vector.  */
+
+    __ptr_t msg_accrights;	/* Access rights information.  */
+    size_t msg_accrightslen;	/* Length of access rights information.  */
+  };
+
+
+/* Protocol number used to manipulate socket-level options
+   with `getsockopt' and `setsockopt'.  */
+#define	SOL_SOCKET	0xffff
+
+/* Socket-level options for `getsockopt' and `setsockopt'.  */
+enum
+  {
+    SO_DEBUG = 0x0001,		/* Record debugging information.  */
+    SO_ACCEPTCONN = 0x0002,	/* Accept connections on socket.  */
+    SO_REUSEADDR = 0x0004,	/* Allow reuse of local addresses.  */
+    SO_KEEPALIVE = 0x0008,	/* Keep connections alive and send
+				   SIGPIPE when they die.  */
+    SO_DONTROUTE = 0x0010,	/* Don't do local routing.  */
+    SO_BROADCAST = 0x0020,	/* Allow transmission of
+				   broadcast messages.  */
+    SO_USELOOPBACK = 0x0040,	/* Use the software loopback to avoid
+				   hardware use when possible.  */
+    SO_LINGER = 0x0080,		/* Block on close of a reliable
+				   socket to transmit pending data.  */
+    SO_OOBINLINE = 0x0100,	/* Receive out-of-band data in-band.  */
+
+    SO_REUSEPORT = 0x0200,	/* Allow local address and port reuse.  */
+
+    SO_SNDBUF = 0x1001,		/* Send buffer size.  */
+    SO_RCVBUF = 0x1002,		/* Receive buffer.  */
+    SO_SNDLOWAT = 0x1003,	/* Send low-water mark.  */
+    SO_RCVLOWAT = 0x1004,	/* Receive low-water mark.  */
+    SO_SNDTIMEO = 0x1005,	/* Send timeout.  */
+    SO_RCVTIMEO = 0x1006,	/* Receive timeout.  */
+
+    SO_ERROR = 0x1007,		/* Get and clear error status.  */
+    SO_STYLE = 0x1008,		/* Get socket connection style.  */
+    SO_TYPE = SO_STYLE,		/* Compatible name for SO_STYLE.  */
+  };
+
+/* Structure used to manipulate the SO_LINGER option.  */
+struct linger
+  {
+    int l_onoff;		/* Nonzero to linger on close.  */
+    int l_linger;		/* Time to linger.  */
+  };
+
+__END_DECLS
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
new file mode 100644
index 0000000000..10bc0728b2
--- /dev/null
+++ b/sysdeps/generic/bits/statfs.h
@@ -0,0 +1,52 @@
+/* Definition of `struct statfs', information about a filesystem.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/statfs.h> instead.
+ */
+
+#ifndef	_BITS_STATFS_H
+#define	_BITS_STATFS_H	1
+
+#include <bits/types.h>
+
+/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
+   <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC.  MiG
+   does not cope at all well with the passed C structure not being of the
+   expected size.  There are some filler words at the end to allow for
+   future expansion.  To increase the size of the structure used in the RPC
+   and retain binary compatibility, we would need to assign a new message
+   number.  */
+
+struct statfs
+  {
+    unsigned int f_type;
+    unsigned int f_bsize;
+    unsigned int f_blocks;
+    unsigned int f_bfree;
+    unsigned int f_bavail;
+    unsigned int f_files;
+    unsigned int f_ffree;
+    __fsid_t f_fsid;
+    unsigned int f_namelen;
+    unsigned int f_spare[6];
+  };
+
+
+#endif /* bits/statfs.h */
diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h
new file mode 100644
index 0000000000..9a6aed2bba
--- /dev/null
+++ b/sysdeps/generic/bits/termios.h
@@ -0,0 +1,230 @@
+/* termios type and macro definitions.  4.4 BSD/generic GNU version.
+   Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* These macros are also defined in some <bits/ioctls.h> files (with
+   numerically identical values), but this serves to shut up cpp's
+   complaining. */
+#ifdef __USE_BSD
+
+#ifdef MDMBUF
+#undef MDMBUF
+#endif
+#ifdef FLUSHO
+#undef FLUSHO
+#endif
+#ifdef PENDIN
+#undef PENDIN
+#endif
+
+#endif /* __USE_BSD */
+
+#ifdef ECHO
+#undef ECHO
+#endif
+#ifdef TOSTOP
+#undef TOSTOP
+#endif
+#ifdef NOFLSH
+#undef NOFLSH
+#endif
+
+
+/* These definitions match those used by the 4.4 BSD kernel.
+   If the operating system has termios system calls or ioctls that
+   correctly implement the POSIX.1 behavior, there should be a
+   system-dependent version of this file that defines `struct termios',
+   `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately.  */
+
+/* Type of terminal control flag masks.  */
+typedef unsigned long int tcflag_t;
+
+/* Type of control characters.  */
+typedef unsigned char cc_t;
+
+/* Type of baud rate specifiers.  */
+typedef long int speed_t;
+
+/* Terminal control structure.  */
+struct termios
+{
+  /* Input modes.  */
+  tcflag_t c_iflag;
+#define	IGNBRK	(1 << 0)	/* Ignore break condition.  */
+#define	BRKINT	(1 << 1)	/* Signal interrupt on break.  */
+#define	IGNPAR	(1 << 2)	/* Ignore characters with parity errors.  */
+#define	PARMRK	(1 << 3)	/* Mark parity and framing errors.  */
+#define	INPCK	(1 << 4)	/* Enable input parity check.  */
+#define	ISTRIP	(1 << 5)	/* Strip 8th bit off characters.  */
+#define	INLCR	(1 << 6)	/* Map NL to CR on input.  */
+#define	IGNCR	(1 << 7)	/* Ignore CR.  */
+#define	ICRNL	(1 << 8)	/* Map CR to NL on input.  */
+#define	IXON	(1 << 9)	/* Enable start/stop output control.  */
+#define	IXOFF	(1 << 10)	/* Enable start/stop input control.  */
+#ifdef	__USE_BSD
+#define	IXANY	(1 << 11)	/* Any character will restart after stop.  */
+#define	IMAXBEL	(1 << 13)	/* Ring bell when input queue is full.  */
+#endif
+
+  /* Output modes.  */
+  tcflag_t c_oflag;
+#define	OPOST	(1 << 0)	/* Perform output processing.  */
+#ifdef	__USE_BSD
+#define	ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
+#define	OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
+#define	ONOEOT	(1 << 8)	/* Discard EOT (^D) on output.  */
+#endif
+
+  /* Control modes.  */
+  tcflag_t c_cflag;
+#ifdef	__USE_BSD
+#define	CIGNORE	(1 << 0)	/* Ignore these control flags.  */
+#endif
+#define	CSIZE	(CS5|CS6|CS7|CS8)	/* Number of bits per byte (mask).  */
+#define	CS5	0		/* 5 bits per byte.  */
+#define	CS6	(1 << 8)	/* 6 bits per byte.  */
+#define	CS7	(1 << 9)	/* 7 bits per byte.  */
+#define	CS8	(CS6|CS7)	/* 8 bits per byte.  */
+#define	CSTOPB	(1 << 10)	/* Two stop bits instead of one.  */
+#define	CREAD	(1 << 11)	/* Enable receiver.  */
+#define	PARENB	(1 << 12)	/* Parity enable.  */
+#define	PARODD	(1 << 13)	/* Odd parity instead of even.  */
+#define	HUPCL	(1 << 14)	/* Hang up on last close.  */
+#define	CLOCAL	(1 << 15)	/* Ignore modem status lines.  */
+#ifdef	__USE_BSD
+#define	CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
+#define	CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
+#define	MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
+#endif
+
+  /* Local modes.  */
+  tcflag_t c_lflag;
+#ifdef	__USE_BSD
+#define	ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
+#endif
+#define	_ECHOE	(1 << 1)	/* Visual erase for ERASE.  */
+#define	ECHOE	_ECHOE
+#define	_ECHOK	(1 << 2)	/* Echo NL after KILL.  */
+#define	ECHOK	_ECHOK
+#define	_ECHO	(1 << 3)	/* Enable echo.  */
+#define	ECHO	_ECHO
+#define	_ECHONL	(1 << 4)	/* Echo NL even if ECHO is off.  */
+#define	ECHONL	_ECHONL
+#ifdef	__USE_BSD
+#define	ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
+#define	ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
+#endif
+#define	_ISIG	(1 << 7)	/* Enable signals.  */
+#define	ISIG	_ISIG
+#define	_ICANON	(1 << 8)	/* Do erase and kill processing.  */
+#define	ICANON	_ICANON
+#ifdef	__USE_BSD
+#define	ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
+#endif
+#define	_IEXTEN	(1 << 10)	/* Enable DISCARD and LNEXT.  */
+#define	IEXTEN	_IEXTEN
+#define	EXTPROC	(1 << 11)	/* External processing.  */
+#define	_TOSTOP	(1 << 22)	/* Send SIGTTOU for background output.  */
+#define	TOSTOP	_TOSTOP
+#ifdef	__USE_BSD
+#define	FLUSHO	(1 << 23)	/* Output being flushed (state).  */
+#define	NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
+#define	PENDIN	(1 << 29)	/* Retype pending input (state).  */
+#endif
+#define	_NOFLSH	(1 << 31)	/* Disable flush after interrupt.  */
+#define	NOFLSH	_NOFLSH
+
+  /* Control characters.  */
+#define	VEOF	0		/* End-of-file character [ICANON].  */
+#define	VEOL	1		/* End-of-line character [ICANON].  */
+#ifdef	__USE_BSD
+#define	VEOL2	2		/* Second EOL character [ICANON].  */
+#endif
+#define	VERASE	3		/* Erase character [ICANON].  */
+#ifdef	__USE_BSD
+#define	VWERASE	4		/* Word-erase character [ICANON].  */
+#endif
+#define	VKILL	5		/* Kill-line character [ICANON].  */
+#ifdef	__USE_BSD
+#define	VREPRINT 6		/* Reprint-line character [ICANON].  */
+#endif
+#define	VINTR	8		/* Interrupt character [ISIG].  */
+#define	VQUIT	9		/* Quit character [ISIG].  */
+#define	VSUSP	10		/* Suspend character [ISIG].  */
+#ifdef	__USE_BSD
+#define	VDSUSP	11		/* Delayed suspend character [ISIG].  */
+#endif
+#define	VSTART	12		/* Start (X-ON) character [IXON, IXOFF].  */
+#define	VSTOP	13		/* Stop (X-OFF) character [IXON, IXOFF].  */
+#ifdef	__USE_BSD
+#define	VLNEXT	14		/* Literal-next character [IEXTEN].  */
+#define	VDISCARD 15		/* Discard character [IEXTEN].  */
+#endif
+#define	VMIN	16		/* Minimum number of bytes read at once [!ICANON].  */
+#define	VTIME	17		/* Time-out value (tenths of a second) [!ICANON].  */
+#ifdef	__USE_BSD
+#define	VSTATUS	18		/* Status character [ICANON].  */
+#endif
+#define	NCCS	20		/* Value duplicated in <hurd/tioctl.defs>.  */
+  cc_t c_cc[NCCS];
+
+  /* Input and output baud rates.  */
+  speed_t __ispeed, __ospeed;
+#define	B0	0		/* Hang up.  */
+#define	B50	50		/* 50 baud.  */
+#define	B75	75		/* 75 baud.  */
+#define	B110	110		/* 110 baud.  */
+#define	B134	134		/* 134.5 baud.  */
+#define	B150	150		/* 150 baud.  */
+#define	B200	200		/* 200 baud.  */
+#define	B300	300		/* 300 baud.  */
+#define	B600	600		/* 600 baud.  */
+#define	B1200	1200		/* 1200 baud.  */
+#define	B1800	1800		/* 1800 baud.  */
+#define	B2400	2400		/* 2400 baud.  */
+#define	B4800	4800		/* 4800 baud.  */
+#define	B9600	9600		/* 9600 baud.  */
+#define	B19200	19200		/* 19200 baud.  */
+#define	B38400	38400		/* 38400 baud.  */
+#ifdef	__USE_BSD
+#define	EXTA	19200
+#define	EXTB	38400
+#endif
+};
+
+#define _IOT_termios /* Hurd ioctl type field.  */ \
+  _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
+#define	TCSANOW		0	/* Change immediately.  */
+#define	TCSADRAIN	1	/* Change when pending output is written.  */
+#define	TCSAFLUSH	2	/* Flush pending input before changing.  */
+#ifdef	__USE_BSD
+#define	TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
+#endif
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
+#define	TCIFLUSH	1	/* Discard data received but not yet read.  */
+#define	TCOFLUSH	2	/* Discard data written but not yet sent.  */
+#define	TCIOFLUSH	3	/* Discard all pending data.  */
+
+/* Values for the ACTION argument to `tcflow'.  */
+#define	TCOOFF	1		/* Suspend output.  */
+#define	TCOON	2		/* Restart suspended output.  */
+#define	TCIOFF	3		/* Send a STOP character.  */
+#define	TCION	4		/* Send a START character.  */
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
new file mode 100644
index 0000000000..c264adc917
--- /dev/null
+++ b/sysdeps/generic/bits/types.h
@@ -0,0 +1,94 @@
+/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
+
+
+/* Convenience types.  */
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long __u_long;
+#ifdef __GNUC__
+typedef unsigned long long int __u_quad_t;
+typedef long long int __quad_t;
+#else
+typedef struct
+{
+  long __val[2];
+} __quad_t;
+typedef struct
+{
+  __u_long __val[2];
+} __u_quad_t;
+#endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+typedef signed long long int __int64_t;
+typedef unsigned long long int __uint64_t;
+#endif
+typedef __quad_t *__qaddr_t;
+typedef int __dev_t;		/* Type of device numbers.  */
+typedef unsigned int __uid_t;	/* Type of user identifications.  */
+typedef unsigned int __gid_t;	/* Type of group identifications.  */
+typedef unsigned int __ino_t;	/* Type of file serial numbers.  */
+typedef unsigned int __mode_t;	/* Type of file attribute bitmasks.  */
+typedef unsigned short int __nlink_t; /* Type of file link counts.  */
+typedef long int __off_t;	/* Type of file sizes and offsets.  */
+typedef __quad_t __loff_t;	/* Type of file sizes and offsets.  */
+typedef int __pid_t;		/* Type of process identifications.  */
+typedef int __ssize_t;		/* Type of a byte count, or error.  */
+typedef __u_quad_t __fsid_t;	/* Type of file system IDs.  */
+typedef long int __clock_t;	/* Type of CPU usage counts.  */
+
+/* Everythin' else.  */
+typedef long int __daddr_t;	/* The type of a disk address.  */
+typedef char *__caddr_t;
+typedef long int __time_t;
+typedef long int __swblk_t;	/* Type of a swap block maybe?  */
+typedef long int __key_t;	/* Type of an IPC key */
+
+/* fd_set for select.  */
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE	256
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
+#define	__NFDBITS	(sizeof (unsigned long int) * 8)
+#define	__FDELT(d)	((d) / __NFDBITS)
+#define	__FDMASK(d)	(1 << ((d) % __NFDBITS))
+
+typedef struct
+  {
+    /* XPG4.2 requires this member name.  */
+    unsigned long int fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS];
+  } __fd_set;
+
+typedef unsigned long int __fd_mask;
+
+#endif /* bits/types.h */
diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h
new file mode 100644
index 0000000000..1a12697008
--- /dev/null
+++ b/sysdeps/generic/bits/uio.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_UIO_H
+#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+#endif
+
+
+/* `struct iovec' -- Structure describing a section of memory.  */
+
+struct iovec
+{
+  /* Starting address.  */
+  __ptr_t iov_base;
+  /* Length in bytes.  */
+  size_t iov_len;
+};
diff --git a/sysdeps/generic/schedbits.h b/sysdeps/generic/bits/ustat.h
index e2cb00e842..aa5d493e63 100644
--- a/sysdeps/generic/schedbits.h
+++ b/sysdeps/generic/bits/ustat.h
@@ -1,6 +1,5 @@
-/* Definitions of constants and data structure for POSIX 1003.1b-1993
-   scheduling interface.
-Copyright (C) 1996 Free Software Foundation, Inc.
+/* Generic declaration of ustat structure.
+Copyright (C) 1994, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -15,21 +14,17 @@ Library General Public License for more details.
 
 You should have received a copy of the GNU Library General Public
 License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
 
-#ifndef	_SCHEDBITS_H
-#define	_SCHEDBITS_H	1
+__BEGIN_DECLS
 
-/* Scheduling algorithms.  */
-#define SCHED_OTHER	0
-#define SCHED_FIFO	1
-#define SCHED_RR	2
-
-/* Data structure to describe a process' schedulability.  */
-struct sched_param
+struct ustat
 {
-  int sched_priority;
+  __daddr_t f_tfree;	/* total free */
+  __ino_t f_tinode;	/* total inodes free */
+  char f_fname[6];	/* filesystem name */
+  char f_fpack[6];	/* filesystem pack name */
 };
 
-#endif /* schedbits.h */
+__END_DECLS
diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h
new file mode 100644
index 0000000000..b8decb0598
--- /dev/null
+++ b/sysdeps/generic/bits/utmp.h
@@ -0,0 +1,53 @@
+/* The `struct utmp' type, describing entries in the utmp file.  Generic/BSDish
+   Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _UTMP_H
+#error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+#endif
+
+
+#include <features.h>
+
+#include <paths.h>
+#include <time.h>
+
+
+#define	UT_NAMESIZE	8
+#define	UT_LINESIZE	8
+#define	UT_HOSTSIZE	16
+
+__BEGIN_DECLS
+
+struct lastlog {
+	time_t	ll_time;
+	char	ll_line[UT_LINESIZE];
+	char	ll_host[UT_HOSTSIZE];
+};
+
+struct utmp {
+	char	ut_line[UT_LINESIZE];
+	char	ut_name[UT_NAMESIZE];
+	char	ut_host[UT_HOSTSIZE];
+	long	ut_time;
+};
+
+
+#define _HAVE_UT_HOST 1		/* We have the ut_host field.  */
+
+
+__END_DECLS
diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h
new file mode 100644
index 0000000000..5594bcc4da
--- /dev/null
+++ b/sysdeps/generic/bits/utsname.h
@@ -0,0 +1,3 @@
+/* The size of the character arrays used to hold the information
+   in a `struct utsname'.  Enlarge this as necessary.  */
+#define	_UTSNAME_LENGTH	1024
diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h
new file mode 100644
index 0000000000..8e97f2702c
--- /dev/null
+++ b/sysdeps/generic/bits/waitstatus.h
@@ -0,0 +1,104 @@
+/* Definitions of status bits for `wait' et al.
+   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead."
+#endif
+
+
+/* Everything extant so far uses these same bits.  */
+
+
+/* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
+#define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
+
+/* If WIFSIGNALED(STATUS), the terminating signal.  */
+#define	__WTERMSIG(status)	((status) & 0x7f)
+
+/* If WIFSTOPPED(STATUS), the signal that stopped the child.  */
+#define	__WSTOPSIG(status)	__WEXITSTATUS(status)
+
+/* Nonzero if STATUS indicates normal termination.  */
+#define	__WIFEXITED(status)	(__WTERMSIG(status) == 0)
+
+/* Nonzero if STATUS indicates termination by a signal.  */
+#ifdef	__GNUC__
+#define	__WIFSIGNALED(status)						      \
+  (__extension__ ({ int __status = (status);				      \
+		    !__WIFSTOPPED(__status) && !__WIFEXITED(__status); }))
+#else	/* Not GCC.  */
+#define	__WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
+#endif	/* GCC.  */
+
+/* Nonzero if STATUS indicates the child is stopped.  */
+#define	__WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
+
+/* Nonzero if STATUS indicates the child dumped core.  */
+#define	__WCOREDUMP(status)	((status) & __WCOREFLAG)
+
+/* Macros for constructing status values.  */
+#define	__W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
+#define	__W_STOPCODE(sig)	((sig) << 8 | 0x7f)
+#define	__WCOREFLAG		0x80
+
+
+#ifdef	__USE_BSD
+
+#include <endian.h>
+
+union wait
+  {
+    int w_status;
+    struct
+      {
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int __w_termsig:7; /* Terminating signal.  */
+	unsigned int __w_coredump:1; /* Set if dumped core.  */
+	unsigned int __w_retcode:8; /* Return code if exited normally.  */
+	unsigned int:16;
+#endif				/* Little endian.  */
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int:16;
+	unsigned int __w_retcode:8;
+	unsigned int __w_coredump:1;
+	unsigned int __w_termsig:7;
+#endif				/* Big endian.  */
+      } __wait_terminated;
+    struct
+      {
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
+	unsigned int __w_stopsig:8; /* Stopping signal.  */
+	unsigned int:16;
+#endif				/* Little endian.  */
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int:16;
+	unsigned int __w_stopsig:8; /* Stopping signal.  */
+	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
+#endif				/* Big endian.  */
+      } __wait_stopped;
+  };
+
+#define	w_termsig	__wait_terminated.__w_termsig
+#define	w_coredump	__wait_terminated.__w_coredump
+#define	w_retcode	__wait_terminated.__w_retcode
+#define	w_stopsig	__wait_stopped.__w_stopsig
+#define	w_stopval	__wait_stopped.__w_stopval
+
+#endif	/* Use BSD.  */
diff --git a/sysdeps/generic/iovec.h b/sysdeps/generic/iovec.h
deleted file mode 100644
index 307fc6a18a..0000000000
--- a/sysdeps/generic/iovec.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* `struct iovec' -- Structure describing a section of memory.  */
-
-struct iovec
-{
-  /* Starting address.  */
-  __ptr_t iov_base;
-  /* Length in bytes.  */
-  size_t iov_len;
-};
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index a119c629f7..84615a5714 100644
--- a/sysdeps/generic/netinet/ip.h
+++ b/sysdeps/generic/netinet/ip.h
@@ -36,7 +36,7 @@
 #ifndef _NETINET_IP_H
 #define _NETINET_IP_H
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #include <endian.h>
 #include <netinet/in.h>
 
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index 11b5906a9d..e740fa9eef 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -47,7 +47,7 @@ extern char **environ;
 
 #if _LIBC
 /* This lock protects against simultaneous modifications of `environ'.  */
-# include <libc-lock.h>
+# include <bits/libc-lock.h>
 __libc_lock_define_initialized (static, envlock)
 # define LOCK	__libc_lock_lock (envlock)
 # define UNLOCK	__libc_lock_unlock (envlock)
diff --git a/sysdeps/generic/statfsbuf.h b/sysdeps/generic/statfsbuf.h
deleted file mode 100644
index e5c2dd7f77..0000000000
--- a/sysdeps/generic/statfsbuf.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Definition of `struct statfs', information about a filesystem.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#ifndef	_STATFSBUF_H
-
-#define	_STATFSBUF_H	1
-
-#include <gnu/types.h>
-
-/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
-   <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC.  MiG
-   does not cope at all well with the passed C structure not being of the
-   expected size.  There are some filler words at the end to allow for
-   future expansion.  To increase the size of the structure used in the RPC
-   and retain binary compatibility, we would need to assign a new message
-   number.  */
-
-struct statfs
-  {
-    unsigned int f_type;
-    unsigned int f_bsize;
-    unsigned int f_blocks;
-    unsigned int f_bfree;
-    unsigned int f_bavail;
-    unsigned int f_files;
-    unsigned int f_ffree;
-    __fsid_t f_fsid;
-    unsigned int f_namelen;
-    unsigned int f_spare[6];
-  };
-
-
-#endif /* statfsbuf.h */
diff --git a/sysdeps/generic/sys/mman.h b/sysdeps/generic/sys/mman.h
index 32b152e124..9c2a1b62ce 100644
--- a/sysdeps/generic/sys/mman.h
+++ b/sysdeps/generic/sys/mman.h
@@ -26,7 +26,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/gnu/utmpbits.h b/sysdeps/gnu/bits/utmp.h
index db49ac845c..db49ac845c 100644
--- a/sysdeps/gnu/utmpbits.h
+++ b/sysdeps/gnu/bits/utmp.h
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index f6331d496d..0ec5d26a38 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 ENTRY (__longjmp)
 	movl 4(%esp), %ecx	/* User's jmp_buf in %ecx.  */
diff --git a/sysdeps/i386/bytesex.h b/sysdeps/i386/bits/endian.h
index a5d6c5ea92..a5d6c5ea92 100644
--- a/sysdeps/i386/bytesex.h
+++ b/sysdeps/i386/bits/endian.h
diff --git a/sysdeps/i386/huge_val.h b/sysdeps/i386/bits/huge_val.h
index fa071452fb..65a06d8f3c 100644
--- a/sysdeps/i386/huge_val.h
+++ b/sysdeps/i386/bits/huge_val.h
@@ -18,8 +18,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	   _HUGE_VAL_H
-#define	   _HUGE_VAL_H	1
+#ifndef _MATH_H
+#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
 
 #include <features.h>
 #include <sys/cdefs.h>
@@ -66,5 +68,3 @@ static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
 #endif	/* GCC.  */
 
 #endif	/* __USE_ISOC9X.  */
-
-#endif	   /* huge_val.h */
diff --git a/sysdeps/i386/selectbits.h b/sysdeps/i386/bits/select.h
index 973ecad58e..3912515a7f 100644
--- a/sysdeps/i386/selectbits.h
+++ b/sysdeps/i386/bits/select.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SELECTBITS_H
-#define _SELECTBITS_H	1
+#ifndef _SYS_SELECT_H
+#error "Never use <bits/select.h> directly; include <sys/select.h> instead."
+#endif
+
 
 #if defined __GNUC__ && __GNUC__ >= 2
 
@@ -53,5 +55,3 @@
 #define __FD_ISSET(d, set)	((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
 
 #endif	/* GNU CC */
-
-#endif /* selectbits.h */
diff --git a/sysdeps/i386/jmp_buf.h b/sysdeps/i386/bits/setjmp.h
index 0c03073b36..0c03073b36 100644
--- a/sysdeps/i386/jmp_buf.h
+++ b/sysdeps/i386/bits/setjmp.h
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 6efa32bcd1..64d36ca1a9 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -263,6 +263,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
       switch (ELF32_R_TYPE (reloc->r_info))
 	{
 	case R_386_COPY:
+	  if (sym == NULL)
+	    /* This can happen in trace mode if an object could not be
+	       found.  */
+	    break;
 	  if (sym->st_size > refsym->st_size
 	      || (_dl_verbose && sym->st_size < refsym->st_size))
 	    {
diff --git a/sysdeps/i386/fpu/fenvbits.h b/sysdeps/i386/fpu/bits/fenv.h
index bea89a15b1..63f3e52958 100644
--- a/sysdeps/i386/fpu/fenvbits.h
+++ b/sysdeps/i386/fpu/bits/fenv.h
@@ -16,10 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This file should never be included directly.  */
+#ifndef _FENV_H
+#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
 
-#ifndef _FENVBITS_H
-#define _FENVBITS_H	1
 
 /* Define bits representing the exception.  We use the bit positions
    of the appropriate bits in the FPU control word.  */
@@ -87,5 +87,3 @@ fenv_t;
 /* Floating-point environment where none of the exception is masked.  */
 # define FE_NOMASK_ENV	((fenv_t *) -2)
 #endif
-
-#endif /* fenvbits.h */
diff --git a/sysdeps/i386/fpu/mathbits.h b/sysdeps/i386/fpu/bits/mathdef.h
index f4a22c0757..2387a39510 100644
--- a/sysdeps/i386/fpu/mathbits.h
+++ b/sysdeps/i386/fpu/bits/mathdef.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _MATHBITS_H
-#define _MATHBITS_H	1
+#ifndef _MATH_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
 
 /* The ix87 FPUs evaluate all values in the 80 bit floating-point format
    which is also available for the user as `long double'.  Therefore
@@ -37,5 +39,3 @@ typedef long double double_t;	/* `double' expressions are evaluated as
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 #define FP_ILOGB0	0x80000000
 #define FP_ILOGBNAN	0x80000000
-
-#endif /* mathbits.h */
diff --git a/sysdeps/i386/fpu/__math.h b/sysdeps/i386/fpu/bits/mathinline.h
index 9e1c23cec0..d5c480a51a 100644
--- a/sysdeps/i386/fpu/__math.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -18,8 +18,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef __MATH_H
-#define __MATH_H	1
+#ifndef _BITS_MATHINLINE_H
+#define _BITS_MATHINLINE_H	1
 
 #if defined __GNUG__ && \
     (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7))
@@ -605,4 +605,4 @@ pow2 (double __x)
 #endif /* __NO_MATH_INLINES  */
 #endif /* __GNUC__  */
 
-#endif /* __MATH_H  */
+#endif /* _BITS_MATHINLINE_H  */
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 203c2d16d0..1ba3fc5a75 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 	/* Binary compatibility entry point.  */
 ENTRY (__setjmp)
diff --git a/sysdeps/ieee754/huge_val.h b/sysdeps/ieee754/bits/huge_val.h
index a2520859e4..fe0144c734 100644
--- a/sysdeps/ieee754/huge_val.h
+++ b/sysdeps/ieee754/bits/huge_val.h
@@ -18,12 +18,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	   _HUGE_VAL_H
-#define	   _HUGE_VAL_H	1
+#ifndef _MATH_H
+#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
 
 #include <features.h>
-#include <sys/cdefs.h>
-#include <endian.h>
 
 /* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
 
@@ -36,6 +36,9 @@
 
 #else /* not GCC */
 
+#include <sys/cdefs.h>
+#include <endian.h>
+
 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
 
 #if __BYTE_ORDER == __BIG_ENDIAN
@@ -84,5 +87,3 @@ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
 #define HUGE_VALL HUGE_VAL
 
 #endif /* __USE_ISOC9X.  */
-
-#endif /* huge_val.h */
diff --git a/sysdeps/ieee754/nan.h b/sysdeps/ieee754/bits/nan.h
index 499edbac8c..94988ced9c 100644
--- a/sysdeps/ieee754/nan.h
+++ b/sysdeps/ieee754/bits/nan.h
@@ -17,42 +17,43 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_NAN_H
+#ifndef _MATH_H
+# error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
 
-#define	_NAN_H	1
 
 /* IEEE Not A Number.  */
 
 #ifdef	__GNUC__
 
-#define NAN                                                                 \
+# define NAN                                                                 \
   (__extension__                                                            \
    ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
     { __l: 0x7ff8000000000000ULL }).__d)
 
-#define NANF                                                                \
+# define NANF                                                                \
   (__extension__                                                            \
    ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \
     { __l: 0x7fc00000UL }).__d)
 
 #else
 
-#include <endian.h>
+# include <endian.h>
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__nan_bytes		{ 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
-#define	__nanf_bytes		{ 0x7f, 0xc0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__nan_bytes		{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
-#define	__nanf_bytes		{ 0, 0, 0xc0, 0x7f }
-#endif
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define __nan_bytes		{ 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
+#  define __nanf_bytes		{ 0x7f, 0xc0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __nan_bytes		{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
+#  define __nanf_bytes		{ 0, 0, 0xc0, 0x7f }
+# endif
 
 static union { unsigned char __c[8]; double __d; } __nan = { __nan_bytes };
-#define	NAN	(__nan.__d)
+# define NAN	(__nan.__d)
 
 static union { unsigned char __c[4]; double __d; } __nanf = { __nanf_bytes };
-#define	NANF	(__nanf.__d)
+# define NANF	(__nanf.__d)
 
 #endif	/* GCC.  */
 
@@ -60,5 +61,3 @@ static union { unsigned char __c[4]; double __d; } __nanf = { __nanf_bytes };
    same as `double'.  */
 
 #define NANL  NAN
-
-#endif	/* nan.h */
diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c
index ada1df1a99..d1f82747f6 100644
--- a/sysdeps/libm-ieee754/k_standard.c
+++ b/sysdeps/libm-ieee754/k_standard.c
@@ -117,7 +117,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    (void) WRITE2("acos: DOMAIN error\n", 19);
 		  }
@@ -137,7 +137,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = NAN;
 		if(_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 		    	(void) WRITE2("asin: DOMAIN error\n", 19);
 		  }
@@ -157,7 +157,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = HUGE;
 		if(_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if(_LIB_VERSION == _SVID_) {
 			(void) WRITE2("atan2: DOMAIN error\n", 20);
 		      }
@@ -177,7 +177,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -194,7 +194,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -211,7 +211,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -225,7 +225,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = zero;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -241,7 +241,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -260,7 +260,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
 		      }
@@ -279,7 +279,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -298,7 +298,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
 		      }
@@ -317,7 +317,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -336,7 +336,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
 		      }
@@ -356,7 +356,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 			__set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         __set_errno (ERANGE);
 		}
 		break;
@@ -373,7 +373,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("lgamma: SING error\n", 19);
 		      }
@@ -392,7 +392,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: SING error\n", 16);
 		      }
@@ -411,7 +411,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log: DOMAIN error\n", 18);
 		      }
@@ -431,7 +431,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: SING error\n", 18);
 		      }
@@ -451,7 +451,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("log10: DOMAIN error\n", 20);
 		      }
@@ -467,7 +467,7 @@ static double zero = 0.0;	/* used as const */
 		exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
 		exc.retval = zero;
 		if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			(void) WRITE2("pow(0,0): DOMAIN error\n", 23);
 			__set_errno (EDOM);
 		}
@@ -489,7 +489,7 @@ static double zero = 0.0;	/* used as const */
 		}
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -502,7 +502,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval =  zero;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -518,7 +518,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
 		      }
@@ -537,7 +537,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
 		      }
@@ -556,7 +556,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;	/* X/Open allow NaN */
 		if (_LIB_VERSION == _POSIX_)
 		   __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
 		      }
@@ -576,7 +576,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL);
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -593,7 +593,7 @@ static double zero = 0.0;	/* used as const */
 		  exc.retval = zero/zero;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("sqrt: DOMAIN error\n", 19);
 		      }
@@ -613,7 +613,7 @@ static double zero = 0.0;	/* used as const */
 		    exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   __set_errno (EDOM);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("fmod:  DOMAIN error\n", 20);
                   }
@@ -631,7 +631,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   __set_errno (EDOM);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("remainder: DOMAIN error\n", 24);
                   }
@@ -648,7 +648,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   __set_errno (EDOM);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("acosh: DOMAIN error\n", 20);
                   }
@@ -665,7 +665,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero/zero;
                 if (_LIB_VERSION == _POSIX_)
                   __set_errno (EDOM);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: DOMAIN error\n", 20);
                   }
@@ -682,7 +682,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x/zero;	/* sign(x)*inf */
                 if (_LIB_VERSION == _POSIX_)
                   __set_errno (EDOM);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   if (_LIB_VERSION == _SVID_) {
                     (void) WRITE2("atanh: SING error\n", 18);
                   }
@@ -699,7 +699,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -713,7 +713,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = __copysign(zero,x);
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (ERANGE);
 		}
 		break;
@@ -726,7 +726,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -743,7 +743,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -760,7 +760,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -777,7 +777,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -794,7 +794,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -811,7 +811,7 @@ static double zero = 0.0;	/* used as const */
                 exc.retval = zero;
                 if (_LIB_VERSION == _POSIX_)
                         __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                         if (_LIB_VERSION == _SVID_) {
                                 (void) WRITE2(exc.name, 2);
                                 (void) WRITE2(": TLOSS error\n", 14);
@@ -832,7 +832,7 @@ static double zero = 0.0;	/* used as const */
                   exc.retval = HUGE_VAL;
                 if (_LIB_VERSION == _POSIX_)
 		  __set_errno (ERANGE);
-                else if (!__matherr(&exc)) {
+                else if (!matherr(&exc)) {
                   __set_errno (ERANGE);
                 }
 		break;
@@ -846,10 +846,10 @@ static double zero = 0.0;	/* used as const */
                 if (_LIB_VERSION == _SVID_)
                   exc.retval = HUGE;
                 else
-                  exc.retval = HUGE_VAL;
+                  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("gamma: SING error\n", 18);
 		      }
@@ -866,7 +866,7 @@ static double zero = 0.0;	/* used as const */
 		exc.retval = x;
 		if (_LIB_VERSION == _IEEE_ ||
 		    _LIB_VERSION == _POSIX_) exc.retval = 1.0;
-		else if (!__matherr(&exc)) {
+		else if (!matherr(&exc)) {
 			__set_errno (EDOM);
 		}
 		break;
diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c
index 87a3408c3f..5c3f27a8c1 100644
--- a/sysdeps/libm-ieee754/w_gamma.c
+++ b/sysdeps/libm-ieee754/w_gamma.c
@@ -29,14 +29,14 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
 	double x;
 #endif
 {
-	int signgam;
         double y;
 	if (_LIB_VERSION == _SVID_)
 	  y = __ieee754_lgamma_r(x,&signgam);
 	else
 	  {
-	    y = __ieee754_gamma_r(x,&signgam);
-	    if (signgam < 0) y = -y;
+	    int local_signgam;
+	    y = __ieee754_gamma_r(x,&local_signgam);
+	    if (local_signgam < 0) y = -y;
 #ifdef _IEEE_LIBM
 	    return y;
 #else
diff --git a/sysdeps/libm-ieee754/w_gammaf.c b/sysdeps/libm-ieee754/w_gammaf.c
index ecde183824..5988e54a60 100644
--- a/sysdeps/libm-ieee754/w_gammaf.c
+++ b/sysdeps/libm-ieee754/w_gammaf.c
@@ -27,14 +27,14 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
 	float x;
 #endif
 {
-	int signgam;
         float y;
 	if (_LIB_VERSION == _SVID_)
 	  y = __ieee754_lgammaf_r(x,&signgam);
 	else
 	  {
-	    y = __ieee754_gammaf_r(x,&signgam);
-	    if (signgam < 0) y = -y;
+	    int local_signgam;
+	    y = __ieee754_gammaf_r(x,&local_signgam);
+	    if (local_signgam < 0) y = -y;
 #ifdef _IEEE_LIBM
 	    return y;
 #else
diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c
index 605a4167c4..0107d551b7 100644
--- a/sysdeps/libm-ieee754/w_gammal.c
+++ b/sysdeps/libm-ieee754/w_gammal.c
@@ -33,13 +33,13 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 {
         long double y;
-	int signgam;
 	if (_LIB_VERSION == _SVID_)
 	  y = __ieee754_lgammal_r(x,&signgam);
 	else
 	  {
-	    y = __ieee754_gammal_r(x,&signgam);
-	    if (signgam < 0) y = -y;
+	    int local_signgam;
+	    y = __ieee754_gammal_r(x,&local_signgam);
+	    if (local_signgam < 0) y = -y;
 #ifdef _IEEE_LIBM
 	    return y;
 #else
diff --git a/sysdeps/m68k/bytesex.h b/sysdeps/m68k/bits/endian.h
index 6f985293f2..6f985293f2 100644
--- a/sysdeps/m68k/bytesex.h
+++ b/sysdeps/m68k/bits/endian.h
diff --git a/sysdeps/m68k/huge_val.h b/sysdeps/m68k/bits/huge_val.h
index c71454e9a8..822b82930b 100644
--- a/sysdeps/m68k/huge_val.h
+++ b/sysdeps/m68k/bits/huge_val.h
@@ -18,8 +18,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	   _HUGE_VAL_H
-#define	   _HUGE_VAL_H	1
+#ifndef _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
 
 #include <features.h>
 #include <sys/cdefs.h>
@@ -28,7 +30,7 @@
 
 #ifdef	__GNUC__
 
-#define HUGE_VAL					\
+# define HUGE_VAL					\
   (__extension__					\
    ((union { unsigned long long __l; double __d; })	\
     { __l: 0x7ff0000000000000ULL }).__d)
@@ -37,7 +39,7 @@
 
 static union { unsigned char __c[8]; double __d; } __huge_val =
   { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
-#define	HUGE_VAL	(__huge_val.__d)
+# define HUGE_VAL	(__huge_val.__d)
 
 #endif	/* GCC.  */
 
@@ -46,30 +48,28 @@ static union { unsigned char __c[8]; double __d; } __huge_val =
 
 #ifdef __USE_ISOC9X
 
-#ifdef __GNUC__
+# ifdef __GNUC__
 
-#define HUGE_VALF					\
+#  define HUGE_VALF					\
   (__extension__					\
    ((union { unsigned long __l; float __f; })		\
     { __l: 0x7f800000UL }).__f)
 
-#define HUGE_VALL					\
+#  define HUGE_VALL					\
   (__extension__					\
    ((union { unsigned long __l[3]; long double __ld; })	\
     { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
 
-#else /* not GCC */
+# else /* not GCC */
 
 static union { unsigned char __c[4]; float __f; } __huge_valf =
   { { 0x7f, 0x80, 0, 0 } };
-#define	HUGE_VALF	(__huge_valf.__f)
+#  define HUGE_VALF	(__huge_valf.__f)
 
 static union { unsigned char __c[12]; long double __ld; } __huge_vall =
   { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
-#define	HUGE_VALL	(__huge_vall.__ld)
+#  define HUGE_VALL	(__huge_vall.__ld)
 
-#endif	/* GCC.  */
+# endif	/* GCC.  */
 
 #endif	/* __USE_ISOC9X.  */
-
-#endif	   /* huge_val.h */
diff --git a/sysdeps/m68k/jmp_buf.h b/sysdeps/m68k/bits/setjmp.h
index 96240f0d8e..96240f0d8e 100644
--- a/sysdeps/m68k/jmp_buf.h
+++ b/sysdeps/m68k/bits/setjmp.h
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 1523ddb1c6..e50f773614 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -227,6 +227,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       switch (ELF32_R_TYPE (reloc->r_info))
 	{
 	case R_68K_COPY:
+	  if (sym == NULL)
+	    /* This can happen in trace mode if an object could not be
+	       found.  */
+	    break;
 	  if (sym->st_size > refsym->st_size
 	      || (_dl_verbose && sym->st_size < refsym->st_size))
 	    {
diff --git a/sysdeps/m68k/fpu/fenvbits.h b/sysdeps/m68k/fpu/bits/fenv.h
index b653b1aafd..ce071b93ff 100644
--- a/sysdeps/m68k/fpu/fenvbits.h
+++ b/sysdeps/m68k/fpu/bits/fenv.h
@@ -16,10 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This file should never be included directly.  */
+#ifndef _FENV_H
+#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
 
-#ifndef _FENVBITS_H
-#define _FENVBITS_H	1
 
 /* Define bits representing the exception.  We use the bit positions of
    the appropriate bits in the FPSR Accrued Exception Byte.  */
@@ -76,5 +76,3 @@ fenv_t;
 /* Floating-point environment where none of the exceptions are masked.  */
 # define FE_NOMASK_ENV	((fenv_t *) -2)
 #endif
-
-#endif /* fenvbits.h */
diff --git a/sysdeps/m68k/fpu/mathbits.h b/sysdeps/m68k/fpu/bits/mathdef.h
index 049662319a..4d07176405 100644
--- a/sysdeps/m68k/fpu/mathbits.h
+++ b/sysdeps/m68k/fpu/bits/mathdef.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _MATHBITS_H
-#define _MATHBITS_H	1
+#ifndef _MATH_H
+#error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
 
 /* The m68k FPUs evaluate all values in the 96 bit floating-point format
    which is also available for the user as `long double'.  Therefore we
@@ -32,5 +34,3 @@ typedef long double double_t;	/* `double' expressions are evaluated as
 
 /* Define `INFINITY' as value of type `float_t'.  */
 #define INFINITY	HUGE_VALL
-
-#endif /* mathbits.h */
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/bits/mathinline.h
index bdeaa9efb0..bdeaa9efb0 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/bits/mathinline.h
diff --git a/sysdeps/m68k/fpu/switch/__math.h b/sysdeps/m68k/fpu/switch/bits/mathinline.h
index c0f6966981..c0f6966981 100644
--- a/sysdeps/m68k/fpu/switch/__math.h
+++ b/sysdeps/m68k/fpu/switch/bits/mathinline.h
diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/bits/libc-lock.h
index cfd176750a..f3ce23a88c 100644
--- a/sysdeps/mach/libc-lock.h
+++ b/sysdeps/mach/bits/libc-lock.h
@@ -17,8 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _LIBC_LOCK_H
-#define _LIBC_LOCK_H 1
+#ifndef _BITS_LIBC_LOCK_H
+#define _BITS_LIBC_LOCK_H 1
 
 #ifdef _LIBC
 #include <cthreads.h>
@@ -87,4 +87,4 @@ typedef struct __libc_lock_opaque__ __libc_lock_t;
 #define __libc_lock_unlock_recursive __libc_lock_unlock
 #define __libc_lock_lock_recursive __libc_lock_lock
 
-#endif	/* libc-lock.h */
+#endif	/* bits/libc-lock.h */
diff --git a/sysdeps/mach/hurd/alpha/sigcontext.h b/sysdeps/mach/hurd/alpha/bits/sigcontext.h
index 32e0c94f98..32e0c94f98 100644
--- a/sysdeps/mach/hurd/alpha/sigcontext.h
+++ b/sysdeps/mach/hurd/alpha/bits/sigcontext.h
diff --git a/sysdeps/mach/hurd/errnos.h b/sysdeps/mach/hurd/bits/errno.h
index beb35ecd9a..beb35ecd9a 100644
--- a/sysdeps/mach/hurd/errnos.h
+++ b/sysdeps/mach/hurd/bits/errno.h
diff --git a/sysdeps/mach/hurd/fcntlbits.h b/sysdeps/mach/hurd/bits/fcntl.h
index 9906c97eb3..4983b338ae 100644
--- a/sysdeps/mach/hurd/fcntlbits.h
+++ b/sysdeps/mach/hurd/bits/fcntl.h
@@ -17,10 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
-
+#ifndef _FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 /* File access modes.  These are understood by io servers; they can be
    passed in `dir_lookup', and are returned by `io_get_openmodes'.
@@ -174,6 +173,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/mach/hurd/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index f6bb4b4ce7..b04438bcca 100644
--- a/sysdeps/mach/hurd/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -1,26 +1,29 @@
-/* Copyright (C) 1992, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#ifndef	_IOCTLS_H
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
 
-#define	_IOCTLS_H	1
+#ifndef	_BITS_IOCTLS_H
+#define	_BITS_IOCTLS_H	1
 
-/* These macros are also defined in termbits.h (with numerically 
+/* These macros are also defined in <bits/termios.h> (with numerically
    identical values) but this serves to shut up cpp's complaining. */
 #ifdef MDMBUF
 #undef MDMBUF
@@ -67,7 +70,7 @@ enum __ioctl_dir
     IOC_INOUT = (IOC_IN|IOC_OUT)
   };
 
-enum __ioctl_datum { IOC_8, IOC_16, IOC_32 };
+enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 
 /* Construct an ioctl from constructed type plus other fields.  */
 #define	_IOC(inout, group, num, type) \
@@ -106,7 +109,8 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32 };
 #define	_IOWR(g, n, t)	_IOC (IOC_INOUT, (g), (n), _IOT_##t)
 
 /* Construct an individual type field for TYPE.  */
-#define _IOTS(type)		(sizeof (type) >> 1)
+#define _IOTS(type)	\
+  (sizeof (type) == 8 ? IOC_64 : (sizeof (type) >> 1))
 
 /* Construct a type information field for
    a single argument of the scalar TYPE.  */
@@ -346,4 +350,4 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32 };
 #endif /* USE_OLD_TTY */
 
 
-#endif /* ioctls.h */
+#endif /* bits/ioctls.h */
diff --git a/sysdeps/mach/hurd/local_lim.h b/sysdeps/mach/hurd/bits/local_lim.h
index e26aa248cb..e26aa248cb 100644
--- a/sysdeps/mach/hurd/local_lim.h
+++ b/sysdeps/mach/hurd/bits/local_lim.h
diff --git a/sysdeps/mach/hurd/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 045b4b6666..045b4b6666 100644
--- a/sysdeps/mach/hurd/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
diff --git a/sysdeps/mach/hurd/statbuf.h b/sysdeps/mach/hurd/bits/stat.h
index a8f92cb5ed..2110a73aae 100644
--- a/sysdeps/mach/hurd/statbuf.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,11 +16,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
 
-#define	_STATBUF_H	1
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* NOTE: The size of this structure (32 ints) is known in
    <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC.  MiG
@@ -66,7 +69,9 @@ struct stat
     unsigned int st_flags;	/* User-defined flags.
 				   High 16 bits can be set only by root.  */
 
-    int st_spare[11];		/* Room for future expansion.  */
+#define _SPARE_SIZE	((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
+    int st_spare[_SPARE_SIZE];	/* Room for future expansion.  */
+#undef _SPARE_SIZE
   };
 
 /* Encoding of the file mode.  */
@@ -128,4 +133,4 @@ struct stat
 #endif
 
 
-#endif /* statbuf.h */
+#endif /* bits/stat.h */
diff --git a/sysdeps/mach/hurd/dirstream.h b/sysdeps/mach/hurd/dirstream.h
index c13383dbd9..9eeb7d9a9e 100644
--- a/sysdeps/mach/hurd/dirstream.h
+++ b/sysdeps/mach/hurd/dirstream.h
@@ -20,7 +20,7 @@ Cambridge, MA 02139, USA.  */
 
 #define	_DIRSTREAM_H	1
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 /* Directory stream type.
 
diff --git a/sysdeps/mach/hurd/hppa/sigcontext.h b/sysdeps/mach/hurd/hppa/bits/sigcontext.h
index b616469f21..b616469f21 100644
--- a/sysdeps/mach/hurd/hppa/sigcontext.h
+++ b/sysdeps/mach/hurd/hppa/bits/sigcontext.h
diff --git a/sysdeps/mach/hurd/i386/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h
index b742326bdb..b742326bdb 100644
--- a/sysdeps/mach/hurd/i386/sigcontext.h
+++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 4646c42920..1a7c42aad7 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -39,7 +39,7 @@ __ioctl (int fd, unsigned long int request, ...)
   /* Map individual type fields to Mach IPC types.  */
   static const int mach_types[] =
     { MACH_MSG_TYPE_CHAR, MACH_MSG_TYPE_INTEGER_16, MACH_MSG_TYPE_INTEGER_32,
-      -1 };
+      MACH_MSG_TYPE_INTEGER_64 };
 #define io2mach_type(count, type) \
   ((mach_msg_type_t) { mach_types[type], typesize (type) * 8, count, 1, 0, 0 })
 
@@ -47,12 +47,14 @@ __ioctl (int fd, unsigned long int request, ...)
   unsigned int type = _IOC_TYPE (request);
 
   /* Message buffer.  */
+#define msg_align(x) \
+  (((x) + sizeof (mach_msg_type_t) - 1) & ~(sizeof (mach_msg_type_t) - 1))
   struct
     {
       mig_reply_header_t header;
       char data[3 * sizeof (mach_msg_type_t) +
-		_IOT_COUNT0 (type) * typesize (_IOT_TYPE0 (type)) +
-		_IOT_COUNT1 (type) * typesize (_IOT_TYPE1 (type)) +
+		msg_align (_IOT_COUNT0 (type) * typesize (_IOT_TYPE0 (type))) +
+		msg_align (_IOT_COUNT1 (type) * typesize (_IOT_TYPE1 (type))) +
 		_IOT_COUNT2 (type) * typesize (_IOT_TYPE2 (type))];
     } msg;
   mach_msg_header_t *const m = &msg.header.Head;
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index 2d5804c71e..7b66df3b4d 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -25,7 +25,7 @@
 
 
 #ifndef _JMPBUF_UNWINDS
- #error "sysdeps/MACHINE/jmp_buf.h fails to define _JMPBUF_UNWINDS"
+#error "<bits/setjmp.h> fails to define _JMPBUF_UNWINDS"
 #endif
 
 /* This function is called by `longjmp' (with its arguments) to restore
diff --git a/sysdeps/mach/hurd/mips/sigcontext.h b/sysdeps/mach/hurd/mips/bits/sigcontext.h
index 81d1f25f25..81d1f25f25 100644
--- a/sysdeps/mach/hurd/mips/sigcontext.h
+++ b/sysdeps/mach/hurd/mips/bits/sigcontext.h
diff --git a/sysdeps/mach/hurd/mips/dl-machine.c b/sysdeps/mach/hurd/mips/dl-machine.c
new file mode 100644
index 0000000000..18261e1115
--- /dev/null
+++ b/sysdeps/mach/hurd/mips/dl-machine.c
@@ -0,0 +1,131 @@
+/* Operating system support for run-time dynamic linker.  MIPS specific
+   stuffs on Hurd.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <hurd.h>
+#include <link.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <assert.h>
+#include <sysdep.h>
+#include <mach/mig_support.h>
+#include "../stdio-common/_itoa.h"
+#include <stdarg.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+void weak_function
+abort (void)
+{
+  _exit (127);
+}
+
+
+#include <string.h>
+#include <mach/error.h>
+#include <errorlib.h>
+
+#undef _
+#define _(x) x
+
+/* Return a string describing the errno code in ERRNUM.  */
+char * weak_function
+_strerror_internal (int errnum, char *buf, size_t buflen)
+{
+  int system;
+  int sub;
+  int code;
+  const struct error_system *es;
+  extern void __mach_error_map_compat (int *);
+
+  __mach_error_map_compat (&errnum);
+
+  system = err_get_system (errnum);
+  sub = err_get_sub (errnum);
+  code = err_get_code (errnum);
+
+  if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
+    {
+      const char *unk = _("Error in unknown error system: ");
+      const size_t unklen = strlen (unk);
+      char *p = buf + buflen;
+      *--p = '\0';
+      p = _itoa (errnum, p, 16, 1);
+      return memcpy (p - unklen, unk, unklen);
+    }
+
+  es = &__mach_error_systems[system];
+
+  if (sub >= es->max_sub)
+    return (char *) es->bad_sub;
+
+  if (code >= es->subsystem[sub].max_code)
+    {
+      const char *unk = _("Unknown error ");
+      const size_t unklen = strlen (unk);
+      char *p = buf + buflen;
+      size_t len = strlen (es->subsystem[sub].subsys_name);
+      *--p = '\0';
+      p = _itoa (errnum, p, 16, 1);
+      *p-- = ' ';
+      p = memcpy (p - len, es->subsystem[sub].subsys_name, len);
+      return memcpy (p - unklen, unk, unklen);
+    }
+
+  return (char *) _(es->subsystem[sub].codes[code]);
+}
+
+/* Read the whole contents of FILE into new mmap'd space with given
+   protections.  The size of the file is returned in SIZE.  */
+void *
+_dl_sysdep_read_whole_file (const char *file, size_t *size, int prot)
+{
+  struct stat stat;
+  mach_port_t memobj_rd;
+  void *contents;
+  error_t err;
+
+  memobj_rd = __open (file, O_RDONLY, 0);
+  if (memobj_rd)
+    {
+      err = __io_stat ((file_t) memobj_rd, &stat);
+      if (err)
+	{
+	  __hurd_fail (err);
+	  contents = 0;
+	}
+      else
+	{
+	  /* Map a copy of the file contents.  */
+	  contents = __mmap (0, stat.st_size, prot, MAP_COPY, memobj_rd, 0);
+	  if (contents == (void *)-1)
+	    contents = 0;
+	  else
+	    *size = stat.st_size;
+	}
+
+      __mach_port_deallocate (__mach_task_self (), memobj_rd);
+    }
+  else
+    contents = 0;
+
+  return contents;
+}
diff --git a/sysdeps/mach/hurd/mips/exc2signal.c b/sysdeps/mach/hurd/mips/exc2signal.c
index f907c89cf0..235b2e2947 100644
--- a/sysdeps/mach/hurd/mips/exc2signal.c
+++ b/sysdeps/mach/hurd/mips/exc2signal.c
@@ -1,21 +1,21 @@
 /* Translate Mach exception codes into signal numbers.  MIPS version.
-Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <hurd.h>
 #include <hurd/signal.h>
@@ -25,56 +25,55 @@ Cambridge, MA 02139, USA.  */
    into a signal number and signal subcode.  */
 
 void
-_hurd_exception2signal (int exception, int code, int subcode,
-			int *signo, long int *sigcode, int *error)
+_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
 {
-  *error = 0;
+  detail->error = 0;
 
-  switch (exception)
+  switch (detail->exc)
     {
     default:
       *signo = SIGIOT;
-      *sigcode = exception;
+      detail->code = detail->exc;
       break;
       
     case EXC_BAD_ACCESS:
-      if (code == KERN_PROTECTION_FAILURE)
+      if (detail->exc_code == KERN_PROTECTION_FAILURE)
 	*signo = SIGSEGV;
       else
 	*signo = SIGBUS;
-      *sigcode = subcode;
-      *error = code;
+      detail->code = detail->exc_subcode;
+      detail->error = detail->exc_code;
       break;
 
     case EXC_BAD_INSTRUCTION:
       *signo = SIGILL;
-      if (code == EXC_MIPS_II)
-	*sigcode = code;
+      if (detail->exc_code == EXC_MIPS_II)
+	detail->code = detail->exc_subcode;
       else
-	*sigcode = 0;
+	detail->code = 0;
       break;
       
     case EXC_ARITHMETIC:
-      switch (code)
+      switch (detail->exc_code)
 	{
 	case EXC_MIPS_OV:	/* integer overflow */
 	  *signo = SIGFPE;
-	  *sigcode = EXC_MIPS_FLT_OVERFLOW;
+	  detail->code = detail->exc_subcode;
 	  break;
 
 	default:
 	  *signo = SIGFPE;
-	  *sigcode = 0;
+	  detail->code = 0;
 	  break;
 
 	case EXC_MIPS_INT:
 	  /* Subcode is the fp_status word saved by the hardware.
 	     Give an error code corresponding to the first bit set.  */
-	  if (subcode == EXC_MIPS_FLT_UNIMP)
+	  if (detail->exc_subcode == EXC_MIPS_FLT_UNIMP)
 	    *signo = SIGILL;
 	  else
 	    *signo = SIGFPE;
-	  *sigcode = subcode;
+	  detail->code = detail->exc_subcode;
 	  break;
 	}
       break;
@@ -82,17 +81,17 @@ _hurd_exception2signal (int exception, int code, int subcode,
     case EXC_EMULATION:		
       /* 3.0 doesn't give this one, why, I don't know.  */
       *signo = SIGEMT;
-      *sigcode = 0;
+      detail->code = 0;
       break;
 
     case EXC_SOFTWARE:
       *signo = SIGEMT;
-      *sigcode = 0;
+      detail->code = 0;
       break;
       
     case EXC_BREAKPOINT:
       *signo = SIGTRAP;
-      *sigcode = code;
+      detail->code = 0;
       break;
     }
 }
diff --git a/sysdeps/mach/hurd/mips/init-fault.c b/sysdeps/mach/hurd/mips/init-fault.c
new file mode 100644
index 0000000000..619ef996a9
--- /dev/null
+++ b/sysdeps/mach/hurd/mips/init-fault.c
@@ -0,0 +1,41 @@
+/* Set up a thread_state for proc_handle_exceptions.  MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <hurd/signal.h>
+#include <mach/thread_status.h>
+#include <string.h>
+#include <setjmp.h>
+
+extern jmp_buf _hurd_sigthread_fault_env;
+
+static char fault_stack[32];
+static volatile void
+faulted (void)
+{
+  __longjmp (_hurd_sigthread_fault_env, 1);
+}
+
+void
+_hurd_initialize_fault_recovery_state (void *state)
+{
+  struct mips_thread_state *ts = state;
+  memset (ts, 0, sizeof (*ts));
+  ts->r29 = (int) &fault_stack[sizeof (fault_stack)];
+  ts->pc = (int) &faulted;
+}
diff --git a/sysdeps/mach/hurd/mips/init-first.c b/sysdeps/mach/hurd/mips/init-first.c
new file mode 100644
index 0000000000..b057aeb097
--- /dev/null
+++ b/sysdeps/mach/hurd/mips/init-first.c
@@ -0,0 +1,407 @@
+/* Initialization code run first thing by the ELF startup code.  For Mips/Hurd.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <hurd.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include "hurdstartup.h"
+#include "set-hooks.h"
+#include "hurdmalloc.h"		/* XXX */
+
+extern void __mach_init (void);
+extern void __libc_init (int, char **, char **);
+extern void __getopt_clean_environment (void);
+extern void __libc_global_ctors (void);
+
+unsigned int __hurd_threadvar_max;
+unsigned long int __hurd_threadvar_stack_offset;
+unsigned long int __hurd_threadvar_stack_mask;
+
+int __libc_multiple_libcs = 1;
+
+int __libc_argc;
+char **__libc_argv;
+
+/* We often need the PID.  Cache this value.  */
+pid_t __libc_pid;
+
+void *(*_cthread_init_routine) (void); /* Returns new SP to use.  */
+void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
+
+
+/* Things that want to be run before _hurd_init or much anything else.
+   Importantly, these are called before anything tries to use malloc.  */
+DEFINE_HOOK (_hurd_preinit_hook, (void));
+
+static void
+init1 (int argc, char *arg0, ...)
+{
+  char **argv = &arg0;
+  char **envp = &argv[argc + 1];
+  struct hurd_startup_data *d;
+
+  __libc_argc = argc;
+  __libc_argv = argv;
+  __environ = envp;
+  while (*envp)
+    ++envp;
+  d = (void *) ++envp;
+
+  /* If we are the bootstrap task started by the kernel,
+     then after the environment pointers there is no Hurd
+     data block; the argument strings start there.  */
+  if ((void *) d != argv[0])
+    {
+      _hurd_init_dtable = d->dtable;
+      _hurd_init_dtablesize = d->dtablesize;
+
+      {
+	/* Check if the stack we are now on is different from
+	   the one described by _hurd_stack_{base,size}.  */
+
+	char dummy;
+	const vm_address_t newsp = (vm_address_t) &dummy;
+
+	if (d->stack_size != 0 && (newsp < d->stack_base ||
+				   newsp - d->stack_base > d->stack_size))
+	  /* The new stack pointer does not intersect with the
+	     stack the exec server set up for us, so free that stack.  */
+	  __vm_deallocate (__mach_task_self (), d->stack_base, d->stack_size);
+      }
+    }
+
+  if (__hurd_threadvar_stack_mask == 0)
+    {
+      /* We are not using cthreads, so we will have just a single allocated
+	 area for the per-thread variables of the main user thread.  */
+      unsigned long int i;
+      __hurd_threadvar_stack_offset
+	= (unsigned long int) malloc (__hurd_threadvar_max *
+				      sizeof (unsigned long int));
+      if (__hurd_threadvar_stack_offset == 0)
+	__libc_fatal ("Can't allocate single-threaded per-thread variables.");
+      for (i = 0; i < __hurd_threadvar_max; ++i)
+	((unsigned long int *) __hurd_threadvar_stack_offset)[i] = 0;
+    }
+
+  if ((void *) d != argv[0] && (d->portarray || d->intarray))
+    /* Initialize library data structures, start signal processing, etc.  */
+    _hurd_init (d->flags, argv,
+		d->portarray, d->portarraysize,
+		d->intarray, d->intarraysize);
+
+  __libc_init (argc, argv, __environ);
+
+  /* This is a hack to make the special getopt in GNU libc working.  */
+  __getopt_clean_environment ();
+
+#ifdef PIC
+  __libc_global_ctors ();
+#endif
+
+  (void) &init1;
+}
+
+static void *
+__init (int *data)
+{
+  int argc = *data;
+  char **argv = (void *) (data + 1);
+  char **envp = &argv[argc + 1];
+  struct hurd_startup_data *d;
+
+  __environ = envp;
+  while (*envp)
+    ++envp;
+  d = (void *) ++envp;
+
+  /* The user might have defined a value for this, to get more variables.
+     Otherwise it will be zero on startup.  We must make sure it is set
+     properly before before cthreads initialization, so cthreads can know
+     how much space to leave for thread variables.  */
+  if (__hurd_threadvar_max < _HURD_THREADVAR_MAX)
+    __hurd_threadvar_max = _HURD_THREADVAR_MAX;
+
+
+  /* After possibly switching stacks, call `init1' (above) with the user
+     code as the return address, and the argument data immediately above
+     that on the stack.  */
+
+  if (_cthread_init_routine)
+    {
+      /* Initialize cthreads, which will allocate us a new stack to run on.  */
+      void *newsp = (*_cthread_init_routine) ();
+      struct hurd_startup_data *od;
+
+      /* Copy the argdata from the old stack to the new one.  */
+      newsp = memcpy (newsp - ((char *) &d[1] - (char *) data), data,
+		      (char *) d - (char *) data);
+
+      /* Set up the Hurd startup data block immediately following
+	 the argument and environment pointers on the new stack.  */
+      od = (newsp + ((char *) d - (char *) data));
+      if ((void *) argv[0] == d)
+	/* We were started up by the kernel with arguments on the stack.
+	   There is no Hurd startup data, so zero the block.  */
+	memset (od, 0, sizeof *od);
+      else
+	/* Copy the Hurd startup data block to the new stack.  */
+	*od = *d;
+
+      /* Push the user code address on the top of the new stack.  It will
+	 be the return address for `init1'; we will jump there with NEWSP
+	 as the stack pointer.  */
+      return newsp;
+    } 
+
+  /* The argument data is just above the stack frame we will unwind by
+     returning.  */
+  return (void *) data;
+
+  (void) &__init;
+}  
+
+#ifdef PIC
+/* This function is called to initialize the shared C library.
+   It is called just before the user _start code from mips/elf/start.S,
+   with the stack set up as that code gets it.  */
+
+/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
+   pointer in the dynamic section based solely on that.  It is convention
+   for this function to be in the `.init' section, but the symbol name is
+   the only thing that really matters!!  */
+/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
+
+#if __mips64
+asm ("\
+	.section .init,\"ax\",@progbits\n\
+	.align 3\n\
+	.globl _init\n\
+	.type _init,@function\n\
+	.ent _init\n\
+_init:\n\
+	.set noreorder\n\
+	.cpload $25\n\
+	.set reorder\n\
+	dsubu $29, 8*8\n\
+	.cprestore 6*8\n\
+	sd $16, 4*8($29)\n\
+	sd $31, 5*8($29)\n\
+	jal preinit\n\
+	sd $28, 6*8($29)\n\
+	move $16, $29 # Save the old stack pointer to s0 ($16)\n\
+	daddu $4, $29, 4*8
+	jal __init\n\
+	# Restore saved registers from the old stack.\n\
+	ld $28, 6*8($16)\n\
+	ld $31, 5*8($16)\n\
+	ld $16, 4*8($16)\n\
+	move $29, $2 # set new sp to SP\n\
+call_init1:\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8($29)\n\
+	ld $7, 3*8($29)\n\
+	dla $25, init1\n\
+	jr $25\n\
+	.end _init\n\
+	.text\n\
+");
+#else
+asm ("\
+	.section .init,\"ax\",@progbits\n\
+	.align 2\n\
+	.globl _init\n\
+	.type _init,@function\n\
+	.ent _init\n\
+_init:\n\
+	.set noreorder\n\
+	.cpload $25\n\
+	.set reorder\n\
+	subu $29, 32\n\
+	.cprestore 24\n\
+	sw $16, 16($29)\n\
+	sw $31, 20($29)\n\
+	jal preinit\n\
+	sw $28, 24($29)\n\
+	move $16, $29 # Save the old stack pointer to s0 ($16)\n\
+	addu $4, $29, 32
+	jal __init\n\
+	# Restore saved registers from the old stack.\n\
+	lw $28, 24($16)\n\
+	lw $31, 20($16)\n\
+	lw $16, 16($16)\n\
+	move $29, $2 # set new sp to SP\n\
+call_init1:\n\
+	lw $4, 0($29)\n\
+	lw $5, 4($29)\n\
+	lw $6, 8($29)\n\
+	lw $7, 12($29)\n\
+	la $25, init1\n\
+	jr $25\n\
+	.end _init\n\
+	.text\n\
+");
+#endif
+
+static void
+preinit (void)
+{
+  /* Initialize data structures so we can do RPCs.  */
+  __mach_init ();
+
+  RUN_HOOK (_hurd_preinit_hook, ());
+
+  (void) &preinit;
+}
+
+void __libc_init_first (int argc, ...)
+{
+}
+#endif
+
+#ifndef PIC
+/* An assembler code wrapping c function __init.  */
+#ifdef __mips64
+asm ("\
+	.text\n\
+	.align 3\n\
+init:\n\
+	dsubu $29, 8*8\n\
+	sd $16, 4*8($29)\n\
+	sd $31, 5*8($29)\n\
+	move $16, $29\n\
+	jal __init\n\
+	ld $31, 5*8($16)\n\
+	ld $16, 4*8($16)\n\
+	move $29, $2 # set new sp to SP\n\
+call_init1:\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8($29)\n\
+	ld $7, 3*8($29)\n\
+	dla $25, init1\n\
+	jr $25\n\
+");
+#else
+asm ("\
+	.text\n\
+	.align 2\n\
+init:\n\
+	subu $29, 32\n\
+	sw $16, 16($29)\n\
+	sw $31, 20($29)\n\
+	move $16, $29\n\
+	jal __init\n\
+	lw $31, 20($16)\n\
+	lw $16, 16($16)\n\
+	move $29, $2 # set new sp to SP\n\
+call_init1:\n\
+	lw $4, 0($29)\n\
+	lw $5, 4($29)\n\
+	lw $6, 8($29)\n\
+	lw $7, 12($29)\n\
+	la $25, init1\n\
+	jr $25\n\
+");
+#endif
+
+/* An assembler code wrapping c function ___libc_init_first.
+   ___libc_init_first does an RPC call to flush cache to put doinit
+   function on the stack, so we should call __mach_init first in
+   this wrap. */
+#ifdef __mips64
+asm ("\
+	.text\n\
+	.align 3\n\
+	.globl __libc_init_first\n\
+__libc_init_first:\n\
+	dsubu $29, 8\n\
+	sd $31, 0($29)
+	jal __mach_init\n\
+	ld $4, 0($29)
+	ld $5, 1*8($29)
+	ld $6, 2*8($29)
+	ld $7, 3*8($29)
+	j ___libc_init_first\n\
+");
+#else
+asm ("\
+	.text\n\
+	.align 2\n\
+	.globl __libc_init_first\n\
+__libc_init_first:\n\
+	subu $29, 4\n\
+	sw $31, 0($29)
+	jal __mach_init\n\
+	lw $4, 0($29)
+	lw $5, 4($29)
+	lw $6, 8($29)
+	lw $7, 12($29)
+	j ___libc_init_first\n\
+");
+#endif
+
+static void
+___libc_init_first (int return_addr, int argc, ...)
+{
+  void doinit (int *data)
+    {
+#if 0
+      /* This function gets called with the argument data at TOS.  */
+      void doinit1 (int argc, ...)
+	{
+	  init (&argc);
+	}
+#endif
+      extern void init (int *data);
+
+      /* Push the user return address after the argument data, and then
+	 jump to `doinit1' (above), so it is as if __libc_init_first's
+	 caller had called `init' with the argument data already on the
+	 stack.  */
+      *--data = return_addr;
+
+#ifdef __mips64
+      asm volatile ("ld $31, 0(%0)\n" /* Load the original return address.  */
+		    "daddu $29, %0, 8\n" /* Switch to new outermost stack.  */
+		    "move $4, $29\n"
+		    "jr %1" : : "r" (data), "r" (&init));
+#else
+      asm volatile ("lw $31, 0(%0)\n" /* Load the original return address.  */
+		    "addu $29, %0, 4\n" /* Switch to new outermost stack.  */
+		    "move $4, $29\n"
+		    "jr %1" : : "r" (data), "r" (&init));
+#endif
+      /* NOTREACHED */
+    }
+
+#if 0
+  /* Initialize data structures so we can do RPCs.  */
+  __mach_init ();
+#endif
+
+  RUN_HOOK (_hurd_preinit_hook, ());
+  
+  _hurd_startup ((void **) &argc, &doinit);
+
+  (void) &___libc_init_first;
+}
+#endif
diff --git a/sysdeps/mach/hurd/mips/intr-msg.h b/sysdeps/mach/hurd/mips/intr-msg.h
new file mode 100644
index 0000000000..7d155f63f3
--- /dev/null
+++ b/sysdeps/mach/hurd/mips/intr-msg.h
@@ -0,0 +1,127 @@
+/* Machine-dependent details of interruptible RPC messaging.  Mips version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+
+#ifdef __mips64
+#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
+({									      \
+  error_t err;								      \
+  mach_port_t __rcv_name = (rcv_name);					      \
+  mach_msg_timeout_t __timeout = (timeout);	       			      \
+  mach_port_t __notify = (notify);					      \
+  asm (".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
+       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
+       "				move $4, %1\n"			      \
+       "				move $5, %2\n"			      \
+       "				move $6, %3\n"			      \
+       "				move $7, %4\n"			      \
+       "				move $8, %5\n"			      \
+       "				move $9, %6\n"			      \
+       "				move $10, %7\n"			      \
+       "				dli $2, -25\n"			      \
+       "_hurd_intr_rpc_msg_do_trap:	syscall\n"			      \
+       "_hurd_intr_rpc_msg_in_trap:	move %0, $2\n"			      \
+       : "=r" (err)							      \
+       : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),	      \
+         "r" (__rcv_name), "r" (__timeout), "r" (__notify)		      \
+       : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10",	      \
+         "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28");	      \
+  err;									      \
+})
+#else
+#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
+({									      \
+  error_t err;								      \
+  mach_port_t __rcv_name = (rcv_name);					      \
+  mach_msg_timeout_t __timeout = (timeout);	       			      \
+  mach_port_t __notify = (notify);					      \
+  asm (".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
+       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
+       "				move $4, %1\n"			      \
+       "				move $5, %2\n"			      \
+       "				move $6, %3\n"			      \
+       "				move $7, %4\n"			      \
+       "				move $8, %5\n"			      \
+       "				move $9, %6\n"			      \
+       "				move $10, %7\n"			      \
+       "				li $2, -25\n"			      \
+       "_hurd_intr_rpc_msg_do_trap:	syscall\n"			      \
+       "_hurd_intr_rpc_msg_in_trap:	move %0, $2\n"			      \
+       : "=r" (err)							      \
+       : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),	      \
+         "r" (__rcv_name), "r" (__timeout), "r" (__notify)		      \
+       : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10",	      \
+         "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28");	      \
+  err;									      \
+})
+#endif
+
+static inline void
+INTR_MSG_BACK_OUT (struct mips_thread_state *state)
+{
+  return;
+}
+
+#include "hurdfault.h"
+
+static inline int
+SYSCALL_EXAMINE (struct mips_thread_state *state, int *callno)
+{
+  u_int32_t *p = (void *) (state->pc - 4);
+  int result;
+  if (_hurdsig_catch_memory_fault (p))
+    return 0;
+  if (result = (*p == 0x0000000c))
+    /* The PC is just after a `syscall' instruction.
+       This is a system call in progress; v0($2) holds the call number.  */
+    *callno = state->r2;
+  _hurdsig_end_catch_fault ();
+  return result;
+}
+
+
+struct mach_msg_trap_args
+  {
+    /* This is the order of arguments to mach_msg_trap.  */
+    mach_msg_header_t *msg;
+    mach_msg_option_t option;
+    mach_msg_size_t send_size;
+    mach_msg_size_t rcv_size;
+    mach_port_t rcv_name;
+    mach_msg_timeout_t timeout;
+    mach_port_t notify;
+  };
+
+
+static inline mach_port_t
+MSG_EXAMINE (struct mips_thread_state *state, int *msgid)
+{
+  mach_msg_header_t *msg;
+  mach_port_t send_port;
+
+  msg = (mach_msg_header_t *) state->r4;
+
+  if (_hurdsig_catch_memory_fault (msg))
+    return MACH_PORT_NULL;
+  send_port = msg->msgh_remote_port;
+  *msgid = msg->msgh_id;
+  _hurdsig_end_catch_fault ();
+
+  return send_port;
+}
diff --git a/sysdeps/mach/hurd/mips/longjmp-ctx.c b/sysdeps/mach/hurd/mips/longjmp-ctx.c
new file mode 100644
index 0000000000..df04900e78
--- /dev/null
+++ b/sysdeps/mach/hurd/mips/longjmp-ctx.c
@@ -0,0 +1,41 @@
+/* Perform a `longjmp' on a `struct sigcontext'.  MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <setjmp.h>
+#include <hurd/signal.h>
+#include <string.h>
+
+void
+_hurd_longjmp_sigcontext (struct sigcontext *scp, jmp_buf env, int retval)
+{
+  scp->sc_gpr[16] = env[0].__regs[0];
+  scp->sc_gpr[17] = env[0].__regs[1];
+  scp->sc_gpr[18] = env[0].__regs[2];
+  scp->sc_gpr[19] = env[0].__regs[3];
+  scp->sc_gpr[20] = env[0].__regs[4];
+  scp->sc_gpr[21] = env[0].__regs[5];
+  scp->sc_gpr[22] = env[0].__regs[6];
+  scp->sc_gpr[23] = env[0].__regs[7];
+
+  scp->sc_gpr[28] = (int) env[0].__gp;
+  scp->sc_fp = (int) env[0].__fp;
+  scp->sc_sp = (int) env[0].__sp;
+  scp->sc_pc = (int) env[0].__pc;
+  scp->sc_gpr[2] = retval ?: 1;
+}
diff --git a/sysdeps/mach/hurd/mips/longjmp-ts.c b/sysdeps/mach/hurd/mips/longjmp-ts.c
index 980a2ceb94..ea62bb1bf3 100644
--- a/sysdeps/mach/hurd/mips/longjmp-ts.c
+++ b/sysdeps/mach/hurd/mips/longjmp-ts.c
@@ -1,21 +1,21 @@
 /* Perform a `longjmp' on a Mach thread_state.  MIPS version.
-Copyright (C) 1991, 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <hurd/signal.h>
 #include <setjmp.h>
diff --git a/sysdeps/mach/hurd/mips/sigreturn.c b/sysdeps/mach/hurd/mips/sigreturn.c
index 7396a8bb22..fe38fac1df 100644
--- a/sysdeps/mach/hurd/mips/sigreturn.c
+++ b/sysdeps/mach/hurd/mips/sigreturn.c
@@ -1,30 +1,32 @@
-/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <hurd.h>
 #include <hurd/signal.h>
 #include <hurd/threadvar.h>
 #include <stdlib.h>
+#include <mach/mips/mips_instruction.h>
 
 int
 __sigreturn (struct sigcontext *scp)
 {
   struct hurd_sigstate *ss;
+  struct hurd_userlink *link = (void *) &scp[1];
   mach_port_t *reply_port;
 
   if (scp == NULL || (scp->sc_mask & _SIG_CANT_MASK))
@@ -36,6 +38,11 @@ __sigreturn (struct sigcontext *scp)
   ss = _hurd_self_sigstate ();
   __spin_lock (&ss->lock);
 
+  /* Remove the link on the `active resources' chain added by
+     _hurd_setup_sighandler.  Its purpose was to make sure
+     that we got called; now we have, it is done.  */
+  _hurd_userlink_unlink (link);
+
   /* Restore the set of blocked signals, and the intr_port slot.  */
   ss->blocked = scp->sc_mask;
   ss->intr_port = scp->sc_intr_port;
@@ -48,15 +55,11 @@ __sigreturn (struct sigcontext *scp)
 	 the signal thread will notice it if it runs another handler, and
 	 arrange to have us called over again in the new reality.  */
       ss->context = scp;
-      /* Clear the intr_port slot, since we are not in fact doing
-	 an interruptible RPC right now.  If SS->intr_port is not null,
-	 the SCP context is doing an interruptible RPC, but the signal
-	 thread will examine us while we are blocked in the sig_post RPC.  */
-      ss->intr_port = MACH_PORT_NULL;
       __spin_unlock (&ss->lock);
-      __msg_sig_post (_hurd_msgport, 0, __mach_task_self ());
+      __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
       /* If a pending signal was handled, sig_post never returned.  */
       __spin_lock (&ss->lock);
+      ss->context = NULL;
     }
 
   if (scp->sc_onstack)
@@ -73,7 +76,17 @@ __sigreturn (struct sigcontext *scp)
   reply_port =
     (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
   if (*reply_port)
-    __mach_port_destroy (__mach_task_self (), *reply_port);
+    {
+      mach_port_t port = *reply_port;
+
+      /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port not to
+	 get another reply port, but avoids mig_dealloc_reply_port trying to
+	 deallocate it after the receive fails (which it will, because the
+	 reply port will be bogus, whether we do this or not).  */
+      *reply_port = MACH_PORT_DEAD;
+
+      __mach_port_destroy (__mach_task_self (), port);
+    }
   *reply_port = scp->sc_reply_port;
 
   if (scp->sc_coproc_used & SC_COPROC_USE_FPU)
@@ -83,30 +96,70 @@ __sigreturn (struct sigcontext *scp)
   asm volatile ("l.d $f" #n ",%0" : : "m" (scp->sc_fpr[n]))
 
       /* Restore floating-point registers. */
+#ifdef __mips64
       restore_fpr (0);
+      restore_fpr (1);
       restore_fpr (2);
+      restore_fpr (3);
       restore_fpr (4);
+      restore_fpr (5);
       restore_fpr (6);
+      restore_fpr (7);
       restore_fpr (8);
+      restore_fpr (9);
       restore_fpr (10);
+      restore_fpr (11);
       restore_fpr (12);
+      restore_fpr (13);
       restore_fpr (14);
+      restore_fpr (15);
       restore_fpr (16);
+      restore_fpr (17);
       restore_fpr (18);
+      restore_fpr (19);
       restore_fpr (20);
+      restore_fpr (21);
       restore_fpr (22);
+      restore_fpr (23);
       restore_fpr (24);
+      restore_fpr (25);
       restore_fpr (26);
+      restore_fpr (27);
       restore_fpr (28);
+      restore_fpr (29);
       restore_fpr (30);
+      restore_fpr (31);
+#else
+      restore_fpr (0);
+      restore_fpr (2);
+      restore_fpr (4);
+      restore_fpr (6);
+      restore_fpr (8);
+      restore_fpr (10);
+      restore_fpr (12);
+      restore_fpr (14);
+      restore_fpr (16);
+      restore_fpr (18);
+      restore_fpr (20);
+      restore_fpr (22);
+      restore_fpr (24);
+      restore_fpr (26);
+      restore_fpr (28);
+      restore_fpr (30);
+#endif
 
       /* Restore the floating-point control/status register ($f31).  */
       asm volatile ("ctc1 %0,$f31" : : "r" (scp->sc_fpcsr));
     }
 
   /* Load all the registers from the sigcontext.  */
+#ifdef __mips64
+#define restore_gpr(n) \
+  asm volatile ("ld $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
+#else
 #define restore_gpr(n) \
   asm volatile ("lw $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
+#endif
 
   {
     register const struct sigcontext *const scpreg asm ("$1") = scp;
@@ -157,9 +210,10 @@ __sigreturn (struct sigcontext *scp)
     at = &scpreg->sc_pc;
     /* This is an emulated instruction that will find at the address in $1
        two words: the PC value to restore, and the $1 value to restore.  */
-    asm volatile (".word op_sigreturn");
-
+    asm volatile (".word %0" : : "i" (op_sigreturn));
     asm volatile (".set reorder; .set at;");
+    /* NOTREACHED */
+    return at;		/* To prevent optimization.  */
   }
 
   /* NOTREACHED */
diff --git a/sysdeps/mach/hurd/mips/trampoline.c b/sysdeps/mach/hurd/mips/trampoline.c
index 03e3d1da6f..fbb7df508f 100644
--- a/sysdeps/mach/hurd/mips/trampoline.c
+++ b/sysdeps/mach/hurd/mips/trampoline.c
@@ -1,56 +1,58 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  MIPS version.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <hurd/signal.h>
+#include <hurd/userlink.h>
 #include "thread_state.h"
-
-
-struct mach_msg_trap_args
-  {
-    /* This is the order of arguments to mach_msg_trap.  */
-    mach_msg_header_t *msg;
-    mach_msg_option_t option;
-    mach_msg_size_t send_size;
-    mach_msg_size_t rcv_size;
-    mach_port_t rcv_name;
-    mach_msg_timeout_t timeout;
-    mach_port_t notify;
-  };
+#include <assert.h>
+#include <errno.h>
+#include "hurdfault.h"
+#include "intr-msg.h"
 
 
 struct sigcontext *
 _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
-			int signo, long int sigcode,
-			int rpc_wait,
+			int signo, struct hurd_signal_detail *detail,
+			volatile int rpc_wait,
 			struct machine_thread_all_state *state)
 {
-
-  __label__ trampoline, rpc_wait_trampoline;
-  void *sigsp;
+  __label__ trampoline, rpc_wait_trampoline, firewall;
+  void *volatile sigsp;
   struct sigcontext *scp;
+  struct 
+    {
+      int signo;
+      long int sigcode;
+      struct sigcontext *scp;	/* Points to ctx, below.  */
+      void *sigreturn_addr;
+      void *sigreturn_returns_here;
+      struct sigcontext *return_scp; /* Same; arg to sigreturn.  */
+      struct sigcontext ctx;
+      struct hurd_userlink link;
+    } *stackframe;
 
   if (ss->context)
     {
       /* We have a previous sigcontext that sigreturn was about
 	 to restore when another signal arrived.  We will just base
 	 our setup on that.  */
-      if (! setjmp (_hurd_sigthread_fault_env))
+      if (! _hurdsig_catch_memory_fault (ss->context))
 	{
 	  memcpy (&state->basic, &ss->context->sc_mips_thread_state,
 		  sizeof (state->basic));
@@ -63,24 +65,17 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 		      sizeof (state->fpu));
 	      state->set |= (1 << MIPS_FLOAT_STATE);
 	    }
-	  assert (! rpc_wait);
-	  /* The intr_port slot was cleared before sigreturn sent us the
-	     sig_post that made us notice this pending signal, so
-	     _hurd_internal_post_signal wouldn't do interrupt_operation.
-	     After we return, our caller will set SCP->sc_intr_port (in the
-	     new context) from SS->intr_port and clear SS->intr_port.  Now
-	     that we are restoring this old context recorded by sigreturn,
-	     we want to restore its intr_port too; so store it in
-	     SS->intr_port now, so it will end up in SCP->sc_intr_port
-	     later.  */
-	  ss->intr_port = ss->context->sc_intr_port;
 	}
-      /* If the sigreturn context was bogus, just ignore it.  */
-      ss->context = NULL;
     }
-  else if (! machine_get_basic_state (ss->thread, state))
+
+  if (! machine_get_basic_state (ss->thread, state))
     return NULL;
 
+  /* Save the original SP in the gratuitous s0 ($16) slot.
+     We may need to reset the SP (the `r29' slot) to avoid clobbering an
+     interrupted RPC frame.  */
+  state->basic.r16 = state->basic.r29;
+
   if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
       !(ss->sigaltstack.ss_flags & (SA_DISABLE|SA_ONSTACK)))
     {
@@ -92,13 +87,46 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   else
     sigsp = (char *) state->basic.r29;
 
-  /* Set up the sigcontext structure on the stack.  This is all the stack
-     needs, since the args are passed in registers (below).  */
-  sigsp -= sizeof (*scp);
-  scp = sigsp;
+  /* Push the arguments to call `trampoline' on the stack.  */
+  sigsp -= sizeof (*stackframe);
+  stackframe = sigsp;
 
-  if (! setjmp (_hurd_sigthread_fault_env))
+  if (_hurdsig_catch_memory_fault (stackframe))
     {
+      /* We got a fault trying to write the stack frame.
+	 We cannot set up the signal handler.
+	 Returning NULL tells our caller, who will nuke us with a SIGILL.  */
+      return NULL;
+    }
+  else
+    {
+      int ok;
+
+      extern void _hurdsig_longjmp_from_handler (void *, jmp_buf, int);
+
+      /* Add a link to the thread's active-resources list.  We mark this as
+	 the only user of the "resource", so the cleanup function will be
+	 called by any longjmp which is unwinding past the signal frame.
+	 The cleanup function (in sigunwind.c) will make sure that all the
+	 appropriate cleanups done by sigreturn are taken care of.  */
+      stackframe->link.cleanup = &_hurdsig_longjmp_from_handler;
+      stackframe->link.cleanup_data = &stackframe->ctx;
+      stackframe->link.resource.next = NULL;
+      stackframe->link.resource.prevp = NULL;
+      stackframe->link.thread.next = ss->active_resources;
+      stackframe->link.thread.prevp = &ss->active_resources;
+      if (stackframe->link.thread.next)
+	stackframe->link.thread.next->thread.prevp
+	  = &stackframe->link.thread.next;
+      ss->active_resources = &stackframe->link;
+
+      /* Set up the arguments for the signal handler.  */
+      stackframe->signo = signo;
+      stackframe->sigcode = detail->code;
+      stackframe->scp = stackframe->return_scp = scp = &stackframe->ctx;
+      stackframe->sigreturn_addr = &__sigreturn;
+      stackframe->sigreturn_returns_here = &&firewall; /* Crash on return.  */
+
       /* Set up the sigcontext from the current state of the thread.  */
 
       scp->sc_onstack = ss->sigaltstack.ss_flags & SA_ONSTACK ? 1 : 0;
@@ -110,24 +138,23 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 
       /* struct sigcontext is laid out so that starting at sc_cause
 	 mimics a struct mips_exc_state.  */
-      if (! machine_get_state (ss->thread, state, MIPS_EXC_STATE,
-			       &state->exc, &scp->sc_cause,
-			       sizeof (state->exc)))
-	return NULL;
-      if ((scp->sc_coproc_used & SC_COPROC_USE_FPU) &&
-	  /* struct sigcontext is laid out so that starting at sc_fpr
-	     mimics a struct mips_float_state.  This state
-	     is only meaningful if the coprocessor was used.  */
-	  ! machine_get_state (ss->thread, state, MIPS_FLOAT_STATE,
-			       &state->fpu,
-			       &scp->sc_mips_float_state, sizeof (state->fpu)))
+      ok = machine_get_state (ss->thread, state, MIPS_EXC_STATE,
+			      &state->exc, &scp->sc_cause,
+			      sizeof (state->exc));
+
+      if (ok && (scp->sc_coproc_used & SC_COPROC_USE_FPU))
+	/* struct sigcontext is laid out so that starting at sc_fpr
+	   mimics a struct mips_float_state.  This state
+	   is only meaningful if the coprocessor was used.  */
+	  ok = machine_get_state (ss->thread, state, MIPS_FLOAT_STATE,
+				  &state->fpu, &scp->sc_mips_float_state,
+				  sizeof (state->fpu));
+
+      _hurdsig_end_catch_fault ();
+
+      if (! ok)
 	return NULL;
     }
-  else
-    /* We got a fault trying to write the stack frame.
-       We cannot set up the signal handler.
-       Returning NULL tells our caller, who will nuke us with a SIGILL.  */
-    return NULL;
 
   /* Modify the thread state to call the trampoline code on the new stack.  */
   if (rpc_wait)
@@ -145,6 +172,12 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
 	 starting with a0 ($4).  */
       struct mach_msg_trap_args *args = (void *) &state->basic.r4;
 
+      if (_hurdsig_catch_memory_fault (args))
+	{
+	  /* Faulted accessing ARGS.  Bomb.  */
+	  return NULL;
+	}
+
       assert (args->option & MACH_RCV_MSG);
       /* Disable the message-send, since it has already completed.  The
 	 calls we retry need only wait to receive the reply message.  */
@@ -156,17 +189,22 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
       args->option |= MACH_RCV_TIMEOUT;
       args->timeout = _hurd_interrupted_rpc_timeout;
 
+      _hurdsig_end_catch_fault ();
+
       state->basic.pc = (int) &&rpc_wait_trampoline;
-      state->basic.r29 = (int) sigsp; /* $29 is the stack pointer register.  */
+      /* The reply-receiving trampoline code runs initially on the original
+	 user stack.  We pass it the signal stack pointer in s4 ($20).  */
+      state->basic.r29 = state->basic.r16; /* Restore mach_msg syscall SP.  */
+      state->basic.r20 = (int) sigsp;
       /* After doing the message receive, the trampoline code will need to
 	 update the v0 ($2) value to be restored by sigreturn.  To simplify
 	 the assembly code, we pass the address of its slot in SCP to the
-	 trampoline code in v1 ($3).  */
-      state->basic.r3 = (int) &scp->sc_gpr[1];
+	 trampoline code in s5 ($21).  */
+      state->basic.r21 = (int) &scp->sc_gpr[1];
       /* We must preserve the mach_msg_trap args in a0..t2 ($4..$10).
 	 Pass the handler args to the trampoline code in s1..s3 ($17..$19).  */
       state->basic.r17 = signo;
-      state->basic.r18 = sigcode;
+      state->basic.r18 = detail->code;
       state->basic.r19 = (int) scp;
     }
   else
@@ -174,12 +212,12 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
       state->basic.pc = (int) &&trampoline;
       state->basic.r29 = (int) sigsp;
       state->basic.r4 = signo;
-      state->basic.r5 = sigcode;
+      state->basic.r5 = detail->code;
       state->basic.r6 = (int) scp;
     }
 
-  /* We pass the handler function to the trampoline code in at ($1).  */
-  state->basic.r1 = (int) handler;
+  /* We pass the handler function to the trampoline code in s6 ($22).  */
+  state->basic.r22 = (int) handler;
   /* In the callee-saved register s0 ($16), we save the SCP value to pass
      to __sigreturn after the handler returns.  */
   state->basic.r16 = (int) scp;
@@ -197,21 +235,31 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
   asm volatile
     (".set noat; .set noreorder; .set nomacro\n"
      /* Retry the interrupted mach_msg system call.  */
+#ifdef __mips64
+     "dli $2, -25\n"		/* mach_msg_trap */
+#else
      "li $2, -25\n"		/* mach_msg_trap */
+#endif
      "syscall\n"
      /* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED.  But
 	now the message receive has completed and the original caller of
 	the RPC (i.e. the code running when the signal arrived) needs to
 	see the final return value of the message receive in v0.  So
 	store the new v0 value into the sc_gpr[1] member of the sigcontext
-	(whose address is in v1 to make this code simpler).  */
-     "sw $2, ($3)\n"
+	(whose address is in s5 to make this code simpler).  */
+#ifdef __mips64
+     "sd $2, ($21)\n"
+#else
+     "sw $2, ($21)\n"
+#endif
      /* Since the argument registers needed to have the mach_msg_trap
 	arguments, we've stored the arguments to the handler function
 	in registers s1..s3 ($17..$19).  */
      "move $4, $17\n"
      "move $5, $18\n"
-     "move $6, $19\n");
+     "move $6, $19\n"
+     /* Switch to the signal stack.  */
+     "move $29, $20\n");
 
  trampoline:
   /* Entry point for running the handler normally.  The arguments to the
@@ -222,14 +270,23 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
        a2	SCP
      */
   asm volatile
-    ("jal $1; nop\n"		/* Call the handler function.  */
+    ("move $25, $22\n"		/* Copy s6 to t9 for MIPS ABI.  */
+     "jal $25; nop\n"		/* Call the handler function.  */
      /* Call __sigreturn (SCP); this cannot return.  */
-     "j %0\n"
+#ifdef __mips64
+     "dla $1,%0\n"
+#else
+     "la $1,%0\n"
+#endif
+     "j $1\n"
      "move $4, $16"		/* Set up arg from saved SCP in delay slot.  */
      : : "i" (&__sigreturn));
 
   /* NOTREACHED */
   asm volatile (".set reorder; .set at; .set macro");
 
+ firewall:
+  asm volatile ("hlt: j hlt");
+
   return NULL;
 }
diff --git a/sysdeps/mach/hurd/select.c b/sysdeps/mach/hurd/select.c
index 391b57bf5c..f8385ff29b 100644
--- a/sysdeps/mach/hurd/select.c
+++ b/sysdeps/mach/hurd/select.c
@@ -223,7 +223,7 @@ __select (nfds, readfds, writefds, exceptfds, timeout)
 	  /* We got a message.  Decode it.  */
 #define IO_SELECT_REPLY_MSGID (21012 + 100) /* XXX */
 	  const mach_msg_type_t inttype =
-	    { MACH_MSG_TYPE_INTEGER_32, 32, 1, 1, 0, 0 };
+	    { MACH_MSG_TYPE_INTEGER_T, MACH_MSG_SIZE_INTEGER_T, 1, 1, 0, 0 };
 	  if (msg.head.msgh_id == IO_SELECT_REPLY_MSGID &&
 	      msg.head.msgh_size >= sizeof msg.error &&
 	      !(msg.head.msgh_bits & MACH_MSGH_BITS_COMPLEX) &&
diff --git a/sysdeps/mach/mips/cacheflush.c b/sysdeps/mach/mips/cacheflush.c
index 5325e6fd1e..de2ec58bff 100644
--- a/sysdeps/mach/mips/cacheflush.c
+++ b/sysdeps/mach/mips/cacheflush.c
@@ -1,28 +1,28 @@
 /* Flush the insn cache after GCC writes a closure on the stack.  Mach/MIPS.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <mach.h>
 #include <mach/vm_attributes.h>
 
 /* Stupid name, but this is what GCC generates (config/mips/mips.h).  */
 void
-cacheflush (void *addr, size_t size, int flag)
+cacheflush (void *addr, unsigned size, int flag)
 {
   vm_machine_attribute_val_t val;
 
diff --git a/sysdeps/mach/mips/machine-lock.h b/sysdeps/mach/mips/machine-lock.h
index 628aae41bb..91d39e3753 100644
--- a/sysdeps/mach/mips/machine-lock.h
+++ b/sysdeps/mach/mips/machine-lock.h
@@ -1,25 +1,28 @@
 /* Machine-specific definition for spin locks.  MIPS version.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _MACHINE_LOCK_H
 #define	_MACHINE_LOCK_H
 
+/* To get the TAS pseudo-instruction. */
+#include <mach/mips/mips_instruction.h>
+
 /* The type of a spin lock variable.  */
 
 typedef __volatile int __spin_lock_t;
@@ -46,19 +49,35 @@ __spin_unlock (__spin_lock_t *__lock)
 _EXTERN_INLINE int
 __spin_try_lock (register __spin_lock_t *__lock)
 {
-  register int __rtn;
+#if (__mips >= 2)
+  int __rtn;
+
   __asm__ __volatile (".set noreorder");
-#if 0
-  __asm__ __volatile ("lw %0,0(%1)": "=r" (__rtn) : "r" (__lock));
-  __asm__ __volatile ("sw %0,0(%0)": : "r" (__lock));
-  __asm__ __volatile ("xor %0,%1,%0": "=r" (__rtn) : "r" (__lock));
+#if (__mips64)
+  __asm__ __volatile ("lld %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
 #else
-  /* Use the Mach microkernel's emulated TAS pseudo-instruction.  */
-  register int __rtn __asm__ ("a0");
-  __asm__ __volatile (".word 0xf ! %0 " : "=r" (__rtn) : "0" (__lock));
+  __asm__ __volatile ("ll %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
+#endif
+  if (__rtn)
+    return 0;
+  __asm__ __volatile ("move %0,%1" : "=r" (__rtn) : "r" (__lock));
+#if (__mips64)
+  __asm__ __volatile ("scd %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
+#else
+  __asm__ __volatile ("sc %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
 #endif
   __asm__ __volatile (".set reorder");
+  return __rtn;
+#else
+  register int __rtn __asm__ ("a0");
+
+  /* Use the Mach microkernel's emulated TAS pseudo-instruction.  */
+  __asm__ __volatile (".set noreorder");
+  __asm__ __volatile (".word %1" : "=r" (__rtn) : "i" (op_tas), "0" (__lock));
+  __asm__ __volatile ("nop");
+  __asm__ __volatile (".set reorder");
   return __rtn ^ (int) __lock;
+#endif
 }
 
 /* Return nonzero if LOCK is locked.  */
diff --git a/sysdeps/mach/mips/machine-sp.h b/sysdeps/mach/mips/machine-sp.h
index 7406658f53..e1217c31f3 100644
--- a/sysdeps/mach/mips/machine-sp.h
+++ b/sysdeps/mach/mips/machine-sp.h
@@ -1,21 +1,21 @@
 /* Machine-specific function to return the stack pointer.  MIPS version.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _MACHINE_SP_H
 #define _MACHINE_SP_H
diff --git a/sysdeps/mach/mips/syscall.S b/sysdeps/mach/mips/syscall.S
index bf56b401dd..9936772295 100644
--- a/sysdeps/mach/mips/syscall.S
+++ b/sysdeps/mach/mips/syscall.S
@@ -1,37 +1,48 @@
-/* Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
+#ifdef PIC
+	.option pic2
+#endif
 ENTRY (syscall)
-	.frame	sp,0,ra
 	move	v0, a0		/* Load system call number from first arg.  */
 	move	a0, a1		/* Move the next three args up a register.  */
 	move	a1, a2
 	move	a2, a3
      	/* Load the remaining possible args (up to 11) from the stack.  */
-	lw	t0,16(sp)
-	lw	t1,20(sp)
-	lw	t2,24(sp)
-	lw	t3,28(sp)
-	lw	t4,32(sp)
-	lw	t5,36(sp)
-	lw	t6,40(sp)
+#ifdef __mips64
+	ld	t0,4*8(sp)
+	ld	t1,5*8(sp)
+	ld	t2,6*8(sp)
+	ld	t3,7*8(sp)
+	ld	t4,8*8(sp)
+	ld	t5,9*8(sp)
+	ld	t6,10*8(sp)
+#else
+	lw	t0,4*4(sp)
+	lw	t1,5*4(sp)
+	lw	t2,6*4(sp)
+	lw	t3,7*4(sp)
+	lw	t4,8*4(sp)
+	lw	t5,9*4(sp)
+	lw	t6,10*4(sp)
+#endif
 	syscall			/* Do the system call.  */
      	j ra			/* Return to caller.  */
-	.end	syscall
diff --git a/sysdeps/mach/mips/sysdep.h b/sysdeps/mach/mips/sysdep.h
index 7609be5931..a4e6dff148 100644
--- a/sysdeps/mach/mips/sysdep.h
+++ b/sysdeps/mach/mips/sysdep.h
@@ -1,35 +1,40 @@
-/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#define MOVE(x,y)	move y , x
-
-#if 0
 #define LOSE asm volatile ("1: b 1b")
-#endif
 
+#define START_MACHDEP asm ("\
+	.text\n\
+	.globl _start\n\
+	.ent _start\n\
+_start:\n\
+	# Put initial SP in a0.\n\
+	move $4, $29\n\
+	# Jump to _start0; don't return.\n\
+	j _start0\n\
+	.end _start\n\
+");
+#define START_ARGS	int *entry_sp
 #define SNARF_ARGS(argc, argv, envp)					      \
   do									      \
     {									      \
-      int *entry_sp;							      \
       register char **p;						      \
 									      \
-      asm ("addu %0,$30,4" : "=r" (entry_sp));				      \
-									      \
       argc = *entry_sp;							      \
       argv = (char **) (entry_sp + 1);					      \
       p = argv;								      \
@@ -44,11 +49,20 @@ Cambridge, MA 02139, USA.  */
   ({ register int __fn = fn, __sp = (int) sp; \
      asm volatile ("move $sp,%0; j %1" : : "r" (__sp), "r" (__fn));})
 
+#define RETURN_TO(sp, pc, retval) \
+  asm volatile ("move $29, %0; move $2, %2; move $25, %1; jr $25" \
+		: : "r" (sp), "r" (pc), "r" (retval))
+
 #define STACK_GROWTH_DOWN
 
-#ifdef P40
 #include <syscall.h>
 
+#if defined (ASSEMBLER)
+
+#define ALIGN	2
+
+#define MOVE(x,y)	move y , x
+
 #define SYSCALL(name, args)	\
   .globl syscall_error;	\
   kernel_trap(name,SYS_##name,args);	\
diff --git a/sysdeps/mach/mips/thread_state.h b/sysdeps/mach/mips/thread_state.h
index f4f4b429cf..a72848dfc0 100644
--- a/sysdeps/mach/mips/thread_state.h
+++ b/sysdeps/mach/mips/thread_state.h
@@ -1,25 +1,30 @@
 /* Mach thread state definitions for machine-independent code.  MIPS version.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #define MACHINE_THREAD_STATE_FLAVOR	MIPS_THREAD_STATE
 #define MACHINE_THREAD_STATE_COUNT	MIPS_THREAD_STATE_COUNT
 
+#ifdef PIC
+#define MACHINE_THREAD_STATE_SET_PC(ts, pc) \
+  ((ts)->PC = (ts)->r25 = (unsigned long int) (pc))
+#endif
+
 #define machine_thread_state mips_thread_state
 
 #define PC pc
diff --git a/sysdeps/mach/start.c b/sysdeps/mach/start.c
index c2ea3e3b7b..b1d121eb75 100644
--- a/sysdeps/mach/start.c
+++ b/sysdeps/mach/start.c
@@ -29,7 +29,9 @@ Cambridge, MA 02139, USA.  */
 /* The first piece of initialized data.  */
 int __data_start = 0;
 
+#ifndef _HURD_THREADVAR_H
 volatile int errno;
+#endif
 
 extern void __mach_init (void);
 extern void __libc_init (int argc, char **argv, char **envp);
@@ -62,6 +64,7 @@ start1 (void)
 
 #ifndef START_ARGS
 #define START_ARGS void
+#endif
 #ifdef START_MACHDEP
 START_MACHDEP
 #define _start _start0
diff --git a/sysdeps/mips/add_n.S b/sysdeps/mips/add_n.S
new file mode 100644
index 0000000000..df32eecfcf
--- /dev/null
+++ b/sysdeps/mips/add_n.S
@@ -0,0 +1,121 @@
+/* MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and
+store sum in a third limb vector.
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   s1_ptr	$5
+   s2_ptr	$6
+   size		$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_add_n)
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	lw	$10,0($5)
+	lw	$11,0($6)
+
+	addiu	$7,$7,-1
+	and	$9,$7,4-1	/* number of limbs in first loop */
+	beq	$9,$0,.L0	/* if multiple of 4 limbs, skip first loop */
+	move	$2,$0
+
+	subu	$7,$7,$9
+
+.Loop0:	addiu	$9,$9,-1
+	lw	$12,4($5)
+	addu	$11,$11,$2
+	lw	$13,4($6)
+	sltu	$8,$11,$2
+	addu	$11,$10,$11
+	sltu	$2,$11,$10
+	sw	$11,0($4)
+	or	$2,$2,$8
+
+	addiu	$5,$5,4
+	addiu	$6,$6,4
+	move	$10,$12
+	move	$11,$13
+	bne	$9,$0,.Loop0
+	 addiu	$4,$4,4
+
+.L0:	beq	$7,$0,.Lend
+	 nop
+
+.Loop:	addiu	$7,$7,-4
+
+	lw	$12,4($5)
+	addu	$11,$11,$2
+	lw	$13,4($6)
+	sltu	$8,$11,$2
+	addu	$11,$10,$11
+	sltu	$2,$11,$10
+	sw	$11,0($4)
+	or	$2,$2,$8
+
+	lw	$10,8($5)
+	addu	$13,$13,$2
+	lw	$11,8($6)
+	sltu	$8,$13,$2
+	addu	$13,$12,$13
+	sltu	$2,$13,$12
+	sw	$13,4($4)
+	or	$2,$2,$8
+
+	lw	$12,12($5)
+	addu	$11,$11,$2
+	lw	$13,12($6)
+	sltu	$8,$11,$2
+	addu	$11,$10,$11
+	sltu	$2,$11,$10
+	sw	$11,8($4)
+	or	$2,$2,$8
+
+	lw	$10,16($5)
+	addu	$13,$13,$2
+	lw	$11,16($6)
+	sltu	$8,$13,$2
+	addu	$13,$12,$13
+	sltu	$2,$13,$12
+	sw	$13,12($4)
+	or	$2,$2,$8
+
+	addiu	$5,$5,16
+	addiu	$6,$6,16
+
+	bne	$7,$0,.Loop
+	 addiu	$4,$4,16
+
+.Lend:	addu	$11,$11,$2
+	sltu	$8,$11,$2
+	addu	$11,$10,$11
+	sltu	$2,$11,$10
+	sw	$11,0($4)
+	j	$31
+	or	$2,$2,$8
diff --git a/sysdeps/mips/add_n.s b/sysdeps/mips/add_n.s
deleted file mode 100644
index f5525cec46..0000000000
--- a/sysdeps/mips/add_n.s
+++ /dev/null
@@ -1,120 +0,0 @@
- # MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and
- # store sum in a third limb vector.
-
- # Copyright (C) 1995 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # s1_ptr	$5
- # s2_ptr	$6
- # size		$7
-
-	.text
-	.align	2
-	.globl	__mpn_add_n
-	.ent	__mpn_add_n
-__mpn_add_n:
-	.set	noreorder
-	.set	nomacro
-
-	lw	$10,0($5)
-	lw	$11,0($6)
-
-	addiu	$7,$7,-1
-	and	$9,$7,4-1	# number of limbs in first loop
-	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
-	 move	$2,$0
-
-	subu	$7,$7,$9
-
-.Loop0:	addiu	$9,$9,-1
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,4
-	addiu	$6,$6,4
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,.Loop0
-	 addiu	$4,$4,4
-
-.L0:	beq	$7,$0,.Lend
-	 nop
-
-.Loop:	addiu	$7,$7,-4
-
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	lw	$10,8($5)
-	addu	$13,$13,$2
-	lw	$11,8($6)
-	sltu	$8,$13,$2
-	addu	$13,$12,$13
-	sltu	$2,$13,$12
-	sw	$13,4($4)
-	or	$2,$2,$8
-
-	lw	$12,12($5)
-	addu	$11,$11,$2
-	lw	$13,12($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,8($4)
-	or	$2,$2,$8
-
-	lw	$10,16($5)
-	addu	$13,$13,$2
-	lw	$11,16($6)
-	sltu	$8,$13,$2
-	addu	$13,$12,$13
-	sltu	$2,$13,$12
-	sw	$13,12($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,16
-	addiu	$6,$6,16
-
-	bne	$7,$0,.Loop
-	 addiu	$4,$4,16
-
-.Lend:	addu	$11,$11,$2
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-
-	.end	__mpn_add_n
diff --git a/sysdeps/mips/addmul_1.S b/sysdeps/mips/addmul_1.S
new file mode 100644
index 0000000000..dc1dc1ba50
--- /dev/null
+++ b/sysdeps/mips/addmul_1.S
@@ -0,0 +1,98 @@
+/* MIPS __mpn_addmul_1 -- Multiply a limb vector with a single limb and
+add the product to a second limb vector.
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   s1_ptr	$5
+   size		$6
+   s2_limb	$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_addmul_1)
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+	/* warm up phase 0 */
+	lw	$8,0($5)
+
+	/* warm up phase 1 */
+	addiu	$5,$5,4
+	multu	$8,$7
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	move	$2,$0		/* zero cy2 */
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+
+Loop:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addiu	$5,$5,4
+	addu	$3,$3,$2	/* add old carry limb to low product limb */
+	multu	$8,$7
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+	addiu	$6,$6,-1	/* decrement loop counter */
+	sltu	$2,$3,$2	/* carry from previous addition -> $2 */
+	addu	$3,$10,$3
+	sltu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	addiu	$4,$4,4
+	bne	$6,$0,Loop	/* should be "bnel" */
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
+
+	/* cool down phase 1 */
+$LC1:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addu	$3,$3,$2
+	sltu	$2,$3,$2
+	multu	$8,$7
+	addu	$3,$10,$3
+	sltu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	addiu	$4,$4,4
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
+
+	/* cool down phase 0 */
+$LC0:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addu	$3,$3,$2
+	sltu	$2,$3,$2
+	addu	$3,$10,$3
+	sltu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	j	$31
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
diff --git a/sysdeps/mips/addmul_1.s b/sysdeps/mips/addmul_1.s
deleted file mode 100644
index 6145771e39..0000000000
--- a/sysdeps/mips/addmul_1.s
+++ /dev/null
@@ -1,97 +0,0 @@
- # MIPS __mpn_addmul_1 -- Multiply a limb vector with a single limb and
- # add the product to a second limb vector.
-
- # Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # s1_ptr	$5
- # size		$6
- # s2_limb	$7
-
-	.text
-	.align	 4
-	.globl	 __mpn_addmul_1
-	.ent	__mpn_addmul_1
-__mpn_addmul_1:
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	lw	$8,0($5)
-
- # warm up phase 1
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC0
-	 move	$2,$0		# zero cy2
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC1
-	lw	$8,0($5)	# load new s1 limb as early as possible
-
-Loop:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$3,$3,$2	# add old carry limb to low product limb
-	multu	$8,$7
-	lw	$8,0($5)	# load new s1 limb as early as possible
-	addiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$3,$2	# carry from previous addition -> $2
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,Loop
-	 addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-$LC1:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	multu	$8,$7
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-$LC0:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	j	$31
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_addmul_1
diff --git a/sysdeps/mips/bytesex.h b/sysdeps/mips/bits/endian.h
index ba555cd76e..ba555cd76e 100644
--- a/sysdeps/mips/bytesex.h
+++ b/sysdeps/mips/bits/endian.h
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
new file mode 100644
index 0000000000..7e570c6bff
--- /dev/null
+++ b/sysdeps/mips/bits/setjmp.h
@@ -0,0 +1,53 @@
+/* Define the machine-dependent type `jmp_buf'.  MIPS version.
+   Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+   Contributed by Brendan Kehoe (brendan@zen.org).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+typedef struct
+  {
+    /* Program counter.  */
+    __ptr_t __pc;
+
+    /* Stack pointer.  */
+    __ptr_t __sp;
+
+    /* Callee-saved registers s0 through s7.  */
+    int __regs[8];
+
+    /* The frame pointer.  */
+    __ptr_t __fp;
+
+    /* The global pointer.  */
+    __ptr_t __gp;
+
+    /* Floating point status register.  */
+    int __fpc_csr;
+
+    /* Callee-saved floating point registers.  */
+    double __fpregs[6];
+  } __jmp_buf[1];
+
+#ifdef __USE_MISC
+/* Offset to the program counter in `jmp_buf'.  */
+# define JB_PC	0
+#endif
+
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((__ptr_t) (address) < (jmpbuf)[0].__sp)
diff --git a/sysdeps/mips/bsd-_setjmp.S b/sysdeps/mips/bsd-_setjmp.S
index 78776cd3e5..f519f19359 100644
--- a/sysdeps/mips/bsd-_setjmp.S
+++ b/sysdeps/mips/bsd-_setjmp.S
@@ -1,21 +1,21 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  MIPS version.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
    We cannot do it in C because it must be a tail-call, so frame-unwinding
@@ -23,7 +23,14 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
-ENTRY (setjmp)
-	j C_SYMBOL_NAME (__sigsetjmp)
-	li a1, $0		/* Pass a second argument of zero.  */
-	.end setjmp
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (_setjmp)
+#ifdef PIC
+	.cpload t9
+#endif
+	la t9, C_SYMBOL_NAME (__sigsetjmp)
+	nop
+	jr t9
+	li a1, 0		/* Pass a second argument of zero.  */
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
index 4742462e88..9a22700718 100644
--- a/sysdeps/mips/bsd-setjmp.S
+++ b/sysdeps/mips/bsd-setjmp.S
@@ -1,21 +1,21 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  MIPS version.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
    We cannot do it in C because it must be a tail-call, so frame-unwinding
@@ -23,7 +23,14 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
+#ifdef PIC
+	.option pic2
+#endif
 ENTRY (setjmp)
-	j C_SYMBOL_NAME (__sigsetjmp)
+#ifdef PIC
+	.cpload t9
+#endif
+	la t9, C_SYMBOL_NAME (__sigsetjmp)
+	nop
+	jr t9
 	li a1, 1		/* Pass a second argument of one.  */
-	.end setjmp
diff --git a/sysdeps/mips/dec/bytesex.h b/sysdeps/mips/dec/bits/endian.h
index 157bc44d06..157bc44d06 100644
--- a/sysdeps/mips/dec/bytesex.h
+++ b/sysdeps/mips/dec/bits/endian.h
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 422179c47d..ff7d371025 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -18,30 +18,25 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef dl_machine_h
+#define dl_machine_h
+
 #define ELF_MACHINE_NAME "MIPS"
 
 #include <assert.h>
-#include <string.h>
-#include <link.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
 
 /* Translate a processor specific dynamic tag to the index
    in l_info array.  */
 #define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
 
-#if 1
-/* XXX If FLAGS has the MAP_ALIGN bit, we need 64k alignment. */
-#ifndef MAP_ALIGN
-#define MAP_ALIGN 0x1000
-#endif
-#define ELF_MACHINE_ALIGN_MASK(flags) ((flags & MAP_ALIGN) ? 0xffff : 0)
+#if 0
+/* We may need 64k alignment. */
+#define ELF_MACHINE_ALIGN_MASK 0xffff
 #endif
 
 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
    with the run-time address of the r_debug structure  */
-#define ELF_MACHINE_SET_DEBUG(l,r) \
+#define ELF_MACHINE_DEBUG_SETUP(l,r) \
 do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
        *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
        (ElfW(Addr)) (r); \
@@ -67,14 +62,16 @@ elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
   /* FIXME: the offset of gp from GOT may be system-dependent. */
   return (ElfW(Addr) *) (gpreg - 0x7ff0);
 }
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  */
-static inline ElfW(Addr)
-elf_machine_dynamic (void)
+
+/* Return the run-time address of the _GLOBAL_OFFSET_TABLE_.
+   Must be inlined in a function which uses global data.  */
+static inline ElfW(Addr) *
+elf_machine_got (void)
 {
-  register ElfW(Addr) gp asm ("$28");
-  return * (ElfW(Addr) *) (gp - 0x7ff0);
+  ElfW(Addr) gp;
+
+  __asm__ __volatile__("move %0, $28\n\t" : "=r" (gp));
+  return elf_mips_got_from_gpreg (gp);
 }
 
 
@@ -83,6 +80,15 @@ static inline ElfW(Addr)
 elf_machine_load_address (void)
 {
   ElfW(Addr) addr;
+#ifdef __mips64
+  asm ("	.set noreorder\n"
+       "	dla %0, here\n"
+       "	bltzal $0, here\n"
+       "	nop\n"
+       "here:	dsubu %0, $31, %0\n"
+       "	.set reorder\n"
+       : "=r" (addr));
+#else
   asm ("	.set noreorder\n"
        "	la %0, here\n"
        "	bltzal $0, here\n"
@@ -90,6 +96,7 @@ elf_machine_load_address (void)
        "here:	subu %0, $31, %0\n"
        "	.set reorder\n"
        : "=r" (addr));
+#endif
   return addr;
 }
 
@@ -97,7 +104,7 @@ elf_machine_load_address (void)
 #define ELF_MIPS_GNU_GOT1_MASK 0x80000000
 
 /* Relocate GOT. */
-static void
+static inline void
 elf_machine_got_rel (struct link_map *map)
 {
   ElfW(Addr) *got;
@@ -107,14 +114,14 @@ elf_machine_got_rel (struct link_map *map)
   const char *strtab
     = ((void *) map->l_addr + map->l_info[DT_STRTAB]->d_un.d_ptr);
 
-  ElfW(Addr) resolve (const ElfW(Sym) *sym)
-    {
-      const ElfW(Sym) *ref = sym;
-      ElfW(Addr) sym_loadaddr;
-      sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope,
-					map->l_name, 0, 1);
-      return (ref)? sym_loadaddr + ref->st_value: 0;
-    }
+#define RESOLVE_GOTSYM(sym) \
+    ({ \
+      const ElfW(Sym) *ref = sym; \
+      ElfW(Addr) sym_loadaddr; \
+      sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope, \
+					map->l_name, DL_LOOKUP_NOPLT); \
+      (ref)? sym_loadaddr + ref->st_value: 0; \
+    })
 
   got = (ElfW(Addr) *) ((void *) map->l_addr
 			+ map->l_info[DT_PLTGOT]->d_un.d_ptr);
@@ -147,39 +154,35 @@ elf_machine_got_rel (struct link_map *map)
 	      if (sym->st_value /* && maybe_stub (sym->st_value) */)
 		*got = sym->st_value + map->l_addr;
 	      else
-		*got = resolve (sym);
+		*got = RESOLVE_GOTSYM (sym);
 	    }
 	  else /* if (*got == 0 || *got == QS) */
-	    *got = resolve (sym);
+	    *got = RESOLVE_GOTSYM (sym);
 	}
       else if (sym->st_shndx == SHN_COMMON)
-	*got = resolve (sym);
+	*got = RESOLVE_GOTSYM (sym);
       else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
 	       && *got != sym->st_value
 	       /* && maybe_stub (*got) */)
 	*got += map->l_addr;
-      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
-	       && ELFW(ST_BIND) (sym->st_info) == STB_GLOBAL)
+      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
 	{
-	  if (sym->st_other == 0 && sym->st_shndx == SHN_ABS)
-	    *got = sym->st_value + map->l_addr; /* only for _gp_disp  */
-	  /* else SGI stuff ignored */
+	  if (sym->st_other == 0)
+	    *got += map->l_addr;
 	}
       else
-	*got = resolve (sym);
+	*got = RESOLVE_GOTSYM (sym);
 
       got++;
       sym++;
     }
 
+#undef RESOLVE_GOTSYM
   *_dl_global_scope_end = NULL;
 
   return;
 }
 
-/* The MIPS never uses Elfxx_Rela relocations.  */
-#define ELF_MACHINE_NO_RELA 1
-
 /* Set up the loaded object described by L so its stub function
    will jump to the on-demand fixup code in dl-runtime.c.  */
 
@@ -188,6 +191,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
 {
   ElfW(Addr) *got;
   extern void _dl_runtime_resolve (ElfW(Word));
+  extern int _dl_mips_gnu_objects;
 
   if (lazy)
     {
@@ -208,7 +212,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
       if ((got[1] & ELF_MIPS_GNU_GOT1_MASK) != 0)
 	got[1] = (ElfW(Addr)) ((unsigned) l | ELF_MIPS_GNU_GOT1_MASK);
       else
-	; /* Do nothing. */
+	_dl_mips_gnu_objects = 0;
     }
 
   /* Relocate global offset table.  */
@@ -219,29 +223,64 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
 
 /* Get link_map for this object.  */
 static inline struct link_map *
-elf_machine_runtime_link_map (ElfW(Addr) gpreg)
+elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
 {
-  ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
-  ElfW(Word) g1;
-
-  g1 = ((ElfW(Word) *) got)[1];
+  extern int _dl_mips_gnu_objects;
 
   /* got[1] is reserved to keep its link map address for the shared
-     object generated by gnu linker. If not so, we must search GOT
-     in object list slowly. XXX  */
-  if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
-    return (struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
-  else
+     object generated by gnu linker. If all are such object, we can
+     find link map from current GPREG simply. If not so, get link map
+     for callers object containing STUB_PC.  */
+
+  if (_dl_mips_gnu_objects)
+    {
+      ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
+      ElfW(Word) g1;
+
+      g1 = ((ElfW(Word) *) got)[1];
+
+      if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
+	return (struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
+    }
+
     {
       struct link_map *l = _dl_loaded;
+      struct link_map *ret = 0;
+      ElfW(Addr) candidate = 0;
+
       while (l)
 	{
-	  if (got == (ElfW(Addr) *) ((void *) l->l_addr
-				     + l->l_info[DT_PLTGOT]->d_un.d_ptr))
-	    return l;
+	  ElfW(Addr) base = 0;
+	  const ElfW(Phdr) *p = l->l_phdr;
+	  ElfW(Half) this, nent = l->l_phnum;
+
+	  /* Get the base. */
+	  for (this = 0; this < nent; this++)
+	    if (p[this].p_type == PT_LOAD)
+	      {
+		base = p[this].p_vaddr + l->l_addr;
+		break;
+	      }
+	  if (! base)
+	    {
+	      l = l->l_next;
+	      continue;
+	    }
+
+	  /* Find closest link base addr. */
+	  if ((base < stub_pc) && (candidate < base))
+	    {
+	      candidate = base;
+	      ret = l;
+	    }
 	  l = l->l_next;
 	}
+      if (candidate && ret && (candidate < stub_pc))
+	return ret;
+      else if (!candidate)
+	return _dl_loaded;
     }
+
   _dl_signal_error (0, NULL, "cannot find runtime link map");
 }
 
@@ -255,17 +294,117 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg)
      t8  index for this function symbol in .dynsym
    to usual c arguments.  */
 
+#ifdef __mips64
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
+   generated by the gnu linker. */\
+int _dl_mips_gnu_objects = 1;\
+\
+/* This is called from assembly stubs below which the compiler can't see.  */ \
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
+                  __attribute__ ((unused)); \
+\
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word) sym_index,\
+		      ElfW(Word) return_address,\
+		      ElfW(Addr) old_gpreg,\
+		      ElfW(Addr) stub_pc)\
+{\
+  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);\
+  const ElfW(Sym) *const symtab\
+    = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);\
+  const char *strtab\
+    = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);\
+  const ElfW(Addr) *got\
+    = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);\
+  const ElfW(Word) local_gotno\
+    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;\
+  const ElfW(Word) gotsym\
+    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;\
+  const ElfW(Sym) *definer;\
+  ElfW(Addr) loadbase;\
+  ElfW(Addr) funcaddr;\
+  struct link_map **scope;\
+\
+  /* Look up the symbol's run-time value.  */\
+  scope = _dl_object_relocation_scope (l);\
+  definer = &symtab[sym_index];\
+\
+  loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,\
+				scope, l->l_name, DL_LOOKUP_NOPLT);\
+\
+  *_dl_global_scope_end = NULL;\
+\
+  /* Apply the relocation with that value.  */\
+  funcaddr = loadbase + definer->st_value;\
+  *(got + local_gotno + sym_index - gotsym) = funcaddr;\
+\
+  return funcaddr;\
+}\
+\
+asm ("\n\
+	.text\n\
+	.align	3\n\
+	.globl	_dl_runtime_resolve\n\
+	.type	_dl_runtime_resolve,@function\n\
+	.ent	_dl_runtime_resolve\n\
+_dl_runtime_resolve:\n\
+	.set noreorder\n\
+	# Save old GP to $3.\n\
+	move	$3,$28\n\
+	# Modify t9 ($25) so as to point .cpload instruction.\n\
+	daddu	$25,2*8\n\
+	# Compute GP.\n\
+	.cpload $25\n\
+	.set reorder\n\
+	# Save slot call pc.\n\
+        move	$2, $31\n\
+	# Save arguments and sp value in stack.\n\
+	dsubu	$29, 10*8\n\
+	.cprestore 8*8\n\
+	sd	$15, 9*8($29)\n\
+	sd	$4, 3*8($29)\n\
+	sd	$5, 4*8($29)\n\
+	sd	$6, 5*8($29)\n\
+	sd	$7, 6*8($29)\n\
+	sd	$16, 7*8($29)\n\
+	move	$16, $29\n\
+	move	$4, $24\n\
+	move	$5, $15\n\
+	move	$6, $3\n\
+	move	$7, $2\n\
+	jal	__dl_runtime_resolve\n\
+	move	$29, $16\n\
+	ld	$31, 9*8($29)\n\
+	ld	$4, 3*8($29)\n\
+	ld	$5, 4*8($29)\n\
+	ld	$6, 5*8($29)\n\
+	ld	$7, 6*8($29)\n\
+	ld	$16, 7*8($29)\n\
+	daddu	$29, 10*8\n\
+	move	$25, $2\n\
+	jr	$25\n\
+	.end	_dl_runtime_resolve\n\
+");
+#else
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
+   generated by the gnu linker. */\
+int _dl_mips_gnu_objects = 1;\
+\
 /* This is called from assembly stubs below which the compiler can't see.  */ \
-static ElfW(Addr) __dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr)) \
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
                   __attribute__ ((unused)); \
 \
 static ElfW(Addr) \
 __dl_runtime_resolve (ElfW(Word) sym_index,\
 		      ElfW(Word) return_address,\
-		      ElfW(Addr) old_gpreg)\
+		      ElfW(Addr) old_gpreg,\
+		      ElfW(Addr) stub_pc)\
 {\
-  struct link_map *l = elf_machine_runtime_link_map (old_gpreg);\
+  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);\
   const ElfW(Sym) *const symtab\
     = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);\
   const char *strtab\
@@ -286,7 +425,7 @@ __dl_runtime_resolve (ElfW(Word) sym_index,\
   definer = &symtab[sym_index];\
 \
   loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,\
-				scope, l->l_name, 0, 1);\
+				scope, l->l_name, DL_LOOKUP_NOPLT);\
 \
   *_dl_global_scope_end = NULL;\
 \
@@ -312,6 +451,8 @@ _dl_runtime_resolve:\n\
 	# Compute GP.\n\
 	.cpload $25\n\
 	.set reorder\n\
+	# Save slot call pc.\n\
+        move	$2, $31\n\
 	# Save arguments and sp value in stack.\n\
 	subu	$29, 40\n\
 	.cprestore 32\n\
@@ -325,6 +466,7 @@ _dl_runtime_resolve:\n\
 	move	$4, $24\n\
 	move	$5, $15\n\
 	move	$6, $3\n\
+	move	$7, $2\n\
 	jal	__dl_runtime_resolve\n\
 	move	$29, $16\n\
 	lw	$31, 36($29)\n\
@@ -338,15 +480,91 @@ _dl_runtime_resolve:\n\
 	jr	$25\n\
 	.end	_dl_runtime_resolve\n\
 ");
+#endif
 
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK	0x00000000UL
 
+
+
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
 
+#ifdef __mips64
+#define RTLD_START asm ("\
+	.text\n\
+	.align	3\n\
+	.globl _start\n\
+	.globl _dl_start_user\n\
+	.ent _start\n\
+_start:\n\
+	.set noreorder\n\
+	bltzal $0, 0f\n\
+	nop\n\
+0:	.cpload $31\n\
+	.set reorder\n\
+	# i386 ABI book says that the first entry of GOT holds\n\
+	# the address of the dynamic structure. Though MIPS ABI\n\
+	# doesn't say nothing about this, I emulate this here.\n\
+	dla $4, _DYNAMIC\n\
+	sd $4, -0x7ff0($28)\n\
+	move $4, $29\n\
+	jal _dl_start\n\
+	# Get the value of label '_dl_start_user' in t9 ($25).\n\
+	dla $25, _dl_start_user\n\
+_dl_start_user:\n\
+	.set noreorder\n\
+	.cpload $25\n\
+	.set reorder\n\
+	move $16, $28\n\
+	# Save the user entry point address in saved register.\n\
+	move $17, $2\n\
+	# See if we were run as a command with the executable file\n\
+	# name as an extra leading argument.\n\
+	ld $2, _dl_skip_args\n\
+	beq $2, $0, 1f\n\
+	# Load the original argument count.\n\
+	ld $4, 0($29)\n\
+	# Subtract _dl_skip_args from it.\n\
+	dsubu $4, $2\n\
+	# Adjust the stack pointer to skip _dl_skip_args words.\n\
+	dsll $2,2\n\
+	daddu $29, $2\n\
+	# Save back the modified argument count.\n\
+	sd $4, 0($29)\n\
+	# Get _dl_default_scope[2] as argument in _dl_init_next call below.\n\
+1:	dla $2, _dl_default_scope\n\
+	ld $4, 2*8($2)\n\
+	# Call _dl_init_next to return the address of an initializer\n\
+	# function to run.\n\
+	jal _dl_init_next\n\
+	move $28, $16\n\
+	# Check for zero return,  when out of initializers.\n\
+	beq $2, $0, 2f\n\
+	# Call the shared object initializer function.\n\
+	move $25, $2\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8($29)\n\
+	ld $7, 3*8($29)\n\
+	jalr $25\n\
+	move $28, $16\n\
+	# Loop to call _dl_init_next for the next initializer.\n\
+	b 1b\n\
+	# Pass our finalizer function to the user in ra.\n\
+2:	dla $31, _dl_fini\n\
+	# Jump to the user entry point.\n\
+	move $25, $17\n\
+	ld $4, 0($29)\n\
+	ld $5, 1*8($29)\n\
+	ld $6, 2*8$29)\n\
+	ld $7, 3*8($29)\n\
+	jr $25\n\
+	.end _start\n\
+");
+#else
 #define RTLD_START asm ("\
 	.text\n\
 	.globl _start\n\
@@ -417,6 +635,12 @@ _dl_start_user:\n\
 	jr $25\n\
 	.end _start\n\
 ");
+#endif
+
+/* The MIPS never uses Elfxx_Rela relocations.  */
+#define ELF_MACHINE_NO_RELA 1
+
+#endif /* !dl_machine_h */
 
 #ifdef RESOLVE
 
@@ -428,34 +652,37 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
 		 const ElfW(Sym) *sym, const struct r_found_version *version)
 {
   ElfW(Addr) *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
-  ElfW(Addr) loadbase, undo;
+  ElfW(Addr) loadbase;
+  ElfW(Addr) undo __attribute__ ((unused));
 
   switch (ELFW(R_TYPE) (reloc->r_info))
     {
     case R_MIPS_REL32:
-      if (ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
-	  && (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
-	      || ELFW(ST_TYPE) (sym->st_info) == STT_NOTYPE))
-	*reloc_addr += map->l_addr;
-      else
-	{
+      {
+	ElfW(Addr) undo = 0;
+
+	if (ELFW(ST_BIND) (sym->st_info) == STB_LOCAL
+	    && (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION
+		|| ELFW(ST_TYPE) (sym->st_info) == STT_NOTYPE))
+	  {
+	    *reloc_addr += map->l_addr;
+	    break;
+	  }
 #ifndef RTLD_BOOTSTRAP
-	  /* This is defined in rtld.c, but nowhere in the static libc.a;
-	     make the reference weak so static programs can still link.  This
-	     declaration cannot be done when compiling rtld.c (i.e.  #ifdef
-	     RTLD_BOOTSTRAP) because rtld.c contains the common defn for
-	     _dl_rtld_map, which is incompatible with a weak decl in the same
-	     file.  */
-	  weak_extern (_dl_rtld_map);
-	  if (map == &_dl_rtld_map)
-	    /* Undo the relocation done here during bootstrapping.  Now we will
-	       relocate it anew, possibly using a binding found in the user
-	       program or a loaded library rather than the dynamic linker's
-	       built-in definitions used while loading those libraries.  */
-	    undo = map->l_addr + sym->st_value;
-	  else
+	/* This is defined in rtld.c, but nowhere in the static libc.a;
+	   make the reference weak so static programs can still link.  This
+	   declaration cannot be done when compiling rtld.c (i.e.  #ifdef
+	   RTLD_BOOTSTRAP) because rtld.c contains the common defn for
+	   _dl_rtld_map, which is incompatible with a weak decl in the same
+	   file.  */
+	weak_extern (_dl_rtld_map);
+	if (map == &_dl_rtld_map)
+	  /* Undo the relocation done here during bootstrapping.  Now we will
+	     relocate it anew, possibly using a binding found in the user
+	     program or a loaded library rather than the dynamic linker's
+	     built-in definitions used while loading those libraries.  */
+	  undo = map->l_addr + sym->st_value;
 #endif
-	    undo = 0;
 	  loadbase = RESOLVE (&sym, version, 0);
 	  *reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo;
 	}
diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S
new file mode 100644
index 0000000000..0db3a04a7d
--- /dev/null
+++ b/sysdeps/mips/elf/start.S
@@ -0,0 +1,181 @@
+/* Startup code compliant to the ELF Mips ABI.
+Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* This is the canonical entry point, usually the first thing in the text
+   segment.  The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
+   point runs, most registers' values are unspecified, except for:
+
+   v1 ($2)	Contains a function pointer to be registered with `atexit'.
+   		This is how the dynamic linker arranges to have DT_FINI
+		functions called for shared libraries that have been loaded
+		before this code runs.
+
+   sp ($29)	The stack contains the arguments and environment:
+   		0(%esp)			argc
+		4(%esp)			argv[0]
+		...
+		(4*argc)(%esp)		NULL
+		(4*(argc+1))(%esp)	envp[0]
+		...
+					NULL
+   ra ($31)	The return address register is set to zero so that programs
+		that search backword through stack frames recognize the last
+		stack frame.
+*/
+
+#ifdef PIC
+/* A macro to (re)initialize gp. We can get the run time address of 0f in
+   ra ($31) by blezal instruction. In this early phase, we can't save gp
+   in stack and .cprestore doesn't work properly. So we set gp by using
+   this macro. */
+#define SET_GP \
+	.set noreorder;	\
+	bltzal $0,0f;	\
+	nop;		\
+0:	.cpload $31;	\
+	.set reorder;
+#endif
+
+	.text	
+	.globl _start
+_start:
+#ifdef PIC
+	SET_GP
+#endif
+	move $31, $0
+
+	/* $2 contains the address of the shared library termination
+	   function, which we will register with `atexit' to be called by
+	   `exit'.  I suspect that on some systems, and when statically
+	   linked, this will not be set by anything to any function
+	   pointer; hopefully it will be zero so we don't try to call
+	   random pointers.  */
+	beq $2, $0, nofini
+	move $4, $2
+	jal atexit
+#ifdef PIC
+	SET_GP
+#endif
+nofini:
+
+	/* Do essential libc initialization.  In statically linked
+	   programs under the GNU Hurd, this is what sets up the
+	   arguments on the stack for the code below. Since the argument
+	   registers (a0 - a3) saved to the first 4 stack entries by
+	   the prologue of __libc_init_first, we preload them to
+	   prevent clobbering the stack tops. In Hurd case, stack pointer
+	   ($29) may be VM_MAX_ADDRESS here. If so, we must modify it.  */
+#if (__mips64)
+	dli $4, 0x10000000000
+	bne $29, $4, 1f
+	dsubu $29, 32
+	sd $0, 0($29)
+	sd $0, 8($29)
+	sd $0, 16($29)
+	sd $0, 24($29)
+1:
+	ld $4, 0($29)
+	ld $5, 8($29)
+	ld $6, 16($29)
+	ld $7, 24($29)
+#else  /* __mips64 */
+	li $4, 0x80000000
+	bne $29, $4, 1f
+	subu $29, 16
+	sw $0, 0($29)
+	sw $0, 4($29)
+	sw $0, 8($29)
+	sw $0, 12($29)
+1:
+	lw $4, 0($29)
+	lw $5, 4($29)
+	lw $6, 8($29)
+	lw $7, 12($29)
+#endif  /* __mips64 */
+
+	jal __libc_init_first
+#ifdef PIC
+	SET_GP
+#endif
+#if (__mips64)
+	ld $4, 0($29)
+	ld $5, 8($29)
+	ld $6, 16($29)
+	ld $7, 24($29)
+#else  /* __mips64 */
+	lw $4, 0($29)
+	lw $5, 4($29)
+	lw $6, 8($29)
+	lw $7, 12($29)
+#endif  /* __mips64 */
+	
+	/* Call `_init', which is the entry point to our own `.init'
+	   section; and register with `atexit' to have `exit' call
+	   `_fini', which is the entry point to our own `.fini' section.  */
+	jal _init
+#ifdef PIC
+	SET_GP
+#endif
+#if (__mips64)
+	dla $4, _fini
+#else  /* __mips64 */
+	la $4, _fini
+#endif  /* __mips64 */
+
+	jal atexit
+#ifdef PIC
+	SET_GP
+#endif
+
+	/* Extract the arguments and environment as encoded on the stack
+	   and set up the arguments for `main': argc, argv, envp.  */
+#if (__mips64)
+	ld $4, 0($29)		/* argc */
+	daddu $5, $29, 8	/* argv */
+	dsll $6, $4, 3
+	daddu $6, $6, 8
+	daddu $6, $5, $6	/* envp = &argv[argc + 1] */
+#else  /* __mips64 */
+	lw $4, 0($29)		/* argc */
+	addu $5, $29, 4		/* argv */
+	sll $6, $4, 2
+	addu $6, $6, 4
+	addu $6, $5, $6		/* envp = &argv[argc + 1] */
+#endif  /* __mips64 */
+
+	/* Call the user's main function, and exit with its value.  */
+	jal main
+#ifdef PIC
+	SET_GP
+#endif
+	move $4, $2
+	jal exit		/* This should never return.  */
+hlt:	b hlt			/* Crash if somehow it does return.  */
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl __data_start
+__data_start:
+#if (__mips64)
+	.dword 0
+#else  /* __mips64 */
+	.word 0
+#endif  /* __mips64 */
+	.weak data_start
+	data_start = __data_start
diff --git a/sysdeps/mips/fpu_control.h b/sysdeps/mips/fpu_control.h
new file mode 100644
index 0000000000..36e05a4f6e
--- /dev/null
+++ b/sysdeps/mips/fpu_control.h
@@ -0,0 +1,96 @@
+/* FPU control word bits.  Mips version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Olaf Flebbe.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _FPU_CONTROL_H
+#define _FPU_CONTROL_H
+
+/* FP control/status register bit assignments.
+ *
+ *     31-25    24  23     22-18       17-12          11-7       6-2     1-0
+ *                                    (cause)      (enables)   (flags)
+ * | reserved | FS | C | reserved | E V Z O U I | V Z O U I | V Z O U I | RM
+ *
+ * FS: When set, denormalized results are flushed to zero instead of
+ *     causing an unimplemented operation exception.
+ * C:  Condition bit.
+ * E:  Unimplemented Operation.
+ * V:  Invalid Operation.
+ * Z:  Division by zero.
+ * O:  Overflow.
+ * U:  Underflow.
+ * I:  Inexact Operation
+ * RM: Rounding mode bits
+ * 00 (RN) - rounding to nearest
+ * 01 (RZ) - rounding toward zero
+ * 10 (RP) - rounding down (toward - infinity)
+ * 11 (RM) - rounding up (toward + infinity)
+ *
+ */
+
+#include <features.h>
+
+/* masking of interrupts */
+#define _FPU_MASK_IM  (1 << 11)
+#define _FPU_MASK_DM  (1 << 24)	/* XXX */
+#define _FPU_MASK_ZM  (1 << 10)
+#define _FPU_MASK_OM  (1 << 9)
+#define _FPU_MASK_UM  (1 << 8)
+#define _FPU_MASK_PM  (1 << 7)
+
+/* precision control */
+#define _FPU_EXTENDED 0
+#define _FPU_DOUBLE   0
+#define _FPU_SINGLE   0
+
+/* rounding control */
+#define _FPU_RC_NEAREST 0x0    /* RECOMMENDED */
+#define _FPU_RC_DOWN    0x2
+#define _FPU_RC_UP      0x3
+#define _FPU_RC_ZERO    0x1
+
+#define _FPU_RESERVED 0xfe7c0000  /* Reserved bits */
+
+
+/* The fdlibm code requires strict IEEE double precision arithmetic,
+   and no interrupts for exceptions, rounding to nearest.  */
+
+#define _FPU_DEFAULT  0x0
+
+/* IEEE:  same as above, but exceptions */
+#define _FPU_IEEE     (0x1f << 7)
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word.  */
+#define _FPU_GETCW(cw) __asm__ ("cfc1 %0, $31; nop; nop" : "=r" (cw))
+#define _FPU_SETCW(cw) __asm__ ("ctc1 %0, $31; nop; nop" : : "r" (cw))
+
+/* Default control word set at startup.  */
+extern fpu_control_t __fpu_control;
+
+__BEGIN_DECLS
+
+/* Called at startup.  It can be used to manipulate fpu control register.  */
+extern void __setfpucw __P ((fpu_control_t));
+
+__END_DECLS
+
+#endif	/* fpu_control.h */
diff --git a/sysdeps/mips/init-first.c b/sysdeps/mips/init-first.c
new file mode 100644
index 0000000000..3fc4b7bc04
--- /dev/null
+++ b/sysdeps/mips/init-first.c
@@ -0,0 +1,64 @@
+/* Initialization code run first thing by the ELF startup code.  For mips/Unix.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <unistd.h>
+
+extern void __libc_init (int, char **, char **);
+extern void __libc_global_ctors (void);
+
+
+static void
+init (int *data)
+{
+  int argc = *data;
+  char **argv = (void *) (data + 1);
+  char **envp = &argv[argc + 1];
+
+  __environ = envp;
+  __libc_init (argc, argv, envp);
+}
+
+#ifdef PIC
+/* This function is called to initialize the shared C library.
+   It is called just before the user _start code from mips/elf/start.S,
+   with the stack set up as that code gets it.  */
+
+/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
+   pointer in the dynamic section based solely on that.  It is convention
+   for this function to be in the `.init' section, but the symbol name is
+   the only thing that really matters!!  */
+/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
+
+void
+_init (int argc, ...)
+{
+  init (&argc);
+
+  __libc_global_ctors ();
+}
+#endif
+
+
+void
+__libc_init_first (int argc __attribute__ ((unused)), ...)
+{
+#ifndef PIC
+  init (&argc);
+#endif
+}
diff --git a/sysdeps/mips/jmp_buf.h b/sysdeps/mips/jmp_buf.h
deleted file mode 100644
index 102a0193d8..0000000000
--- a/sysdeps/mips/jmp_buf.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Define the machine-dependent type `jmp_buf'.  MIPS version.
-   Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-typedef struct
-  {
-    /* Program counter.  */
-    __ptr_t __pc;
-    
-    /* Stack pointer.  */
-    __ptr_t __sp;
-    
-    /* Callee-saved registers s0 through s7.  */
-    int __regs[8];
-    
-    /* The frame pointer.  */
-    __ptr_t __fp;
-    
-    /* The global pointer.  */
-    __ptr_t __gp;
-    
-    /* Floating point status register.  */
-    int __fpc_csr;
-    
-    /* Callee-saved floating point registers.  */
-    double __fpregs[6];
-  } __jmp_buf[1];
-
-#ifdef __USE_MISC
-/* Offset to the program counter in `jmp_buf'.  */
-#define JB_PC	0
-#endif
-
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((__ptr_t) (address) < (jmpbuf)[0].__sp)
diff --git a/sysdeps/mips/lshift.S b/sysdeps/mips/lshift.S
new file mode 100644
index 0000000000..e76630310f
--- /dev/null
+++ b/sysdeps/mips/lshift.S
@@ -0,0 +1,97 @@
+/* MIPS2 __mpn_lshift --
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   src_ptr	$5
+   size		$6
+   cnt		$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_lshift)
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	sll	$2,$6,2
+	addu	$5,$5,$2	/* make r5 point at end of src */
+	lw	$10,-4($5)	/* load first limb */
+	subu	$13,$0,$7
+	addu	$4,$4,$2	/* make r4 point at end of res */
+	addiu	$6,$6,-1
+	and	$9,$6,4-1	/* number of limbs in first loop */
+	beq	$9,$0,.L0	/* if multiple of 4 limbs, skip first loop */
+	 srl	$2,$10,$13	/* compute function result */
+
+	subu	$6,$6,$9
+
+.Loop0:	lw	$3,-8($5)
+	addiu	$4,$4,-4
+	addiu	$5,$5,-4
+	addiu	$9,$9,-1
+	sll	$11,$10,$7
+	srl	$12,$3,$13
+	move	$10,$3
+	or	$8,$11,$12
+	bne	$9,$0,.Loop0
+	 sw	$8,0($4)
+
+.L0:	beq	$6,$0,.Lend
+	 nop
+
+.Loop:	lw	$3,-8($5)
+	addiu	$4,$4,-16
+	addiu	$6,$6,-4
+	sll	$11,$10,$7
+	srl	$12,$3,$13
+
+	lw	$10,-12($5)
+	sll	$14,$3,$7
+	or	$8,$11,$12
+	sw	$8,12($4)
+	srl	$9,$10,$13
+
+	lw	$3,-16($5)
+	sll	$11,$10,$7
+	or	$8,$14,$9
+	sw	$8,8($4)
+	srl	$12,$3,$13
+
+	lw	$10,-20($5)
+	sll	$14,$3,$7
+	or	$8,$11,$12
+	sw	$8,4($4)
+	srl	$9,$10,$13
+
+	addiu	$5,$5,-16
+	or	$8,$14,$9
+	bgtz	$6,.Loop
+	 sw	$8,0($4)
+
+.Lend:	sll	$8,$10,$7
+	j	$31
+	sw	$8,-4($4)
diff --git a/sysdeps/mips/lshift.s b/sysdeps/mips/lshift.s
deleted file mode 100644
index ee92d7916f..0000000000
--- a/sysdeps/mips/lshift.s
+++ /dev/null
@@ -1,95 +0,0 @@
- # MIPS2 __mpn_lshift --
-
- # Copyright (C) 1995 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # src_ptr	$5
- # size		$6
- # cnt		$7
-
-	.text
-	.align	2
-	.globl	__mpn_lshift
-	.ent	__mpn_lshift
-__mpn_lshift:
-	.set	noreorder
-	.set	nomacro
-
-	sll	$2,$6,2
-	addu	$5,$5,$2	# make r5 point at end of src
-	lw	$10,-4($5)	# load first limb
-	subu	$13,$0,$7
-	addu	$4,$4,$2	# make r4 point at end of res
-	addiu	$6,$6,-1
-	and	$9,$6,4-1	# number of limbs in first loop
-	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
-	 srl	$2,$10,$13	# compute function result
-
-	subu	$6,$6,$9
-
-.Loop0:	lw	$3,-8($5)
-	addiu	$4,$4,-4
-	addiu	$5,$5,-4
-	addiu	$9,$9,-1
-	sll	$11,$10,$7
-	srl	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,.Loop0
-	 sw	$8,0($4)
-
-.L0:	beq	$6,$0,.Lend
-	 nop
-
-.Loop:	lw	$3,-8($5)
-	addiu	$4,$4,-16
-	addiu	$6,$6,-4
-	sll	$11,$10,$7
-	srl	$12,$3,$13
-
-	lw	$10,-12($5)
-	sll	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,12($4)
-	srl	$9,$10,$13
-
-	lw	$3,-16($5)
-	sll	$11,$10,$7
-	or	$8,$14,$9
-	sw	$8,8($4)
-	srl	$12,$3,$13
-
-	lw	$10,-20($5)
-	sll	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,4($4)
-	srl	$9,$10,$13
-
-	addiu	$5,$5,-16
-	or	$8,$14,$9
-	bgtz	$6,.Loop
-	 sw	$8,0($4)
-
-.Lend:	sll	$8,$10,$7
-	j	$31
-	sw	$8,-4($4)
-	.end	__mpn_lshift
diff --git a/sysdeps/mips/machine-gmon.h b/sysdeps/mips/machine-gmon.h
new file mode 100644
index 0000000000..a01b1746f4
--- /dev/null
+++ b/sysdeps/mips/machine-gmon.h
@@ -0,0 +1,57 @@
+/* Machine-specific calling sequence for `mcount' profiling function.  MIPS
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#define _MCOUNT_DECL static void __mcount
+
+/* Call __mcount with our the return PC for our caller,
+   and the return PC our caller will return to.  */
+#ifdef PIC
+#define CPLOAD ".cpload $25;"
+#else
+#define CPLOAD
+#endif
+
+#define MCOUNT asm(\
+	".globl _mcount;" \
+	".align 2;" \
+	".type _mcount,@function;" \
+        "_mcount:;" \
+        ".set noreorder;" \
+        ".set noat;" \
+        CPLOAD \
+        "sw $4,8($29);" \
+        "sw $5,12($29);" \
+        "sw $6,16($29);" \
+        "sw $7,20($29);" \
+        "sw $1,0($29);" \
+        "sw $31,4($29);" \
+        "move $5,$31;" \
+        "jal __mcount;" \
+        "move $4,$1;" \
+        "lw $4,8($29);" \
+        "lw $5,12($29);" \
+        "lw $6,16($29);" \
+        "lw $7,20($29);" \
+        "lw $31,4($29);" \
+        "lw $1,0($29);" \
+        "addu $29,$29,8;" \
+        "j $31;" \
+        "move $31,$1;" \
+        ".set reorder;" \
+        ".set at");
diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implies
new file mode 100644
index 0000000000..a8cae95f9d
--- /dev/null
+++ b/sysdeps/mips/mips64/Implies
@@ -0,0 +1 @@
+wordsize-64
diff --git a/sysdeps/mips/mips64/__longjmp.c b/sysdeps/mips/mips64/__longjmp.c
new file mode 100644
index 0000000000..551daa4895
--- /dev/null
+++ b/sysdeps/mips/mips64/__longjmp.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Brendan Kehoe (brendan@zen.org).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <setjmp.h>
+#include <stdlib.h>
+
+#undef __longjmp
+
+#ifndef	__GNUC__
+  #error This file uses GNU C extensions; you must compile with GCC.
+#endif
+
+void
+__longjmp (env, val_arg)
+     __jmp_buf env;
+     int val_arg;
+{
+  /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
+     the hack around it); force it to use $a1 for the longjmp value.
+     Without this it saves $a1 in a register which gets clobbered
+     along the way.  */
+  register int val asm ("a1");
+
+  /* Pull back the floating point callee-saved registers.  */
+  asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[0]));
+  asm volatile ("l.d $f25, %0" : : "m" (env[0].__fpregs[1]));
+  asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[2]));
+  asm volatile ("l.d $f27, %0" : : "m" (env[0].__fpregs[3]));
+  asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
+  asm volatile ("l.d $f29, %0" : : "m" (env[0].__fpregs[5]));
+  asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[6]));
+  asm volatile ("l.d $f31, %0" : : "m" (env[0].__fpregs[7]));
+
+  /* Restore the stack pointer.  */
+  asm volatile ("ld $29, %0" : : "m" (env[0].__sp));
+
+  /* Get and reconstruct the floating point csr.  */
+  asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
+  asm volatile ("ctc1 $2, $31");
+
+  /* Get the FP.  */
+  asm volatile ("ld $30, %0" : : "m" (env[0].__fp));
+
+  /* Get the GP. */
+  asm volatile ("ld $gp, %0" : : "m" (env[0].__gp));
+
+  /* Get the callee-saved registers.  */
+  asm volatile ("ld $16, %0" : : "m" (env[0].__regs[0]));
+  asm volatile ("ld $17, %0" : : "m" (env[0].__regs[1]));
+  asm volatile ("ld $18, %0" : : "m" (env[0].__regs[2]));
+  asm volatile ("ld $19, %0" : : "m" (env[0].__regs[3]));
+  asm volatile ("ld $20, %0" : : "m" (env[0].__regs[4]));
+  asm volatile ("ld $21, %0" : : "m" (env[0].__regs[5]));
+  asm volatile ("ld $22, %0" : : "m" (env[0].__regs[6]));
+  asm volatile ("ld $23, %0" : : "m" (env[0].__regs[7]));
+
+  /* Get the PC.  */
+  asm volatile ("ld $31, %0" : : "m" (env[0].__pc));
+
+  /* Give setjmp 1 if given a 0, or what they gave us if non-zero.  */
+  if (val == 0)
+    asm volatile ("dli $2, 1");
+  else
+    asm volatile ("move $2, %0" : : "r" (val));
+
+  asm volatile ("j $31");
+
+  abort ();
+}
diff --git a/sysdeps/mips/mips64/add_n.S b/sysdeps/mips/mips64/add_n.S
new file mode 100644
index 0000000000..ad93d9d081
--- /dev/null
+++ b/sysdeps/mips/mips64/add_n.S
@@ -0,0 +1,129 @@
+/* MIPS3 __mpn_add_n -- Add two limb vectors of the same length > 0 and
+ * store sum in a third limb vector.
+ *
+ * Copyright (C) 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/*
+ * INPUT PARAMETERS
+ * res_ptr	$4
+ * s1_ptr	$5
+ * s2_ptr	$6
+ * size		$7
+ */
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	2
+	.globl	__mpn_add_n
+	.ent	__mpn_add_n
+__mpn_add_n:
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	ld	$10,0($5)
+	ld	$11,0($6)
+
+	daddiu	$7,$7,-1
+	and	$9,$7,4-1	# number of limbs in first loop
+	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
+	 move	$2,$0
+
+	dsubu	$7,$7,$9
+
+.Loop0:	daddiu	$9,$9,-1
+	ld	$12,8($5)
+	daddu	$11,$11,$2
+	ld	$13,8($6)
+	sltu	$8,$11,$2
+	daddu	$11,$10,$11
+	sltu	$2,$11,$10
+	sd	$11,0($4)
+	or	$2,$2,$8
+
+	daddiu	$5,$5,8
+	daddiu	$6,$6,8
+	move	$10,$12
+	move	$11,$13
+	bne	$9,$0,.Loop0
+	 daddiu	$4,$4,8
+
+.L0:	beq	$7,$0,.Lend
+	 nop
+
+.Loop:	daddiu	$7,$7,-4
+
+	ld	$12,8($5)
+	daddu	$11,$11,$2
+	ld	$13,8($6)
+	sltu	$8,$11,$2
+	daddu	$11,$10,$11
+	sltu	$2,$11,$10
+	sd	$11,0($4)
+	or	$2,$2,$8
+
+	ld	$10,16($5)
+	daddu	$13,$13,$2
+	ld	$11,16($6)
+	sltu	$8,$13,$2
+	daddu	$13,$12,$13
+	sltu	$2,$13,$12
+	sd	$13,8($4)
+	or	$2,$2,$8
+
+	ld	$12,24($5)
+	daddu	$11,$11,$2
+	ld	$13,24($6)
+	sltu	$8,$11,$2
+	daddu	$11,$10,$11
+	sltu	$2,$11,$10
+	sd	$11,16($4)
+	or	$2,$2,$8
+
+	ld	$10,32($5)
+	daddu	$13,$13,$2
+	ld	$11,32($6)
+	sltu	$8,$13,$2
+	daddu	$13,$12,$13
+	sltu	$2,$13,$12
+	sd	$13,24($4)
+	or	$2,$2,$8
+
+	daddiu	$5,$5,32
+	daddiu	$6,$6,32
+
+	bne	$7,$0,.Loop
+	 daddiu	$4,$4,32
+
+.Lend:	daddu	$11,$11,$2
+	sltu	$8,$11,$2
+	daddu	$11,$10,$11
+	sltu	$2,$11,$10
+	sd	$11,0($4)
+	j	$31
+	or	$2,$2,$8
+
+	.end	__mpn_add_n
diff --git a/sysdeps/mips/mips64/addmul_1.S b/sysdeps/mips/mips64/addmul_1.S
new file mode 100644
index 0000000000..58eff8c889
--- /dev/null
+++ b/sysdeps/mips/mips64/addmul_1.S
@@ -0,0 +1,106 @@
+/* MIPS3 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
+ * add the product to a second limb vector.
+ *
+ * Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * s1_ptr	$5
+ * size		$6
+ * s2_limb	$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	4
+	.globl	__mpn_addmul_1
+	.ent	__mpn_addmul_1
+__mpn_addmul_1:
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+ # warm up phase 0
+	ld	$8,0($5)
+
+ # warm up phase 1
+	daddiu	$5,$5,8
+	dmultu	$8,$7
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	 move	$2,$0		# zero cy2
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	ld	$8,0($5)	# load new s1 limb as early as possible
+
+Loop:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddiu	$5,$5,8
+	daddu	$3,$3,$2	# add old carry limb to low product limb
+	dmultu	$8,$7
+	ld	$8,0($5)	# load new s1 limb as early as possible
+	daddiu	$6,$6,-1	# decrement loop counter
+	sltu	$2,$3,$2	# carry from previous addition -> $2
+	daddu	$3,$10,$3
+	sltu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	daddiu	$4,$4,8
+	bne	$6,$0,Loop
+	 daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 1
+$LC1:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddu	$3,$3,$2
+	sltu	$2,$3,$2
+	dmultu	$8,$7
+	daddu	$3,$10,$3
+	sltu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	daddiu	$4,$4,8
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 0
+$LC0:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddu	$3,$3,$2
+	sltu	$2,$3,$2
+	daddu	$3,$10,$3
+	sltu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	j	$31
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+	.end	__mpn_addmul_1
diff --git a/sysdeps/mips/mips64/bits/setjmp.h b/sysdeps/mips/mips64/bits/setjmp.h
new file mode 100644
index 0000000000..b108540505
--- /dev/null
+++ b/sysdeps/mips/mips64/bits/setjmp.h
@@ -0,0 +1,54 @@
+/* Define the machine-dependent type `jmp_buf'.  MIPS version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Brendan Kehoe (brendan@zen.org).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+typedef struct
+  {
+    /* Program counter.  */
+    __ptr_t __pc;
+
+    /* Stack pointer.  */
+    __ptr_t __sp;
+
+    /* Callee-saved registers s0 through s7.  */
+    int __regs[8];
+
+    /* The frame pointer.  */
+    __ptr_t __fp;
+
+    /* The global pointer.  */
+    __ptr_t __gp;
+
+    /* Floating point status register.  */
+    int __fpc_csr;
+
+    /* Callee-saved floating point registers.  */
+    double __fpregs[8];
+  } __jmp_buf[1];
+
+#ifdef __USE_MISC
+/* Offset to the program counter in `jmp_buf'.  */
+# define JB_PC	0
+#endif
+
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((__ptr_t) (address) < (jmpbuf)[0].__sp)
diff --git a/sysdeps/mips/mips64/bsd-_setjmp.S b/sysdeps/mips/mips64/bsd-_setjmp.S
new file mode 100644
index 0000000000..cd6ec3e196
--- /dev/null
+++ b/sysdeps/mips/mips64/bsd-_setjmp.S
@@ -0,0 +1,36 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  MIPS64 version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (_setjmp)
+#ifdef PIC
+	.cpload t9
+#endif
+	dla t9, C_SYMBOL_NAME (__sigsetjmp)
+	nop
+	jr t9
+	dli a1, 0		/* Pass a second argument of zero.  */
diff --git a/sysdeps/mips/mips64/bsd-setjmp.S b/sysdeps/mips/mips64/bsd-setjmp.S
new file mode 100644
index 0000000000..b37031679d
--- /dev/null
+++ b/sysdeps/mips/mips64/bsd-setjmp.S
@@ -0,0 +1,36 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  MIPS64 version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (setjmp)
+#ifdef PIC
+	.cpload t9
+#endif
+	dla t9, C_SYMBOL_NAME (__sigsetjmp)
+	nop
+	jr t9
+	dli a1, 1		/* Pass a second argument of one.  */
diff --git a/sysdeps/mips/mips64/gmp-mparam.h b/sysdeps/mips/mips64/gmp-mparam.h
index a801b35d7a..38872ec5bc 100644
--- a/sysdeps/mips/mips64/gmp-mparam.h
+++ b/sysdeps/mips/mips64/gmp-mparam.h
@@ -20,7 +20,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #define BITS_PER_MP_LIMB 64
 #define BYTES_PER_MP_LIMB 8
-#define BITS_PER_LONGINT 32
-#define BITS_PER_INT 32
+#define BITS_PER_LONGINT 64
+#define BITS_PER_INT 64
 #define BITS_PER_SHORTINT 16
 #define BITS_PER_CHAR 8
diff --git a/sysdeps/mips/mips64/lshift.S b/sysdeps/mips/mips64/lshift.S
new file mode 100644
index 0000000000..ef403ec25f
--- /dev/null
+++ b/sysdeps/mips/mips64/lshift.S
@@ -0,0 +1,104 @@
+/* MIPS3 __mpn_lshift --
+ *
+ * Copyright (C) 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * src_ptr	$5
+ * size		$6
+ * cnt		$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	2
+	.globl	__mpn_lshift
+	.ent	__mpn_lshift
+__mpn_lshift:
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	dsll	$2,$6,3
+	daddu	$5,$5,$2	# make r5 point at end of src
+	ld	$10,-8($5)	# load first limb
+	dsubu	$13,$0,$7
+	daddu	$4,$4,$2	# make r4 point at end of res
+	daddiu	$6,$6,-1
+	and	$9,$6,4-1	# number of limbs in first loop
+	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
+	 dsrl	$2,$10,$13	# compute function result
+
+	dsubu	$6,$6,$9
+
+.Loop0:	ld	$3,-16($5)
+	daddiu	$4,$4,-8
+	daddiu	$5,$5,-8
+	daddiu	$9,$9,-1
+	dsll	$11,$10,$7
+	dsrl	$12,$3,$13
+	move	$10,$3
+	or	$8,$11,$12
+	bne	$9,$0,.Loop0
+	 sd	$8,0($4)
+
+.L0:	beq	$6,$0,.Lend
+	 nop
+
+.Loop:	ld	$3,-16($5)
+	daddiu	$4,$4,-32
+	daddiu	$6,$6,-4
+	dsll	$11,$10,$7
+	dsrl	$12,$3,$13
+
+	ld	$10,-24($5)
+	dsll	$14,$3,$7
+	or	$8,$11,$12
+	sd	$8,24($4)
+	dsrl	$9,$10,$13
+
+	ld	$3,-32($5)
+	dsll	$11,$10,$7
+	or	$8,$14,$9
+	sd	$8,16($4)
+	dsrl	$12,$3,$13
+
+	ld	$10,-40($5)
+	dsll	$14,$3,$7
+	or	$8,$11,$12
+	sd	$8,8($4)
+	dsrl	$9,$10,$13
+
+	daddiu	$5,$5,-32
+	or	$8,$14,$9
+	bgtz	$6,.Loop
+	 sd	$8,0($4)
+
+.Lend:	dsll	$8,$10,$7
+	j	$31
+	sd	$8,-8($4)
+	.end	__mpn_lshift
diff --git a/sysdeps/mips/mips64/mul_1.S b/sysdeps/mips/mips64/mul_1.S
new file mode 100644
index 0000000000..ef0cf36d75
--- /dev/null
+++ b/sysdeps/mips/mips64/mul_1.S
@@ -0,0 +1,94 @@
+/* MIPS3 __mpn_mul_1 -- Multiply a limb vector with a single limb and
+ * store the product in a second limb vector.
+ *
+ * Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * s1_ptr	$5
+ * size		$6
+ * s2_limb	$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	4
+	.globl	__mpn_mul_1
+	.ent	__mpn_mul_1
+__mpn_mul_1:
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+ # warm up phase 0
+	ld	$8,0($5)
+
+ # warm up phase 1
+	daddiu	$5,$5,8
+	dmultu	$8,$7
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	 move	$2,$0		# zero cy2
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	ld	$8,0($5)	# load new s1 limb as early as possible
+
+Loop:	mflo	$10
+	mfhi	$9
+	daddiu	$5,$5,8
+	daddu	$10,$10,$2	# add old carry limb to low product limb
+	dmultu	$8,$7
+	ld	$8,0($5)	# load new s1 limb as early as possible
+	daddiu	$6,$6,-1	# decrement loop counter
+	sltu	$2,$10,$2	# carry from previous addition -> $2
+	sd	$10,0($4)
+	daddiu	$4,$4,8
+	bne	$6,$0,Loop
+	 daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 1
+$LC1:	mflo	$10
+	mfhi	$9
+	daddu	$10,$10,$2
+	sltu	$2,$10,$2
+	dmultu	$8,$7
+	sd	$10,0($4)
+	daddiu	$4,$4,8
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 0
+$LC0:	mflo	$10
+	mfhi	$9
+	daddu	$10,$10,$2
+	sltu	$2,$10,$2
+	sd	$10,0($4)
+	j	$31
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+	.end	__mpn_mul_1
diff --git a/sysdeps/mips/mips64/rshift.S b/sysdeps/mips/mips64/rshift.S
new file mode 100644
index 0000000000..bc26f3f360
--- /dev/null
+++ b/sysdeps/mips/mips64/rshift.S
@@ -0,0 +1,101 @@
+/* MIPS3 __mpn_rshift --
+ *
+ * Copyright (C) 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * src_ptr	$5
+ * size		$6
+ * cnt		$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	2
+	.globl	__mpn_rshift
+	.ent	__mpn_rshift
+__mpn_rshift:
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	ld	$10,0($5)	# load first limb
+	dsubu	$13,$0,$7
+	daddiu	$6,$6,-1
+	and	$9,$6,4-1	# number of limbs in first loop
+	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
+	 dsll	$2,$10,$13	# compute function result
+
+	dsubu	$6,$6,$9
+
+.Loop0:	ld	$3,8($5)
+	daddiu	$4,$4,8
+	daddiu	$5,$5,8
+	daddiu	$9,$9,-1
+	dsrl	$11,$10,$7
+	dsll	$12,$3,$13
+	move	$10,$3
+	or	$8,$11,$12
+	bne	$9,$0,.Loop0
+	 sd	$8,-8($4)
+
+.L0:	beq	$6,$0,.Lend
+	 nop
+
+.Loop:	ld	$3,8($5)
+	daddiu	$4,$4,32
+	daddiu	$6,$6,-4
+	dsrl	$11,$10,$7
+	dsll	$12,$3,$13
+
+	ld	$10,16($5)
+	dsrl	$14,$3,$7
+	or	$8,$11,$12
+	sd	$8,-32($4)
+	dsll	$9,$10,$13
+
+	ld	$3,24($5)
+	dsrl	$11,$10,$7
+	or	$8,$14,$9
+	sd	$8,-24($4)
+	dsll	$12,$3,$13
+
+	ld	$10,32($5)
+	dsrl	$14,$3,$7
+	or	$8,$11,$12
+	sd	$8,-16($4)
+	dsll	$9,$10,$13
+
+	daddiu	$5,$5,32
+	or	$8,$14,$9
+	bgtz	$6,.Loop
+	 sd	$8,-8($4)
+
+.Lend:	dsrl	$8,$10,$7
+	j	$31
+	sd	$8,0($4)
+	.end	__mpn_rshift
diff --git a/sysdeps/mips/mips64/setjmp.S b/sysdeps/mips/mips64/setjmp.S
new file mode 100644
index 0000000000..74214297b8
--- /dev/null
+++ b/sysdeps/mips/mips64/setjmp.S
@@ -0,0 +1,35 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* The function __sigsetjmp_aux saves all the registers, but it can't
+   reliably access the stack or frame pointers, so we pass them in as
+   extra arguments.  */
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__sigsetjmp)
+#ifdef PIC
+	.cpload t9
+#endif
+	move a2, sp
+	move a3, fp
+	dla t9, __sigsetjmp_aux
+	nop
+	jr t9
diff --git a/sysdeps/mips/mips64/setjmp_aux.c b/sysdeps/mips/mips64/setjmp_aux.c
new file mode 100644
index 0000000000..19d06e9999
--- /dev/null
+++ b/sysdeps/mips/mips64/setjmp_aux.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Brendan Kehoe (brendan@zen.org).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <setjmp.h>
+
+/* This function is only called via the assembly language routine
+   __sigsetjmp, which arranges to pass in the stack pointer and the frame
+   pointer.  We do things this way because it's difficult to reliably
+   access them in C.  */
+
+int
+__sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
+{
+  /* Store the floating point callee-saved registers...  */
+  asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0]));
+  asm volatile ("s.d $f25, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1]));
+  asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2]));
+  asm volatile ("s.d $f27, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3]));
+  asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4]));
+  asm volatile ("s.d $f29, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5]));
+  asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[6]));
+  asm volatile ("s.d $f31, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[7]));
+
+  /* .. and the PC;  */
+  asm volatile ("sd $31, %0" : : "m" (env[0].__jmpbuf[0].__pc));
+
+  /* .. and the stack pointer;  */
+  env[0].__jmpbuf[0].__sp = sp;
+
+  /* .. and the FP; it'll be in s8. */
+  env[0].__jmpbuf[0].__fp = fp;
+
+  /* .. and the GP; */
+  asm volatile ("sd $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
+
+  /* .. and the callee-saved registers; */
+  asm volatile ("sd $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0]));
+  asm volatile ("sd $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1]));
+  asm volatile ("sd $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2]));
+  asm volatile ("sd $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3]));
+  asm volatile ("sd $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4]));
+  asm volatile ("sd $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5]));
+  asm volatile ("sd $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6]));
+  asm volatile ("sd $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7]));
+
+  /* .. and finally get and reconstruct the floating point csr.  */
+  asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr));
+
+  /* Save the signal mask if requested.  */
+  return __sigjmp_save (env, savemask);
+}
diff --git a/sysdeps/mips/mips64/sub_n.S b/sysdeps/mips/mips64/sub_n.S
new file mode 100644
index 0000000000..bfcba95afa
--- /dev/null
+++ b/sysdeps/mips/mips64/sub_n.S
@@ -0,0 +1,129 @@
+/* MIPS3 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+ * store difference in a third limb vector.
+ *
+ * Copyright (C) 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * s1_ptr	$5
+ * s2_ptr	$6
+ * size		$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	2
+	.globl	__mpn_sub_n
+	.ent	__mpn_sub_n
+__mpn_sub_n:
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	ld	$10,0($5)
+	ld	$11,0($6)
+
+	daddiu	$7,$7,-1
+	and	$9,$7,4-1	# number of limbs in first loop
+	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
+	 move	$2,$0
+
+	dsubu	$7,$7,$9
+
+.Loop0:	daddiu	$9,$9,-1
+	ld	$12,8($5)
+	daddu	$11,$11,$2
+	ld	$13,8($6)
+	sltu	$8,$11,$2
+	dsubu	$11,$10,$11
+	sltu	$2,$10,$11
+	sd	$11,0($4)
+	or	$2,$2,$8
+
+	daddiu	$5,$5,8
+	daddiu	$6,$6,8
+	move	$10,$12
+	move	$11,$13
+	bne	$9,$0,.Loop0
+	 daddiu	$4,$4,8
+
+.L0:	beq	$7,$0,.Lend
+	 nop
+
+.Loop:	daddiu	$7,$7,-4
+
+	ld	$12,8($5)
+	daddu	$11,$11,$2
+	ld	$13,8($6)
+	sltu	$8,$11,$2
+	dsubu	$11,$10,$11
+	sltu	$2,$10,$11
+	sd	$11,0($4)
+	or	$2,$2,$8
+
+	ld	$10,16($5)
+	daddu	$13,$13,$2
+	ld	$11,16($6)
+	sltu	$8,$13,$2
+	dsubu	$13,$12,$13
+	sltu	$2,$12,$13
+	sd	$13,8($4)
+	or	$2,$2,$8
+
+	ld	$12,24($5)
+	daddu	$11,$11,$2
+	ld	$13,24($6)
+	sltu	$8,$11,$2
+	dsubu	$11,$10,$11
+	sltu	$2,$10,$11
+	sd	$11,16($4)
+	or	$2,$2,$8
+
+	ld	$10,32($5)
+	daddu	$13,$13,$2
+	ld	$11,32($6)
+	sltu	$8,$13,$2
+	dsubu	$13,$12,$13
+	sltu	$2,$12,$13
+	sd	$13,24($4)
+	or	$2,$2,$8
+
+	daddiu	$5,$5,32
+	daddiu	$6,$6,32
+
+	bne	$7,$0,.Loop
+	 daddiu	$4,$4,32
+
+.Lend:	daddu	$11,$11,$2
+	sltu	$8,$11,$2
+	dsubu	$11,$10,$11
+	sltu	$2,$10,$11
+	sd	$11,0($4)
+	j	$31
+	or	$2,$2,$8
+
+	.end	__mpn_sub_n
diff --git a/sysdeps/mips/mips64/submul_1.S b/sysdeps/mips/mips64/submul_1.S
new file mode 100644
index 0000000000..66e634e102
--- /dev/null
+++ b/sysdeps/mips/mips64/submul_1.S
@@ -0,0 +1,106 @@
+/* MIPS3 __mpn_submul_1 -- Multiply a limb vector with a single limb and
+ * subtract the product from a second limb vector.
+ *
+ * Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
+ *
+ * This file is part of the GNU MP Library.
+ *
+ * The GNU MP Library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The GNU MP Library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+ * res_ptr	$4
+ * s1_ptr	$5
+ * size		$6
+ * s2_limb	$7
+ */
+
+#ifdef PIC
+	.option pic2
+#endif
+	.text
+	.align	4
+	.globl	__mpn_submul_1
+	.ent	__mpn_submul_1
+__mpn_submul_1:
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+ # warm up phase 0
+	ld	$8,0($5)
+
+ # warm up phase 1
+	daddiu	$5,$5,8
+	dmultu	$8,$7
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	 move	$2,$0		# zero cy2
+
+	daddiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	ld	$8,0($5)	# load new s1 limb as early as possible
+
+Loop:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddiu	$5,$5,8
+	daddu	$3,$3,$2	# add old carry limb to low product limb
+	dmultu	$8,$7
+	ld	$8,0($5)	# load new s1 limb as early as possible
+	daddiu	$6,$6,-1	# decrement loop counter
+	sltu	$2,$3,$2	# carry from previous addition -> $2
+	dsubu	$3,$10,$3
+	sgtu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	daddiu	$4,$4,8
+	bne	$6,$0,Loop
+	 daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 1
+$LC1:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddu	$3,$3,$2
+	sltu	$2,$3,$2
+	dmultu	$8,$7
+	dsubu	$3,$10,$3
+	sgtu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	daddiu	$4,$4,8
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+ # cool down phase 0
+$LC0:	ld	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	daddu	$3,$3,$2
+	sltu	$2,$3,$2
+	dsubu	$3,$10,$3
+	sgtu	$10,$3,$10
+	daddu	$2,$2,$10
+	sd	$3,0($4)
+	j	$31
+	daddu	$2,$9,$2	# add high product limb and carry from addition
+
+	.end	__mpn_submul_1
diff --git a/sysdeps/mips/mipsel/bytesex.h b/sysdeps/mips/mipsel/bits/endian.h
index 5da5965cb2..5da5965cb2 100644
--- a/sysdeps/mips/mipsel/bytesex.h
+++ b/sysdeps/mips/mipsel/bits/endian.h
diff --git a/sysdeps/mips/mul_1.S b/sysdeps/mips/mul_1.S
new file mode 100644
index 0000000000..184aae6fa1
--- /dev/null
+++ b/sysdeps/mips/mul_1.S
@@ -0,0 +1,86 @@
+/* MIPS __mpn_mul_1 -- Multiply a limb vector with a single limb and
+store the product in a second limb vector.
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   s1_ptr	$5
+   size		$6
+   s2_limb	$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_mul_1)
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+	/* warm up phase 0 */
+	lw	$8,0($5)
+
+	/* warm up phase 1 */
+	addiu	$5,$5,4
+	multu	$8,$7
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	move	$2,$0		/* zero cy2 */
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+
+Loop:	mflo	$10
+	mfhi	$9
+	addiu	$5,$5,4
+	addu	$10,$10,$2	/* add old carry limb to low product limb */
+	multu	$8,$7
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+	addiu	$6,$6,-1	/* decrement loop counter */
+	sltu	$2,$10,$2	/* carry from previous addition -> $2 */
+	sw	$10,0($4)
+	addiu	$4,$4,4
+	bne	$6,$0,Loop	/* should be "bnel" */
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
+
+	/* cool down phase 1 */
+$LC1:	mflo	$10
+	mfhi	$9
+	addu	$10,$10,$2
+	sltu	$2,$10,$2
+	multu	$8,$7
+	sw	$10,0($4)
+	addiu	$4,$4,4
+	addu	$2,$9,$2	/* add high product limb and carry from addition
+
+	/* cool down phase 0 */
+$LC0:	mflo	$10
+	mfhi	$9
+	addu	$10,$10,$2
+	sltu	$2,$10,$2
+	sw	$10,0($4)
+	j	$31
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
diff --git a/sysdeps/mips/mul_1.s b/sysdeps/mips/mul_1.s
deleted file mode 100644
index d006fa1221..0000000000
--- a/sysdeps/mips/mul_1.s
+++ /dev/null
@@ -1,85 +0,0 @@
- # MIPS __mpn_mul_1 -- Multiply a limb vector with a single limb and
- # store the product in a second limb vector.
-
- # Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # s1_ptr	$5
- # size		$6
- # s2_limb	$7
-
-	.text
-	.align	 4
-	.globl	 __mpn_mul_1
-	.ent	__mpn_mul_1
-__mpn_mul_1:
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	lw	$8,0($5)
-
- # warm up phase 1
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC0
-	 move	$2,$0		# zero cy2
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC1
-	lw	$8,0($5)	# load new s1 limb as early as possible
-
-Loop:	mflo	$10
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$10,$10,$2	# add old carry limb to low product limb
-	multu	$8,$7
-	lw	$8,0($5)	# load new s1 limb as early as possible
-	addiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$10,$2	# carry from previous addition -> $2
-	sw	$10,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,Loop
-	 addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-$LC1:	mflo	$10
-	mfhi	$9
-	addu	$10,$10,$2
-	sltu	$2,$10,$2
-	multu	$8,$7
-	sw	$10,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-$LC0:	mflo	$10
-	mfhi	$9
-	addu	$10,$10,$2
-	sltu	$2,$10,$2
-	sw	$10,0($4)
-	j	$31
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_mul_1
diff --git a/sysdeps/mips/p40/bytesex.h b/sysdeps/mips/p40/bits/endian.h
index e4b0119433..e4b0119433 100644
--- a/sysdeps/mips/p40/bytesex.h
+++ b/sysdeps/mips/p40/bits/endian.h
diff --git a/sysdeps/mips/rshift.S b/sysdeps/mips/rshift.S
new file mode 100644
index 0000000000..37bde2f7cd
--- /dev/null
+++ b/sysdeps/mips/rshift.S
@@ -0,0 +1,94 @@
+/* MIPS2 __mpn_rshift --
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   src_ptr	$5
+   size		$6
+   cnt		$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_rshift)
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	lw	$10,0($5)	/* load first limb */
+	subu	$13,$0,$7
+	addiu	$6,$6,-1
+	and	$9,$6,4-1	/* number of limbs in first loop */
+	beq	$9,$0,.L0	/* if multiple of 4 limbs, skip first loop*/
+	 sll	$2,$10,$13	/* compute function result */
+
+	subu	$6,$6,$9
+
+.Loop0:	lw	$3,4($5)
+	addiu	$4,$4,4
+	addiu	$5,$5,4
+	addiu	$9,$9,-1
+	srl	$11,$10,$7
+	sll	$12,$3,$13
+	move	$10,$3
+	or	$8,$11,$12
+	bne	$9,$0,.Loop0
+	 sw	$8,-4($4)
+
+.L0:	beq	$6,$0,.Lend
+	 nop
+
+.Loop:	lw	$3,4($5)
+	addiu	$4,$4,16
+	addiu	$6,$6,-4
+	srl	$11,$10,$7
+	sll	$12,$3,$13
+
+	lw	$10,8($5)
+	srl	$14,$3,$7
+	or	$8,$11,$12
+	sw	$8,-16($4)
+	sll	$9,$10,$13
+
+	lw	$3,12($5)
+	srl	$11,$10,$7
+	or	$8,$14,$9
+	sw	$8,-12($4)
+	sll	$12,$3,$13
+
+	lw	$10,16($5)
+	srl	$14,$3,$7
+	or	$8,$11,$12
+	sw	$8,-8($4)
+	sll	$9,$10,$13
+
+	addiu	$5,$5,16
+	or	$8,$14,$9
+	bgtz	$6,.Loop
+	 sw	$8,-4($4)
+
+.Lend:	srl	$8,$10,$7
+	j	$31
+	sw	$8,0($4)
diff --git a/sysdeps/mips/rshift.s b/sysdeps/mips/rshift.s
deleted file mode 100644
index a8beb40577..0000000000
--- a/sysdeps/mips/rshift.s
+++ /dev/null
@@ -1,92 +0,0 @@
- # MIPS2 __mpn_rshift --
-
- # Copyright (C) 1995 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # src_ptr	$5
- # size		$6
- # cnt		$7
-
-	.text
-	.align	2
-	.globl	__mpn_rshift
-	.ent	__mpn_rshift
-__mpn_rshift:
-	.set	noreorder
-	.set	nomacro
-
-	lw	$10,0($5)	# load first limb
-	subu	$13,$0,$7
-	addiu	$6,$6,-1
-	and	$9,$6,4-1	# number of limbs in first loop
-	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
-	 sll	$2,$10,$13	# compute function result
-
-	subu	$6,$6,$9
-
-.Loop0:	lw	$3,4($5)
-	addiu	$4,$4,4
-	addiu	$5,$5,4
-	addiu	$9,$9,-1
-	srl	$11,$10,$7
-	sll	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,.Loop0
-	 sw	$8,-4($4)
-
-.L0:	beq	$6,$0,.Lend
-	 nop
-
-.Loop:	lw	$3,4($5)
-	addiu	$4,$4,16
-	addiu	$6,$6,-4
-	srl	$11,$10,$7
-	sll	$12,$3,$13
-
-	lw	$10,8($5)
-	srl	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,-16($4)
-	sll	$9,$10,$13
-
-	lw	$3,12($5)
-	srl	$11,$10,$7
-	or	$8,$14,$9
-	sw	$8,-12($4)
-	sll	$12,$3,$13
-
-	lw	$10,16($5)
-	srl	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,-8($4)
-	sll	$9,$10,$13
-
-	addiu	$5,$5,16
-	or	$8,$14,$9
-	bgtz	$6,.Loop
-	 sw	$8,-4($4)
-
-.Lend:	srl	$8,$10,$7
-	j	$31
-	sw	$8,0($4)
-	.end	__mpn_rshift
diff --git a/sysdeps/mips/setjmp.S b/sysdeps/mips/setjmp.S
index 0f5dba3a60..bc42dcb03b 100644
--- a/sysdeps/mips/setjmp.S
+++ b/sysdeps/mips/setjmp.S
@@ -1,32 +1,35 @@
-/* Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
 /* The function __sigsetjmp_aux saves all the registers, but it can't
    reliably access the stack or frame pointers, so we pass them in as
    extra arguments.  */
+#ifdef PIC
+	.option pic2
+#endif
 ENTRY (__sigsetjmp)
+#ifdef PIC
+	.cpload t9
+#endif
 	move a2, sp
-#ifdef __sgi__
 	move a3, fp
-#else
-	move a3, $fp
-#endif
-	j __sigsetjmp_aux
-	.end __sigsetjmp
+	la t9, __sigsetjmp_aux
+	nop
+	jr t9
diff --git a/sysdeps/mips/setjmp_aux.c b/sysdeps/mips/setjmp_aux.c
index d478e3fdc9..d06732efc2 100644
--- a/sysdeps/mips/setjmp_aux.c
+++ b/sysdeps/mips/setjmp_aux.c
@@ -1,20 +1,21 @@
-/* Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <setjmp.h>
 
diff --git a/sysdeps/mips/sub_n.S b/sysdeps/mips/sub_n.S
new file mode 100644
index 0000000000..09fbf7eeff
--- /dev/null
+++ b/sysdeps/mips/sub_n.S
@@ -0,0 +1,121 @@
+/* MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+store difference in a third limb vector.
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   s1_ptr	$5
+   s2_ptr	$6
+   size		$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_sub_n)
+	.set	noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set	nomacro
+
+	lw	$10,0($5)
+	lw	$11,0($6)
+
+	addiu	$7,$7,-1
+	and	$9,$7,4-1	/* number of limbs in first loop */
+	beq	$9,$0,.L0	/* if multiple of 4 limbs, skip first loop */
+	 move	$2,$0
+
+	subu	$7,$7,$9
+
+.Loop0:	addiu	$9,$9,-1
+	lw	$12,4($5)
+	addu	$11,$11,$2
+	lw	$13,4($6)
+	sltu	$8,$11,$2
+	subu	$11,$10,$11
+	sltu	$2,$10,$11
+	sw	$11,0($4)
+	or	$2,$2,$8
+
+	addiu	$5,$5,4
+	addiu	$6,$6,4
+	move	$10,$12
+	move	$11,$13
+	bne	$9,$0,.Loop0
+	 addiu	$4,$4,4
+
+.L0:	beq	$7,$0,.Lend
+	 nop
+
+.Loop:	addiu	$7,$7,-4
+
+	lw	$12,4($5)
+	addu	$11,$11,$2
+	lw	$13,4($6)
+	sltu	$8,$11,$2
+	subu	$11,$10,$11
+	sltu	$2,$10,$11
+	sw	$11,0($4)
+	or	$2,$2,$8
+
+	lw	$10,8($5)
+	addu	$13,$13,$2
+	lw	$11,8($6)
+	sltu	$8,$13,$2
+	subu	$13,$12,$13
+	sltu	$2,$12,$13
+	sw	$13,4($4)
+	or	$2,$2,$8
+
+	lw	$12,12($5)
+	addu	$11,$11,$2
+	lw	$13,12($6)
+	sltu	$8,$11,$2
+	subu	$11,$10,$11
+	sltu	$2,$10,$11
+	sw	$11,8($4)
+	or	$2,$2,$8
+
+	lw	$10,16($5)
+	addu	$13,$13,$2
+	lw	$11,16($6)
+	sltu	$8,$13,$2
+	subu	$13,$12,$13
+	sltu	$2,$12,$13
+	sw	$13,12($4)
+	or	$2,$2,$8
+
+	addiu	$5,$5,16
+	addiu	$6,$6,16
+
+	bne	$7,$0,.Loop
+	 addiu	$4,$4,16
+
+.Lend:	addu	$11,$11,$2
+	sltu	$8,$11,$2
+	subu	$11,$10,$11
+	sltu	$2,$10,$11
+	sw	$11,0($4)
+	j	$31
+	or	$2,$2,$8
diff --git a/sysdeps/mips/sub_n.s b/sysdeps/mips/sub_n.s
deleted file mode 100644
index 3368ef29d6..0000000000
--- a/sysdeps/mips/sub_n.s
+++ /dev/null
@@ -1,120 +0,0 @@
- # MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
- # store difference in a third limb vector.
-
- # Copyright (C) 1995 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # s1_ptr	$5
- # s2_ptr	$6
- # size		$7
-
-	.text
-	.align	2
-	.globl	__mpn_sub_n
-	.ent	__mpn_sub_n
-__mpn_sub_n:
-	.set	noreorder
-	.set	nomacro
-
-	lw	$10,0($5)
-	lw	$11,0($6)
-
-	addiu	$7,$7,-1
-	and	$9,$7,4-1	# number of limbs in first loop
-	beq	$9,$0,.L0	# if multiple of 4 limbs, skip first loop
-	 move	$2,$0
-
-	subu	$7,$7,$9
-
-.Loop0:	addiu	$9,$9,-1
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,4
-	addiu	$6,$6,4
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,.Loop0
-	 addiu	$4,$4,4
-
-.L0:	beq	$7,$0,.Lend
-	 nop
-
-.Loop:	addiu	$7,$7,-4
-
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	lw	$10,8($5)
-	addu	$13,$13,$2
-	lw	$11,8($6)
-	sltu	$8,$13,$2
-	subu	$13,$12,$13
-	sltu	$2,$12,$13
-	sw	$13,4($4)
-	or	$2,$2,$8
-
-	lw	$12,12($5)
-	addu	$11,$11,$2
-	lw	$13,12($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,8($4)
-	or	$2,$2,$8
-
-	lw	$10,16($5)
-	addu	$13,$13,$2
-	lw	$11,16($6)
-	sltu	$8,$13,$2
-	subu	$13,$12,$13
-	sltu	$2,$12,$13
-	sw	$13,12($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,16
-	addiu	$6,$6,16
-
-	bne	$7,$0,.Loop
-	 addiu	$4,$4,16
-
-.Lend:	addu	$11,$11,$2
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-
-	.end	__mpn_sub_n
diff --git a/sysdeps/mips/submul_1.S b/sysdeps/mips/submul_1.S
new file mode 100644
index 0000000000..eae8ebbfaf
--- /dev/null
+++ b/sysdeps/mips/submul_1.S
@@ -0,0 +1,98 @@
+/* MIPS __mpn_submul_1 -- Multiply a limb vector with a single limb and
+subtract the product from a second limb vector.
+
+Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* INPUT PARAMETERS
+   res_ptr	$4
+   s1_ptr	$5
+   size		$6
+   s2_limb	$7
+*/
+#ifdef PIC
+	.option pic2
+#endif
+ENTRY (__mpn_submul_1)
+	.set    noreorder
+#ifdef PIC
+	.cpload t9
+#endif
+	.set    nomacro
+
+	/* warm up phase 0 */
+	lw	$8,0($5)
+
+	/* warm up phase 1 */
+	addiu	$5,$5,4
+	multu	$8,$7
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC0
+	move	$2,$0		/* zero cy2 */
+
+	addiu	$6,$6,-1
+	beq	$6,$0,$LC1
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+
+Loop:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addiu	$5,$5,4
+	addu	$3,$3,$2	/* add old carry limb to low product limb */
+	multu	$8,$7
+	lw	$8,0($5)	/* load new s1 limb as early as possible */
+	addiu	$6,$6,-1	/* decrement loop counter */
+	sltu	$2,$3,$2	/* carry from previous addition -> $2 */
+	subu	$3,$10,$3
+	sgtu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	addiu	$4,$4,4
+	bne	$6,$0,Loop	/* should be "bnel" */
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
+
+	/* cool down phase 1 */
+$LC1:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addu	$3,$3,$2
+	sltu	$2,$3,$2
+	multu	$8,$7
+	subu	$3,$10,$3
+	sgtu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	addiu	$4,$4,4
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
+
+	/* cool down phase 0 */
+$LC0:	lw	$10,0($4)
+	mflo	$3
+	mfhi	$9
+	addu	$3,$3,$2
+	sltu	$2,$3,$2
+	subu	$3,$10,$3
+	sgtu	$10,$3,$10
+	addu	$2,$2,$10
+	sw	$3,0($4)
+	j	$31
+	addu	$2,$9,$2	/* add high product limb and carry from addition */
diff --git a/sysdeps/mips/submul_1.s b/sysdeps/mips/submul_1.s
deleted file mode 100644
index 1324b66090..0000000000
--- a/sysdeps/mips/submul_1.s
+++ /dev/null
@@ -1,97 +0,0 @@
- # MIPS __mpn_submul_1 -- Multiply a limb vector with a single limb and
- # subtract the product from a second limb vector.
-
- # Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
-
- # This file is part of the GNU MP Library.
-
- # The GNU MP Library is free software; you can redistribute it and/or modify
- # it under the terms of the GNU Library General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or (at your
- # option) any later version.
-
- # The GNU MP Library is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
- # License for more details.
-
- # You should have received a copy of the GNU Library General Public License
- # along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
- # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- # MA 02111-1307, USA.
-
-
- # INPUT PARAMETERS
- # res_ptr	$4
- # s1_ptr	$5
- # size		$6
- # s2_limb	$7
-
-	.text
-	.align	 4
-	.globl	 __mpn_submul_1
-	.ent	__mpn_submul_1
-__mpn_submul_1:
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	lw	$8,0($5)
-
- # warm up phase 1
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC0
-	 move	$2,$0		# zero cy2
-
-	addiu	$6,$6,-1
-	beq	$6,$0,$LC1
-	lw	$8,0($5)	# load new s1 limb as early as possible
-
-Loop:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$3,$3,$2	# add old carry limb to low product limb
-	multu	$8,$7
-	lw	$8,0($5)	# load new s1 limb as early as possible
-	addiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$3,$2	# carry from previous addition -> $2
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,Loop
-	 addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-$LC1:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	multu	$8,$7
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-$LC0:	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	j	$31
-	addu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_submul_1
diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile
index a47f77af32..358114a921 100644
--- a/sysdeps/posix/Makefile
+++ b/sysdeps/posix/Makefile
@@ -20,13 +20,13 @@ ifneq (yes,$(inhibit-stdio_lim))
 # Disable these rules if we generate stdio_lim.h by other means.
 
 ifeq (yes,$(cross-compiling))
-$(common-objpfx)stdio_lim.h:
+$(common-objpfx)bits/stdio_lim.h:
 	@echo
-	@echo "You must build stdio_lim.h by hand.  Stop."
+	@echo "You must build <bits/stdio_lim.h> by hand.  Stop."
 	@echo
 	@exit 1
 else
-$(common-objpfx)stdio_lim.h: $(common-objpfx)mk-stdiolim
+$(common-objpfx)bits/stdio_lim.h: $(common-objpfx)mk-stdiolim
 	$(dir $<)$(notdir $<) > $@-t
 	mv $@-t $@
 endif
@@ -36,10 +36,10 @@ mk-stdiolim-CFLAGS = $(patsubst -I$(shell pwd)//%,-I/%,\
 				$(patsubst -I%,-I$(shell pwd)/%,$(+includes)))
 # $(ALL_BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
 $(common-objpfx)mk-stdiolim: $(sysdep_dir)/posix/mk-stdiolim.c \
-			     $(..)posix/posix1_lim.h local_lim.h
+			     $(..)posix/bits/posix1_lim.h bits/local_lim.h
 	$(common-objdir-compile)
 
-common-generated := $(common-generated) stdio_lim.h mk-stdiolim
-before-compile := $(before-compile) $(common-objpfx)stdio_lim.h
+common-generated := $(common-generated) bits/stdio_lim.h mk-stdiolim
+before-compile := $(before-compile) $(common-objpfx)bits/stdio_lim.h
 
 endif # inhibit-stdio_lim
diff --git a/sysdeps/posix/mk-stdiolim.c b/sysdeps/posix/mk-stdiolim.c
index 5df460e89a..a129f2b4f9 100644
--- a/sysdeps/posix/mk-stdiolim.c
+++ b/sysdeps/posix/mk-stdiolim.c
@@ -16,7 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <posix1_lim.h>
+#include <bits/posix1_lim.h>
 
 int
 main()
@@ -32,9 +32,9 @@ main()
   puts  ("#endif");
 
   /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
-     <local_lim.h> will not define them if they are run-time variant (which
-     is the case in the Hurd).  ANSI still requires that FOPEN_MAX and
-     FILENAME_MAX be defined, however.  */
+     <bits/local_lim.h> will not define them if they are run-time
+     variant (which is the case in the Hurd).  ANSI still requires
+     that FOPEN_MAX and FILENAME_MAX be defined, however.  */
 
   printf("#define FOPEN_MAX %u\n",
 #ifdef	OPEN_MAX
diff --git a/sysdeps/powerpc/__longjmp.S b/sysdeps/powerpc/__longjmp.S
index 02292a0eb2..4a22fb8952 100644
--- a/sysdeps/powerpc/__longjmp.S
+++ b/sysdeps/powerpc/__longjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 ENTRY (__longjmp)
 	lwz %r1,(JB_GPR1*4)(%r3)
diff --git a/sysdeps/powerpc/fenvbits.h b/sysdeps/powerpc/bits/fenv.h
index 8acd0ab8a4..9158a54586 100644
--- a/sysdeps/powerpc/fenvbits.h
+++ b/sysdeps/powerpc/bits/fenv.h
@@ -16,10 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This file should never be included directly.  */
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
 
-#ifndef _FENVBITS_H
-#define _FENVBITS_H	1
 
 /* Define bits representing the exception.  We use the bit positions of
    the appropriate bits in the FPSCR...  */
@@ -126,5 +126,3 @@ extern const fenv_t __fe_dfl_env;
 extern const fenv_t __fe_nomask_env;
 # define FE_NOMASK_ENV	(&__fe_nomask_env);
 #endif
-
-#endif /* fenvbits.h */
diff --git a/sysdeps/powerpc/mathbits.h b/sysdeps/powerpc/bits/mathdef.h
index 2cecb6fa88..c0e6caa843 100644
--- a/sysdeps/powerpc/mathbits.h
+++ b/sysdeps/powerpc/bits/mathdef.h
@@ -16,8 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _MATHBITS_H
-#define _MATHBITS_H	1
+#ifndef _MATH_H
+#error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
 
 /* FIXME! This file describes properties of the compiler, not the machine;
    it should not be part of libc!
@@ -68,5 +70,3 @@ typedef double double_t;
 #define INFINITY	HUGE_VAL
 
 #endif
-
-#endif /* mathbits.h */
diff --git a/sysdeps/powerpc/__math.h b/sysdeps/powerpc/bits/mathinline.h
index db9688cfc5..db9688cfc5 100644
--- a/sysdeps/powerpc/__math.h
+++ b/sysdeps/powerpc/bits/mathinline.h
diff --git a/sysdeps/powerpc/jmp_buf.h b/sysdeps/powerpc/bits/setjmp.h
index df832b157c..a9cab03fc6 100644
--- a/sysdeps/powerpc/jmp_buf.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,6 +1,6 @@
 /* Define the machine-dependent type `jmp_buf'.  PowerPC version.  */
 
-/* The previous jmp_buf.h had __jmp_buf defined as a structure.
+/* The previous bits/setjmp.h had __jmp_buf defined as a structure.
    We use an array of 'long int' instead, to make writing the
    assembler easier. Naturally, user code should not depend on
    either representation. */
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index 17e8d9a12d..6ddbea584b 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -591,6 +591,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     }
   else if (rinfo == R_PPC_COPY)
     {
+      if (sym == NULL)
+	/* This can happen in trace mode when an object could not be
+	   found.  */
+	return;
       if (sym->st_size > refsym->st_size
 	  || (_dl_verbose && sym->st_size < refsym->st_size))
 	{
diff --git a/sysdeps/powerpc/setjmp.S b/sysdeps/powerpc/setjmp.S
index af10581af0..ddfea7eed3 100644
--- a/sysdeps/powerpc/setjmp.S
+++ b/sysdeps/powerpc/setjmp.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 ENTRY (__sigsetjmp)
 	stw  %r1,(JB_GPR1*4)(3)
diff --git a/sysdeps/sparc/__longjmp.S b/sysdeps/sparc/__longjmp.S
index 5424300fe5..36e1c170dd 100644
--- a/sysdeps/sparc/__longjmp.S
+++ b/sysdeps/sparc/__longjmp.S
@@ -1,25 +1,25 @@
-/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
 #define _ASM 1
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 #define ENV(reg) [%g1 + (reg * 4)]
 
 ENTRY (__longjmp)
diff --git a/sysdeps/sparc/bytesex.h b/sysdeps/sparc/bits/endian.h
index f1a75c0652..f1a75c0652 100644
--- a/sysdeps/sparc/bytesex.h
+++ b/sysdeps/sparc/bits/endian.h
diff --git a/sysdeps/sparc/jmp_buf.h b/sysdeps/sparc/bits/setjmp.h
index 43bae1a496..43bae1a496 100644
--- a/sysdeps/sparc/jmp_buf.h
+++ b/sysdeps/sparc/bits/setjmp.h
diff --git a/sysdeps/sparc/setjmp.S b/sysdeps/sparc/setjmp.S
index 84c63542cc..b80a83046e 100644
--- a/sysdeps/sparc/setjmp.S
+++ b/sysdeps/sparc/setjmp.S
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 
 #define _ASM 1
-#include <jmp_buf.h>
+#include <bits/setjmp.h>
 
 ENTRY (__sigsetjmp)
 	/* Save our SP and FP; in the delay slot of the jump, save our
diff --git a/sysdeps/standalone/arm/errnos.h b/sysdeps/standalone/arm/bits/errno.h
index 8090a8074d..8090a8074d 100644
--- a/sysdeps/standalone/arm/errnos.h
+++ b/sysdeps/standalone/arm/bits/errno.h
diff --git a/sysdeps/standalone/stdio_lim.h b/sysdeps/standalone/bits/stdio_lim.h
index 5552bc4325..5552bc4325 100644
--- a/sysdeps/standalone/stdio_lim.h
+++ b/sysdeps/standalone/bits/stdio_lim.h
diff --git a/sysdeps/standalone/close.c b/sysdeps/standalone/close.c
index 7ef1a5f878..2d92937ec1 100644
--- a/sysdeps/standalone/close.c
+++ b/sysdeps/standalone/close.c
@@ -22,7 +22,7 @@ Cambridge, MA 02139, USA.  */
 #include <errno.h>
 #include <unistd.h>
 
-#include <stdio_lim.h>
+#include <bits/stdio_lim.h>
 #include "filedesc.h"
 
 /* Close the file descriptor FD.  */
diff --git a/sysdeps/standalone/filedesc.h b/sysdeps/standalone/filedesc.h
index bf3b6a9f0c..e4b8d6545e 100644
--- a/sysdeps/standalone/filedesc.h
+++ b/sysdeps/standalone/filedesc.h
@@ -27,7 +27,7 @@ Cambridge, MA 02139, USA.  */
 #ifndef __FILEDESC_h
 #define __FILEDESC_h
 
-#include <stdio_lim.h>
+#include <bits/stdio_lim.h>
 
 #ifndef __DECLARE_FILE_DESCRIPTORS__
 #define FILEDESC_EXTERN extern
diff --git a/sysdeps/standalone/open.c b/sysdeps/standalone/open.c
index 87097d9cb0..b61b729ca6 100644
--- a/sysdeps/standalone/open.c
+++ b/sysdeps/standalone/open.c
@@ -25,7 +25,7 @@ Cambridge, MA 02139, USA.  */
 #include <stddef.h>
 
 #include <stdio.h>
-#include <stdio_lim.h>
+#include <bits/stdio_lim.h>
 #include <unistd.h>
 
 #define __DECLARE_FILE_DESCRIPTORS__
diff --git a/sysdeps/stub/direntry.h b/sysdeps/stub/bits/dirent.h
index 2f7dca78aa..2f7dca78aa 100644
--- a/sysdeps/stub/direntry.h
+++ b/sysdeps/stub/bits/dirent.h
diff --git a/sysdeps/stub/elfclass.h b/sysdeps/stub/bits/elfclass.h
index 1ad12954b2..1ad12954b2 100644
--- a/sysdeps/stub/elfclass.h
+++ b/sysdeps/stub/bits/elfclass.h
diff --git a/sysdeps/stub/bytesex.h b/sysdeps/stub/bits/endian.h
index 238a082bad..597f079a0f 100644
--- a/sysdeps/stub/bytesex.h
+++ b/sysdeps/stub/bits/endian.h
@@ -1,9 +1,9 @@
 /* This file should define __BYTE_ORDER as appropriate for the machine
    in question.  See string/endian.h for how to define it.
 
-   If only the stub bytesex.h applies to a particular configuration,
+   If only the stub bits/endian.h applies to a particular configuration,
    bytesex.h is generated by running a program on the host machine.
    So if cross-compiling to a machine with a different byte order,
-   the bytesex.h file for that machine must exist.  */
+   the bits/endian.h file for that machine must exist.  */
 
 #error Machine byte order unknown.
diff --git a/sysdeps/stub/errnos.h b/sysdeps/stub/bits/errno.h
index 0a0f80a19d..0a0f80a19d 100644
--- a/sysdeps/stub/errnos.h
+++ b/sysdeps/stub/bits/errno.h
diff --git a/sysdeps/stub/fcntlbits.h b/sysdeps/stub/bits/fcntl.h
index 48237f53c6..24a1c38be6 100644
--- a/sysdeps/stub/fcntlbits.h
+++ b/sysdeps/stub/bits/fcntl.h
@@ -19,9 +19,9 @@
 
 /* These values should be changed as appropriate for your system.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -66,7 +66,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -83,6 +83,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/stub/fenvbits.h b/sysdeps/stub/bits/fenv.h
index cb8868cc70..f45deb07c1 100644
--- a/sysdeps/stub/fenvbits.h
+++ b/sysdeps/stub/bits/fenv.h
@@ -16,10 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* This file should never be included directly.  */
+#ifndef _FENV_H
+#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
 
-#ifndef _FENVBITS_H
-#define _FENVBITS_H	1
 
 /* Here should be the exception be defined:
     FE_INVALID
@@ -59,5 +59,3 @@ fenv_t;
 
 /* If the default argument is used we use this value.  */
 #define FE_DFL_ENV	((fenv_t *) -1l)
-
-#endif /* fenvbits.h */
diff --git a/sysdeps/stub/huge_val.h b/sysdeps/stub/bits/huge_val.h
index 18e96b14fb..8f137d1734 100644
--- a/sysdeps/stub/huge_val.h
+++ b/sysdeps/stub/bits/huge_val.h
@@ -18,9 +18,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	   _HUGE_VAL_H
-#define	   _HUGE_VAL_H	1
+#ifndef _MATH_H
+#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
 
-#define	   HUGE_VAL	1e37
 
-#endif	   /* huge_val.h */
+#define	   HUGE_VAL	1e37
diff --git a/sysdeps/stub/ioctls.h b/sysdeps/stub/bits/ioctls.h
index 3b6178bfae..3b6178bfae 100644
--- a/sysdeps/stub/ioctls.h
+++ b/sysdeps/stub/bits/ioctls.h
diff --git a/sysdeps/stub/sys/ipc_buf.h b/sysdeps/stub/bits/ipc.h
index a5ecbd90b7..a5ecbd90b7 100644
--- a/sysdeps/stub/sys/ipc_buf.h
+++ b/sysdeps/stub/bits/ipc.h
diff --git a/sysdeps/stub/libc-lock.h b/sysdeps/stub/bits/libc-lock.h
index 724b6e59d4..4261728b2c 100644
--- a/sysdeps/stub/libc-lock.h
+++ b/sysdeps/stub/bits/libc-lock.h
@@ -17,8 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _LIBC_LOCK_H
-#define _LIBC_LOCK_H 1
+#ifndef _BITS_LIBC_LOCK_H
+#define _BITS_LIBC_LOCK_H 1
 
 
 /* Define a lock variable NAME with storage class CLASS.  The lock must be
@@ -80,4 +80,4 @@
 /* We need portable names for some of the functions.  */
 #define __libc_mutex_unlock
 
-#endif	/* libc-lock.h */
+#endif	/* bits/libc-lock.h */
diff --git a/sysdeps/stub/local_lim.h b/sysdeps/stub/bits/local_lim.h
index 42cc7ebbc9..42cc7ebbc9 100644
--- a/sysdeps/stub/local_lim.h
+++ b/sysdeps/stub/bits/local_lim.h
diff --git a/sysdeps/stub/__math.h b/sysdeps/stub/bits/mathinline.h
index 8159c89b94..8159c89b94 100644
--- a/sysdeps/stub/__math.h
+++ b/sysdeps/stub/bits/mathinline.h
diff --git a/sysdeps/stub/bits/msq.h b/sysdeps/stub/bits/msq.h
new file mode 100644
index 0000000000..37daa9bf8c
--- /dev/null
+++ b/sysdeps/stub/bits/msq.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_MSG_H
+#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Define options for message queue functions.  */
+#define MSG_NOERROR	010000	/* no error if message is too big */
+
+__BEGIN_DECLS
+
+/* Structure of record for one message inside the kernel.
+   The type `struct __msg' is opaque.  */
+struct msqid_ds
+{
+  struct ipc_perm msg_perm;	/* structure describing operation permission */
+  __time_t msg_stime;		/* time of last msgsnd command */
+  __time_t msg_rtime;		/* time of last msgrcv command */
+  __time_t msg_ctime;		/* time of last change */
+  unsigned short int msg_qnum;	/* number of messages currently on queue */
+  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+  __pid_t msg_lspid;		/* pid of last msgsnd() */
+  __pid_t msg_lrpid;		/* pid of last msgrcv() */
+};
+
+__END_DECLS
diff --git a/sysdeps/stub/bits/nan.h b/sysdeps/stub/bits/nan.h
new file mode 100644
index 0000000000..ab38168ea4
--- /dev/null
+++ b/sysdeps/stub/bits/nan.h
@@ -0,0 +1,5 @@
+#ifndef _MATH_H
+#error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
+
+/* This file should define `NAN' on machines that have such things.  */
diff --git a/sysdeps/stub/posix_opt.h b/sysdeps/stub/bits/posix_opt.h
index 54f5a79aa2..54f5a79aa2 100644
--- a/sysdeps/stub/posix_opt.h
+++ b/sysdeps/stub/bits/posix_opt.h
diff --git a/sysdeps/stub/sys/sem_buf.h b/sysdeps/stub/bits/sem.h
index 278cdeb1e2..1d3e41bd56 100644
--- a/sysdeps/stub/sys/sem_buf.h
+++ b/sysdeps/stub/bits/sem.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SEM_BUF_H
-#define _SYS_SEM_BUF_H
+#ifndef _SYS_SEM_H
+#error "Never use <bits/sem.h> directly; include <sys/sem.h> instead."
+#endif
+
 
 #include <features.h>
 #include <sys/types.h>
@@ -57,5 +59,3 @@ union semun
  };
 
 __END_DECLS
-
-#endif /* sys/sem_buf.h */
diff --git a/sysdeps/stub/jmp_buf.h b/sysdeps/stub/bits/setjmp.h
index 6620e5ab15..6620e5ab15 100644
--- a/sysdeps/stub/jmp_buf.h
+++ b/sysdeps/stub/bits/setjmp.h
diff --git a/sysdeps/stub/sys/shm_buf.h b/sysdeps/stub/bits/shm.h
index 45147d4b06..b41d0c1e86 100644
--- a/sysdeps/stub/sys/shm_buf.h
+++ b/sysdeps/stub/bits/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SHM_BUF_H
-#define _SYS_SHM_BUF_H
+#ifndef _SYS_SHM_H
+#error "Never use <bits/shm.h> directly; include <sys/shm.h> instead."
+#endif
+
 
 #include <features.h>
 #include <sys/types.h>
@@ -49,5 +51,3 @@ struct shmid_ds
 };
 
 __END_DECLS
-
-#endif /* sys/shm_buf.h */
diff --git a/sysdeps/stub/sigcontext.h b/sysdeps/stub/bits/sigcontext.h
index 18d599fa8a..18d599fa8a 100644
--- a/sysdeps/stub/sigcontext.h
+++ b/sysdeps/stub/bits/sigcontext.h
diff --git a/sysdeps/stub/signum.h b/sysdeps/stub/bits/signum.h
index 6b4693f64c..6b4693f64c 100644
--- a/sysdeps/stub/signum.h
+++ b/sysdeps/stub/bits/signum.h
diff --git a/sysdeps/stub/statbuf.h b/sysdeps/stub/bits/stat.h
index ab14e23bc5..dab0cd00cb 100644
--- a/sysdeps/stub/statbuf.h
+++ b/sysdeps/stub/bits/stat.h
@@ -16,14 +16,17 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
 /* This structure needs to be defined in accordance with the
    implementation of __stat, __fstat, and __lstat.  */
 
-#ifndef	_STATBUF_H
-
-#define	_STATBUF_H	1
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Structure describing file characteristics.  */
 struct stat
@@ -68,4 +71,4 @@ struct stat
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
 
-#endif /* statbuf.h */
+#endif /* bits/stat.h */
diff --git a/sysdeps/stub/stdio_lim.h b/sysdeps/stub/bits/stdio_lim.h
index 59b6a40ebe..59b6a40ebe 100644
--- a/sysdeps/stub/stdio_lim.h
+++ b/sysdeps/stub/bits/stdio_lim.h
diff --git a/sysdeps/stub/timebits.h b/sysdeps/stub/bits/time.h
index 45185cc356..e41a991b44 100644
--- a/sysdeps/stub/timebits.h
+++ b/sysdeps/stub/bits/time.h
@@ -1,5 +1,5 @@
 /* System-dependent timing definitions.  Stub version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
 #ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
@@ -32,9 +36,9 @@ struct timeval
 #endif	/* need timeval */
 
 
-#ifndef _TIMEBITS_H
-#define	_TIMEBITS_H	1
+#ifndef _BITS_TIME_H
+#define	_BITS_TIME_H	1
 
 #define CLOCKS_PER_SEC 60
 
-#endif	/* timebits.h */
+#endif	/* bits/time.h */
diff --git a/sysdeps/stub/waitflags.h b/sysdeps/stub/bits/waitflags.h
index e8c9843339..127eb6ce4c 100644
--- a/sysdeps/stub/waitflags.h
+++ b/sysdeps/stub/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,12 +17,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_WAITFLAGS_H
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+#endif
 
-#define	_WAITFLAGS_H	1
 
 /* Bits in the third argument to `waitpid'.  */
 #define	WNOHANG		1	/* Don't block waiting.  */
 #define	WUNTRACED	2	/* Report status of stopped children.  */
-
-#endif	/* waitflags.h */
diff --git a/sysdeps/stub/nan.h b/sysdeps/stub/nan.h
deleted file mode 100644
index 9dd53415c8..0000000000
--- a/sysdeps/stub/nan.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef	_NAN_H
-#define	_NAN_H	1
-
-/* This file should define `NAN' on machines that have such things.  */
-
-#endif	/* nan.h */
diff --git a/sysdeps/stub/sys/msq_buf.h b/sysdeps/stub/sys/msq_buf.h
deleted file mode 100644
index 0222a652ab..0000000000
--- a/sysdeps/stub/sys/msq_buf.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#ifndef _SYS_MSQ_BUF_H
-#define _SYS_MSQ_BUF_H
-
-#include <features.h>
-#include <sys/types.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-
-__BEGIN_DECLS
-
-/* Structure of record for one message inside the kernel.
-   The type `struct __msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-  __time_t msg_stime;		/* time of last msgsnd command */
-  __time_t msg_rtime;		/* time of last msgrcv command */
-  __time_t msg_ctime;		/* time of last change */
-  unsigned short int msg_qnum;	/* number of messages currently on queue */
-  unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-};
-
-__END_DECLS
-
-#endif /* sys/msq_buf.h */
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index f51dc508a0..0e837ca2e7 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -20,7 +20,7 @@
 config-generated := $(config-generated) $(unix-generated)
 
 ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/local_lim.h))))))
+	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/local_lim.h))))))
 
 ifneq (,$(wildcard $(sysincludedir)/sys/param.h))
 mk-local_lim-CFLAGS += -DHAVE_SYS_PARAM_H
@@ -32,13 +32,13 @@ ifneq (,$(wildcard $(sysincludedir)/limits.h))
 mk-local_lim-CFLAGS += -DHAVE_LIMITS_H
 endif
 
-$(common-objpfx)local_lim.h: $(common-objpfx)mk-local_lim
+$(common-objpfx)bits/local_lim.h: $(common-objpfx)mk-local_lim
 	$(dir $<)$(notdir $<) > $@-t
 	mv -f $@-t $@
 $(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
 	$(common-objdir-compile)
 
-before-compile := $(before-compile) $(common-objpfx)local_lim.h
+before-compile := $(before-compile) $(common-objpfx)bits/local_lim.h
 common-generated := $(common-generated) local_lim.h mk-local_lim
 
 endif
@@ -51,8 +51,8 @@ before-compile := $(before-compile) $(common-objpfx)sys/param.h
 
 $(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h
 	$(make-target-directory)
-	(echo '#ifndef _GNU_SYS_PARAM_H';	\
-	 echo '#define _GNU_SYS_PARAM_H 1';	\
+	(echo '#ifndef _SYS_PARAM_H';	\
+	 echo '#define _SYS_PARAM_H 1';	\
 	 echo '#include <endian.h>';		\
 	 awk < $<			\
 	   '/^#define[ 	]*NULL/ { print "#ifndef NULL";	\
@@ -127,13 +127,13 @@ endif # misc
 endif # No sysdep sys/param.h.
 
 ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/errnos.h))))))
+	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/errno.h))))))
 
 # These need to exist before any compiling is done,
 # so cpp doesn't instead find the stub versions.
-before-compile := $(before-compile) $(common-objpfx)errnos.h
+before-compile := $(before-compile) $(common-objpfx)bits/errno.h
 
-$(common-objpfx)errnos.h: $(common-objpfx)make-errnos
+$(common-objpfx)bits/errno.h: $(common-objpfx)make-errnos
 	$(dir $<)$(notdir $<) > $@-tmp
 	mv $@-tmp $@
 
@@ -156,11 +156,11 @@ common-generated := $(common-generated) \
 endif
 
 ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/ioctls.h))))))
+	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/ioctls.h))))))
 
-before-compile := $(before-compile) $(common-objpfx)ioctls.h
+before-compile := $(before-compile) $(common-objpfx)bits/ioctls.h
 
-$(common-objpfx)ioctls.h: $(common-objpfx)make-ioctls
+$(common-objpfx)bits/ioctls.h: $(common-objpfx)make-ioctls
 	$(dir $<)$(notdir $<) > $@-tmp
 	mv $@-tmp $@
 
@@ -180,25 +180,26 @@ $(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
 	mv $@T $@
 
 
-termbits.h := $(firstword $(wildcard $(+sysdep_dirs:%=%/termbits.h)))
-ifeq ($(termbits.h),$(sysdep_dir)/generic/termbits.h)
-termbits.h := # Ignore the generic version.
+bits_termios.h := $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/termios.h)))
+ifeq ($(bits_termios.h),$(sysdep_dir)/generic/bits/termios.h)
+bits_termios.h := # Ignore the generic version.
 endif
 
-# If there is a system-specific <termbits.h> file, we want to omit all the
-# symbols it defines from ioctls.  Otherwise, both ioctls.h and termbits.h
-# would define them.  The system-specific <termbits.h> file presumably
-# defines them with the same values as we find from the system's headers.
-# We also want to omit from ioctls the symbols defined in our own
+# If there is a system-specific <bits/termios.h> file, we want to omit
+# all the symbols it defines from ioctls.  Otherwise, both
+# <bits/ioctls.h> and <bits/termios.h> would define them.  The
+# system-specific <bits/termios.h> file presumably defines them with
+# the same values as we find from the system's headers.  We also want
+# to omit from ioctls the symbols defined in our own
 # <sys/ttydefaults.h>, to avoid multiple definition conflicts.  We use
-# snarf-ioctls on these files to find what symbols we want to omit.  fgrep
-# -xv gives all lines which do not match in their entirety; without -x,
-# CSTOP's presence elided TIOCSTOP.
+# snarf-ioctls on these files to find what symbols we want to omit.
+# fgrep -xv gives all lines which do not match in their entirety;
+# without -x, CSTOP's presence elided TIOCSTOP.
 
 $(common-objpfx)ioctls: $(sysdep_dir)/unix/snarf-ioctls \
 			$(sysincludedir)/sys/ioctl.h $(ioctl-includes)
 	$(dir $<)$(notdir $<) $(filter-out $<,$^) \
-	| fgrep -xv "`($(dir $<)$(notdir $<) $(termbits.h) \
+	| fgrep -xv "`($(dir $<)$(notdir $<) $(bits_termios.h) \
 					     $(..)sysdeps/generic/sys/ttydefaults.h; \
 		      echo NULL) \
 		     | sort | uniq`" \
@@ -206,7 +207,7 @@ $(common-objpfx)ioctls: $(sysdep_dir)/unix/snarf-ioctls \
 	mv $@-tmp $@
 
 common-generated := $(common-generated) \
-		    ioctls.h ioctls make-ioctls make-ioctls.c
+		    bits/ioctls.h ioctls make-ioctls make-ioctls.c
 endif
 
 ifeq ($(subdir),stdio-common)
diff --git a/sysdeps/unix/bsd/direntry.h b/sysdeps/unix/bsd/bits/dirent.h
index 2f563ec306..2f563ec306 100644
--- a/sysdeps/unix/bsd/direntry.h
+++ b/sysdeps/unix/bsd/bits/dirent.h
diff --git a/sysdeps/unix/bsd/fcntlbits.h b/sysdeps/unix/bsd/bits/fcntl.h
index 1e87a379e4..3d9bcb5c60 100644
--- a/sysdeps/unix/bsd/fcntlbits.h
+++ b/sysdeps/unix/bsd/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -94,7 +94,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -112,6 +112,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/bsd/posix_opt.h b/sysdeps/unix/bsd/bits/posix_opt.h
index 7d5e5782eb..7d5e5782eb 100644
--- a/sysdeps/unix/bsd/posix_opt.h
+++ b/sysdeps/unix/bsd/bits/posix_opt.h
diff --git a/sysdeps/unix/bsd/signum.h b/sysdeps/unix/bsd/bits/signum.h
index 775240fc05..775240fc05 100644
--- a/sysdeps/unix/bsd/signum.h
+++ b/sysdeps/unix/bsd/bits/signum.h
diff --git a/sysdeps/unix/bsd/statbuf.h b/sysdeps/unix/bsd/bits/stat.h
index c4a4e0964b..037433f388 100644
--- a/sysdeps/unix/bsd/statbuf.h
+++ b/sysdeps/unix/bsd/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,11 +16,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
 
+#ifndef	_STATBUF_H
 #define	_STATBUF_H	1
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Structure describing file characteristics.  */
 struct stat
@@ -81,4 +84,4 @@ struct stat
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
 
-#endif /* statbuf.h */
+#endif /* bits/stat.h */
diff --git a/sysdeps/unix/bsd/waitflags.h b/sysdeps/unix/bsd/bits/waitflags.h
index 00a1520db4..ca952f90b4 100644
--- a/sysdeps/unix/bsd/waitflags.h
+++ b/sysdeps/unix/bsd/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.  Hurd version.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,9 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_WAITFLAGS_H
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+#endif
 
-#define	_WAITFLAGS_H	1
 
 /* Bits in the third argument to `waitpid'.  */
 #define	WNOHANG		1	/* Don't block waiting.  */
@@ -27,5 +28,3 @@
 #ifdef  __USE_GNU
 #define WNOREAP		4	/* Don't remove record of child reported.  */
 #endif
-
-#endif	/* waitflags.h */
diff --git a/sysdeps/unix/bsd/bsd4.4/direntry.h b/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
index b9e0d7277e..b9e0d7277e 100644
--- a/sysdeps/unix/bsd/bsd4.4/direntry.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
diff --git a/sysdeps/unix/bsd/bsd4.4/errnos.h b/sysdeps/unix/bsd/bsd4.4/bits/errno.h
index c2a9c08413..c2a9c08413 100644
--- a/sysdeps/unix/bsd/bsd4.4/errnos.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/errno.h
diff --git a/sysdeps/unix/bsd/bsd4.4/fcntlbits.h b/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h
index 3ab2bf027d..c00a0e80dd 100644
--- a/sysdeps/unix/bsd/bsd4.4/fcntlbits.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -94,7 +94,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -111,6 +111,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/bsd/bsd4.4/ioctls.h b/sysdeps/unix/bsd/bsd4.4/bits/ioctls.h
index 6c351f46a6..6c351f46a6 100644
--- a/sysdeps/unix/bsd/bsd4.4/ioctls.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/ioctls.h
diff --git a/sysdeps/unix/bsd/bsd4.4/sockaddrcom.h b/sysdeps/unix/bsd/bsd4.4/bits/sockaddr.h
index 87da37df90..d70dfe4031 100644
--- a/sysdeps/unix/bsd/bsd4.4/sockaddrcom.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/sockaddr.h
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SOCKADDRCOM_H
-#define _SOCKADDRCOM_H	1
+/*
+ * Never include this file directly; use <sys/socket.h> instead.
+ */
+
+#ifndef _BITS_SOCKADDR_H
+#define _BITS_SOCKADDR_H	1
 
 
 /* POSIX.1g specifies this type name for the `sa_family' member.  */
@@ -35,4 +39,4 @@ typedef unsigned char sa_family_t;
 #define __SOCKADDR_COMMON_SIZE	(2 * sizeof (unsigned char))
 
 
-#endif	/* sockaddrcom.h */
+#endif	/* bits/sockaddr.h */
diff --git a/sysdeps/unix/bsd/bsd4.4/tcgetattr.c b/sysdeps/unix/bsd/bsd4.4/tcgetattr.c
index d47443a335..29c7e28b8e 100644
--- a/sysdeps/unix/bsd/bsd4.4/tcgetattr.c
+++ b/sysdeps/unix/bsd/bsd4.4/tcgetattr.c
@@ -19,7 +19,7 @@
 #include <stddef.h>
 #include <termios.h>
 
-/* These are defined both in termbits.h and in ioctls.h.
+/* These are defined both in <bits/termios.h> and in <bits/ioctls.h>.
    They should have the same values, but perhaps not written the same way.  */
 #undef ECHO
 #undef MDMBUF
diff --git a/sysdeps/unix/bsd/bsd4.4/tcsetattr.c b/sysdeps/unix/bsd/bsd4.4/tcsetattr.c
index 7c09f90f0e..2e4b00b68d 100644
--- a/sysdeps/unix/bsd/bsd4.4/tcsetattr.c
+++ b/sysdeps/unix/bsd/bsd4.4/tcsetattr.c
@@ -20,7 +20,7 @@
 #include <stddef.h>
 #include <termios.h>
 
-/* These are defined both in termbits.h and in ioctls.h.
+/* These are defined both in <bits/termios.h> and in <bits/ioctls.h>.
    They should have the same values, but perhaps not written the same way.  */
 #undef ECHO
 #undef MDMBUF
diff --git a/sysdeps/unix/bsd/m68k/sysdep.S b/sysdeps/unix/bsd/m68k/sysdep.S
index cef8990eea..1be2d5a23f 100644
--- a/sysdeps/unix/bsd/m68k/sysdep.S
+++ b/sysdeps/unix/bsd/m68k/sysdep.S
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 .globl syscall_error
 syscall_error:
diff --git a/sysdeps/unix/bsd/osf/alpha/statbuf.h b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
index 8541922b37..752d4eede1 100644
--- a/sysdeps/unix/bsd/osf/alpha/statbuf.h
+++ b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -17,10 +17,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
 
-#include <gnu/types.h>
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H
+
+#include <bits/types.h>
 
 /* Structure describing file characteristics.  */
 struct stat
@@ -73,4 +77,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/bsd/osf/sigaction.h b/sysdeps/unix/bsd/osf/bits/sigaction.h
index df400d4aaa..df400d4aaa 100644
--- a/sysdeps/unix/bsd/osf/sigaction.h
+++ b/sysdeps/unix/bsd/osf/bits/sigaction.h
diff --git a/sysdeps/unix/bsd/osf/sys/mman.h b/sysdeps/unix/bsd/osf/sys/mman.h
index 6dc3e4e0cf..72846195d2 100644
--- a/sysdeps/unix/bsd/osf/sys/mman.h
+++ b/sysdeps/unix/bsd/osf/sys/mman.h
@@ -22,7 +22,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/unix/bsd/sun/signum.h b/sysdeps/unix/bsd/sun/bits/signum.h
index a327401d0b..a327401d0b 100644
--- a/sysdeps/unix/bsd/sun/signum.h
+++ b/sysdeps/unix/bsd/sun/bits/signum.h
diff --git a/sysdeps/unix/bsd/sun/m68k/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
index 471b516bdc..471b516bdc 100644
--- a/sysdeps/unix/bsd/sun/m68k/sigcontext.h
+++ b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
diff --git a/sysdeps/unix/bsd/sun/m68k/sethostid.S b/sysdeps/unix/bsd/sun/m68k/sethostid.S
index 8b30f3fe65..ab76d75f7b 100644
--- a/sysdeps/unix/bsd/sun/m68k/sethostid.S
+++ b/sysdeps/unix/bsd/sun/m68k/sethostid.S
@@ -25,7 +25,7 @@ SYSCALL (sethostid, 1)
 
 #else
 
-#include <errnos.h>
+#include <bits/errno.h>
 
 .globl _sethostid
 .even
diff --git a/sysdeps/unix/bsd/sun/sparc/sigcontext.h b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
index 290bf817af..290bf817af 100644
--- a/sysdeps/unix/bsd/sun/sparc/sigcontext.h
+++ b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
diff --git a/sysdeps/unix/bsd/sun/sparc/sethostid.S b/sysdeps/unix/bsd/sun/sparc/sethostid.S
index fbafba5277..f8ee805c75 100644
--- a/sysdeps/unix/bsd/sun/sparc/sethostid.S
+++ b/sysdeps/unix/bsd/sun/sparc/sethostid.S
@@ -25,9 +25,9 @@ SYSCALL (sethostid, 1)
 
 #else
 
-/* <errnos.h> only defines E* #ifdef _ERRNO_H.  */
+/* <bits/errno.h> only defines E* #ifdef _ERRNO_H.  */
 #define	_ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 ENTRY (sethostid)
 	mov ENOSYS, %o0
diff --git a/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h b/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
index a9f66c47a3..b74c80e170 100644
--- a/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -104,7 +104,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -140,6 +140,3 @@ struct eflock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index ff55773e69..ff55773e69 100644
--- a/sysdeps/unix/bsd/sun/sunos4/resourcebits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
diff --git a/sysdeps/unix/bsd/sun/sunos4/termbits.h b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
index dc0a007208..dc0a007208 100644
--- a/sysdeps/unix/bsd/sun/sunos4/termbits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
diff --git a/sysdeps/unix/bsd/sun/sunos4/utsnamelen.h b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
index e9111b6504..e9111b6504 100644
--- a/sysdeps/unix/bsd/sun/sunos4/utsnamelen.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/mman.h b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
index fb38c34d90..65771a2aac 100644
--- a/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
+++ b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
@@ -22,7 +22,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/unix/bsd/ultrix4/fcntlbits.h b/sysdeps/unix/bsd/ultrix4/bits/fcntl.h
index ba736e428e..1398b811ce 100644
--- a/sysdeps/unix/bsd/ultrix4/fcntlbits.h
+++ b/sysdeps/unix/bsd/ultrix4/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -103,7 +103,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -120,6 +120,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/bsd/ultrix4/posix_opt.h b/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h
index ecd04d1f0e..ecd04d1f0e 100644
--- a/sysdeps/unix/bsd/ultrix4/posix_opt.h
+++ b/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h
diff --git a/sysdeps/unix/bsd/ultrix4/utsnamelen.h b/sysdeps/unix/bsd/ultrix4/bits/utsname.h
index ad4389ab02..ad4389ab02 100644
--- a/sysdeps/unix/bsd/ultrix4/utsnamelen.h
+++ b/sysdeps/unix/bsd/ultrix4/bits/utsname.h
diff --git a/sysdeps/unix/bsd/ultrix4/mips/sigcontext.h b/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
index 4bddcf2f4b..4bddcf2f4b 100644
--- a/sysdeps/unix/bsd/ultrix4/mips/sigcontext.h
+++ b/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
diff --git a/sysdeps/unix/bsd/ultrix4/sys/mman.h b/sysdeps/unix/bsd/ultrix4/sys/mman.h
index 2d3c8fe2ef..989bf21754 100644
--- a/sysdeps/unix/bsd/ultrix4/sys/mman.h
+++ b/sysdeps/unix/bsd/ultrix4/sys/mman.h
@@ -22,7 +22,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/unix/bsd/vax/sysdep.S b/sysdeps/unix/bsd/vax/sysdep.S
index 618d889742..b5b76aaba5 100644
--- a/sysdeps/unix/bsd/vax/sysdep.S
+++ b/sysdeps/unix/bsd/vax/sysdep.S
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 .globl _errno
 .globl syscall_error
diff --git a/sysdeps/unix/common/direntry.h b/sysdeps/unix/common/bits/dirent.h
index aa065474bf..aa065474bf 100644
--- a/sysdeps/unix/common/direntry.h
+++ b/sysdeps/unix/common/bits/dirent.h
diff --git a/sysdeps/unix/common/fcntlbits.h b/sysdeps/unix/common/bits/fcntl.h
index e416e0df13..31f213eab7 100644
--- a/sysdeps/unix/common/fcntlbits.h
+++ b/sysdeps/unix/common/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -98,7 +98,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -117,6 +117,3 @@ struct flock
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
 #define	F_UNLCK	3	/* Remove lock.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/dirstream.h b/sysdeps/unix/dirstream.h
index cbbdb6b659..424627e740 100644
--- a/sysdeps/unix/dirstream.h
+++ b/sysdeps/unix/dirstream.h
@@ -22,7 +22,7 @@
 
 #include <sys/types.h>
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 /* Directory stream type.
 
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index a65589df72..b296bb707a 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -18,7 +18,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 .globl C_SYMBOL_NAME(errno)
 .globl syscall_error
diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S
index f17ba44341..1791801ec5 100644
--- a/sysdeps/unix/mips/sysdep.S
+++ b/sysdeps/unix/mips/sysdep.S
@@ -18,7 +18,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* .globl errno */
 .set noreorder
diff --git a/sysdeps/unix/mk-local_lim.c b/sysdeps/unix/mk-local_lim.c
index b2212ee46d..27dfbc2dfc 100644
--- a/sysdeps/unix/mk-local_lim.c
+++ b/sysdeps/unix/mk-local_lim.c
@@ -31,7 +31,8 @@ Cambridge, MA 02139, USA.  */
 #include <sys/limits.h>
 #endif
 
-/* Generate local_lim.h from the values defined in the system's headers.  */
+/* Generate bits/local_lim.h from the values defined in the system's
+   headers.  */
 
 struct param
   {
diff --git a/sysdeps/unix/sparc/sysdep.S b/sysdeps/unix/sparc/sysdep.S
index d04a778794..5eea06939e 100644
--- a/sysdeps/unix/sparc/sysdep.S
+++ b/sysdeps/unix/sparc/sysdep.S
@@ -18,7 +18,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 .global C_SYMBOL_NAME(errno)
 .global syscall_error
diff --git a/sysdeps/unix/sysv/direntry.h b/sysdeps/unix/sysv/bits/dirent.h
index 5035f143ce..5035f143ce 100644
--- a/sysdeps/unix/sysv/direntry.h
+++ b/sysdeps/unix/sysv/bits/dirent.h
diff --git a/sysdeps/unix/sysv/fcntlbits.h b/sysdeps/unix/sysv/bits/fcntl.h
index 7f38422707..22863ffa5e 100644
--- a/sysdeps/unix/sysv/fcntlbits.h
+++ b/sysdeps/unix/sysv/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -64,7 +64,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -92,5 +92,3 @@ struct flock
 #define	FNONBLOCK	O_NONBLOCK
 #define	FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/local_lim.h b/sysdeps/unix/sysv/bits/local_lim.h
index a370928484..a370928484 100644
--- a/sysdeps/unix/sysv/local_lim.h
+++ b/sysdeps/unix/sysv/bits/local_lim.h
diff --git a/sysdeps/unix/sysv/signum.h b/sysdeps/unix/sysv/bits/signum.h
index 088ca2a1be..088ca2a1be 100644
--- a/sysdeps/unix/sysv/signum.h
+++ b/sysdeps/unix/sysv/bits/signum.h
diff --git a/sysdeps/unix/sysv/statbuf.h b/sysdeps/unix/sysv/bits/stat.h
index f74943c19a..56f4544594 100644
--- a/sysdeps/unix/sysv/statbuf.h
+++ b/sysdeps/unix/sysv/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
 struct stat
   {
@@ -58,4 +62,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/bits/utmp.h b/sysdeps/unix/sysv/bits/utmp.h
new file mode 100644
index 0000000000..1bb1a55873
--- /dev/null
+++ b/sysdeps/unix/sysv/bits/utmp.h
@@ -0,0 +1,57 @@
+/* The `struct utmp' type, describing entries in the utmp file.  System V.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _UTMP_H
+#error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+#endif
+
+
+#include <time.h>
+
+#define _PATH_UTMP      "/var/adm/utmp"
+#define _PATH_WTMP      "/var/adm/wtmp"
+#define _PATH_LASTLOG   "/var/adm/lastlog"
+
+__BEGIN_DECLS
+
+struct utmp
+  {
+#define	ut_name	ut_user
+    char ut_user[8];
+    char ut_id[4];
+    char ut_line[12];
+    short ut_pid;
+    short ut_type;
+    struct exit_status
+      {
+	short e_termination;
+	short e_exit;
+      } ut_exit;
+    time_t ut_time;
+  };
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_TYPE, UT_ID
+   and UT_TV fields.  */
+#define _HAVE_UT_TYPE	1
+#define _HAVE_UT_ID	1
+#define _HAVE_UT_TV	1
+#define _HAVE_UT_HOST	1
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/utsnamelen.h b/sysdeps/unix/sysv/bits/utsname.h
index 31473cf4ea..31473cf4ea 100644
--- a/sysdeps/unix/sysv/utsnamelen.h
+++ b/sysdeps/unix/sysv/bits/utsname.h
diff --git a/sysdeps/unix/sysv/irix4/confname.h b/sysdeps/unix/sysv/irix4/bits/confname.h
index 49d2f9c989..49d2f9c989 100644
--- a/sysdeps/unix/sysv/irix4/confname.h
+++ b/sysdeps/unix/sysv/irix4/bits/confname.h
diff --git a/sysdeps/unix/sysv/irix4/fcntlbits.h b/sysdeps/unix/sysv/irix4/bits/fcntl.h
index 318e483279..a926d049ec 100644
--- a/sysdeps/unix/sysv/irix4/fcntlbits.h
+++ b/sysdeps/unix/sysv/irix4/bits/fcntl.h
@@ -17,9 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
 
 
 /* File access modes for `open' and `fcntl'.  */
@@ -76,7 +76,7 @@
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* The structure describing an advisory lock.  This is the type of the third
    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
@@ -105,6 +105,3 @@ struct flock
 #define	FNONBLOCK	O_NONBLOCK
 #define	FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
-
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/irix4/signum.h b/sysdeps/unix/sysv/irix4/bits/signum.h
index 13314cff42..13314cff42 100644
--- a/sysdeps/unix/sysv/irix4/signum.h
+++ b/sysdeps/unix/sysv/irix4/bits/signum.h
diff --git a/sysdeps/unix/sysv/irix4/statbuf.h b/sysdeps/unix/sysv/irix4/bits/stat.h
index 579ccec8a6..0dab45cfa0 100644
--- a/sysdeps/unix/sysv/irix4/statbuf.h
+++ b/sysdeps/unix/sysv/irix4/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
 struct stat
   {
@@ -58,4 +62,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/irix4/sys/mman.h b/sysdeps/unix/sysv/irix4/sys/mman.h
index 9ceca1fe96..f42a9f67aa 100644
--- a/sysdeps/unix/sysv/irix4/sys/mman.h
+++ b/sysdeps/unix/sysv/irix4/sys/mman.h
@@ -22,7 +22,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index ae79600717..53700850b9 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -2,8 +2,10 @@ cmsg_nxthdr.c
 init-first.h
 kernel_sigaction.h
 kernel_stat.h
+kernel_termios.h
 llseek.c
 siglist.h
+socketcall.h
 sysctl.c
 termio.h
 net/ethernet.h
@@ -30,14 +32,12 @@ sys/debugreg.h
 sys/io.h
 sys/kd.h
 sys/kdaemon.h
-sys/kernel_termios.h
 sys/klog.h
 sys/module.h
 sys/mount.h
 sys/mtio.h
 sys/procfs.h
 sys/quota.h
-sys/socketcall.h
 sys/socketvar.h
 sys/soundcard.h
 sys/sysctl.h
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 7255a69ece..42f64638ca 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -36,7 +36,7 @@ sysdep_headers += sys/timex.h
 endif
 
 ifeq ($(subdir),socket)
-sysdep_headers += sys/socketcall.h net/if.h net/if_ppp.h net/ppp-comp.h \
+sysdep_headers += net/if.h net/if_ppp.h net/ppp-comp.h \
 		  net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
 		  net/if_slip.h
 sysdep_routines += cmsg_nxthdr
@@ -47,7 +47,7 @@ sysdep_headers += nfs/nfs.h
 endif
 
 ifeq ($(subdir),termios)
-sysdep_headers += termio.h sys/kernel_termios.h
+sysdep_headers += termio.h
 endif
 
 ifeq ($(subdir),stdio-common)
diff --git a/sysdeps/unix/sysv/linux/alpha/fcntlbits.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index 6e1c843ccb..b70502f21a 100644
--- a/sysdeps/unix/sysv/linux/alpha/fcntlbits.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -17,8 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
 
 #include <sys/types.h>
 
@@ -96,5 +98,3 @@ struct flock
 #define	FNONBLOCK	O_NONBLOCK
 #define	FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/ioctls.h b/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h
index 80b2e62e77..8a14f99f43 100644
--- a/sysdeps/unix/sysv/linux/sparc/ioctls.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h
@@ -16,12 +16,16 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOCTLS_H
-#define _IOCTLS_H 1
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTLS_H
+#define _BITS_IOCTLS_H 1
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
-#include <sys/kernel_termios.h>
+#include <kernel_termios.h>
 
 /* Oh well, this is necessary since the kernel data structure is
    different from the user-level version.  */
@@ -36,4 +40,4 @@
 
 #include <linux/sockios.h>
 
-#endif /* ioctls.h  */
+#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
index 57830daae1..57830daae1 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
diff --git a/sysdeps/unix/sysv/linux/alpha/sigaction.h b/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
index 57ce5e6ded..57ce5e6ded 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigaction.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/linux/alpha/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
index be6132d42f..be6132d42f 100644
--- a/sysdeps/unix/sysv/linux/alpha/signum.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/signum.h
diff --git a/sysdeps/unix/sysv/linux/alpha/statbuf.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index 207fa0ca1c..768b8192ff 100644
--- a/sysdeps/unix/sysv/linux/alpha/statbuf.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
 /* Versions of the `struct stat' data structure.  */
 #define _STAT_VER_LINUX_OLD	0
@@ -71,4 +75,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/termbits.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index d0932c1cd7..d0932c1cd7 100644
--- a/sysdeps/unix/sysv/linux/alpha/termbits.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
diff --git a/sysdeps/unix/sysv/linux/alpha/timebits.h b/sysdeps/unix/sysv/linux/alpha/bits/time.h
index 1ad0df8c5b..7475b68f5b 100644
--- a/sysdeps/unix/sysv/linux/alpha/timebits.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/time.h
@@ -1,5 +1,5 @@
 /* System-dependent timing definitions.  Linux/Alpha version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
 #ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
@@ -32,8 +36,8 @@ struct timeval
 #endif	/* need timeval */
 
 
-#ifndef _TIMEBITS_H
-# define _TIMEBITS_H	1
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
 
 /* ISO/IEC 9899:1990 7.12.1: <time.h>
    The macro `CLOCKS_PER_SEC' is the number per second of the value
@@ -47,4 +51,4 @@ struct timeval
    presents the real value for clock ticks per second for the system.  */
 # define CLK_TCK 1024
 
-#endif	/* timebits.h */
+#endif	/* bits/time.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/gnu/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 2af77f70cf..9a4666a508 100644
--- a/sysdeps/unix/sysv/linux/alpha/gnu/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_GNU_TYPES_H
-#define	_GNU_TYPES_H	1
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
 
 #include <features.h>
 
@@ -26,19 +30,16 @@ typedef unsigned char __u_char;
 typedef unsigned short __u_short;
 typedef unsigned int __u_int;
 typedef unsigned long __u_long;
-#ifdef __GNUC__
-typedef unsigned long long int __u_quad_t;
-typedef long long int __quad_t;
-#else
-typedef struct
-  {
-    long int __val[2];
-  } __quad_t;
-typedef struct
-  {
-    __u_long __val[2];
-  } __u_quad_t;
-#endif
+typedef unsigned long int __u_quad_t;
+typedef long int __quad_t;
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+typedef signed long int __int64_t;
+typedef unsigned long int __uint64_t;
 typedef __quad_t *__qaddr_t;
 
 typedef __u_long __dev_t;		/* Type of device numbers.  */
@@ -91,4 +92,4 @@ typedef struct
 
 typedef int __key_t;
 
-#endif /* gnu/types.h */
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S
index be0539b475..6f994937d3 100644
--- a/sysdeps/unix/sysv/linux/alpha/brk.S
+++ b/sysdeps/unix/sysv/linux/alpha/brk.S
@@ -23,7 +23,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 #ifdef PIC
 .section .bss
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index aab4e590a5..3f097fe068 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -22,7 +22,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H	1
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/alpha/kernel_termios.h
index c5e9e2684a..093ac25096 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_termios.h
@@ -16,12 +16,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_KERNEL_TERMIOS_H
-#define _SYS_KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.0.28 kernel.  */
+#ifndef _KERNEL_TERMIOS_H
+#define _KERNEL_TERMIOS_H 1
+
+/* The following corresponds to the values from the Linux 2.1.20 kernel.  */
 
 /* We need the definition of tcflag_t, cc_t, and speed_t.  */
-#include <termbits.h>
+#include <bits/termios.h>
 
 #define __KERNEL_NCCS 19
 
@@ -33,11 +34,11 @@ struct __kernel_termios
     tcflag_t c_lflag;		/* local mode flags */
     cc_t c_cc[__KERNEL_NCCS];	/* control characters */
     cc_t c_line;		/* line discipline */
-    int c_ispeed;               /* input speed */
-    int c_ospeed;               /* output speed */
+    speed_t c_ispeed;		/* input speed */
+    speed_t c_ospeed;		/* output speed */
   };
 
 #define _HAVE_C_ISPEED 1
 #define _HAVE_C_OSPEED 1
 
-#endif /* sys/kernel_termios.h */
+#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h
deleted file mode 100644
index 4be759a51f..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/sys/kernel_termios.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _SYS_KERNEL_TERMIOS_H
-#define _SYS_KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.1.20 kernel.  */
-
-/* We need the definition of tcflag_t, cc_t, and speed_t.  */
-#include <termbits.h>
-
-#define __KERNEL_NCCS 19
-
-struct __kernel_termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
-    cc_t c_line;		/* line discipline */
-    speed_t c_ispeed;		/* input speed */
-    speed_t c_ospeed;		/* output speed */
-  };
-
-#define _HAVE_C_ISPEED 1
-#define _HAVE_C_OSPEED 1
-
-#endif /* sys/kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S
index c7e7aed9c8..8125ebff20 100644
--- a/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/sysdeps/unix/sysv/linux/arm/clone.S
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H	1
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h
index a915da7788..802cbd5d63 100644
--- a/sysdeps/unix/sysv/linux/arm/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/arm/profil-counter.h
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sigcontext.h>
+#include <signal.h>
 
 void
 profil_counter (int signo, struct sigcontext sc)
diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S
index e8db072971..4d877e51d5 100644
--- a/sysdeps/unix/sysv/linux/arm/socket.S
+++ b/sysdeps/unix/sysv/linux/arm/socket.S
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
-#include <sys/socketcall.h>
+#include <socketcall.h>
 
 #define P(a, b) P2(a, b)
 #define P2(a, b) a##b
diff --git a/sysdeps/unix/sysv/linux/direntry.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index ccf5080151..ccf5080151 100644
--- a/sysdeps/unix/sysv/linux/direntry.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
diff --git a/sysdeps/unix/sysv/linux/errnos.h b/sysdeps/unix/sysv/linux/bits/errno.h
index f676d35e49..f676d35e49 100644
--- a/sysdeps/unix/sysv/linux/errnos.h
+++ b/sysdeps/unix/sysv/linux/bits/errno.h
diff --git a/sysdeps/unix/sysv/linux/fcntlbits.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index f6ba880459..62c3052d8c 100644
--- a/sysdeps/unix/sysv/linux/fcntlbits.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -17,8 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_FCNTLBITS_H
-#define	_FCNTLBITS_H	1
+#ifndef	_FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
 
 #include <sys/types.h>
 
@@ -95,5 +97,3 @@ struct flock
 #define	FNONBLOCK	O_NONBLOCK
 #define	FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
-
-#endif	/* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/linux/ioctl-types.h b/sysdeps/unix/sysv/linux/bits/ioctl-types.h
index 91fcc2653b..af988a3c9d 100644
--- a/sysdeps/unix/sysv/linux/ioctl-types.h
+++ b/sysdeps/unix/sysv/linux/bits/ioctl-types.h
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOCTL_TYPES_H
-#define _IOCTL_TYPES_H 1
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTL_TYPES_H
+#define _BITS_IOCTL_TYPES_H 1
 
 /* Get definition of constants for use with `ioctl'.  */
 #include <asm/ioctls.h>
@@ -67,4 +71,4 @@ struct termio
 #define N_AX25		5
 
 
-#endif /* ioctl-types.h */
+#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/unix/sysv/linux/ioctls.h b/sysdeps/unix/sysv/linux/bits/ioctls.h
index 8b5326998a..265c857f92 100644
--- a/sysdeps/unix/sysv/linux/ioctls.h
+++ b/sysdeps/unix/sysv/linux/bits/ioctls.h
@@ -16,11 +16,15 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOCTLS_H
-#define _IOCTLS_H 1
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTLS_H
+#define _BITS_IOCTLS_H 1
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
 #include <linux/sockios.h>
 
-#endif /* ioctls.h  */
+#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/bits/ipc.h
index f5fea0d295..f5fea0d295 100644
--- a/sysdeps/unix/sysv/linux/sys/ipc_buf.h
+++ b/sysdeps/unix/sysv/linux/bits/ipc.h
diff --git a/sysdeps/unix/sysv/linux/local_lim.h b/sysdeps/unix/sysv/linux/bits/local_lim.h
index 7ce423061a..7ce423061a 100644
--- a/sysdeps/unix/sysv/linux/local_lim.h
+++ b/sysdeps/unix/sysv/linux/bits/local_lim.h
diff --git a/sysdeps/unix/sysv/linux/sys/msq_buf.h b/sysdeps/unix/sysv/linux/bits/msq.h
index 0abc10f6e5..0abc10f6e5 100644
--- a/sysdeps/unix/sysv/linux/sys/msq_buf.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
diff --git a/sysdeps/unix/sysv/linux/posix_opt.h b/sysdeps/unix/sysv/linux/bits/posix_opt.h
index a467acfb48..e9f8b7f8f3 100644
--- a/sysdeps/unix/sysv/linux/posix_opt.h
+++ b/sysdeps/unix/sysv/linux/bits/posix_opt.h
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_POSIX_OPT_H
-#define	_POSIX_OPT_H	1
+/*
+ * Never include this file directly; use <unistd.h> instead.
+ */
+
+#ifndef	_BITS_POSIX_OPT_H
+#define	_BITS_POSIX_OPT_H	1
 
 /* Job control is supported.  */
 #define	_POSIX_JOB_CONTROL	1
@@ -66,4 +70,4 @@
 /* XPG4.2 shared memory is supported.  */
 #define	_XOPEN_SHM	1
 
-#endif /* posix_opt.h */
+#endif /* bits/posix_opt.h */
diff --git a/sysdeps/unix/sysv/linux/resourcebits.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 05cae83244..05cae83244 100644
--- a/sysdeps/unix/sysv/linux/resourcebits.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/bits/sched.h
index fccb5d834f..521bbb7177 100644
--- a/sysdeps/unix/sysv/linux/schedbits.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -18,9 +18,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_SCHEDBITS_H
+#ifndef _SCHED_H
+#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+#endif
+
 
-#define	_SCHEDBITS_H	1
 #include <features.h>
 
 /* Scheduling algorithms.  */
@@ -50,6 +52,3 @@ extern int __clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 extern int clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 		       int __flags, void *__arg));
 #endif
-
-
-#endif /* schedbits.h */
diff --git a/sysdeps/unix/sysv/linux/sys/sem_buf.h b/sysdeps/unix/sysv/linux/bits/sem.h
index 049a71bc47..049a71bc47 100644
--- a/sysdeps/unix/sysv/linux/sys/sem_buf.h
+++ b/sysdeps/unix/sysv/linux/bits/sem.h
diff --git a/sysdeps/unix/sysv/linux/sys/shm_buf.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 642b7bd191..642b7bd191 100644
--- a/sysdeps/unix/sysv/linux/sys/shm_buf.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
diff --git a/sysdeps/unix/sysv/linux/sigaction.h b/sysdeps/unix/sysv/linux/bits/sigaction.h
index 13a6a03248..13a6a03248 100644
--- a/sysdeps/unix/sysv/linux/sigaction.h
+++ b/sysdeps/unix/sysv/linux/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/linux/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h
index 71afc76c71..fb8bc5fc57 100644
--- a/sysdeps/unix/sysv/linux/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/bits/sigcontext.h
@@ -16,14 +16,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SIGCONTEXT_H
-#define _SIGCONTEXT_H 1
+#ifndef _SIGNAL_H
+#error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 
 /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
    we need sigcontext.  */
 #define sigcontext_struct sigcontext
 
 #include <asm/sigcontext.h>
-
-
-#endif /* sigcontext.h */
diff --git a/sysdeps/unix/sysv/linux/signum.h b/sysdeps/unix/sysv/linux/bits/signum.h
index d8a716f2e0..d8a716f2e0 100644
--- a/sysdeps/unix/sysv/linux/signum.h
+++ b/sysdeps/unix/sysv/linux/bits/signum.h
diff --git a/sysdeps/unix/sysv/linux/sigset.h b/sysdeps/unix/sysv/linux/bits/sigset.h
index 741ff9ac9d..741ff9ac9d 100644
--- a/sysdeps/unix/sysv/linux/sigset.h
+++ b/sysdeps/unix/sysv/linux/bits/sigset.h
diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/bits/socket.h
index e60f903fc5..e3f53a97be 100644
--- a/sysdeps/unix/sysv/linux/socketbits.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -17,9 +17,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_SOCKETBITS_H
+#ifndef _SYS_SOCKET_H
+#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
 
-#define	_SOCKETBITS_H	1
 #include <features.h>
 
 #define	__need_size_t
@@ -101,7 +103,7 @@ enum __socket_type
 #define SOMAXCONN	128
 
 /* Get the definition of the macro to define the common sockaddr members.  */
-#include <sockaddrcom.h>
+#include <bits/sockaddr.h>
 
 /* Structure describing a generic socket address.  */
 struct sockaddr
@@ -201,5 +203,3 @@ struct linger
   };
 
 __END_DECLS
-
-#endif /* socketbits.h */
diff --git a/sysdeps/unix/sysv/linux/statbuf.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 15ffe637bc..1c6e5f84ca 100644
--- a/sysdeps/unix/sysv/linux/statbuf.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
+
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
 
 /* Versions of the `struct stat' data structure.  */
 #define _STAT_VER_LINUX_OLD	1
@@ -81,4 +85,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/statfsbuf.h b/sysdeps/unix/sysv/linux/bits/statfs.h
index 7e1aa55334..8b9501423c 100644
--- a/sysdeps/unix/sysv/linux/statfsbuf.h
+++ b/sysdeps/unix/sysv/linux/bits/statfs.h
@@ -16,10 +16,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _STATFSBUF_H
-#define _STATFSBUF_H
+/*
+ * Never include this file directly; use <sys/statfs.h> instead.
+ */
 
-#include <gnu/types.h>  /* for __fsid_t */
+#ifndef _BITS_STATFS_H
+#define _BITS_STATFS_H
+
+#include <bits/types.h>  /* for __fsid_t */
 
 struct statfs
   {
@@ -35,4 +39,4 @@ struct statfs
     int f_spare[6];
   };
 
-#endif	/* statfsbuf.h */
+#endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/termbits.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 8224ac5403..dd42012374 100644
--- a/sysdeps/unix/sysv/linux/termbits.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -17,8 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _TERMBITS_H
-#define _TERMBITS_H	1
+/*
+ * Never include this file directly; use <termios.h> instead.
+ */
+
+
+#ifndef _BITS_TERMIOS_H
+#define _BITS_TERMIOS_H	1
 
 typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
@@ -181,4 +186,4 @@ struct termios
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
 
-#endif /* termbits.h */
+#endif /* bits/termios.h */
diff --git a/sysdeps/unix/sysv/linux/timebits.h b/sysdeps/unix/sysv/linux/bits/time.h
index de30a6f348..509cb2ce32 100644
--- a/sysdeps/unix/sysv/linux/timebits.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
 #ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
@@ -32,8 +36,8 @@ struct timeval
 #endif	/* need timeval */
 
 
-#ifndef _TIMEBITS_H
-# define _TIMEBITS_H	1
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
 
 /* ISO/IEC 9899:1990 7.12.1: <time.h>
    The macro `CLOCKS_PER_SEC' is the number per second of the value
@@ -49,4 +53,4 @@ struct timeval
 #  define CLK_TCK 100
 # endif
 
-#endif	/* timebits.h */
+#endif	/* bits/time.h */
diff --git a/sysdeps/unix/sysv/linux/gnu/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 872fc4e557..34f4682b3c 100644
--- a/sysdeps/unix/sysv/linux/gnu/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_GNU_TYPES_H
-#define	_GNU_TYPES_H	1
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
 
 #include <features.h>
 
@@ -39,6 +43,16 @@ typedef struct
     __u_long __val[2];
   } __u_quad_t;
 #endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+typedef signed long long int __int64_t;
+typedef unsigned long long int __uint64_t;
+#endif
 typedef __quad_t *__qaddr_t;
 
 typedef __u_quad_t __dev_t;		/* Type of device numbers.  */
@@ -86,4 +100,4 @@ typedef struct
 
 typedef int __key_t;
 
-#endif /* gnu/types.h */
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/iovec.h b/sysdeps/unix/sysv/linux/bits/uio.h
index 430edfc029..3f1dc01c73 100644
--- a/sysdeps/unix/sysv/linux/iovec.h
+++ b/sysdeps/unix/sysv/linux/bits/uio.h
@@ -16,9 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOVEC_H
+#ifndef _SYS_UIO_H
+#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+#endif
 
-#define _IOVEC_H	1
 
 #include <sys/types.h>
 
@@ -43,5 +44,3 @@ struct iovec
     void *iov_base;	/* Pointer to data.  */
     size_t iov_len;	/* Length of data.  */
   };
-
-#endif	/* iovec.h */
diff --git a/sysdeps/unix/sysv/linux/ustatbits.h b/sysdeps/unix/sysv/linux/bits/ustat.h
index 526069a7f3..526069a7f3 100644
--- a/sysdeps/unix/sysv/linux/ustatbits.h
+++ b/sysdeps/unix/sysv/linux/bits/ustat.h
diff --git a/sysdeps/unix/sysv/linux/utsnamelen.h b/sysdeps/unix/sysv/linux/bits/utsname.h
index 64e2ab5bbc..64e2ab5bbc 100644
--- a/sysdeps/unix/sysv/linux/utsnamelen.h
+++ b/sysdeps/unix/sysv/linux/bits/utsname.h
diff --git a/sysdeps/unix/sysv/linux/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h
index a60d17272b..ba3528b709 100644
--- a/sysdeps/unix/sysv/linux/waitflags.h
+++ b/sysdeps/unix/sysv/linux/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,14 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_WAITFLAGS_H
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+#endif
 
-#define	_WAITFLAGS_H	1
 
 /* Bits in the third argument to `waitpid'.  */
 #define	WNOHANG		1	/* Don't block waiting.  */
 #define	WUNTRACED	2	/* Report status of stopped children.  */
 
 #define __WCLONE	0x80000000 /* Wait for cloned process.  */
-
-#endif	/* waitflags.h */
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index 3cdd2dc468..7f758a52a8 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -22,7 +22,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H	1
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
diff --git a/sysdeps/unix/sysv/linux/i386/profil-counter.h b/sysdeps/unix/sysv/linux/i386/profil-counter.h
index 96b38e24c0..56754744c7 100644
--- a/sysdeps/unix/sysv/linux/i386/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/i386/profil-counter.h
@@ -17,7 +17,7 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <sigcontext.h>
+#include <signal.h>
 
 void
 profil_counter (int signo, struct sigcontext sc)
diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index 441c143156..7c539e17d2 100644
--- a/sysdeps/unix/sysv/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
-#include <sys/socketcall.h>
+#include <socketcall.h>
 
 #define P(a, b) P2(a, b)
 #define P2(a, b) a##b
diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h
new file mode 100644
index 0000000000..78c6f4aa2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/kernel_termios.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _KERNEL_TERMIOS_H
+#define _KERNEL_TERMIOS_H 1
+/* The following corresponds to the values from the Linux 2.1.20 kernel.  */
+
+/* We need the definition of tcflag_t, cc_t, and speed_t.  */
+#include <bits/termios.h>
+
+#define __KERNEL_NCCS 19
+
+struct __kernel_termios
+  {
+    tcflag_t c_iflag;		/* input mode flags */
+    tcflag_t c_oflag;		/* output mode flags */
+    tcflag_t c_cflag;		/* control mode flags */
+    tcflag_t c_lflag;		/* local mode flags */
+    cc_t c_line;		/* line discipline */
+    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
+  };
+
+#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
index ef9716d979..d553ab78c6 100644
--- a/sysdeps/unix/sysv/linux/m68k/clone.S
+++ b/sysdeps/unix/sysv/linux/m68k/clone.S
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H	1
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
diff --git a/sysdeps/unix/sysv/linux/m68k/socket.S b/sysdeps/unix/sysv/linux/m68k/socket.S
index d0741afeb1..1508b879f6 100644
--- a/sysdeps/unix/sysv/linux/m68k/socket.S
+++ b/sysdeps/unix/sysv/linux/m68k/socket.S
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
-#include <sys/socketcall.h>
+#include <socketcall.h>
 
 #define P(a, b) P2(a, b)
 #define P2(a, b) a##b
diff --git a/sysdeps/unix/sysv/linux/netinet/ip.h b/sysdeps/unix/sysv/linux/netinet/ip.h
index 6d50bb41d1..bf4e01680b 100644
--- a/sysdeps/unix/sysv/linux/netinet/ip.h
+++ b/sysdeps/unix/sysv/linux/netinet/ip.h
@@ -37,7 +37,7 @@ struct timestamp
     u_int8_t overflow:4;
     u_int8_t flags:4;
 #else
-#error	"Please fix <bytesex.h>"
+#error	"Please fix <bits/endian.h>"
 #endif
     u_int32_t data[9];
   };
@@ -72,7 +72,7 @@ struct iphdr
     u_int8_t	version:4;
     u_int8_t ihl:4;
 #else
-#error	"Please fix <bytesex.h>"
+#error	"Please fix <bits/endian.h>"
 #endif
     u_int8_t tos;
     u_int16_t tot_len;
diff --git a/sysdeps/unix/sysv/linux/netinet/tcp.h b/sysdeps/unix/sysv/linux/netinet/tcp.h
index b7bf0857b8..60e67c5149 100644
--- a/sysdeps/unix/sysv/linux/netinet/tcp.h
+++ b/sysdeps/unix/sysv/linux/netinet/tcp.h
@@ -99,7 +99,7 @@ struct tcphdr {
 		syn:1,
 		fin:1;
 #else
-#error	"Adjust your <bytesex.h> defines"
+#error	"Adjust your <bits/endian.h> defines"
 #endif	
 	u_int16_t	window;
 	u_int16_t	check;
diff --git a/sysdeps/unix/sysv/linux/netipx/ipx.h b/sysdeps/unix/sysv/linux/netipx/ipx.h
index 170dfdf134..ec93c8185c 100644
--- a/sysdeps/unix/sysv/linux/netipx/ipx.h
+++ b/sysdeps/unix/sysv/linux/netipx/ipx.h
@@ -19,10 +19,94 @@
 #ifndef __NETIPX_IPX_H
 #define __NETIPX_IPX_H 1
 
-#include <asm/types.h>
-#include <linux/ipx.h>
+#include <features.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+__BEGIN_DECLS
 
 #define SOL_IPX    256          /* sockopt level */
-#define IPX_TYPE   1
+
+#define IPX_TYPE        1
+#define IPX_NODE_LEN	6
+#define IPX_MTU		576
+
+struct sockaddr_ipx
+  {
+    sa_family_t sipx_family;
+    u_int16_t sipx_port;
+    u_int32_t sipx_network;
+    unsigned char sipx_node[IPX_NODE_LEN];
+    u_int8_t sipx_type;
+    unsigned char sipx_zero;	/* 16 byte fill */
+  };
+
+/*
+ *	So we can fit the extra info for SIOCSIFADDR into the address nicely
+ */
+
+#define sipx_special	sipx_port
+#define sipx_action	sipx_zero
+#define IPX_DLTITF	0
+#define IPX_CRTITF	1
+
+typedef struct ipx_route_definition
+  {
+    unsigned long ipx_network;
+    unsigned long ipx_router_network;
+    unsigned char ipx_router_node[IPX_NODE_LEN];
+  }
+ipx_route_definition;
+
+typedef struct ipx_interface_definition
+  {
+    unsigned long ipx_network;
+    unsigned char ipx_device[16];
+    unsigned char ipx_dlink_type;
+#define IPX_FRAME_NONE		0
+#define IPX_FRAME_SNAP		1
+#define IPX_FRAME_8022		2
+#define IPX_FRAME_ETHERII	3
+#define IPX_FRAME_8023		4
+#define IPX_FRAME_TR_8022	5
+    unsigned char ipx_special;
+#define IPX_SPECIAL_NONE	0
+#define IPX_PRIMARY		1
+#define IPX_INTERNAL		2
+    unsigned char ipx_node[IPX_NODE_LEN];
+  }
+ipx_interface_definition;
+
+typedef struct ipx_config_data
+  {
+    unsigned char ipxcfg_auto_select_primary;
+    unsigned char ipxcfg_auto_create_interfaces;
+  }
+ipx_config_data;
+
+/*
+ * OLD Route Definition for backward compatibility.
+ */
+
+struct ipx_route_def
+  {
+    unsigned long ipx_network;
+    unsigned long ipx_router_network;
+#define IPX_ROUTE_NO_ROUTER	0
+    unsigned char ipx_router_node[IPX_NODE_LEN];
+    unsigned char ipx_device[16];
+    unsigned short ipx_flags;
+#define IPX_RT_SNAP		8
+#define IPX_RT_8022		4
+#define IPX_RT_BLUEBOOK		2
+#define IPX_RT_ROUTED		1
+  };
+
+#define SIOCAIPXITFCRT		(SIOCPROTOPRIVATE)
+#define SIOCAIPXPRISLT		(SIOCPROTOPRIVATE + 1)
+#define SIOCIPXCFGDATA		(SIOCPROTOPRIVATE + 2)
+
+__END_DECLS
 
 #endif /* netipx/ipx.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/ioctl-types.h b/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h
index 9e2695652e..9e2695652e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ioctl-types.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/termbits.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 4c6073bfc2..4c6073bfc2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/termbits.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/clone.S b/sysdeps/unix/sysv/linux/powerpc/clone.S
index 068b14c538..cca63fe0bc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/clone.S
@@ -19,7 +19,7 @@
 
 #include <sysdep.h>
 #define _ERRNO_H	1
-#include <errnos.h>
+#include <bits/errno.h>
 
 /* This is the only really unusual system call in PPC linux, but not
    because of any weirdness in the system call itself; because of
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
index acf62a42ca..9a5e830c31 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
@@ -1,9 +1,27 @@
-#ifndef _SYS_KERNEL_TERMIOS_H
-#define _SYS_KERNEL_TERMIOS_H 1
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _KERNEL_TERMIOS_H
+#define _KERNEL_TERMIOS_H 1
 /* The following corresponds to the values from the Linux 2.0.28 kernel.  */
 
 /* We need the definition of tcflag_t, cc_t, and speed_t.  */
-#include <termbits.h>
+#include <bits/termios.h>
 
 #define __KERNEL_NCCS 19
 
@@ -22,4 +40,4 @@ struct __kernel_termios
 #define _HAVE_C_ISPEED 1
 #define _HAVE_C_OSPEED 1
 
-#endif /* sys/kernel_termios.h */
+#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/socket.S b/sysdeps/unix/sysv/linux/powerpc/socket.S
index 305aba9281..904bca4dc3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/socket.S
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
-#include <sys/socketcall.h>
+#include <socketcall.h>
 
 #define P(a, b) P2(a, b)
 #define P2(a, b) a##b
diff --git a/sysdeps/unix/sysv/linux/sys/socketcall.h b/sysdeps/unix/sysv/linux/socketcall.h
index 9aaca7a27b..9aaca7a27b 100644
--- a/sysdeps/unix/sysv/linux/sys/socketcall.h
+++ b/sysdeps/unix/sysv/linux/socketcall.h
diff --git a/sysdeps/unix/sysv/linux/sparc/fcntlbits.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 3fc7240a66..3fc7240a66 100644
--- a/sysdeps/unix/sysv/linux/sparc/fcntlbits.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
diff --git a/sysdeps/unix/sysv/linux/alpha/ioctls.h b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
index 80b2e62e77..8a14f99f43 100644
--- a/sysdeps/unix/sysv/linux/alpha/ioctls.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
@@ -16,12 +16,16 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _IOCTLS_H
-#define _IOCTLS_H 1
+/*
+ * Never include this file directly; use <sys/ioctl.h> instead.
+ */
+
+#ifndef _BITS_IOCTLS_H
+#define _BITS_IOCTLS_H 1
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
-#include <sys/kernel_termios.h>
+#include <kernel_termios.h>
 
 /* Oh well, this is necessary since the kernel data structure is
    different from the user-level version.  */
@@ -36,4 +40,4 @@
 
 #include <linux/sockios.h>
 
-#endif /* ioctls.h  */
+#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sigaction.h b/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
index 19aa7e39cb..19aa7e39cb 100644
--- a/sysdeps/unix/sysv/linux/sparc/sigaction.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/linux/sparc/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
index 3437c16113..3437c16113 100644
--- a/sysdeps/unix/sysv/linux/sparc/signum.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/signum.h
diff --git a/sysdeps/unix/sysv/linux/sparc/termbits.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index bf7aa1480f..bf7aa1480f 100644
--- a/sysdeps/unix/sysv/linux/sparc/termbits.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
diff --git a/sysdeps/unix/sysv/linux/sparc/profil-counter.h b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
index 258df5ba93..1bd06482c9 100644
--- a/sysdeps/unix/sysv/linux/sparc/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sigcontext.h>
+#include <signal.h>
 
 void
 profil_counter (int signo, __siginfo_t si)
diff --git a/sysdeps/unix/sysv/linux/sparc/socket.S b/sysdeps/unix/sysv/linux/sparc/socket.S
index 24aba3fc74..bdfc2fcc6d 100644
--- a/sysdeps/unix/sysv/linux/sparc/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/socket.S
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
-#include <sys/socketcall.h>
+#include <socketcall.h>
 
 #define P(a, b) P2(a, b)
 #define P2(a, b) a##b
diff --git a/sysdeps/unix/sysv/linux/sys/kernel_termios.h b/sysdeps/unix/sysv/linux/sys/kernel_termios.h
deleted file mode 100644
index 629508e765..0000000000
--- a/sysdeps/unix/sysv/linux/sys/kernel_termios.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _SYS_KERNEL_TERMIOS_H
-#define _SYS_KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.1.20 kernel.  */
-
-/* We need the definition of tcflag_t, cc_t, and speed_t.  */
-#include <termbits.h>
-
-#define __KERNEL_NCCS 19
-
-struct __kernel_termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;		/* line discipline */
-    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
-  };
-
-#endif /* sys/kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index 367b9062b3..dc9f8f7e48 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -22,7 +22,7 @@
 #define	_SYS_MMAN_H	1
 #include <features.h>
 
-#include <gnu/types.h>
+#include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
 
diff --git a/sysdeps/unix/sysv/linux/sys/syscall.h b/sysdeps/unix/sysv/linux/sys/syscall.h
index cef91f6727..d6b14fcf0a 100644
--- a/sysdeps/unix/sysv/linux/sys/syscall.h
+++ b/sysdeps/unix/sysv/linux/sys/syscall.h
@@ -27,9 +27,9 @@
 #ifndef _LIBC
 /* The Linux kernel header file defines macros `__NR_<name>', but some
    programs expect the traditional form `SYS_<name>'.  So in building libc
-   we scan the kernel's list and produce <syscall-list.h> with macros for
+   we scan the kernel's list and produce <bits/syscall.h> with macros for
    all the `SYS_' names.  */
-#include <syscall-list.h>
+#include <bits/syscall.h>
 #endif
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index 9578c4b772..7866183abe 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -23,7 +23,7 @@
 /* The difference here is that the termios structure used in the
    kernel is not the same as we use in the libc.  Therefore we must
    translate it here.  */
-#include <sys/kernel_termios.h>
+#include <kernel_termios.h>
 
 /* Put the state of FD into *TERMIOS_P.  */
 int
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index 6c128110f6..0b9fee2165 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -24,7 +24,7 @@
 /* The difference here is that the termios structure used in the
    kernel is not the same as we use in the libc.  Therefore we must
    translate it here.  */
-#include <sys/kernel_termios.h>
+#include <kernel_termios.h>
 
 
 /* Set the state of FD to *TERMIOS_P.  */
diff --git a/sysdeps/unix/sysv/minix/sigaction.h b/sysdeps/unix/sysv/minix/bits/sigaction.h
index 6b0c460914..6b0c460914 100644
--- a/sysdeps/unix/sysv/minix/sigaction.h
+++ b/sysdeps/unix/sysv/minix/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/sco3.2.4/confname.h b/sysdeps/unix/sysv/sco3.2.4/bits/confname.h
index 0408951863..0408951863 100644
--- a/sysdeps/unix/sysv/sco3.2.4/confname.h
+++ b/sysdeps/unix/sysv/sco3.2.4/bits/confname.h
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigaction.h b/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h
index c21b928cdb..c21b928cdb 100644
--- a/sysdeps/unix/sysv/sco3.2.4/sigaction.h
+++ b/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/sco3.2.4/sysconf.S b/sysdeps/unix/sysv/sco3.2.4/sysconf.S
index 631e5e977a..44c89f2cf8 100644
--- a/sysdeps/unix/sysv/sco3.2.4/sysconf.S
+++ b/sysdeps/unix/sysv/sco3.2.4/sysconf.S
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
-#include <confname.h>
+#include <bits/confname.h>
 
 .globl	__tzname_max
 ENTRY (__sysconf)
diff --git a/sysdeps/unix/sysv/sco3.2/local_lim.h b/sysdeps/unix/sysv/sco3.2/bits/local_lim.h
index e456816446..365858c6f8 100644
--- a/sysdeps/unix/sysv/sco3.2/local_lim.h
+++ b/sysdeps/unix/sysv/sco3.2/bits/local_lim.h
@@ -16,8 +16,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _LOCAL_LIM_H
-#define _LOCAL_LIM_H 1
+#ifndef _BITS_LOCAL_LIM_H
+#define _BITS_LOCAL_LIM_H 1
 
 #define NGROUPS_MAX 8		/* Maximum number of supplementary groups.  */
 #define ARG_MAX 5120
@@ -34,4 +34,4 @@
 
 #define PATH_MAX 1024
 
-#endif	/* local_lim.h */
+#endif	/* bits/local_lim.h */
diff --git a/sysdeps/unix/sysv/sysv4/sigaction.h b/sysdeps/unix/sysv/sysv4/bits/sigaction.h
index 1305ba61e6..1305ba61e6 100644
--- a/sysdeps/unix/sysv/sysv4/sigaction.h
+++ b/sysdeps/unix/sysv/sysv4/bits/sigaction.h
diff --git a/sysdeps/unix/sysv/sysv4/signum.h b/sysdeps/unix/sysv/sysv4/bits/signum.h
index f11c731a42..f11c731a42 100644
--- a/sysdeps/unix/sysv/sysv4/signum.h
+++ b/sysdeps/unix/sysv/sysv4/bits/signum.h
diff --git a/sysdeps/unix/sysv/sysv4/sigset.h b/sysdeps/unix/sysv/sysv4/bits/sigset.h
index 1461c93b3d..1461c93b3d 100644
--- a/sysdeps/unix/sysv/sysv4/sigset.h
+++ b/sysdeps/unix/sysv/sysv4/bits/sigset.h
diff --git a/sysdeps/unix/sysv/sysv4/utsnamelen.h b/sysdeps/unix/sysv/sysv4/bits/utsname.h
index 9dcc618068..9dcc618068 100644
--- a/sysdeps/unix/sysv/sysv4/utsnamelen.h
+++ b/sysdeps/unix/sysv/sysv4/bits/utsname.h
diff --git a/sysdeps/unix/sysv/sysv4/waitflags.h b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
index f5613c1327..29ff566342 100644
--- a/sysdeps/unix/sysv/sysv4/waitflags.h
+++ b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -18,9 +18,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_WAITFLAGS_H
+#ifndef _SYS_WAIT_H
+#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+#endif
 
-#define	_WAITFLAGS_H	1
 
 /* Bits in the third argument to `waitpid'.  */
 #define	WNOHANG		64	/* Don't block waiting.  */
@@ -31,5 +32,3 @@
 #define WTRAPPED	2	/* Look for processes that stopped
 				   while tracing.  */
 #endif
-
-#endif	/* waitflags.h */
diff --git a/sysdeps/unix/sysv/sysv4/i386/statbuf.h b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
index 9354d6790c..9b6fed083d 100644
--- a/sysdeps/unix/sysv/sysv4/i386/statbuf.h
+++ b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
@@ -17,10 +17,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
 
-#include <gnu/types.h>
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
+
+#include <bits/types.h>
 
 /* Versions of the `struct stat' data structure and
    the bits of the `xmknod' interface.  */
@@ -87,4 +91,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/sysv4/i386/sysdep.h b/sysdeps/unix/sysv/sysv4/i386/sysdep.h
index 1e0cd69f74..ad262e23de 100644
--- a/sysdeps/unix/sysv/sysv4/i386/sysdep.h
+++ b/sysdeps/unix/sysv/sysv4/i386/sysdep.h
@@ -24,7 +24,7 @@ Cambridge, MA 02139, USA.  */
 #ifndef _ERRNO_H
 #define _ERRNO_H
 #endif
-#include <errnos.h>
+#include <bits/errno.h>
 
 #undef	PSEUDO
 #define	PSEUDO(name, syscall_name, args)				      \
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/signum.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h
index 4e5576425b..4e5576425b 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/signum.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/signum.h
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
index e4e2ab8bcf..ea5f1f4279 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -17,10 +17,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+/*
+ * Never include this file directly; use <sys/stat.h> instead.
+ */
 
-#include <gnu/types.h>
+#ifndef	_BITS_STAT_H
+#define	_BITS_STAT_H	1
+
+#include <bits/types.h>
 
 /* Structure describing file characteristics.  */
 struct stat
@@ -80,4 +84,4 @@ struct stat
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#endif	/* statbuf.h */
+#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h
new file mode 100644
index 0000000000..7402704864
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h>
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h
deleted file mode 100644
index 532b3793ec..0000000000
--- a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sigcontext.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/sun/sparc/sigcontext.h>
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S
index da3cd6b8be..edefad0168 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S
@@ -18,7 +18,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H
-#include <errnos.h>
+#include <bits/errno.h>
 
 ENTRY(syscall_error)
 	/* If it was a syscall that got interrupted, but can
diff --git a/sysdeps/unix/sysv/utmpbits.h b/sysdeps/unix/sysv/utmpbits.h
deleted file mode 100644
index 3d2ccf3b12..0000000000
--- a/sysdeps/unix/sysv/utmpbits.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* The `struct utmp' type, describing entries in the utmp file.  System V.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#ifndef _UTMPBITS_H
-
-#define _UTMPBITS_H	1
-
-#include <time.h>
-
-#define _PATH_UTMP      "/var/adm/utmp"
-#define _PATH_WTMP      "/var/adm/wtmp"
-#define _PATH_LASTLOG   "/var/adm/lastlog"
-
-__BEGIN_DECLS
-
-struct utmp
-  {
-#define	ut_name	ut_user
-    char ut_user[8];
-    char ut_id[4];
-    char ut_line[12];
-    short ut_pid;
-    short ut_type;
-    struct exit_status
-      {
-	short e_termination;
-	short e_exit;
-      } ut_exit;
-    time_t ut_time;
-  };
-
-
-/* Tell the user that we have a modern system with UT_HOST, UT_TYPE, UT_ID
-   and UT_TV fields.  */
-#define _HAVE_UT_TYPE	1
-#define _HAVE_UT_ID	1
-#define _HAVE_UT_TV	1
-#define _HAVE_UT_HOST	1
-
-__END_DECLS
-
-#endif /* utmpbits.h  */
diff --git a/sysdeps/vax/huge_val.h b/sysdeps/vax/bits/huge_val.h
index 02cafb0141..f323049d83 100644
--- a/sysdeps/vax/huge_val.h
+++ b/sysdeps/vax/bits/huge_val.h
@@ -18,9 +18,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	   _HUGE_VAL_H
-#define	   _HUGE_VAL_H	1
+#ifndef _MATH_H
+#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
 
-#define	   HUGE_VAL	1.70141182460469227e38
 
-#endif	   /* huge_val.h */
+#define	   HUGE_VAL	1.70141182460469227e38
diff --git a/sysdeps/vax/jmp_buf.h b/sysdeps/vax/bits/setjmp.h
index 7adecd9a17..7adecd9a17 100644
--- a/sysdeps/vax/jmp_buf.h
+++ b/sysdeps/vax/bits/setjmp.h
diff --git a/sysdeps/wordsize-32/elfclass.h b/sysdeps/wordsize-32/bits/elfclass.h
index 49411d66f3..49411d66f3 100644
--- a/sysdeps/wordsize-32/elfclass.h
+++ b/sysdeps/wordsize-32/bits/elfclass.h
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index f3029cc823..a2648bf2e2 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -28,10 +28,15 @@
 /* Exact integral types.  */
 
 /* Signed.  */
+
+/* There is some amount of overlap with <sys/types.h> as known by inet code */
+#ifndef __int8_t_defined
+#define __int8_t_defined
 typedef signed char    int8_t;
 typedef short int     int16_t;
 typedef int           int32_t;
 typedef long long int int64_t;
+#endif
 
 /* Unsigned.  */
 typedef unsigned char           uint8_t;
diff --git a/sysdeps/wordsize-64/elfclass.h b/sysdeps/wordsize-64/bits/elfclass.h
index ac52904886..ac52904886 100644
--- a/sysdeps/wordsize-64/elfclass.h
+++ b/sysdeps/wordsize-64/bits/elfclass.h
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index b94aff0749..07680d0488 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -28,10 +28,15 @@
 /* Exact integral types.  */
 
 /* Signed.  */
+
+/* There is some amount of overlap with <sys/types.h> as known by inet code */
+#ifndef __int8_t_defined
+#define __int8_t_defined
 typedef signed char int8_t;
 typedef short int  int16_t;
 typedef int        int32_t;
 typedef long int   int64_t;
+#endif
 
 /* Unsigned.  */
 typedef unsigned char       uint8_t;
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 36a502a9b6..96ac66e0e9 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -22,7 +22,7 @@
 subdir	:= sysvipc
 
 headers	:= sys/ipc.h sys/msg.h sys/sem.h sys/shm.h \
-	   sys/ipc_buf.h sys/msq_buf.h sys/sem_buf.h sys/shm_buf.h
+	   bits/ipc.h bits/msq.h bits/sem.h bits/shm.h
 
 routines := ftok \
 	    msgsnd msgrcv msgget msgctl \
diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h
index 4386d676d4..c36dd79b33 100644
--- a/sysvipc/sys/ipc.h
+++ b/sysvipc/sys/ipc.h
@@ -18,12 +18,12 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_IPC_H
-
 #define _SYS_IPC_H	1
+
 #include <sys/cdefs.h>
 
 /* Get system dependent definition of `struct ipc_perm' and more.  */
-#include <sys/ipc_buf.h>
+#include <bits/ipc.h>
 
 #if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
 # warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index b90f05165b..b6fe7a77cf 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -27,7 +27,7 @@
 #include <sys/ipc.h>
 
 /* Get system dependent definition of `struct msqid_ds' and more.  */
-#include <sys/msq_buf.h>
+#include <bits/msq.h>
 
 __BEGIN_DECLS
 
diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h
index 2c26e24672..84bcc5a0fc 100644
--- a/sysvipc/sys/sem.h
+++ b/sysvipc/sys/sem.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SEM_H
-
 #define _SYS_SEM_H	1
+
 #include <features.h>
 
 #include <sys/types.h>
@@ -28,7 +28,7 @@
 #include <sys/ipc.h>
 
 /* Get system dependent definition of `struct semid_ds' and more.  */
-#include <sys/sem_buf.h>
+#include <bits/sem.h>
 
 __BEGIN_DECLS
 
@@ -57,4 +57,4 @@ extern int semop __P ((int __semid, struct sembuf *__sops,
 
 __END_DECLS
 
-#endif /* _SYS_SEM_H */
+#endif /* sys/sem.h */
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index 2a1e7c664d..56883b787b 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -18,8 +18,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SHM_H
-
 #define _SYS_SHM_H	1
+
 #include <features.h>
 
 #include <unistd.h>		/* for `getpagesize' declaration */
@@ -29,7 +29,7 @@
 #include <sys/ipc.h>
 
 /* Get system dependent definition of `struct shmid_ds' and more.  */
-#include <sys/shm_buf.h>
+#include <bits/shm.h>
 
 
 /* Segment low boundary address multiple.  */
@@ -54,4 +54,4 @@ extern int shmdt __P ((__const void *__shmaddr));
 
 __END_DECLS
 
-#endif /* _SYS_SHM_H */
+#endif /* sys/shm.h */
diff --git a/termios/Makefile b/termios/Makefile
index 13c5b08cd8..b637633e52 100644
--- a/termios/Makefile
+++ b/termios/Makefile
@@ -21,7 +21,9 @@
 #
 subdir	:= termios
 
-headers	:= termios.h termbits.h sys/ttydefaults.h sys/termios.h sys/ttychars.h
+headers	:= termios.h bits/termios.h sys/ttydefaults.h sys/termios.h \
+	   sys/ttychars.h
+
 routines	:= speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \
 		   tcdrain tcflow tcflush tcsendbrk cfmakeraw
 
diff --git a/termios/sys/ttychars.h b/termios/sys/ttychars.h
index 1a23aa7709..54674e1af8 100644
--- a/termios/sys/ttychars.h
+++ b/termios/sys/ttychars.h
@@ -38,8 +38,8 @@
  *
  * User visible structures and constants related to terminal handling.
  */
-#ifndef _SYS_TTYCHARS_H_
-#define	_SYS_TTYCHARS_H_
+#ifndef _SYS_TTYCHARS_H
+#define	_SYS_TTYCHARS_H 1
 
 struct ttychars {
 	char	tc_erase;	/* erase last character */
@@ -57,7 +57,9 @@ struct ttychars {
 	char	tc_werasc;	/* word erase */
 	char	tc_lnextc;	/* literal next character */
 };
-#ifdef USE_OLD_TTY
+
+#ifdef __USE_OLD_TTY
 #include <sys/ttydefaults.h>	/* to pick up character defaults */
 #endif
-#endif /* !_SYS_TTYCHARS_H_ */
+
+#endif /* sys/ttychars.h */
diff --git a/termios/termios.h b/termios/termios.h
index f1a0fe2d17..342b0607a2 100644
--- a/termios/termios.h
+++ b/termios/termios.h
@@ -21,15 +21,15 @@
  */
 
 #ifndef	_TERMIOS_H
-
 #define	_TERMIOS_H	1
+
 #include <features.h>
 
 __BEGIN_DECLS
 
 /* Get the system-dependent definitions of `struct termios', `tcflag_t',
    `cc_t', `speed_t', and all the macros specifying the flag bits.  */
-#include <termbits.h>
+#include <bits/termios.h>
 
 #ifdef __USE_BSD
 /* Compare a character C to a value VAL from the `c_cc' array in a
@@ -60,7 +60,7 @@ extern int __tcgetattr __P ((int __fd, struct termios *__termios_p));
 extern int tcgetattr __P ((int __fd, struct termios *__termios_p));
 
 /* Set the state of FD to *TERMIOS_P.
-   Values for OPTIONAL_ACTIONS (TCSA*) are in <termbits.h>.  */
+   Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>.  */
 extern int tcsetattr __P ((int __fd, int __optional_actions,
 			   __const struct termios *__termios_p));
 
@@ -77,11 +77,11 @@ extern int tcsendbreak __P ((int __fd, int __duration));
 extern int tcdrain __P ((int __fd));
 
 /* Flush pending data on FD.
-   Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <termbits.h>.  */
+   Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>.  */
 extern int tcflush __P ((int __fd, int __queue_selector));
 
 /* Suspend or restart transmission on FD.
-   Values for ACTION (TC[IO]{OFF,ON}) are in <termbits.h>.  */
+   Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>.  */
 extern int tcflow __P ((int __fd, int __action));
 
 
diff --git a/time/Makefile b/time/Makefile
index ec870f2700..5b20e1d071 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -21,7 +21,7 @@
 #
 subdir	:= time
 
-headers	:= time.h sys/time.h sys/timeb.h timebits.h
+headers	:= time.h sys/time.h sys/timeb.h bits/time.h
 distribute := tzfile.h private.h scheck.c ialloc.c yearistype	\
 	      iso3166.tab zone.tab tzselect.ksh checktab.awk	\
 	      README
diff --git a/time/localtime.c b/time/localtime.c
index ab8fc1ac45..6b7c9f394c 100644
--- a/time/localtime.c
+++ b/time/localtime.c
@@ -19,7 +19,7 @@
 
 #include <errno.h>
 #include <time.h>
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 /* The C Standard says that localtime and gmtime return the same pointer.  */
 struct tm _tmbuf;
diff --git a/time/sys/time.h b/time/sys/time.h
index 0204050d22..f5b03f3e9e 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -17,15 +17,15 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_TIME_H
-
 #define _SYS_TIME_H	1
+
 #include <features.h>
 
 #include <time.h>
 #include <sys/select.h>
 
 #define __need_timeval
-#include <timebits.h>
+#include <bits/time.h>
 
 
 __BEGIN_DECLS
diff --git a/time/sys/timeb.h b/time/sys/timeb.h
index b3887b7254..9959f92979 100644
--- a/time/sys/timeb.h
+++ b/time/sys/timeb.h
@@ -17,8 +17,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_TIMEB_H
-
 #define _SYS_TIMEB_H	1
+
 #include <features.h>
 
 #define __need_time_t
diff --git a/time/time.h b/time/time.h
index 709e56eca2..ce9b9755b1 100644
--- a/time/time.h
+++ b/time/time.h
@@ -44,7 +44,7 @@ __BEGIN_DECLS
 
 /* This defines CLOCKS_PER_SEC, which is the number of processor clock
    ticks per second.  */
-#include <timebits.h>
+#include <bits/time.h>
 
 /* This is the obsolete POSIX.1-1988 name for the same constant.  */
 #ifdef	__USE_POSIX
@@ -59,7 +59,7 @@ __BEGIN_DECLS
 #if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t)
 #define	__clock_t_defined	1
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Returned by `clock'.  */
 typedef __clock_t clock_t;
@@ -70,7 +70,7 @@ typedef __clock_t clock_t;
 #if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t)
 #define	__time_t_defined	1
 
-#include <gnu/types.h>
+#include <bits/types.h>
 
 /* Returned by `time'.  */
 typedef __time_t time_t;
diff --git a/time/tzset.c b/time/tzset.c
index 05760b2c62..9eceb73cf5 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -508,7 +508,7 @@ __tz_compute (timer, tm)
   return 1;
 }
 
-#include <libc-lock.h>
+#include <bits/libc-lock.h>
 
 /* This locks all the state variables in tzfile.c and this file.  */
 __libc_lock_define (, __tzset_lock)
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index d74a1bc492..8d152566fc 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -22,8 +22,8 @@
  */
 
 #ifndef _WCHAR_H
-
 #define _WCHAR_H 1
+
 #include <features.h>
 
 __BEGIN_DECLS
diff --git a/wctype/wctype.h b/wctype/wctype.h
index b67995918d..9c9258f183 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -22,9 +22,10 @@
  */
 
 #ifndef _WCTYPE_H
-
 #define _WCTYPE_H	1
+
 #include <features.h>
+#include <gnu/types.h>
 
 __BEGIN_DECLS
 
@@ -197,8 +198,8 @@ extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc));
 #endif
 
 /* Pointer to conversion tables.  */
-extern __const int *__ctype_tolower; /* Case conversions.  */
-extern __const int *__ctype_toupper; /* Case conversions.  */
+extern __const __int32_t *__ctype_tolower; /* Case conversions.  */
+extern __const __int32_t *__ctype_toupper; /* Case conversions.  */
 
 #define	towlower(wc)	towctrans ((wc), __ctype_tolower)
 #define	towupper(wc)	towctrans ((wc), __ctype_toupper)