summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-12-22 20:53:38 +0000
committerUlrich Drepper <drepper@redhat.com>1997-12-22 20:53:38 +0000
commit9756dfe161e523a5d543fb2b1f33a7e682a36342 (patch)
tree88c91bf4a7cb829a3aeb1c0c5d2d529dfaa85b85
parentbd355af04fc1df69d4ebb6733be170b9baf0dfb5 (diff)
downloadglibc-9756dfe161e523a5d543fb2b1f33a7e682a36342.tar.gz
glibc-9756dfe161e523a5d543fb2b1f33a7e682a36342.tar.xz
glibc-9756dfe161e523a5d543fb2b1f33a7e682a36342.zip
1997-12-22 18:10  Ulrich Drepper  <drepper@cygnus.com>

	* configure.in: Stop with error if --disable-static is used when
	the shared lib uses this library.

	* gen-FAQ.pl: I've perl installed in /usr/bin.

	* include/bits/xopen_lim.h (STREAM_MAX): Define using FOPEN_MAX.

	Fix Unix98 conformance problems in the headers.
	* catgets/nl_types.h: Define nl_item.
	* grp/grp.h: Define gid_t.
	* include/features.h [_POSIX_C_SOURCE]: Don't define _XOPEN_SOURCE.
	* include/nl_types.h: New file.
	* include/ulimit.h: New file.
	* io/fcntl.h: Include sys/stat.h for Unix98.  Don't define locking
	constants in POSIX mode.
	* io/utime.h: Get definition for time_t.
	* io/sys/stat.h: Define dev_t, gid_t, ino_t, mode_t, nlink_t, off_t,
	uid_t, pid_t.  Define D_IFLNK and S_IFSOCK only if !__USE_UNIX98.
	* libio/stdio.h: Define va_list.  Make snprintf also available is
	__USE_UNIX98.  Declare getopt function and variables.
	* locale/langinfo.h: Include nl_types.h.  Don't define nl_item.
	Define CODESET, CRNCYSTR, RADIXCHAR and THOUSEP as aliases.
	* math/math.h: Defined M_* constants as double for Unix98 mode.
	* posix/fnmatch.h: Pretty print.  Define FNM_NOSYS.
	* posix/glob.h: Pretty print.  Define GLOB_NOSYS.
	* posix/regex.h: Define REG_NOSYS.
	* posix/wordexp.h: Define WRDE_NOSYS.
	* posix/unistd.h: Define _POSIX2_VERSION.  Define _XOPEN_VERSION to
	500 for Unix98.
	* posix/sys/types.h: Alloc dev_t, mode_t, nlink_t to be defined
	somewhere else as well.  Define clock_t for Unix98.
	* posix/sys/wait.h: Define pid_t.
	* pwd/pwd.h: Define gid_t, uid_t.
	* resource/Makefile (headers): Add ulimit.h.
	* resource/ulimit.h: New file.
	* sysdeps/generic/ulimit.c: Define according to X/Open using varargs
	instead of second argument.
	* sysdeps/unix/bsd/ulimit.c: Likewise.  Use UL_* constants.
	* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
	* resource/sys/resource.h: Don't declare ulimit here, include ulimit.h.
	* signal/signal.h: Define pid_t.
	* string/string.h: Don't declare BSD string functions in POSIX mode.
	* sysdeps/generic/bits/confname.h: Define _PC_VDISABLE.  Add
	_SC_XOPEN_LEGACY, _SC_XOPEN_REALTIME and _SC_XOPEN_REALTIME_THREADS.
	* sysdeps/unix/sysv/linux/bits/termios.h: Clean namespace for Unix98
	and POSIX.

	* inet/test_ifindex.c: Change test so that it does not fail for
	interface aliases.

	* locale/programs/locale.c (show_info): Use correct cast sequence
	for 64bit machines.

	* malloc/malloc.c: __malloc_initialized now signals three states:
	uninitialized, initializing, initialized.  Used in mcheck.
	* malloc/mcheck.c (mabort): Add '\n' to messages.
	(mcheck): Allow installation when malloc is uninitialized or is
	just initializing.

	* manual/memory.texi: Explain mtrace output a bit more.

	* math/libm-test.c: Add more epsilons.

	* misc/regexp.h (compile): Remove __ prefix from parameter names.

	* nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r): Use strncpy
	instead of strcpy for security.
	* nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r): Likewise.
	* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r): Likewise.
	* nis/nss_nis/nis-service.c (internal_nis_getservent_r): Likewise.

	* nss/digits_dots.c: Pretty print.

	* posix/getconf.c (vars): Add symbols for programming environment
	recognition.  Recognize --version.

	* sysdeps/generic/sysconf.c: Handle _SC_XBS5_*, _SC_XOPEN_LEGACY,
	_SC_XOPEN_REALTIME, and _SC_XOPEN_REALTIME_THREADS.
	* sysdeps/posix/sysconf.c: Handle _SC_XBS5_* and new _XOPEN_* symbols.

	* sysdeps/generic/bits/stdio_lim.h: Implement handling of
	__need_FOPEN_MAX.
	* sysdeps/unix/sysv/linux/stdio_lim.h.in: Likewise.
	* sysdeps/posix/mk-stdiolim.c: Change to generate file handling
	__need_FOPEN_MAX.

	* sysdeps/unix/sysv/linux/Dist: Add rt_sigpending.c.
	* sysdeps/unix/sysv/linux/rt_sigpending.c: New file.

	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Define __ipc_pid_t.
	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/msq.h: Use __ipc_pid_t.
	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types.h: New file.

	* sysdeps/wordsize-32/inttypes.h: Add SCNd8, SCNi8, SCNo8, SCNx8,
	SCNu*.
	* sysdeps/wordsize-64/inttypes.h: Likewise.

	* time/africa: Update from tzdata1997j.
	* time/antarctica: Likewise.
	* time/asia: Likewise.
	* time/australasia: Likewise.
	* time/backward: Likewise.
	* time/etcetera: Likewise.
	* time/europe: Likewise.
	* time/factory: Likewise.
	* time/northamerica: Likewise.
	* time/pacificnew: Likewise.
	* time/southamerica: Likewise.

	* time/tzfile.h: Update from tzcode1997h.
	* time/zic.c: Likewise.

	* wcsmbs/wchar.h: Get definition of FILE.  Define `struct tm' tag.
	Declare wcwidth and wcswidth for __USE_XOPEN.  Declare the
	isw*() functions for Unix98.
	* wctype/towctrans.c: Define as __towctrans, make towctrans weak alias.
	* wctype/wctype.h: Declare isw*() functions also if __need_iswxxx
	is defined.

1997-12-21  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/duplocale.c: Increase usage_count only if less than
	MAX_USAGE_COUNT.
	* locale/freelocale.c: Test usage_count against UNDELETABLE, not
	MAX_USAGE_COUNT.
	* locale/setlocale.c: Likewise.

1997-12-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile ($(inst_includedir)/gnu/stubs.h): Use a more direct
	dependency to make it easier to install it selectively.

	* Makerules (.SUFFIXES): Don't define any suffixes.

1997-12-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/fstatfs64.c: Emulate using fstatfs.
	* sysdeps/generic/statfs64.c: Emulate using statfs.
	* sysdeps/generic/getrlimit64.c: Emulate using getrlimit.
	* sysdeps/generic/setrlimit64.c: Emulate using setrlimit.
	* sysdpes/generic/ftruncate64.c: New file.
	* sysdpes/generic/truncate64.c: New file.

	* sysdeps/generic/bits/stat.h: Add LFS support.
	* sysdeps/generic/bits/statfs.h: Likewise.

	* sysdeps/unix/bsd/sun/sunos4/bits/resource.h (RLIM_INFINITY)
	[__USE_FILE_OFFSET64]: Make long long constant.
	(RLIM64_INFINITY): Likewise.

	* sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Correct
	for LFS support.
	(RLIM64_INFINITY) [__USE_LARGEFILE64]: Define.
	* sysdeps/generic/bits/resource.h: Likewise.

	* misc/Makefile (routines): Add truncate64 and ftruncate64.

	* include/features.h: Don't prevent LFS support from defining BSD
	and SYSV things.

	* dirent/dirent.h [__USE_FILE_OFFSET64]: Don't use xxx64 names.
	* io/ftw.h [__USE_FILE_OFFSET64]: Likewise.
	* io/sys/stat.h [__USE_FILE_OFFSET64]: Likewise.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Add xxx64 alias for
	fstatfs, statfs, getrlimit, setrlimit, ftruncate and truncate.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.

	* sysdeps/unix/sysv/linux/alpha/fstatfs64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/statfs64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/ftruncate64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/truncate64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/readdir.c: New file.
	* sysdeps/unix/sysv/linux/alpha/readdir64.c: New file.
	* sysdeps/unix/sysv/linux/alpha/readdir64_r.c: New file.
	* sysdeps/unix/sysv/linux/alpha/readdir_r.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c: New file.

	* sysdeps/unix/sysv/linux/fxstat64.c: New file.
	* sysdeps/unix/sysv/linux/lxstat64.c: New file.
	* sysdeps/unix/sysv/linux/xstat64.c: New file.
	* sysdeps/unix/sysv/linux/readdir64.c: New file.
	* sysdeps/unix/sysv/linux/readdir64_r.c: New file.

	* sysdeps/unix/sysv/linux/getdents64.c: New file.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines)
	[$(subdir)=dirent]: Add getdents64.
	* sysdeps/unix/sysv/linux/Dist: Add getdents64.c.

	* sysdeps/unix/sysv/linux/xstatconv.c: LFS support.

1997-12-18 12:07  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/generic/bits/statfs.h (struct statfs64): Added.

	* sysdeps/generic/getrlimit.c: Include <sys/types.h>.
	* sysdeps/generic/getrlimit64.c: Likewise.
	* sysdeps/generic/setrlimit.c: Likewise.
	* sysdeps/generic/setrlimit64.c: Likewise.

1997-12-17 13:57  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/unix/sysv/linux/siglist.c: Fix compile problem if not
	using versioning.

	* sysdeps/generic/waitid.c: Include <sys/types.h> for id_t.

	* sysdeps/standalone/arm/bits/errno.h (EBUSY): Added.

1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/programs/ld-ctype.c (ctype_output): Clear out the padding
	after the codeset name.

1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libc.map: Add get_kernel_syms.

1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/testrtsig.h (kernel_has_rtsig): Make
	static.
	* sysdeps/unix/sysv/linux/testrtsig.h (kernel_has_rtsig):
	Likewise.  Fix condition.

1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libio/Makefile (routines) [$(versioning)=yes]: Add oldiofdopen.

1997-12-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/fpu/bits/mathinline.h: Don't define exp2 inline.
	Define scalbln{,f,l} under __USE_ISOC9X, not __USE_MISC.

1997-12-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/powerpc/syscall.S: Put back.
	* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Delete this
	instead.  Oops.

1997-12-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* configure.in (libc_cv_gcc_alpha_ng_prefix): Correct quoting.

1997-12-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm-test.c (catanh_test): Change epsilon.
	Reported by H.J. Lu.

1997-12-14 19:39  H.J. Lu  <hjl@gnu.org>

	* libc.map (__getpid): Added for linuxthreads.

1997-12-13 21:09  H.J. Lu  <hjl@gnu.org>

	* configure.in (HAVE_DWARF2_UNWIND_INFO_STATIC): Define
	it if gcc uses static variable in DWARF2 unwind information
	for exception support.

	* config.h.in (HAVE_DWARF2_UNWIND_INFO_STATIC): New.

	* elf/soinit.c (__libc_global_ctors, _fini): Handle
	HAVE_DWARF2_UNWIND_INFO_STATIC.

	* libc.map (__register_frame*, __deregister_frame*): Make them
	global.

1997-12-15  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm-test.c: Add more tests for "normal" values.

1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio-common/printf_fphex.c: Fix printing of long double number
	with a biased exponent of zero.  Fix rounding.

1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sunrpc/rpc_main.c: Accept new flag -$.
	* sunrpc/Makefile (rpcgen-cmd): Pass it here.

1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile ($(inst_slibdir)/libc-$(version).so): Install the
	dynamic linker first, in case the interface has changed.

1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* nss/nss_files/files-alias.c (get_next_alias): Fix parameter
	order.

1997-12-12  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/tgmath.h: Check for double first, for architectures where
	sizeof (long double) == sizeof (double).

1997-12-07  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm-test.c: New tests for "normal" values added for most
	functions.
-rw-r--r--ChangeLog317
-rw-r--r--Makefile14
-rw-r--r--Makerules4
-rw-r--r--bits/confname.h10
-rw-r--r--bits/resource.h15
-rw-r--r--bits/stat.h14
-rw-r--r--bits/statfs.h24
-rw-r--r--catgets/nl_types.h5
-rw-r--r--config.h.in4
-rwxr-xr-xconfigure63
-rw-r--r--configure.in46
-rw-r--r--dirent/dirent.h6
-rw-r--r--elf/soinit.c26
-rwxr-xr-xgen-FAQ.pl2
-rw-r--r--grp/grp.h6
-rw-r--r--include/bits/xopen_lim.h6
-rw-r--r--include/features.h11
-rw-r--r--include/nl_types.h1
-rw-r--r--include/ulimit.h1
-rw-r--r--inet/test_ifindex.c5
-rw-r--r--io/fcntl.h8
-rw-r--r--io/ftw.h8
-rw-r--r--io/sys/stat.h110
-rw-r--r--io/utime.h7
-rw-r--r--libc.map5
-rw-r--r--libio/Makefile2
-rw-r--r--libio/stdio.h24
-rw-r--r--locale/duplocale.c2
-rw-r--r--locale/freelocale.c2
-rw-r--r--locale/langinfo.h24
-rw-r--r--locale/programs/ld-ctype.c5
-rw-r--r--locale/programs/locale.c3
-rw-r--r--locale/setlocale.c8
-rw-r--r--malloc/malloc.c7
-rw-r--r--malloc/mcheck.c28
-rw-r--r--manual/memory.texi23
-rw-r--r--math/Makefile3
-rw-r--r--math/libm-test.c61
-rw-r--r--math/math.h4
-rw-r--r--math/tgmath.h76
-rw-r--r--misc/Makefile2
-rw-r--r--misc/regexp.h16
-rw-r--r--nis/nss_nis/nis-ethers.c2
-rw-r--r--nis/nss_nis/nis-proto.c2
-rw-r--r--nis/nss_nis/nis-rpc.c2
-rw-r--r--nis/nss_nis/nis-service.c2
-rw-r--r--nss/digits_dots.c2
-rw-r--r--nss/nss_files/files-alias.c2
-rw-r--r--posix/fnmatch.h36
-rw-r--r--posix/getconf.c52
-rw-r--r--posix/glob.h14
-rw-r--r--posix/regex.h4
-rw-r--r--posix/sys/types.h28
-rw-r--r--posix/sys/wait.h5
-rw-r--r--posix/unistd.h11
-rw-r--r--posix/wordexp.h5
-rw-r--r--pwd/pwd.h14
-rw-r--r--resource/Makefile3
-rw-r--r--resource/sys/resource.h18
-rw-r--r--resource/ulimit.h49
-rw-r--r--signal/signal.h6
-rw-r--r--stdio-common/printf_fphex.c31
-rw-r--r--string/string.h3
-rw-r--r--sunrpc/Makefile4
-rw-r--r--sunrpc/rpc_main.c39
-rw-r--r--sysdeps/generic/bits/confname.h10
-rw-r--r--sysdeps/generic/bits/resource.h15
-rw-r--r--sysdeps/generic/bits/stat.h14
-rw-r--r--sysdeps/generic/bits/statfs.h24
-rw-r--r--sysdeps/generic/bits/stdio_lim.h23
-rw-r--r--sysdeps/generic/fstatfs64.c21
-rw-r--r--sysdeps/generic/ftruncate64.c35
-rw-r--r--sysdeps/generic/getrlimit.c3
-rw-r--r--sysdeps/generic/getrlimit64.c23
-rw-r--r--sysdeps/generic/setrlimit.c3
-rw-r--r--sysdeps/generic/setrlimit64.c17
-rw-r--r--sysdeps/generic/statfs64.c21
-rw-r--r--sysdeps/generic/sysconf.c11
-rw-r--r--sysdeps/generic/testrtsig.h2
-rw-r--r--sysdeps/generic/truncate64.c35
-rw-r--r--sysdeps/generic/ulimit.c6
-rw-r--r--sysdeps/generic/waitid.c1
-rw-r--r--sysdeps/m68k/fpu/bits/mathinline.h9
-rw-r--r--sysdeps/posix/mk-stdiolim.c57
-rw-r--r--sysdeps/posix/sysconf.c47
-rw-r--r--sysdeps/standalone/arm/bits/errno.h1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h4
-rw-r--r--sysdeps/unix/bsd/ulimit.c68
-rw-r--r--sysdeps/unix/sysv/linux/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/init-first.h48
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir_r.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/truncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h82
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c6
-rw-r--r--sysdeps/unix/sysv/linux/getdents64.c2
-rw-r--r--sysdeps/unix/sysv/linux/lxstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types.h130
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c103
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c107
-rw-r--r--sysdeps/unix/sysv/linux/rt_sigpending.c (renamed from sysdeps/unix/sysv/linux/powerpc/sigreturn.S)14
-rw-r--r--sysdeps/unix/sysv/linux/siglist.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/stdio_lim.h.in23
-rw-r--r--sysdeps/unix/sysv/linux/testrtsig.h4
-rw-r--r--sysdeps/unix/sysv/linux/ulimit.c55
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/xstatconv.c62
-rw-r--r--sysdeps/wordsize-32/inttypes.h9
-rw-r--r--sysdeps/wordsize-64/inttypes.h9
-rw-r--r--time/README4
-rw-r--r--time/africa2
-rw-r--r--time/antarctica2
-rw-r--r--time/asia4
-rw-r--r--time/australasia4
-rw-r--r--time/backward2
-rw-r--r--time/etcetera2
-rw-r--r--time/europe4
-rw-r--r--time/factory2
-rw-r--r--time/northamerica4
-rw-r--r--time/pacificnew2
-rw-r--r--time/southamerica3
-rw-r--r--time/tzfile.h7
-rw-r--r--time/zic.c4
-rw-r--r--wcsmbs/wchar.h27
-rw-r--r--wctype/towctrans.c3
-rw-r--r--wctype/wctype.h174
153 files changed, 2338 insertions, 594 deletions
diff --git a/ChangeLog b/ChangeLog
index 841c2d9afa..00185bf0a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,320 @@
+1997-12-22 18:10  Ulrich Drepper  <drepper@cygnus.com>
+
+	* configure.in: Stop with error if --disable-static is used when
+	the shared lib uses this library.
+
+	* gen-FAQ.pl: I've perl installed in /usr/bin.
+
+	* include/bits/xopen_lim.h (STREAM_MAX): Define using FOPEN_MAX.
+
+	Fix Unix98 conformance problems in the headers.
+	* catgets/nl_types.h: Define nl_item.
+	* grp/grp.h: Define gid_t.
+	* include/features.h [_POSIX_C_SOURCE]: Don't define _XOPEN_SOURCE.
+	* include/nl_types.h: New file.
+	* include/ulimit.h: New file.
+	* io/fcntl.h: Include sys/stat.h for Unix98.  Don't define locking
+	constants in POSIX mode.
+	* io/utime.h: Get definition for time_t.
+	* io/sys/stat.h: Define dev_t, gid_t, ino_t, mode_t, nlink_t, off_t,
+	uid_t, pid_t.  Define D_IFLNK and S_IFSOCK only if !__USE_UNIX98.
+	* libio/stdio.h: Define va_list.  Make snprintf also available is
+	__USE_UNIX98.  Declare getopt function and variables.
+	* locale/langinfo.h: Include nl_types.h.  Don't define nl_item.
+	Define CODESET, CRNCYSTR, RADIXCHAR and THOUSEP as aliases.
+	* math/math.h: Defined M_* constants as double for Unix98 mode.
+	* posix/fnmatch.h: Pretty print.  Define FNM_NOSYS.
+	* posix/glob.h: Pretty print.  Define GLOB_NOSYS.
+	* posix/regex.h: Define REG_NOSYS.
+	* posix/wordexp.h: Define WRDE_NOSYS.
+	* posix/unistd.h: Define _POSIX2_VERSION.  Define _XOPEN_VERSION to
+	500 for Unix98.
+	* posix/sys/types.h: Alloc dev_t, mode_t, nlink_t to be defined
+	somewhere else as well.  Define clock_t for Unix98.
+	* posix/sys/wait.h: Define pid_t.
+	* pwd/pwd.h: Define gid_t, uid_t.
+	* resource/Makefile (headers): Add ulimit.h.
+	* resource/ulimit.h: New file.
+	* sysdeps/generic/ulimit.c: Define according to X/Open using varargs
+	instead of second argument.
+	* sysdeps/unix/bsd/ulimit.c: Likewise.  Use UL_* constants.
+	* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
+	* resource/sys/resource.h: Don't declare ulimit here, include ulimit.h.
+	* signal/signal.h: Define pid_t.
+	* string/string.h: Don't declare BSD string functions in POSIX mode.
+	* sysdeps/generic/bits/confname.h: Define _PC_VDISABLE.  Add
+	_SC_XOPEN_LEGACY, _SC_XOPEN_REALTIME and _SC_XOPEN_REALTIME_THREADS.
+	* sysdeps/unix/sysv/linux/bits/termios.h: Clean namespace for Unix98
+	and POSIX.
+
+	* inet/test_ifindex.c: Change test so that it does not fail for
+	interface aliases.
+
+	* locale/programs/locale.c (show_info): Use correct cast sequence
+	for 64bit machines.
+
+	* malloc/malloc.c: __malloc_initialized now signals three states:
+	uninitialized, initializing, initialized.  Used in mcheck.
+	* malloc/mcheck.c (mabort): Add '\n' to messages.
+	(mcheck): Allow installation when malloc is uninitialized or is
+	just initializing.
+
+	* manual/memory.texi: Explain mtrace output a bit more.
+
+	* math/libm-test.c: Add more epsilons.
+
+	* misc/regexp.h (compile): Remove __ prefix from parameter names.
+
+	* nis/nss_nis/nis-ethers.c (internal_nis_getetherent_r): Use strncpy
+	instead of strcpy for security.
+	* nis/nss_nis/nis-proto.c (internal_nis_getprotoent_r): Likewise.
+	* nis/nss_nis/nis-rpc.c (internal_nis_getrpcent_r): Likewise.
+	* nis/nss_nis/nis-service.c (internal_nis_getservent_r): Likewise.
+
+	* nss/digits_dots.c: Pretty print.
+
+	* posix/getconf.c (vars): Add symbols for programming environment
+	recognition.  Recognize --version.
+
+	* sysdeps/generic/sysconf.c: Handle _SC_XBS5_*, _SC_XOPEN_LEGACY,
+	_SC_XOPEN_REALTIME, and _SC_XOPEN_REALTIME_THREADS.
+	* sysdeps/posix/sysconf.c: Handle _SC_XBS5_* and new _XOPEN_* symbols.
+
+	* sysdeps/generic/bits/stdio_lim.h: Implement handling of
+	__need_FOPEN_MAX.
+	* sysdeps/unix/sysv/linux/stdio_lim.h.in: Likewise.
+	* sysdeps/posix/mk-stdiolim.c: Change to generate file handling
+	__need_FOPEN_MAX.
+
+	* sysdeps/unix/sysv/linux/Dist: Add rt_sigpending.c.
+	* sysdeps/unix/sysv/linux/rt_sigpending.c: New file.
+
+	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Define __ipc_pid_t.
+	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/msq.h: Use __ipc_pid_t.
+	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/types.h: New file.
+
+	* sysdeps/wordsize-32/inttypes.h: Add SCNd8, SCNi8, SCNo8, SCNx8,
+	SCNu*.
+	* sysdeps/wordsize-64/inttypes.h: Likewise.
+
+	* time/africa: Update from tzdata1997j.
+	* time/antarctica: Likewise.
+	* time/asia: Likewise.
+	* time/australasia: Likewise.
+	* time/backward: Likewise.
+	* time/etcetera: Likewise.
+	* time/europe: Likewise.
+	* time/factory: Likewise.
+	* time/northamerica: Likewise.
+	* time/pacificnew: Likewise.
+	* time/southamerica: Likewise.
+
+	* time/tzfile.h: Update from tzcode1997h.
+	* time/zic.c: Likewise.
+
+	* wcsmbs/wchar.h: Get definition of FILE.  Define `struct tm' tag.
+	Declare wcwidth and wcswidth for __USE_XOPEN.  Declare the
+	isw*() functions for Unix98.
+	* wctype/towctrans.c: Define as __towctrans, make towctrans weak alias.
+	* wctype/wctype.h: Declare isw*() functions also if __need_iswxxx
+	is defined.
+
+1997-12-21  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* locale/duplocale.c: Increase usage_count only if less than
+	MAX_USAGE_COUNT.
+	* locale/freelocale.c: Test usage_count against UNDELETABLE, not
+	MAX_USAGE_COUNT.
+	* locale/setlocale.c: Likewise.
+
+1997-12-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile ($(inst_includedir)/gnu/stubs.h): Use a more direct
+	dependency to make it easier to install it selectively.
+
+	* Makerules (.SUFFIXES): Don't define any suffixes.
+
+1997-12-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/generic/fstatfs64.c: Emulate using fstatfs.
+	* sysdeps/generic/statfs64.c: Emulate using statfs.
+	* sysdeps/generic/getrlimit64.c: Emulate using getrlimit.
+	* sysdeps/generic/setrlimit64.c: Emulate using setrlimit.
+	* sysdpes/generic/ftruncate64.c: New file.
+	* sysdpes/generic/truncate64.c: New file.
+
+	* sysdeps/generic/bits/stat.h: Add LFS support.
+	* sysdeps/generic/bits/statfs.h: Likewise.
+
+	* sysdeps/unix/bsd/sun/sunos4/bits/resource.h (RLIM_INFINITY)
+	[__USE_FILE_OFFSET64]: Make long long constant.
+	(RLIM64_INFINITY): Likewise.
+
+	* sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Correct
+	for LFS support.
+	(RLIM64_INFINITY) [__USE_LARGEFILE64]: Define.
+	* sysdeps/generic/bits/resource.h: Likewise.
+
+	* misc/Makefile (routines): Add truncate64 and ftruncate64.
+
+	* include/features.h: Don't prevent LFS support from defining BSD
+	and SYSV things.
+
+	* dirent/dirent.h [__USE_FILE_OFFSET64]: Don't use xxx64 names.
+	* io/ftw.h [__USE_FILE_OFFSET64]: Likewise.
+	* io/sys/stat.h [__USE_FILE_OFFSET64]: Likewise.
+
+	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Add xxx64 alias for
+	fstatfs, statfs, getrlimit, setrlimit, ftruncate and truncate.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
+
+	* sysdeps/unix/sysv/linux/alpha/fstatfs64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/statfs64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/ftruncate64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/truncate64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/readdir.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/readdir64.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/readdir64_r.c: New file.
+	* sysdeps/unix/sysv/linux/alpha/readdir_r.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c: New file.
+
+	* sysdeps/unix/sysv/linux/fxstat64.c: New file.
+	* sysdeps/unix/sysv/linux/lxstat64.c: New file.
+	* sysdeps/unix/sysv/linux/xstat64.c: New file.
+	* sysdeps/unix/sysv/linux/readdir64.c: New file.
+	* sysdeps/unix/sysv/linux/readdir64_r.c: New file.
+
+	* sysdeps/unix/sysv/linux/getdents64.c: New file.
+	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines)
+	[$(subdir)=dirent]: Add getdents64.
+	* sysdeps/unix/sysv/linux/Dist: Add getdents64.c.
+
+	* sysdeps/unix/sysv/linux/xstatconv.c: LFS support.
+
+1997-12-18 12:07  Philip Blundell  <pb@nexus.co.uk>
+
+	* sysdeps/generic/bits/statfs.h (struct statfs64): Added.
+
+	* sysdeps/generic/getrlimit.c: Include <sys/types.h>.
+	* sysdeps/generic/getrlimit64.c: Likewise.
+	* sysdeps/generic/setrlimit.c: Likewise.
+	* sysdeps/generic/setrlimit64.c: Likewise.
+
+1997-12-17 13:57  Philip Blundell  <pb@nexus.co.uk>
+
+	* sysdeps/unix/sysv/linux/siglist.c: Fix compile problem if not
+	using versioning.
+
+	* sysdeps/generic/waitid.c: Include <sys/types.h> for id_t.
+
+	* sysdeps/standalone/arm/bits/errno.h (EBUSY): Added.
+
+1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* locale/programs/ld-ctype.c (ctype_output): Clear out the padding
+	after the codeset name.
+
+1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* libc.map: Add get_kernel_syms.
+
+1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/generic/testrtsig.h (kernel_has_rtsig): Make
+	static.
+	* sysdeps/unix/sysv/linux/testrtsig.h (kernel_has_rtsig):
+	Likewise.  Fix condition.
+
+1997-12-16  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* libio/Makefile (routines) [$(versioning)=yes]: Add oldiofdopen.
+
+1997-12-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/m68k/fpu/bits/mathinline.h: Don't define exp2 inline.
+	Define scalbln{,f,l} under __USE_ISOC9X, not __USE_MISC.
+
+1997-12-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/sysv/linux/powerpc/syscall.S: Put back.
+	* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Delete this
+	instead.  Oops.
+
+1997-12-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* configure.in (libc_cv_gcc_alpha_ng_prefix): Correct quoting.
+
+1997-12-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm-test.c (catanh_test): Change epsilon.
+	Reported by H.J. Lu.
+
+1997-12-14 19:39  H.J. Lu  <hjl@gnu.org>
+
+	* libc.map (__getpid): Added for linuxthreads.
+
+1997-12-13 21:09  H.J. Lu  <hjl@gnu.org>
+
+	* configure.in (HAVE_DWARF2_UNWIND_INFO_STATIC): Define
+	it if gcc uses static variable in DWARF2 unwind information
+	for exception support.
+
+	* config.h.in (HAVE_DWARF2_UNWIND_INFO_STATIC): New.
+
+	* elf/soinit.c (__libc_global_ctors, _fini): Handle
+	HAVE_DWARF2_UNWIND_INFO_STATIC.
+
+	* libc.map (__register_frame*, __deregister_frame*): Make them
+	global.
+
+1997-12-15  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm-test.c: Add more tests for "normal" values.
+
+1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* stdio-common/printf_fphex.c: Fix printing of long double number
+	with a biased exponent of zero.  Fix rounding.
+
+1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sunrpc/rpc_main.c: Accept new flag -$.
+	* sunrpc/Makefile (rpcgen-cmd): Pass it here.
+
+1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile ($(inst_slibdir)/libc-$(version).so): Install the
+	dynamic linker first, in case the interface has changed.
+
+1997-12-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* nss/nss_files/files-alias.c (get_next_alias): Fix parameter
+	order.
+
+1997-12-12  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* math/tgmath.h: Check for double first, for architectures where
+	sizeof (long double) == sizeof (double).
+
+1997-12-07  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm-test.c: New tests for "normal" values added for most
+	functions.
+
 1997-12-14 21:33  Ulrich Drepper  <drepper@cygnus.com>
 
 	* version.h (VERSION): Bump to 2.0.91.
diff --git a/Makefile b/Makefile
index dbacf8b669..9e7679bcf4 100644
--- a/Makefile
+++ b/Makefile
@@ -117,6 +117,9 @@ include Makerules
 # Install from subdirectories too.
 install: subdir_install
 
+# Make sure that the dynamic linker is installed before libc.
+$(inst_slibdir)/libc-$(version).so: elf/subdir_install
+
 # Create links for shared libraries using the `ldconfig' program is possible.
 # Ignore the error if we cannot update /etc/ld.so.cache.
 ifeq (no,$(cross-compiling))
@@ -185,20 +188,19 @@ $(version.c-objects): $(objpfx)version-info.h
 
 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)stub-$(dir))
 
+$(common-objpfx)stub-%: subdir_install
+
 # Since stubs.h is never needed when building the library, we simplify the
 # hairy installation process by producing it in place only as the last part
-# of the top-level `make install'.  It depends on subdir_install, which
-# iterates over all the subdirs; subdir_install in each subdir depends on
-# 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
+# of the top-level `make install'.
+$(inst_includedir)/gnu/stubs.h: $(subdir-stubs)
 	$(make-target-directory)
 	@rm -f $(objpfx)stubs.h
 	(echo '/* This file is automatically generated.';\
 	 echo '   It defines a symbol `__stub_FUNCTION'\'' for each function';\
 	 echo '   in the C library which is a stub, meaning it will fail';\
 	 echo '   every time called, usually setting errno to ENOSYS.  */';\
-	 sort $(subdir-stubs)) > $(objpfx)stubs.h
+	 sort $^) > $(objpfx)stubs.h
 	if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
 	then echo 'stubs.h unchanged'; \
 	else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
diff --git a/Makerules b/Makerules
index 53fa726aec..62fd79f684 100644
--- a/Makerules
+++ b/Makerules
@@ -448,9 +448,7 @@ endif
 endif
 
 # Maximize efficiency by minimizing the number of rules.
-.SUFFIXES:	# Clear the suffix list.
-# Add the suffixes we use.
-.SUFFIXES: .a $(object-suffixes) .S .s .c .h .d
+.SUFFIXES:	# Clear the suffix list.  We don't use suffix rules.
 
 # Generic rule for making directories.
 %/:
diff --git a/bits/confname.h b/bits/confname.h
index 1b75d6e5b5..8aac5cb67d 100644
--- a/bits/confname.h
+++ b/bits/confname.h
@@ -41,6 +41,7 @@ enum
     _PC_NO_TRUNC,
 #define	_PC_NO_TRUNC			_PC_NO_TRUNC
     _PC_VDISABLE,
+#define _PC_VDISABLE			_PC_VDISABLE
     _PC_SYNC_IO,
 #define	_PC_SYNC_IO			_PC_SYNC_IO
     _PC_ASYNC_IO,
@@ -325,8 +326,15 @@ enum
 #define _SC_XBS5_ILP32_OFFBIG		_SC_XBS5_ILP32_OFFBIG
     _SC_XBS5_LP64_OFF64,
 #define _SC_XBS5_LP64_OFF64		_SC_XBS5_LP64_OFF64
-    _SC_XBS5_LPBIG_OFFBIG
+    _SC_XBS5_LPBIG_OFFBIG,
 #define _SC_XBS5_LPBIG_OFFBIG		_SC_XBS5_LPBIG_OFFBIG
+
+    _SC_XOPEN_LEGACY,
+#define _SC_XOPEN_LEGACY		_SC_XOPEN_LEGACY
+    _SC_XOPEN_REALTIME,
+#define _SC_XOPEN_REALTIME		_SC_XOPEN_REALTIME
+    _SC_XOPEN_REALTIME_THREADS
+#define _SC_XOPEN_REALTIME_THREADS	_SC_XOPEN_REALTIME_THREADS
   };
 
 #if (defined __USE_POSIX2 || defined __USE_UNIX98 \
diff --git a/bits/resource.h b/bits/resource.h
index e72836d3c7..e29be98210 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -66,11 +66,20 @@ enum __rlimit_resource
 
     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
   };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
 typedef __rlim_t rlim_t;
diff --git a/bits/stat.h b/bits/stat.h
index a0edf2be52..bdc3a48de9 100644
--- a/bits/stat.h
+++ b/bits/stat.h
@@ -31,13 +31,21 @@ struct stat
     /* These are the members that POSIX.1 requires.  */
 
     __mode_t st_mode;		/* File mode.  */
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File serial number.  */
+#else
+    __ino64_t st_ino;		/* File serial number.	*/
+#endif
     __dev_t st_dev;		/* Device containing the file.  */
     __nlink_t st_nlink;		/* Link count.  */
 
     __uid_t st_uid;		/* User ID of the file's owner.  */
     __gid_t st_gid;		/* Group ID of the file's group.  */
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;		/* Size of file, in bytes.  */
+#endif
 
     __time_t st_atime;		/* Time of last access.  */
     __time_t st_mtime;		/* Time of last modification.  */
@@ -70,11 +78,11 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-    __dev_t st_dev;		/* Device.  */
-
-    __ino64_t st_ino;		/* File serial number.	*/
     __mode_t st_mode;		/* File mode.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __dev_t st_dev;		/* Device.  */
     __nlink_t st_nlink;		/* Link count.  */
+
     __uid_t st_uid;		/* User ID of the file's owner.	*/
     __gid_t st_gid;		/* Group ID of the file's group.*/
     __off64_t st_size;		/* Size of file, in bytes.  */
diff --git a/bits/statfs.h b/bits/statfs.h
index a92cf52315..03b92d8faa 100644
--- a/bits/statfs.h
+++ b/bits/statfs.h
@@ -35,12 +35,36 @@ struct statfs
   {
     unsigned int f_type;
     unsigned int f_bsize;
+#ifndef __USE_FILE_OFFSET64
     __fsblkcnt_t f_blocks;
     __fsblkcnt_t f_bfree;
     __fsblkcnt_t f_bavail;
     __fsblkcnt_t f_files;
     __fsblkcnt_t f_ffree;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+#endif
+    __fsid_t f_fsid;
+    unsigned int f_namelen;
+    unsigned int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    unsigned int f_type;
+    unsigned int f_bsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
     __fsid_t f_fsid;
     unsigned int f_namelen;
     unsigned int f_spare[6];
   };
+#endif
diff --git a/catgets/nl_types.h b/catgets/nl_types.h
index bf07fcd1e4..960edb5365 100644
--- a/catgets/nl_types.h
+++ b/catgets/nl_types.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
@@ -33,6 +33,9 @@ __BEGIN_DECLS
 /* Message catalog descriptor type.  */
 typedef void *nl_catd;
 
+/* Type used by `nl_langinfo'.  */
+typedef int nl_item;
+
 /* Open message catalog for later use, returning descriptor.  */
 extern nl_catd catopen __P ((__const char *__cat_name, int __flag));
 
diff --git a/config.h.in b/config.h.in
index a38900b64a..9e85c7e5cd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -55,6 +55,10 @@
 /* Define if gcc uses DWARF2 unwind information for exception support.  */
 #undef	HAVE_DWARF2_UNWIND_INFO
 
+/* Define if gcc uses DWARF2 unwind information for exception support
+   with static variable. */
+#undef	HAVE_DWARF2_UNWIND_INFO_STATIC
+
 /* Define is the regparm attribute shall be used for local functions
    (gcc on ix86 only).  */
 #undef	USE_REGPARMS
diff --git a/configure b/configure
index 133194c598..625d2f75ba 100755
--- a/configure
+++ b/configure
@@ -2317,7 +2317,7 @@ else
   cat > conftest.c <<\EOF
 foo () { }
 EOF
-if { ac_try='${CC-cc} -S conftest.c -o - | fgrep '$foo..ng' > /dev/null'; { (eval echo configure:2321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
 then
   libc_cv_gcc_alpha_ng_prefix=yes
 else
@@ -2350,8 +2350,14 @@ else
 static char __EH_FRAME_BEGIN__;
 _start ()
 {
+#ifdef CHECK__register_frame
   __register_frame (__EH_FRAME_BEGIN__);
   __deregister_frame (__EH_FRAME_BEGIN__);
+#endif
+#ifdef CHECK__register_frame_info
+  __register_frame_info (__EH_FRAME_BEGIN__);
+  __deregister_frame_info (__EH_FRAME_BEGIN__);
+#endif
 }
 int __eh_pc;
 __throw () {}
@@ -2365,23 +2371,44 @@ free () {}
 abort () {}
 __bzero () {}
 EOF
-if { ac_try='${CC-cc} $CFLAGS
+if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info
 			    -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
-  libc_cv_gcc_dwarf2_unwind_info=yes
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2377: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  libc_cv_gcc_dwarf2_unwind_info=static
 else
   libc_cv_gcc_dwarf2_unwind_info=no
 fi
+if test $libc_cv_gcc_dwarf2_unwind_info = no; then
+  if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame
+			      -nostdlib -nostartfiles
+			      -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    libc_cv_gcc_dwarf2_unwind_info=yes
+  else
+    libc_cv_gcc_dwarf2_unwind_info=no
+  fi
+fi
 rm -f conftest*
 fi
 
 echo "$ac_t""$libc_cv_gcc_dwarf2_unwind_info" 1>&6
-if test $libc_cv_gcc_dwarf2_unwind_info = yes; then
+case $libc_cv_gcc_dwarf2_unwind_info in
+yes)
   cat >> confdefs.h <<\EOF
 #define HAVE_DWARF2_UNWIND_INFO 1
 EOF
 
-fi
+  ;;
+static)
+  cat >> confdefs.h <<\EOF
+#define HAVE_DWARF2_UNWIND_INFO 1
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define HAVE_DWARF2_UNWIND_INFO_STATIC 1
+EOF
+
+  ;;
+esac
 
 ### End of automated tests.
 ### Now run sysdeps configure fragments.
@@ -2425,7 +2452,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2429: checking OS release for uname" >&5
+echo "configure:2456: 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
@@ -2447,7 +2474,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:2451: checking OS version for uname" >&5
+echo "configure:2478: 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
@@ -2469,7 +2496,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2473: checking stdio selection" >&5
+echo "configure:2500: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -2481,7 +2508,7 @@ esac
 echo "$ac_t""$stdio" 1>&6
 
 echo $ac_n "checking ldap selection""... $ac_c" 1>&6
-echo "configure:2485: checking ldap selection" >&5
+echo "configure:2512: checking ldap selection" >&5
 
 case $add_ons in
 *ldap*)
@@ -2530,14 +2557,26 @@ if test $shared = default; then
   fi
 fi
 
+if test $static = no && test $shared = yes; then
+  case "$host_os" in
+  linux* | gnu*)
+    { echo "configure: error: 
+*** You must compile with support for the static library since the shared
+*** library uses it.  Restart configure without \`--disable-static'." 1>&2; exit 1; }
+    ;;
+  *)
+    ;;
+  esac
+fi
+
 echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
-echo "configure:2535: checking whether -fPIC is default" >&5
+echo "configure:2574: checking whether -fPIC is default" >&5
 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   pic_default=yes
 cat > conftest.c <<EOF
-#if defined(__PIC__) || defined(__pic__) || defined(PIC) || defined(pic)
+#if defined __PIC__ || defined __pic__ || defined PIC || defined pic
 # error PIC is default.
 #endif
 EOF
diff --git a/configure.in b/configure.in
index 939fda8a4e..4aeeae047a 100644
--- a/configure.in
+++ b/configure.in
@@ -837,7 +837,7 @@ cat > conftest.c <<\EOF
 foo () { }
 EOF
 dnl
-if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep '$foo..ng' > /dev/null]);
+if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null]);
 then
   libc_cv_gcc_alpha_ng_prefix=yes
 else
@@ -857,8 +857,14 @@ AC_CACHE_CHECK(for DWARF2 unwind info support, libc_cv_gcc_dwarf2_unwind_info,
 static char __EH_FRAME_BEGIN__[];
 _start ()
 {
+#ifdef CHECK__register_frame
   __register_frame (__EH_FRAME_BEGIN__);
   __deregister_frame (__EH_FRAME_BEGIN__);
+#endif
+#ifdef CHECK__register_frame_info
+  __register_frame_info (__EH_FRAME_BEGIN__);
+  __deregister_frame_info (__EH_FRAME_BEGIN__);
+#endif
 }
 int __eh_pc;
 __throw () {}
@@ -873,17 +879,32 @@ abort () {}
 __bzero () {}
 EOF
 dnl No \ in command here because it ends up inside ''.
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
 			    -nostdlib -nostartfiles
 			    -o conftest conftest.c -lgcc >&AC_FD_CC]); then
-  libc_cv_gcc_dwarf2_unwind_info=yes
+  libc_cv_gcc_dwarf2_unwind_info=static
 else
   libc_cv_gcc_dwarf2_unwind_info=no
 fi
+if test $libc_cv_gcc_dwarf2_unwind_info = no; then
+  if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame
+			      -nostdlib -nostartfiles
+			      -o conftest conftest.c -lgcc >&AC_FD_CC]); then
+    libc_cv_gcc_dwarf2_unwind_info=yes
+  else
+    libc_cv_gcc_dwarf2_unwind_info=no
+  fi
+fi
 rm -f conftest*])
-if test $libc_cv_gcc_dwarf2_unwind_info = yes; then
+case $libc_cv_gcc_dwarf2_unwind_info in
+yes)
   AC_DEFINE(HAVE_DWARF2_UNWIND_INFO)
-fi
+  ;;
+static)
+  AC_DEFINE(HAVE_DWARF2_UNWIND_INFO)
+  AC_DEFINE(HAVE_DWARF2_UNWIND_INFO_STATIC)
+  ;;
+esac
 
 ### End of automated tests.
 ### Now run sysdeps configure fragments.
@@ -1024,10 +1045,23 @@ if test $shared = default; then
   fi
 fi
 
+dnl We must not allow compilation without static library on some platforms.
+if test $static = no && test $shared = yes; then
+  case "$host_os" in
+  linux* | gnu*)
+    AC_MSG_ERROR([
+*** You must compile with support for the static library since the shared
+*** library uses it.  Restart configure without \`--disable-static'.])
+    ;;
+  *)
+    ;;
+  esac
+fi
+
 AC_CACHE_CHECK([whether -fPIC is default], pic_default,
 [pic_default=yes
 cat > conftest.c <<EOF
-#if defined(__PIC__) || defined(__pic__) || defined(PIC) || defined(pic)
+#if defined __PIC__ || defined __pic__ || defined PIC || defined pic
 # error PIC is default.
 #endif
 EOF
diff --git a/dirent/dirent.h b/dirent/dirent.h
index e2fab0ab03..d7e8a543b9 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -123,7 +123,7 @@ extern struct dirent *__readdir __P ((DIR *__dirp));
 #ifndef __USE_FILE_OFFSET64
 extern struct dirent *readdir __P ((DIR *__dirp));
 #else
-extern struct dirent64 *readdir __P ((DIR *__dirp)) __asm__ ("readdir64");
+extern struct dirent *readdir __P ((DIR *__dirp)) __asm__ ("readdir64");
 #endif
 
 #ifdef __USE_LARGEFILE64
@@ -139,8 +139,8 @@ extern int __readdir_r __P ((DIR *__dirp, struct dirent *__entry,
 extern int readdir_r __P ((DIR *__dirp, struct dirent *__entry,
 			   struct dirent **__result));
 # else
-extern int readdir_r __P ((DIR *__dirp, struct dirent64 *__entry,
-			   struct dirent64 **__result))
+extern int readdir_r __P ((DIR *__dirp, struct dirent *__entry,
+			   struct dirent **__result))
      __asm__ ("readdir64_r");
 # endif
 
diff --git a/elf/soinit.c b/elf/soinit.c
index 2b333b7ace..1dee73c3be 100644
--- a/elf/soinit.c
+++ b/elf/soinit.c
@@ -21,8 +21,23 @@ run_hooks (void (*const list[]) (void))
 static char __EH_FRAME_BEGIN__[]
      __attribute__ ((section (".eh_frame")))
      = { };
+# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
+/* This must match what's in frame.h in gcc. How can one do that? */
+struct object
+{
+  void *pc_begin;
+  void *pc_end;
+  void *fde_begin;
+  void *fde_array;
+  __SIZE_TYPE__ count;
+  struct object *next;
+};
+extern void __register_frame_info (const void *, struct object *);
+extern void __deregister_frame_info (const void *);
+# else
 extern void __register_frame (const void *);
 extern void __deregister_frame (const void *);
+# endif
 #endif
 
 /* This function will be called from _init in init-first.c.  */
@@ -32,7 +47,14 @@ __libc_global_ctors (void)
   /* Call constructor functions.  */
   run_hooks (__CTOR_LIST__);
 #ifdef HAVE_DWARF2_UNWIND_INFO
+# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
+  {
+    static struct object ob;
+    __register_frame_info (__EH_FRAME_BEGIN__, &ob);
+  }
+# else
   __register_frame (__EH_FRAME_BEGIN__);
+# endif
 #endif
 }
 
@@ -46,6 +68,10 @@ _fini (void)
   /* Call destructor functions.  */
   run_hooks (__DTOR_LIST__);
 #ifdef HAVE_DWARF2_UNWIND_INFO
+# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
+  __deregister_frame_info (__EH_FRAME_BEGIN__);
+# else
   __deregister_frame (__EH_FRAME_BEGIN__);
+# endif
 #endif
 }
diff --git a/gen-FAQ.pl b/gen-FAQ.pl
index e8b55ac7ab..9503903f8c 100755
--- a/gen-FAQ.pl
+++ b/gen-FAQ.pl
@@ -1,4 +1,4 @@
-#! /usr/local/bin/perl
+#! /usr/bin/perl
 
 =pod
 This is a silly little program for generating the libc FAQ.
diff --git a/grp/grp.h b/grp/grp.h
index f5db84f7dc..11883ab1f1 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -33,6 +33,12 @@ __BEGIN_DECLS
 #include <stddef.h>
 
 
+/* For the Single Unix specification we must define this type here.  */
+#if defined __USE_UNIX98 && !defined gid_t
+typedef __gid_t gid_t;
+# define gid_t gid_t
+#endif
+
 /* The group structure.	 */
 struct group
   {
diff --git a/include/bits/xopen_lim.h b/include/bits/xopen_lim.h
index c8b847fbc2..9f22e44e25 100644
--- a/include/bits/xopen_lim.h
+++ b/include/bits/xopen_lim.h
@@ -28,9 +28,11 @@
    should be used to obtain the actual value.  */
 
 #ifndef _XOPEN_LIM_H
-
 #define _XOPEN_LIM_H	1
 
+#define __need_FOPEN_MAX
+#include <bits/stdio_lim.h>
+
 /* We do not provide fixed values for
 
    ARG_MAX	Maximum length of argument to the `exec' function
@@ -57,7 +59,7 @@
 #define IOV_MAX		_XOPEN_IOV_MAX
 
 /* The number of streams that one process can have open at one time.  */
-#define STREAM_MAX	_POSIX_STREAM_MAX
+#define STREAM_MAX	FOPEN_MAX
 
 /* Maximum number of bytes supported for the name of a time zone.  */
 #define TZNAME_MAX	_POSIX_TZNAME_MAX
diff --git a/include/features.h b/include/features.h
index b6118a1cf6..141c05031f 100644
--- a/include/features.h
+++ b/include/features.h
@@ -109,7 +109,6 @@
 #if defined _BSD_SOURCE && \
     !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
       defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
-      defined _LARGEFILE64_SOURCE || defined _FILE_OFFSET_BITS || \
       defined _GNU_SOURCE || defined _SVID_SOURCE)
 # define __FAVOR_BSD	1
 #endif
@@ -139,7 +138,6 @@
 #if (!defined __STRICT_ANSI__ && !defined _ISOC9X_SOURCE && \
      !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
      !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
-     !defined _LARGEFILE64_SOURCE && !defined _FILE_OFFSET_BITS && \
      !defined _BSD_SOURCE && !defined _SVID_SOURCE)
 # define _BSD_SOURCE	1
 # define _SVID_SOURCE	1
@@ -171,13 +169,8 @@
 # define __USE_POSIX2	1
 #endif
 
-#ifdef _POSIX_C_SOURCE
-# if _POSIX_C_SOURCE >= 199309L
-#  define __USE_POSIX199309	1
-# endif
-# ifndef _XOPEN_SOURCE
-#  define _XOPEN_SOURCE	500
-# endif
+#if (_POSIX_C_SOURCE - 0) >= 199309L
+# define __USE_POSIX199309	1
 #endif
 
 #ifdef	_XOPEN_SOURCE
diff --git a/include/nl_types.h b/include/nl_types.h
new file mode 100644
index 0000000000..71cb425995
--- /dev/null
+++ b/include/nl_types.h
@@ -0,0 +1 @@
+#include <catgets/nl_types.h>
diff --git a/include/ulimit.h b/include/ulimit.h
new file mode 100644
index 0000000000..1e6cf9e95a
--- /dev/null
+++ b/include/ulimit.h
@@ -0,0 +1 @@
+#include <resource/ulimit.h>
diff --git a/inet/test_ifindex.c b/inet/test_ifindex.c
index d44e0b1cb4..0441bf0feb 100644
--- a/inet/test_ifindex.c
+++ b/inet/test_ifindex.c
@@ -51,6 +51,11 @@ main (void)
       printf ("%3d", ni = if_nametoindex (p->if_name));
       printf ("%15s", if_indextoname (p->if_index, buf));
       result = (ni != p->if_index || (strcmp (buf, p->if_name)));
+      if (ni == p->if_index)
+	/* We have to make sure that this is not an alias with the
+	   same interface number.  */
+	if (p->if_index == if_nametoindex (buf))
+	  result = 0;
       printf ("%10s", result ? "fail" : "okay");
       printf ("\n");
       failures += result;
diff --git a/io/fcntl.h b/io/fcntl.h
index d47da0a1ff..14a165539b 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -32,6 +32,11 @@ __BEGIN_DECLS
    numbers and flag bits for `open', `fcntl', et al.  */
 #include <bits/fcntl.h>
 
+/* For Unix98 all symbols from <sys/stat.h> should also be available.  */
+#ifdef __USE_UNIX98
+# include <sys/stat.h>
+#endif
+
 #ifdef	__USE_MISC
 # ifndef R_OK			/* Verbatim from <unistd.h>.  Ugh.  */
 /* Values for the second argument to access.
@@ -76,7 +81,8 @@ extern int creat __P ((__const char *__file, __mode_t __mode))
 extern int creat64 __P ((__const char *__file, __mode_t __mode));
 #endif
 
-#if !defined F_LOCK && (defined __USE_MISC || defined __USE_XOPEN_EXTENDED)
+#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
+					       && !defined __USE_POSIX))
 /* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
    files consistent.  Some systems have them there and some here, and some
    software depends on the macros being defined without including both.  */
diff --git a/io/ftw.h b/io/ftw.h
index 298e58ed8a..b7417fc70c 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -88,7 +88,7 @@ struct FTW
 /* Convenient types for callback functions.  */
 typedef int (*__ftw_func_t) __P ((__const char *__filename,
 				  __const struct stat *__status, int __flag));
-#if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
+#ifdef __USE_LARGEFILE64
 typedef int (*__ftw64_func_t) __P ((__const char *__filename,
 				    __const struct stat64 *__status,
 				    int __flag));
@@ -97,7 +97,7 @@ typedef int (*__ftw64_func_t) __P ((__const char *__filename,
 typedef int (*__nftw_func_t) __P ((__const char *__filename,
 				   __const struct stat *__status, int __flag,
 				   struct FTW *__info));
-# if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
+# ifdef __USE_LARGEFILE64
 typedef int (*__nftw64_func_t) __P ((__const char *__filename,
 				     __const struct stat64 *__status,
 				     int __flag, struct FTW *__info));
@@ -109,7 +109,7 @@ typedef int (*__nftw64_func_t) __P ((__const char *__filename,
 extern int ftw __P ((__const char *__dir, __ftw_func_t __func,
 		     int __descriptors));
 #else
-extern int ftw __P ((__const char *__dir, __ftw64_func_t __func,
+extern int ftw __P ((__const char *__dir, __ftw_func_t __func,
 		     int __descriptors)) __asm__ ("ftw64");
 #endif
 #ifdef __USE_LARGEFILE64
@@ -124,7 +124,7 @@ extern int ftw64 __P ((__const char *__dir, __ftw64_func_t __func,
 extern int nftw __P ((__const char *__dir, __nftw_func_t __func,
 		      int __descriptors, int __flag));
 # else
-extern int nftw __P ((__const char *__dir, __nftw64_func_t __func,
+extern int nftw __P ((__const char *__dir, __nftw_func_t __func,
 		      int __descriptors, int __flag)) __asm__ ("nftw64");
 # endif
 # ifdef __USE_LARGEFILE64
diff --git a/io/sys/stat.h b/io/sys/stat.h
index d57b8d6ee8..76ef3c5f28 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -27,25 +27,79 @@
 
 #include <bits/types.h>		/* For __mode_t and __dev_t.  */
 
+#ifdef __USE_UNIX98
+/* The Single Unix specification says that some more types are
+   available here.  */
+# ifndef dev_t
+typedef __dev_t dev_t;
+#  define dev_t dev_t
+# endif
+
+# ifndef gid_t
+typedef __gid_t gid_t;
+#  define gid_t gid_t
+# endif
+
+# ifndef ino_t
+#  ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+#  else
+typedef __ino64_t ino_t;
+#  endif
+#  define ino_t ino_t
+# endif
+
+# ifndef mode_t
+typedef __mode_t mode_t;
+#  define mode_t mode_t
+# endif
+
+# ifndef nlink_t
+typedef __nlink_t nlink_t;
+#  define nlink_t nlink_t
+# endif
+
+# ifndef off_t
+#  ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+#  else
+typedef __off64_t off_t;
+#  endif
+#  define off_t off_t
+# endif
+
+# ifndef uid_t
+typedef __uid_t uid_t;
+#  define uid_t uid_t
+# endif
+
+# ifndef pid_t
+typedef __pid_t pid_t;
+#  define pid_t pid_t
+# endif
+#endif	/* Unix98 */
+
 __BEGIN_DECLS
 
 #include <bits/stat.h>
 
-#if defined __USE_BSD || defined __USE_MISC
+#if defined __USE_BSD || defined __USE_MISC || defined __USE_UNIX98
 # define S_IFMT		__S_IFMT
 # define S_IFDIR	__S_IFDIR
 # define S_IFCHR	__S_IFCHR
 # define S_IFBLK	__S_IFBLK
 # define S_IFREG	__S_IFREG
-# ifdef __S_IFLNK
-#  define S_IFLNK	__S_IFLNK
-# endif
-# ifdef __S_IFSOCK
-#  define S_IFSOCK	__S_IFSOCK
-# endif
 # ifdef __S_IFIFO
 #  define S_IFIFO	__S_IFIFO
 # endif
+# ifndef __USE_UNIX98
+#  ifdef __S_IFLNK
+#   define S_IFLNK	__S_IFLNK
+#  endif
+#  ifdef __S_IFSOCK
+#   define S_IFSOCK	__S_IFSOCK
+#  endif
+# endif
 #endif
 
 /* Test macros for file types.	*/
@@ -221,15 +275,25 @@ extern int mkfifo __P ((__const char *__path, __mode_t __mode));
 #endif
 
 /* Wrappers for stat and mknod system calls.  */
+#ifndef __USE_FILE_OFFSET64
 extern int __fxstat __P ((int __ver, int __fildes,
 			  struct stat *__stat_buf));
 extern int __xstat __P ((int __ver, __const char *__filename,
 			 struct stat *__stat_buf));
 extern int __lxstat __P ((int __ver, __const char *__filename,
 			  struct stat *__stat_buf));
-extern int __xmknod __P ((int __ver, __const char *__path,
-			  __mode_t __mode, __dev_t *__dev));
-#if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
+#else
+extern int __fxstat __P ((int __ver, int __fildes,
+			  struct stat *__stat_buf))
+     __asm__ ("__fxstat64");
+extern int __xstat __P ((int __ver, __const char *__filename,
+			 struct stat *__stat_buf))
+     __asm__ ("__xstat64");
+extern int __lxstat __P ((int __ver, __const char *__filename,
+			  struct stat *__stat_buf))
+     __asm__ ("__lxstat64");
+#endif
+#ifdef __USE_LARGEFILE64
 extern int __fxstat64 __P ((int __ver, int __fildes,
 			    struct stat64 *__stat_buf));
 extern int __xstat64 __P ((int __ver, __const char *__filename,
@@ -237,61 +301,39 @@ extern int __xstat64 __P ((int __ver, __const char *__filename,
 extern int __lxstat64 __P ((int __ver, __const char *__filename,
 			    struct stat64 *__stat_buf));
 #endif
+extern int __xmknod __P ((int __ver, __const char *__path,
+			  __mode_t __mode, __dev_t *__dev));
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Inlined versions of the real stat and mknod functions.  */
 
 extern __inline__ int __stat (__const char *__path, struct stat *__statbuf)
 {
-# ifndef __USE_FILE_OFFSET64
   return __xstat (_STAT_VER, __path, __statbuf);
-# else
-  return __xstat64 (_STAT_VER, __path, __statbuf);
-# endif
 }
 extern __inline__ int stat (__const char *__path, struct stat *__statbuf)
 {
-# ifndef __USE_FILE_OFFSET64
   return __xstat (_STAT_VER, __path, __statbuf);
-# else
-  return __xstat64 (_STAT_VER, __path, __statbuf);
-# endif
 }
 
 extern __inline__ int __lstat (__const char *__path, struct stat *__statbuf)
 {
-# ifndef __USE_FILE_OFFSET64
   return __lxstat (_STAT_VER, __path, __statbuf);
-# else
-  return __lxstat64 (_STAT_VER, __path, __statbuf);
-# endif
 }
 # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 extern __inline__ int lstat (__const char *__path, struct stat *__statbuf)
 {
-#  ifndef __USE_FILE_OFFSET64
   return __lxstat (_STAT_VER, __path, __statbuf);
-#  else
-  return __lxstat64 (_STAT_VER, __path, __statbuf);
-#  endif
 }
 # endif
 
 extern __inline__ int __fstat (int __fd, struct stat *__statbuf)
 {
-# ifndef __USE_FILE_OFFSET64
   return __fxstat (_STAT_VER, __fd, __statbuf);
-# else
-  return __fxstat64 (_STAT_VER, __fd, __statbuf);
-# endif
 }
 extern __inline__ int fstat (int __fd, struct stat *__statbuf)
 {
-# ifndef __USE_FILE_OFFSET64
   return __fxstat (_STAT_VER, __fd, __statbuf);
-# else
-  return __fxstat64 (_STAT_VER, __fd, __statbuf);
-# endif
 }
 
 extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
diff --git a/io/utime.h b/io/utime.h
index 7cb4724f93..3bfdd092a8 100644
--- a/io/utime.h
+++ b/io/utime.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
@@ -29,6 +29,11 @@ __BEGIN_DECLS
 
 #include <bits/types.h>
 
+#ifdef __USE_UNIX98
+# define __need_time_t
+# include <time.h>
+#endif
+
 /* Structure describing file times.  */
 struct utimbuf
   {
diff --git a/libc.map b/libc.map
index e301159cdb..902d8f89c8 100644
--- a/libc.map
+++ b/libc.map
@@ -98,8 +98,7 @@ GLIBC_2.0 {
 
     # Exception handling support functions from libgcc
     __register_frame; __register_frame_table; __deregister_frame;
-    __register_frame_new; __register_frame_table_new; __deregister_frame_new;
-    __frame_state_for;
+    __register_frame_info; __deregister_frame_info;
 
     # variables in normal name space
     argp_err_exit_status; argp_program_bug_address; argp_program_version;
@@ -193,7 +192,7 @@ GLIBC_2.0 {
 
     # g*
     gai_strerror; gcvt; get_avphys_pages; get_current_dir_name;
-    get_myaddress; get_nprocs; get_nprocs_conf;
+    get_kernel_syms; get_myaddress; get_nprocs; get_nprocs_conf;
     get_phys_pages; getaddrinfo; getaliasbyname; getaliasbyname_r;
     getaliasent; getaliasent_r; getc; getc_unlocked; getchar;
     getchar_unlocked; getcontext;
diff --git a/libio/Makefile b/libio/Makefile
index 0997b5d8bf..4ad342ec05 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -43,7 +43,7 @@ all: # Make this the default target; it will be defined in Rules.
 include ../Makeconfig
 
 ifeq ($(versioning),yes)
-routines += oldiofopen oldiofclose oldiofclose
+routines += oldiofopen oldiofdopen oldiofclose oldiofclose
 endif
 
 CPPFLAGS-.o += -DIO_DEBUG
diff --git a/libio/stdio.h b/libio/stdio.h
index 99b61aae01..13287f9880 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -22,7 +22,7 @@
 
 #ifndef _STDIO_H
 
-#if !defined __need_FILE
+#ifndef __need_FILE
 # define _STDIO_H	1
 # include <features.h>
 
@@ -32,6 +32,9 @@ __BEGIN_DECLS
 # define __need_NULL
 # include <stddef.h>
 
+# define __need___va_list
+# include <stdarg.h>
+
 # include <bits/types.h>
 #endif /* Don't need FILE.  */
 #undef	__need_FILE
@@ -282,7 +285,7 @@ vprintf (__const char *__restrict __fmt, _G_va_list __arg)
 }
 #endif /* Optimizing.  */
 
-#if defined __USE_BSD || defined __USE_ISOC9X
+#if defined __USE_BSD || defined __USE_ISOC9X || defined __USE_UNIX98
 /* Maximum chars of output to write in MAXLEN.  */
 extern int __snprintf __P ((char *__restrict __s, size_t __maxlen,
 			    __const char *__restrict __format, ...))
@@ -452,7 +455,7 @@ putchar_unlocked (int __c)
 #endif /* Use POSIX or MISc.  */
 
 
-#if defined __USE_SVID || defined __USE_MISC
+#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
 /* Get a word (int) from STREAM.  */
 extern int getw __P ((FILE *__stream));
 
@@ -701,6 +704,21 @@ extern int ftrylockfile __P ((FILE *__stream));
 extern void funlockfile __P ((FILE *__stream));
 #endif /* POSIX || misc */
 
+#if defined __USE_XOPEN && !defined __USE_GNU
+/* The X/Open standard requires some functions and variables to be
+   declared here which do not belong into this header.  But we have to
+   follow.  In GNU mode we don't do this nonsense.  */
+
+/* For more information on these symbols look in <getopt.h>.  */
+extern char *optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
+
+extern int getopt __P ((int __argc, char *__const *__argv,
+			__const char *__shortopts));
+#endif
+
 __END_DECLS
 
 /* Define helper macro.  */
diff --git a/locale/duplocale.c b/locale/duplocale.c
index b3aa4af68c..2dcc0f5b02 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -45,7 +45,7 @@ __duplocale (__locale_t dataset)
       for (cnt = 0; cnt < LC_ALL; ++cnt)
 	{
 	  result->__locales[cnt] = dataset->__locales[cnt];
-	  if (result->__locales[cnt]->usage_count != MAX_USAGE_COUNT)
+	  if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT)
 	    ++result->__locales[cnt]->usage_count;
 	}
     }
diff --git a/locale/freelocale.c b/locale/freelocale.c
index a09a744ebf..3cfa5276ca 100644
--- a/locale/freelocale.c
+++ b/locale/freelocale.c
@@ -38,7 +38,7 @@ __freelocale (__locale_t dataset)
   __libc_lock_lock (__libc_setlocale_lock);
 
   for (cnt = 0; cnt < LC_ALL; ++cnt)
-    if (dataset->__locales[cnt]->usage_count != MAX_USAGE_COUNT)
+    if (dataset->__locales[cnt]->usage_count != UNDELETABLE)
       /* We can remove the data.  */
       _nl_remove_locale (cnt, dataset->__locales[cnt]);
 
diff --git a/locale/langinfo.h b/locale/langinfo.h
index 81696479e5..8cdb104c0d 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -1,5 +1,5 @@
-/* nl_langinfo -- Access to locale-dependent parameters.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Access to locale-dependent parameters.
+   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
@@ -22,6 +22,10 @@
 
 #include <locale.h>		/* Define the LC_* category names.  */
 
+/* Get the type definition.  */
+#include <nl_types.h>
+
+
 __BEGIN_DECLS
 
 /* Construct an `nl_item' value for `nl_langinfo' from a locale category
@@ -36,7 +40,7 @@ __BEGIN_DECLS
 
 
 /* Enumeration of locale items that can be queried with `nl_langinfo'.  */
-typedef enum
+enum
 {
   /* LC_TIME category: date and time formatting.  */
 
@@ -153,6 +157,9 @@ typedef enum
   _NL_CTYPE_WIDTH,
   _NL_CTYPE_MB_CUR_MAX,
   _NL_CTYPE_CODESET_NAME,
+#ifdef __USE_UNIX98
+  CODESET = _NL_CTYPE_CODESET_NAME,
+#endif
   _NL_NUM_LC_CTYPE,
 
   /* LC_MONETARY category: formatting of monetary quantities.
@@ -160,6 +167,9 @@ typedef enum
      defined in <locale.h>.  */
   INT_CURR_SYMBOL = _NL_ITEM (LC_MONETARY, 0),
   CURRENCY_SYMBOL,
+#ifdef __USE_UNIX98
+  CRNCYSTR = CURRENCY_SYMBOL,
+#endif
   MON_DECIMAL_POINT,
   MON_THOUSANDS_SEP,
   MON_GROUPING,
@@ -178,7 +188,13 @@ typedef enum
   /* LC_NUMERIC category: formatting of numbers.
      These also correspond to members of `struct lconv'; see <locale.h>.  */
   DECIMAL_POINT = _NL_ITEM (LC_NUMERIC, 0),
+#ifdef __USE_UNIX98
+  RADIXCHAR = DECIMAL_POINT,
+#endif
   THOUSANDS_SEP,
+#ifdef __USE_UNIX98
+  THOUSEP = THOUSANDS_SEP,
+#endif
   GROUPING,
   _NL_NUM_LC_NUMERIC,
 
@@ -190,7 +206,7 @@ typedef enum
 
   /* This marks the highest value used.  */
   _NL_NUM
-} nl_item;
+};
 
 
 /* Return the current locale's value for ITEM.
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 0a5e4eebf1..f2ad46f092 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -492,8 +492,9 @@ ctype_output (struct localedef_t *locale, struct charset_t *charset,
 	    else
 	      {
 		iov[2 + elem + offset].iov_base = alloca ((total + 3) & ~3);
-		memcpy (iov[2 + elem + offset].iov_base, ctype->codeset_name,
-			total);
+		memset (mempcpy (iov[2 + elem + offset].iov_base,
+				 ctype->codeset_name, total),
+			'\0', 4 - (total & 3));
 		total = (total + 3) & ~3;
 	      }
 	    iov[2 + elem + offset].iov_len = total;
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index e09e6f1e37..93818e02e2 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -657,7 +657,8 @@ show_info (const char *name)
 	  break;
 	case word:
 	  {
-	    unsigned int val = (unsigned int) nl_langinfo (item->item_id);
+	    unsigned int val =
+	      (unsigned int) (unsigned long int) nl_langinfo (item->item_id);
 	    printf ("%d", val);
 	  }
 	  break;
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 42c1e5033a..33599c64db 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -312,8 +312,8 @@ setlocale (int category, const char *locale)
 
 	  /* We must not simply free a global locale since we have no
 	     control over the usage.  So we mark it as un-deletable.  */
-	  if (newdata[category]->usage_count != MAX_USAGE_COUNT)
-	    newdata[category]->usage_count = MAX_USAGE_COUNT;
+	  if (newdata[category]->usage_count != UNDELETABLE)
+	    newdata[category]->usage_count = UNDELETABLE;
 	}
 
       /* Create new composite name.  */
@@ -362,8 +362,8 @@ setlocale (int category, const char *locale)
 
 	     Note: do ont remove the `if', it's necessary to copy with
 	     the builtin locale data.  */
-	  if (newdata->usage_count != MAX_USAGE_COUNT)
-	    newdata->usage_count = MAX_USAGE_COUNT;
+	  if (newdata->usage_count != UNDELETABLE)
+	    newdata->usage_count = UNDELETABLE;
 	}
 
       /* Create new composite name.  */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 058c156be4..3d4933cd7c 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1522,7 +1522,7 @@ static unsigned long max_mmapped_mem = 0;
 #endif
 
 /* Already initialized? */
-int __malloc_initialized = 0;
+int __malloc_initialized = -1;
 
 
 /* The following two functions are registered via thread_atfork() to
@@ -1596,8 +1596,8 @@ ptmalloc_init __MALLOC_P((void))
   const char* s;
 #endif
 
-  if(__malloc_initialized) return;
-  __malloc_initialized = 1;
+  if(__malloc_initialized >= 0) return;
+  __malloc_initialized = 0;
 #if defined _LIBC || defined MALLOC_HOOKS
   /* With some threads implementations, creating thread-specific data
      or initializing a mutex may call malloc() itself.  Provide a
@@ -1638,6 +1638,7 @@ ptmalloc_init __MALLOC_P((void))
   if(__malloc_initialize_hook != NULL)
     (*__malloc_initialize_hook)();
 #endif
+  __malloc_initialized = 1;
 }
 
 /* There are platforms (e.g. Hurd) with a link-time hook mechanism. */
diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 47d35f1f1f..4547a31299 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -21,10 +21,10 @@
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
 #ifndef	_MALLOC_INTERNAL
-#define	_MALLOC_INTERNAL
-#include <malloc.h>
-#include <mcheck.h>
-#include <stdio.h>
+# define _MALLOC_INTERNAL
+# include <malloc.h>
+# include <mcheck.h>
+# include <stdio.h>
 #endif
 
 /* Old hook values.  */
@@ -49,9 +49,9 @@ struct hdr
     unsigned long int magic;	/* Magic number to check header integrity.  */
   };
 
-#if	defined(_LIBC) || defined(STDC_HEADERS) || defined(USG)
-#include <string.h>
-#define flood memset
+#if defined _LIBC || defined STDC_HEADERS || defined USG
+# include <string.h>
+# define flood memset
 #else
 static void flood __P ((__ptr_t, int, __malloc_size_t));
 static void
@@ -196,25 +196,25 @@ mabort (status)
   switch (status)
     {
     case MCHECK_OK:
-      msg = _("memory is consistent, library is buggy");
+      msg = _("memory is consistent, library is buggy\n");
       break;
     case MCHECK_HEAD:
-      msg = _("memory clobbered before allocated block");
+      msg = _("memory clobbered before allocated block\n");
       break;
     case MCHECK_TAIL:
-      msg = _("memory clobbered past end of allocated block");
+      msg = _("memory clobbered past end of allocated block\n");
       break;
     case MCHECK_FREE:
-      msg = _("block freed twice");
+      msg = _("block freed twice\n");
       break;
     default:
-      msg = _("bogus mcheck_status, library is buggy");
+      msg = _("bogus mcheck_status, library is buggy\n");
       break;
     }
 #ifdef _LIBC
   __libc_fatal (msg);
 #else
-  fprintf (stderr, "mcheck: %s\n", msg);
+  fprintf (stderr, "mcheck: %s", msg);
   fflush (stderr);
   abort ();
 #endif
@@ -229,7 +229,7 @@ mcheck (func)
   abortfunc = (func != NULL) ? func : &mabort;
 
   /* These hooks may not be safely inserted if malloc is already in use.  */
-  if (!__malloc_initialized && !mcheck_used)
+  if (__malloc_initialized <= 0 && !mcheck_used)
     {
       old_free_hook = __free_hook;
       __free_hook = freehook;
diff --git a/manual/memory.texi b/manual/memory.texi
index a186fd4b8c..343fcd1c8a 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -975,7 +975,7 @@ main (int argc, char *argv[])
 @}
 @end example
 
-I.e., the user can start the memory debugger any time he wants if the
+I.e., the user can start the memory debugger any time s/he wants if the
 program was started with @code{MALLOC_TRACE} set in the environment.
 The output will of course not show the allocations which happened before
 the first signal but if there is a memory leak this will show up
@@ -1004,9 +1004,9 @@ readability.  Instead there is a program which comes with the GNU C
 library which interprets the traces and outputs a summary in on
 user-friendly way.  The program is called @code{mtrace} (it is in fact a
 Perl script) and it takes one or two arguments.  In any case the name of
-the file with the trace must be specified.  If an optional precedes the
-name of the trace file this must be the name of the program which
-generated the trace.
+the file with the trace output must be specified.  If an optional argument
+precedes the name of the trace file this must be the name of the program
+which generated the trace.
 
 @example
 drepper$ mtrace tst-mtrace log
@@ -1058,6 +1058,21 @@ Memory not freed:
 Suddenly the output makes much more sense and the user can see
 immediately where the function calls causing the trouble can be found.
 
+Interpreting this output is not complicated.  There are at most two
+different situations being detected.  First, @code{free} was called for
+pointers which were never returned by one of the allocation functions.
+This is usually a very bad problem and how this looks like is shown in
+the first three lines of the output.  Situations like this are quite
+rare and if they appear they show up very drastically: the program
+normally crashes.
+
+The other situation which is much harder to detect are memory leaks.  As
+you can see in the output the @code{mtrace} function collects all this
+information and so can say that the program calls an allocation function
+from line 33 in the source file @file{/home/drepper/tst-mtrace.c} four
+times without freeing this memory before the program terminates.
+Whether this is a real problem keeps to be investigated.
+
 @node Obstacks
 @section Obstacks
 @cindex obstacks
diff --git a/math/Makefile b/math/Makefile
index d52de78c3d..2be1718d32 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -86,6 +86,9 @@ test-longdouble-yes = test-ldouble test-ildoubl
 CFLAGS-test-float.c = -fno-inline -ffloat-store
 CFLAGS-test-double.c = -fno-inline -ffloat-store
 CFLAGS-test-ldouble.c = -fno-inline -ffloat-store
+CFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES
+CFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES
+CFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES
 LDLIBS-test-ifloat = math/libm
 LDLIBS-test-idouble = math/libm
 LDLIBS-test-ildoubl = math/libm
diff --git a/math/libm-test.c b/math/libm-test.c
index a1050ba0aa..1b0b163e99 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -844,8 +844,10 @@ acos_test (void)
   check ("acos (1) == 0", FUNC(acos) (1), 0);
   check ("acos (-1) == pi", FUNC(acos) (-1), M_PI);
 
-  check ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6 * 2.0);
-  check ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6 * 4.0);
+  check_eps ("acos (0.5) == pi/3", FUNC(acos) (0.5), M_PI_6 * 2.0,
+	     CHOOSE (1e-18, 0, 0));
+  check_eps ("acos (-0.5) == 2*pi/3", FUNC(acos) (-0.5), M_PI_6 * 4.0,
+	     CHOOSE (1e-17, 0, 0));
 
   check_eps ("acos (0.7) == 0.795398830...", FUNC(acos) (0.7),
 	     0.7953988301841435554L, CHOOSE(7e-17L, 0, 0));
@@ -927,8 +929,10 @@ atan_test (void)
   check ("atan (+inf) == pi/2", FUNC(atan) (plus_infty), M_PI_2);
   check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2);
 
-  check ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4);
-  check ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4);
+  check_eps ("atan (1) == pi/4", FUNC(atan) (1), M_PI_4,
+	     CHOOSE (1e-18, 0, 0));
+  check_eps ("atan (-1) == -pi/4", FUNC(atan) (1), M_PI_4,
+	     CHOOSE (1e-18, 0, 0));
 
   check_eps ("atan (0.7) == 0.610725964...", FUNC(atan) (0.7),
 	     0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
@@ -1008,6 +1012,11 @@ atan2_test (void)
 	 FUNC(atan2) (minus_infty, minus_infty), -3 * M_PI_4);
 
   /* FIXME: Add some specific tests */
+  check_eps ("atan2 (0.7,1) == 0.61072...", FUNC(atan2) (0.7,1),
+	     0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
+  check_eps ("atan2 (0.4,0.0003) == 1.57004...", FUNC(atan2) (0.4, 0.0003),
+	     1.5700463269355215718L, CHOOSE(2e-19L, 0, 0));
+
 }
 
 
@@ -1168,8 +1177,10 @@ exp_test (void)
 #endif
   check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 5e-16, 0));
 
-  check ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E);
-  check ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E);
+  check_eps ("exp (2) == e^2", FUNC(exp) (2), M_E * M_E,
+	     CHOOSE (1e-18, 0, 0));
+  check_eps ("exp (3) == e^3", FUNC(exp) (3), M_E * M_E * M_E,
+	     CHOOSE (1.5e-17, 0, 0));
   check_eps ("exp (0.7) == 2.0137527074...", FUNC(exp) (0.7),
 	     2.0137527074704765216L, CHOOSE(9e-17L, 0, 0));
 }
@@ -1211,6 +1222,9 @@ expm1_test (void)
 
   check_eps ("expm1 (1) == e-1", FUNC(expm1) (1), M_E - 1.0,
 	     CHOOSE (4e-18L, 0, 2e-7));
+
+  check_eps ("expm1 (0.7) == 1.01375...", FUNC(expm1) (0.7),
+	     1.0137527074704765216L, CHOOSE(9e-17L, 0, 0));
 }
 
 
@@ -1438,6 +1452,10 @@ gamma_test (void)
   check ("gamma (1) == 1", FUNC(gamma) (1), 1);
   check ("gamma (4) == 6", FUNC(gamma) (4), 6);
 
+  check_eps ("gamma (0.7) == 1.29805...", FUNC(gamma) (0.7),
+	     1.29805533264755778568L, CHOOSE(0, 3e-16, 2e-7));
+  check ("gamma (1.2) == 0.91816...", FUNC(gamma) (1.2), 0.91816874239976061064L);
+
   _LIB_VERSION = save_lib_version;
 }
 
@@ -1480,6 +1498,16 @@ lgamma_test (void)
 
   check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1);
 
+  signgam = 0;
+  check_eps ("lgamma (0.7) == 0.26086...", FUNC(lgamma) (0.7),
+	     0.26086724653166651439L, CHOOSE(0, 6e-17, 3e-8));
+  check_int ("lgamma (0.7) sets signgam to 1", signgam, 1);
+
+  signgam = 0;
+  check_eps ("lgamma (1.2) == -0.08537...", FUNC(lgamma) (1.2),
+	     -0.853740900033158497197e-1L, CHOOSE(0, 2e-17, 2e-8));
+  check_int ("lgamma (1.2) sets signgam to 1", signgam, 1);
+
 }
 
 
@@ -1595,6 +1623,8 @@ log1p_test (void)
   check_eps ("log1p (e-1) == 1", FUNC(log1p) (M_E - 1.0), 1,
 	     CHOOSE (1e-18L, 0, 6e-8));
 
+  check_eps ("log1p (-0.3) == -0.35667...", FUNC(log1p) (-0.3),
+	     -0.35667494393873237891L, CHOOSE(2e-17L, 6e-17, 3e-8));
 }
 
 
@@ -1954,6 +1984,9 @@ hypot_test (void)
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (1.0L, 0), 1.0L);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (5.7e7L, 0), 5.7e7L);
+
+  check_eps ("hypot (0.7,1.2) == 1.38924...", FUNC(hypot) (0.7, 1.2),
+	     1.3892443989449804508L, CHOOSE(7e-17L, 3e-16, 0));
 }
 
 
@@ -2146,6 +2179,9 @@ pow_test (void)
   x = ((rand () % 1000000) + 1) * 2.0;	/* Get random even integer > 1 */
   check_ext ("pow (-0, y) == +0 for y > 0 and not an odd integer",
 	     FUNC(pow) (minus_zero, x), 0.0, x);
+
+  check_eps ("pow (0.7, 1.2) == 0.65180...", FUNC(pow) (0.7, 1.2),
+	     0.65180494056638638188L, CHOOSE(4e-17L, 0, 0));
 }
 
 
@@ -4541,7 +4577,7 @@ ctanh_test (void)
   result = FUNC(ctanh) (BUILD_COMPLEX (0, M_PI_4));
   check ("real(ctanh (0 + i pi/4)) == 0", __real__ result, 0);
   check_eps ("imag(ctanh (0 + i pi/4)) == 1", __imag__ result, 1,
-	     CHOOSE (0, 0, 2e-7));
+	     CHOOSE (0, 2e-16, 2e-7));
 
   result = FUNC(ctanh) (BUILD_COMPLEX (0.7, 1.2));
   check_eps ("real(ctanh(0.7 + i 1.2)) == 1.34721...", __real__ result,
@@ -5086,15 +5122,16 @@ cpow_test (void)
   check ("imag(cpow (2 + i0), (10 + i0)) == 0", __imag__ result, 0);
 
   result = FUNC (cpow) (BUILD_COMPLEX (M_E, 0), BUILD_COMPLEX (0, 2*M_PI));
-  check ("real(cpow (e + i0), (0 + i 2*PI)) == 1", __real__ result, 1);
+  check_eps ("real(cpow (e + i0), (0 + i 2*PI)) == 1", __real__ result, 1,
+	     CHOOSE (0, 0, 6e-8));
   check_eps ("imag(cpow (e + i0), (0 + i 2*PI)) == 0", __imag__ result, 0,
-	     CHOOSE (1e-18L, 3e-16, 4e-7));
+	     CHOOSE (3e-18L, 3e-16, 4e-7));
 
   result = FUNC (cpow) (BUILD_COMPLEX (2, 3), BUILD_COMPLEX (4, 0));
   check_eps ("real(cpow (2 + i3), (4 + i0)) == -119", __real__ result, -119,
-	     CHOOSE (2e-17L, 2e-14, 4e-5));
+	     CHOOSE (9e-16L, 2e-14, 4e-5));
   check_eps ("imag(cpow (2 + i3), (4 + i0)) == -120", __imag__ result, -120,
-	     CHOOSE (4e-17L, 0, 8e-6));
+	     CHOOSE (1e-15L, 0, 5e-5));
 }
 
 
@@ -5137,6 +5174,8 @@ cabs_test (void)
   check ("cabs (x,0) == fabs (x)", FUNC(cabs) (BUILD_COMPLEX(5.7e7L, 0)),
 	 5.7e7L);
 
+  check_eps ("cabs (0.7 + i 1.2) == 1.38924...", FUNC(cabs) (BUILD_COMPLEX(0.7, 1.2)),
+	     1.3892443989449804508L, CHOOSE(7e-17L, 3e-16, 0));
 }
 
 
diff --git a/math/math.h b/math/math.h
index 0aedaf1d56..ae83262338 100644
--- a/math/math.h
+++ b/math/math.h
@@ -262,7 +262,7 @@ extern int matherr __P ((struct exception *__exc));
 #endif	/* SVID */
 
 
-#ifdef __USE_BSD
+#if defined __USE_BSD || defined __USE_UNIX98
 
 /* Some useful constants.  */
 # define M_E		_Mldbl(2.7182818284590452354)	/* e */
@@ -292,7 +292,7 @@ extern int matherr __P ((struct exception *__exc));
 
    Please note we define the macro even if the constants are not defined.
    This helps us to use the macros in other places.  */
-#if __STDC__ - 0 || __GNUC__ - 0
+#if (__STDC__ - 0 || __GNUC__ - 0) && defined __USE_GNU
 # define _Mldbl(x) x##L
 #else	/* Traditional C.  */
 # define _Mldbl(x) x
diff --git a/math/tgmath.h b/math/tgmath.h
index b0ce202d35..5880e666d5 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -40,70 +40,70 @@
    only defined on real valued parameters and those which are defined
    for complex functions as well.  */
 # define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
-     (__extension__ (sizeof (__real__ (Val)) == sizeof (long double)	      \
-		     ? Fct##l (Val)					      \
-		     : (sizeof (__real__ (Val)) == sizeof (double)	      \
-			? Fct (Val)					      \
+     (__extension__ (sizeof (__real__ (Val)) == sizeof (double)		      \
+		     ? Fct (Val)					      \
+		     : (sizeof (__real__ (Val)) == sizeof (long double)	      \
+			? Fct##l (Val)					      \
 			: Fct##f (Val))))
 
 # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
-     (__extension__ (sizeof (__real__ (Val1)) == sizeof (long double)	      \
-		     ? Fct##l (Val1, Val2)				      \
-		     : (sizeof (__real__ (Val1)) == sizeof (double)	      \
-			? Fct (Val1, Val2)				      \
+     (__extension__ (sizeof (__real__ (Val1)) == sizeof (double)	      \
+		     ? Fct (Val1, Val2)					      \
+		     : (sizeof (__real__ (Val1)) == sizeof (long double)      \
+			? Fct##l (Val1, Val2)				      \
 			: Fct##f (Val1, Val2))))
 
 # define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
-     (__extension__ (sizeof (Val1) == sizeof (long double)		      \
-		     || sizeof (Val2) == sizeof (long double)		      \
-		     ? Fct##l (Val1, Val2)				      \
-		     : (sizeof (Val1) == sizeof (double)		      \
-			|| sizeof (Val2) == sizeof (double)		      \
-			? Fct (Val1, Val2)				      \
+     (__extension__ (sizeof (Val1) == sizeof (double)			      \
+		     || sizeof (Val2) == sizeof (double)		      \
+		     ? Fct (Val1, Val2)					      \
+		     : (sizeof (Val1) == sizeof (long double)		      \
+			|| sizeof (Val2) == sizeof (long double)	      \
+			? Fct##l (Val1, Val2)				      \
 			: Fct##f (Val1, Val2))))
 
 # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
-     (__extension__ (sizeof (Val1) == sizeof (long double)		      \
-		     || sizeof (Val2) == sizeof (long double)		      \
-		     ? Fct##l (Val1, Val2, Val3)			      \
-		     : (sizeof (Val1) == sizeof (double)		      \
-			|| sizeof (Val2) == sizeof (double)		      \
-			? Fct (Val1, Val2, Val3)			      \
+     (__extension__ (sizeof (Val1) == sizeof (double)			      \
+		     || sizeof (Val2) == sizeof (double)		      \
+		     ? Fct (Val1, Val2, Val3)				      \
+		     : (sizeof (Val1) == sizeof (long double)		      \
+			|| sizeof (Val2) == sizeof (long double)	      \
+			? Fct##l (Val1, Val2, Val3)			      \
 			: Fct##f (Val1, Val2, Val3))))
 
 # define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
-     (__extension__ (sizeof (__real__ (Val)) == sizeof (long double)	      \
+     (__extension__ (sizeof (__real__ (Val)) == sizeof (double)		      \
 		     ? (sizeof (__real__ (Val)) == sizeof (Val)		      \
-			? Fct##l (Val)					      \
-			: Cfct##l (Val))				      \
-		     : (sizeof (__real__ (Val)) == sizeof (double)	      \
+			? Fct (Val)					      \
+			: Cfct (Val))					      \
+		     : (sizeof (__real__ (Val)) == sizeof (long double)	      \
 			? (sizeof (__real__ (Val)) == sizeof (Val)	      \
-			   ? Fct (Val)					      \
-			   : Cfct (Val))				      \
+			   ? Fct##l (Val)				      \
+			   : Cfct##l (Val))				      \
 			: (sizeof (__real__ (Val)) == sizeof (Val)	      \
 			   ? Fct##f (Val)				      \
 			   : Cfct##f (Val)))))
 
 # define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \
-     (__extension__ (sizeof (Val) == sizeof (__complex__ long double)	      \
-		     ? Fct##l (Val)					      \
-		     : (sizeof (Val) == sizeof (__complex__ double)	      \
-			? Fct (Val)					      \
+     (__extension__ (sizeof (Val) == sizeof (__complex__ double)	      \
+		     ? Fct (Val)					      \
+		     : (sizeof (Val) == sizeof (__complex__ long double)      \
+			? Fct##l (Val)					      \
 			: Fct##f (Val))))
 
 # define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
-     (__extension__ (sizeof (__real__ (Val1)) == sizeof (long double)	      \
-		     || sizeof (__real__ (Val2)) == sizeof (long double)      \
+     (__extension__ (sizeof (__real__ (Val1)) == sizeof (double)	      \
+		     || sizeof (__real__ (Val2)) == sizeof (double)	      \
 		     ? (sizeof (__real__ (Val1)) == sizeof (Val1)	      \
 			&& sizeof (__real__ (Val2)) == sizeof (Val2)	      \
-			? Fct##l (Val1, Val2)				      \
-			: Cfct##l (Val1, Val2))				      \
-		     : (sizeof (__real__ (Val1)) == sizeof (double)	      \
-			|| sizeof (__real__ (Val2)) == sizeof (double)	      \
+			? Fct (Val1, Val2)				      \
+			: Cfct (Val1, Val2))				      \
+		     : (sizeof (__real__ (Val1)) == sizeof (long double)      \
+			|| sizeof (__real__ (Val2)) == sizeof (long double)   \
 			? (sizeof (__real__ (Val1)) == sizeof (Val1)	      \
 			   && sizeof (__real__ (Val2)) == sizeof (Val2)	      \
-			   ? Fct (Val1, Val2)				      \
-			   : Cfct (Val1, Val2))				      \
+			   ? Fct##l (Val1, Val2)			      \
+			   : Cfct##l (Val1, Val2))			      \
 			: (sizeof (__real__ (Val1)) == sizeof (Val1)	      \
 			   && sizeof (__real__ (Val2)) == sizeof (Val2)	      \
 			   ? Fct##f (Val1, Val2)			      \
diff --git a/misc/Makefile b/misc/Makefile
index 7975964471..842f9839bb 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -48,7 +48,7 @@ routines := brk sbrk sstk ioctl \
 	    ptrace \
 	    fstab mntent mntent_r \
 	    utimes \
-	    truncate ftruncate \
+	    truncate ftruncate truncate64 ftruncate64 \
 	    chflags fchflags \
 	    insremque getttyent getusershell getpass ttyslot \
 	    syslog syscall daemon \
diff --git a/misc/regexp.h b/misc/regexp.h
index 384001366e..c2633eb8da 100644
--- a/misc/regexp.h
+++ b/misc/regexp.h
@@ -98,7 +98,7 @@ extern char *locs;
    This function cannot be defined in the libc itself since it depends
    on the macros.  */
 char *
-compile (char *__instring, char *__expbuf, __const char *__endbuf, int __eof)
+compile (char *instring, char *expbuf, __const char *endbuf, int eof)
 {
   char *__input_buffer = NULL;
   size_t __input_size = 0;
@@ -118,19 +118,19 @@ compile (char *__instring, char *__expbuf, __const char *__endbuf, int __eof)
      this really proofs to be wrong.  */
   const size_t __req = 8;
 # endif
-  __expbuf += __req;
-  __expbuf -= (__expbuf - ((char *) 0)) % __req;
-  if (__endbuf < __expbuf + sizeof (regex_t))
+  expbuf += __req;
+  expbuf -= (expbuf - ((char *) 0)) % __req;
+  if (endbuf < expbuf + sizeof (regex_t))
     {
       ERROR (50);
     }
-  __expr_ptr = (regex_t *) __expbuf;
+  __expr_ptr = (regex_t *) expbuf;
   /* The remaining space in the buffer can be used for the compiled
      pattern.  */
-  __expr_ptr->buffer = __expbuf + sizeof (regex_t);
-  __expr_ptr->allocated = __endbuf -  (char *) __expr_ptr->buffer;
+  __expr_ptr->buffer = expbuf + sizeof (regex_t);
+  __expr_ptr->allocated = endbuf -  (char *) __expr_ptr->buffer;
 
-  while ((__ch = (GETC ())) != __eof)
+  while ((__ch = (GETC ())) != eof)
     {
       if (__ch == '\0' || __ch == 'n')
 	{
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index 365f9c9c1d..cbc37591ee 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -159,7 +159,7 @@ internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen,
 
       if (next == NULL)
 	return NSS_STATUS_NOTFOUND;
-      p = strcpy (buffer, next->val);
+      p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
         ++p;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index e0c976041d..a6f57fde98 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -151,7 +151,7 @@ internal_nis_getprotoent_r (struct protoent *proto,
 
       if (next == NULL)
         return NSS_STATUS_NOTFOUND;
-      p = strcpy (buffer, next->val);
+      p = strncpy (buffer, next->val, buflen);
 
       while (isspace (*p))
         ++p;
diff --git a/nis/nss_nis/nis-rpc.c b/nis/nss_nis/nis-rpc.c
index 274ef04b7a..3be99496e4 100644
--- a/nis/nss_nis/nis-rpc.c
+++ b/nis/nss_nis/nis-rpc.c
@@ -168,7 +168,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
     {
       if (data->next == NULL)
         return NSS_STATUS_NOTFOUND;
-      p = strcpy (buffer, data->next->val);
+      p = strncpy (buffer, data->next->val, buflen);
       while (isspace (*p))
         ++p;
 
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c
index c55b3e0191..0aa35cc34b 100644
--- a/nis/nss_nis/nis-service.c
+++ b/nis/nss_nis/nis-service.c
@@ -168,7 +168,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
     {
       if (data->next == NULL)
 	return NSS_STATUS_NOTFOUND;
-      p = strcpy (buffer, data->next->val);
+      p = strncpy (buffer, data->next->val, buflen);
            while (isspace (*p))
         ++p;
 
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index 29aa5b1c5c..944b328a1a 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -48,7 +48,7 @@
 
 	default:
 	  af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
-	  addr_size = (af == AF_INET6 ) ? IN6ADDRSZ : INADDRSZ;
+	  addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
 	  break;
 	}
 
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 7eb22bb187..733e599103 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -131,7 +131,7 @@ _nss_files_endaliasent (void)
 /* Parsing the database file into `struct aliasent' data structures.  */
 static enum nss_status
 get_next_alias (const char *match, struct aliasent *result,
-		char *buffer, int *errnop, size_t buflen)
+		char *buffer, size_t buflen, int *errnop)
 {
   enum nss_status status = NSS_STATUS_NOTFOUND;
   int ignore = 0;
diff --git a/posix/fnmatch.h b/posix/fnmatch.h
index 38b7255f4d..4d1eb3e2d3 100644
--- a/posix/fnmatch.h
+++ b/posix/fnmatch.h
@@ -23,18 +23,24 @@
 extern "C" {
 #endif
 
-#if (defined (__cplusplus) || (defined (__STDC__) && __STDC__) \
-     || defined (WINDOWS32))
-#undef	__P
-#define	__P(protos)	protos
+#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
+# undef	__P
+# define __P(protos)	protos
 #else /* Not C++ or ANSI C.  */
-#undef	__P
-#define	__P(protos)	()
+# undef	__P
+# define __P(protos)	()
 /* We can get away without defining `const' here only because in this file
    it is used only inside the prototype for `fnmatch', which is elided in
    non-ANSI C where `const' is problematical.  */
 #endif /* C++ or ANSI C.  */
 
+#ifndef const
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+#  define __const	const
+# else
+#  define __const
+# endif
+#endif
 
 /* We #undef these before defining them because some losing systems
    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
@@ -47,18 +53,26 @@ extern "C" {
 #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
 #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
 
-#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
-#define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
-#define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */
-#define	FNM_CASEFOLD	(1 << 4) /* Compare without regard to case.  */
+#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
+# define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
+# define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
+# define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
 #endif
 
 /* Value returned by `fnmatch' if STRING does not match PATTERN.  */
 #define	FNM_NOMATCH	1
 
+/* This value is returned if the implementation does not support
+   `fnmatch'.  Since this is not the case here it will never be
+   returned but the conformance test suites still require the symbol
+   to be defined.  */
+#if (_XOPEN_SOURCE - 0) == 500
+# define FNM_NOSYS	(-1)
+#endif
+
 /* Match STRING against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch __P ((const char *__pattern, const char *__string,
+extern int fnmatch __P ((__const char *__pattern, __const char *__string,
 			 int __flags));
 
 #ifdef	__cplusplus
diff --git a/posix/getconf.c b/posix/getconf.c
index c6371cb60b..8aaa75ba67 100644
--- a/posix/getconf.c
+++ b/posix/getconf.c
@@ -20,10 +20,14 @@
 #include <errno.h>
 #include <error.h>
 #include <libintl.h>
+#include <locale.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "../version.h"
+#define PACKAGE _libc_intl_domainname
+
 struct conf
   {
     const char *name;
@@ -148,6 +152,9 @@ static const struct conf vars[] =
     { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
     { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
     { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
+    { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
+    { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
+    { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
     { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
     { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
     { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
@@ -198,6 +205,31 @@ static const struct conf vars[] =
     { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
     { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
 
+    /* Programming environments.  */
+    { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
+    { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
+    { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
+    { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
+    { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
+
+    { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
+    { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
+    { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
+    { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
+    { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
+
+    { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
+    { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
+    { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
+    { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
+    { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
+
+    { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
+    { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
+    { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
+    { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
+    { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
+
     { NULL, 0, SYSCONF }
   };
 
@@ -216,6 +248,26 @@ main (int argc, char *argv[])
 {
   register const struct conf *c;
 
+  /* Set locale.  Do not set LC_ALL because the other categories must
+     not be affected (according to POSIX.2).  */
+  setlocale (LC_CTYPE, "");
+  setlocale (LC_MESSAGES, "");
+
+  /* Initialize the message catalog.  */
+  textdomain (PACKAGE);
+
+  if (argc > 1 && strcmp (argv[1], "--version") == 0)
+    {
+      fprintf (stderr, "getconf (GNU %s) %s\n", PACKAGE, VERSION);
+      fprintf (stderr, gettext ("\
+Copyright (C) %s Free Software Foundation, Inc.\n\
+This is free software; see the source for copying conditions.  There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
+"), "1991, 1992, 1995, 1996, 1997");
+      fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
+      return 0;
+    }
+
   if (argc < 2 || argc > 3)
     usage ();
 
diff --git a/posix/glob.h b/posix/glob.h
index a15d8ef92f..a546c865f2 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -19,13 +19,11 @@
 #define	_GLOB_H	1
 
 #ifdef	__cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 #undef	__ptr_t
-#if (defined __cplusplus || (defined __STDC__ && __STDC__) \
-     || defined WINDOWS32)
+#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
 # undef	__P
 # define __P(protos)	protos
 # define __ptr_t	void *
@@ -80,6 +78,14 @@ extern "C"
 # define GLOB_ABEND GLOB_ABORTED
 #endif
 
+/* This value is returned if the implementation does not support
+   `glob'.  Since this is not the case here it will never be
+   returned but the conformance test suites still require the symbol
+   to be defined.  */
+#if (_XOPEN_SOURCE - 0) == 500
+# define GLOB_NOSYS	(-1)
+#endif
+
 /* Structure describing a globbing run.  */
 #if !defined _AMIGA && !defined VMS /* Buggy compiler.   */
 struct stat;
diff --git a/posix/regex.h b/posix/regex.h
index 22d316b0f1..44f6b557b6 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -282,6 +282,10 @@ extern reg_syntax_t re_syntax_options;
    `re_error_msg' table in regex.c.  */
 typedef enum
 {
+#if (_XOPEN_SOURCE - 0) == 500
+  REG_NOSYS = -1,	/* This will never happen for this implementation.  */
+#endif
+
   REG_NOERROR = 0,	/* Success.  */
   REG_NOMATCH,		/* Didn't find a match (for regexec).  */
 
diff --git a/posix/sys/types.h b/posix/sys/types.h
index d48e0d23eb..113dd1415d 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -39,25 +39,40 @@ typedef __u_quad_t u_quad_t;
 typedef __fsid_t fsid_t;
 #endif
 
-typedef __dev_t dev_t;
-typedef __mode_t mode_t;
-typedef __nlink_t nlink_t;
 typedef __loff_t loff_t;
 
-#ifndef __USE_FILE_OFFSET64
+#ifndef ino_t
+# ifndef __USE_FILE_OFFSET64
 typedef __ino_t ino_t;
-#else
+# else
 typedef __ino64_t ino_t;
+# endif
+# define ino_t ino_t
 #endif
 #ifdef __USE_LARGEFILE64
 typedef __ino64_t ino64_t;
 #endif
 
+#ifndef dev_t
+typedef __dev_t dev_t;
+# define dev_t dev_t
+#endif
+
 #ifndef gid_t
 typedef __gid_t gid_t;
 # define gid_t gid_t
 #endif
 
+#ifndef mode_t
+typedef __mode_t mode_t;
+# define mode_t mode_t
+#endif
+
+#ifndef nlink_t
+typedef __nlink_t nlink_t;
+# define nlink_t nlink_t
+#endif
+
 #ifndef uid_t
 typedef __uid_t uid_t;
 # define uid_t uid_t
@@ -99,6 +114,9 @@ typedef __caddr_t caddr_t;
 typedef __key_t key_t;
 #endif
 
+#ifdef __USE_XOPEN
+# define __need_clock_t
+#endif
 #define	__need_time_t
 #include <time.h>
 
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index e663f41e05..ed904d909b 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -29,6 +29,11 @@ __BEGIN_DECLS
 
 #include <bits/types.h>
 
+#if defined __USE_UNIX98 && !defined pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+#endif
+
 /* This will define the `W*' macros for the flag
    bits to `waitpid', `wait3', and `wait4'.  */
 #include <bits/waitflags.h>
diff --git a/posix/unistd.h b/posix/unistd.h
index 2fbdae5652..0147594f53 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -40,6 +40,9 @@ __BEGIN_DECLS
 /* POSIX Standard approved as ISO/IEC 9945-2 as of December, 1993.  */
 #define	_POSIX2_C_VERSION	199209L
 
+/* The utilities on GNU systems also correspond to this version.  */
+#define _POSIX2_VERSION	199209L
+
 /* If defined, the implementation supports the
    C Language Bindings Option.  */
 #define	_POSIX2_C_BIND	1
@@ -56,8 +59,12 @@ __BEGIN_DECLS
    creation of locales with the localedef utility.  */
 #define _POSIX2_LOCALEDEF       1
 
-/* Library conforms to X/Open version 4.  */
-#define _XOPEN_VERSION	4
+/* X/Open version number to which the library conforms.  It is selectable.  */
+#ifdef __USE_UNIX98
+# define _XOPEN_VERSION	500
+#else
+# define _XOPEN_VERSION	4
+#endif
 
 /* Commands and utilities from XPG4 are available.  */
 #define _XOPEN_XCU_VERSION	4
diff --git a/posix/wordexp.h b/posix/wordexp.h
index 6fa02b78c4..cd5fba9b41 100644
--- a/posix/wordexp.h
+++ b/posix/wordexp.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
@@ -47,6 +47,9 @@ typedef struct
 /* Possible nonzero return values from `wordexp'.  */
 enum
   {
+#ifdef __USE_UNIX98
+    WRDE_NOSYS = -1,		/* Never used since we support `wordexp'.  */
+#endif
     WRDE_NOSPACE = 1,		/* Ran out of memory.  */
     WRDE_BADCHAR,		/* A metachar appears in the wrong place.  */
     WRDE_BADVAL,		/* Undefined var reference with WRDE_UNDEF.  */
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 3b639305cf..ef16963c0e 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -32,6 +32,20 @@ __BEGIN_DECLS
 #define __need_size_t
 #include <stddef.h>
 
+#ifdef __USE_UNIX98
+/* The Single Unix specification says that some more types are
+   available here.  */
+# ifndef gid_t
+typedef __gid_t gid_t;
+#  define gid_t gid_t
+# endif
+
+# ifndef uid_t
+typedef __uid_t uid_t;
+#  define uid_t uid_t
+# endif
+#endif
+
 /* The passwd structure.  */
 struct passwd
 {
diff --git a/resource/Makefile b/resource/Makefile
index 1ad0bb3bc4..5a4d9603c8 100644
--- a/resource/Makefile
+++ b/resource/Makefile
@@ -18,7 +18,8 @@
 
 subdir := resource
 
-headers	  := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h
+headers	  := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h	\
+	     ulimit.h
 
 routines := getrlimit setrlimit getrlimit64 setrlimit64 getrusage ulimit      \
 	    vlimit vtimes getpriority setpriority nice
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index f9c6bb2488..488612ffad 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -21,11 +21,14 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
-
 /* Get the system-dependent definitions of structures and bit values.  */
 #include <bits/resource.h>
 
+/* Get the definitions for the `ulimit' function.  */
+#include <ulimit.h>
+
+__BEGIN_DECLS
+
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 extern int __getrlimit __P ((enum __rlimit_resource __resource,
@@ -62,16 +65,6 @@ extern int setrlimit64 __P ((enum __rlimit_resource __resource,
 extern int __getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
 extern int getrusage __P ((enum __rusage_who __who, struct rusage *__usage));
 
-/* Function depends on CMD:
-   1 = Return the limit on the size of a file, in units of 512 bytes.
-   2 = Set the limit on the size of a file to NEWLIMIT.  Only the
-       super-user can increase the limit.
-   3 = Return the maximum possible address of the data segment.
-   4 = Return the maximum number of files that the calling process can open.
-   Returns -1 on errors.  */
-extern long int __ulimit __P ((int __cmd, long int __newlimit));
-extern long int ulimit __P ((int __cmd, long int __newlimit));
-
 /* Return the highest priority of any process specified by WHICH and WHO
    (see above); if WHO is zero, the current process, process group, or user
    (as specified by WHO) is used.  A lower priority number means higher
@@ -83,7 +76,6 @@ extern int getpriority __P ((enum __priority_which __which, int __who));
 extern int setpriority __P ((enum __priority_which __which, int __who,
 			     int __prio));
 
-
 __END_DECLS
 
 #endif	/* sys/resource.h  */
diff --git a/resource/ulimit.h b/resource/ulimit.h
new file mode 100644
index 0000000000..651e9f4e25
--- /dev/null
+++ b/resource/ulimit.h
@@ -0,0 +1,49 @@
+/* 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 _ULIMIT_H
+#define _ULIMIT_H	1
+
+#include <features.h>
+
+/* Constants used as the first parameter for `ulimit'.  They denote limits
+   which can be set or retrieved using this function.  */
+enum
+{
+  UL_GETFSIZE = 1,			/* Return limit on the size of a file,
+					   in units of 512 bytes.  */
+#define UL_GETFSIZE	UL_GETFSIZE
+  UL_SETFSIZE,				/* Set limit on the size of a file to
+					   second argument.  */
+#define UL_SETFSIZE	UL_SETFSIZE
+  __UL_GETMAXBRK,			/* Return the maximum possible address
+					   of the data segment.  */
+  __UL_GETOPENMAX			/* Return the maximum number of files
+					   that the calling process can open.*/
+};
+
+
+__BEGIN_DECLS
+
+/* Control process limits according to CMD.  */
+extern long int __ulimit __P ((int __cmd, ...));
+extern long int ulimit __P ((int __cmd, ...));
+
+__END_DECLS
+
+#endif /* ulimit.h */
diff --git a/signal/signal.h b/signal/signal.h
index 11b6565be6..589b870806 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -32,11 +32,17 @@ __BEGIN_DECLS
 #include <bits/types.h>
 #include <bits/sigset.h>		/* __sigset_t, __sig_atomic_t.  */
 
+#if defined _SIGNAL_H && defined __USE_UNIX98 && !defined pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+#endif	/* Unix98 */
+
 #if !defined __sig_atomic_t_defined \
     && (defined _SIGNAL_H || defined __need_sig_atomic_t)
 /* An integral type that can be modified atomically, without the
    possibility of a signal arriving in the middle of the operation.  */
 typedef __sig_atomic_t sig_atomic_t;
+# define __sig_atomic_t_defined
 #endif /* `sig_atomic_t' undefined and <signal.h> or need `sig_atomic_t'.  */
 #undef __need_sig_atomic_t
 
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index eaae77a8d5..76084a8de5 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -237,18 +237,17 @@ __printf_fphex (FILE *fp,
 			info->spec == 'A');
 
       /* Fill with zeroes.  */
-      while (numstr > numbuf + (sizeof numbuf - 13))	/* 52 ÷ 4 = 13 */
+      while (numstr > numbuf + (sizeof numbuf - 52 / 4))
 	*--numstr = '0';
 
       leading = fpnum.dbl.ieee.exponent == 0 ? '0' : '1';
 
       exponent = fpnum.dbl.ieee.exponent;
 
-      if ((exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
-	  || (exponent == 0 && !zero_mantissa))
+      if (exponent == 0 ? !zero_mantissa : exponent < IEEE754_DOUBLE_BIAS)
 	{
 	  expnegative = 1;
-	  exponent = abs (exponent - IEEE754_DOUBLE_BIAS);
+	  exponent = -(exponent - IEEE754_DOUBLE_BIAS);
 	}
       else
 	{
@@ -276,27 +275,27 @@ __printf_fphex (FILE *fp,
       else
 	numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
 
-      /* We use a full nibble for the leading digit.  */
-      leading = *numstr++;
-
       /* Fill with zeroes.  */
-      while (numstr > numbuf + (sizeof numbuf - 15))	/* 60 ÷ 4 = 15 */
+      while (numstr > numbuf + (sizeof numbuf - 64 / 4))
 	*--numstr = '0';
 
+      /* We use a full nibble for the leading digit.  */
+      leading = *numstr++;
+
       /* We have 3 bits from the mantissa in the leading nibble.  */
-      exponent = fpnum.ldbl.ieee.exponent - 3;
+      exponent = fpnum.ldbl.ieee.exponent;
 
-      if ((exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
-	  || (exponent == 0 && !zero_mantissa))
+      if (exponent == 0 ? !zero_mantissa
+	  : exponent < IEEE854_LONG_DOUBLE_BIAS + 3)
 	{
 	  expnegative = 1;
-	  exponent = abs (exponent - IEEE854_LONG_DOUBLE_BIAS);
+	  exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3));
 	}
       else
 	{
 	  expnegative = 0;
 	  if (exponent != 0)
-	    exponent -= IEEE854_LONG_DOUBLE_BIAS;
+	    exponent -= IEEE854_LONG_DOUBLE_BIAS + 3;
 	}
     }
 
@@ -310,8 +309,10 @@ __printf_fphex (FILE *fp,
       if (precision == -1)
 	precision = numend - numstr;
       else if (precision < numend - numstr
-	       && (numstr[precision] > 5
-		   || (numstr[precision] == 5
+	       && (numstr[precision] > '8'
+		   || (('A' < '0' || 'a' < '0')
+		       && numstr[precision] < '0')
+		   || (numstr[precision] == '8'
 		       && (precision + 1 < numend - numstr
 			   /* Round to even.  */
 			   || (precision > 0
diff --git a/string/string.h b/string/string.h
index 2b4d6b9545..3e978520a7 100644
--- a/string/string.h
+++ b/string/string.h
@@ -213,7 +213,8 @@ extern char *strerror_r __P ((int __errnum, char *__buf, size_t __buflen));
    the namespace rules does not allow this.  */
 extern void __bzero __P ((__ptr_t __s, size_t __n));
 
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || (defined __USE_XOPEN_EXTENDED \
+			  && (_POSIX_C_SOURCE - 0) < 199506L)
 /* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
 extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
 
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index bde8cdc717..db5278ff5e 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -114,7 +114,9 @@ include ../Rules
 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a
 	$(+link)
 
-rpcgen-cmd = $(built-program-cmd)
+# Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the
+# preprocessor.
+rpcgen-cmd = $(built-program-cmd) -$$
 
 # The proper file name is longer than 14 chars, so we install it under
 # a shorter name.  But if the filesystem can handle it, we want to
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index ec990d1846..7d64e1b784 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -38,6 +38,7 @@ char main_rcsid[] =
  * rpc_main.c, Top level of the RPC protocol compiler.
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -79,7 +80,7 @@ static const char *cmdname;
 static const char *svcclosetime = "120";
 static const char *CPP = SVR4_CPP;
 static char CPPFLAGS[] = "-C";
-static char pathbuf[FILENAME_MAX + 1];
+static char *pathbuf;
 static const char *allv[] = {
 	"rpcgen", "-s", "udp", "-s", "tcp",
 };
@@ -167,6 +168,10 @@ int tirpcflag = 0;       /* generating code for tirpc, by default */
 int tirpcflag = 1;       /* generating code for tirpc, by default */
 #endif
 
+#ifdef __GNU_LIBRARY__
+int building_libc = 0;	/* running as part of libc built process */
+#endif
+
 int
 main(int argc, const char *argv[])
 {
@@ -334,6 +339,13 @@ open_input(const char *infile, const char *define)
 	(void) pipe(pd);
 	switch (fork()) {
 	case 0:
+#ifdef __GNU_LIBRARY__
+		/* While building libc we don't want to use the libc from
+		   the build directory which may be incompatible with the
+		   installed dynamic linker.  */
+		if (building_libc)
+		  unsetenv ("LD_LIBRARY_PATH");
+#endif
 		find_cpp();
 		putarg(0, CPP);
 		putarg(1, CPPFLAGS);
@@ -939,7 +951,9 @@ parseargs(int argc, const char *argv[], struct commandline *cmd)
 					    */
 					tirpcflag = 1;
 					break;
-
+				case '$':
+					building_libc = 1;
+					break;
 #endif
 				case 'I':
 					inetdflag = 1;
@@ -998,12 +1012,21 @@ parseargs(int argc, const char *argv[], struct commandline *cmd)
 					if (++i == argc) {
 						return (0);
 					}
-					(void) strcpy(pathbuf, argv[i]);
-					(void) strcat(pathbuf, "/cpp");
-					CPP = pathbuf;
-					cppDefined = 1;
-					goto nextarg;
-
+					{
+						size_t len = strlen (argv[i]);
+						pathbuf = malloc (len + 5);
+						if (pathbuf == NULL) {
+							f_print(stderr, "%s\n",
+								strerror (errno));
+							crash();
+						}
+						stpcpy (stpcpy (pathbuf,
+								argv[i]),
+							"/cpp");
+						CPP = pathbuf;
+						cppDefined = 1;
+						goto nextarg;
+					}
 
 
 				default:
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 1b75d6e5b5..8aac5cb67d 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -41,6 +41,7 @@ enum
     _PC_NO_TRUNC,
 #define	_PC_NO_TRUNC			_PC_NO_TRUNC
     _PC_VDISABLE,
+#define _PC_VDISABLE			_PC_VDISABLE
     _PC_SYNC_IO,
 #define	_PC_SYNC_IO			_PC_SYNC_IO
     _PC_ASYNC_IO,
@@ -325,8 +326,15 @@ enum
 #define _SC_XBS5_ILP32_OFFBIG		_SC_XBS5_ILP32_OFFBIG
     _SC_XBS5_LP64_OFF64,
 #define _SC_XBS5_LP64_OFF64		_SC_XBS5_LP64_OFF64
-    _SC_XBS5_LPBIG_OFFBIG
+    _SC_XBS5_LPBIG_OFFBIG,
 #define _SC_XBS5_LPBIG_OFFBIG		_SC_XBS5_LPBIG_OFFBIG
+
+    _SC_XOPEN_LEGACY,
+#define _SC_XOPEN_LEGACY		_SC_XOPEN_LEGACY
+    _SC_XOPEN_REALTIME,
+#define _SC_XOPEN_REALTIME		_SC_XOPEN_REALTIME
+    _SC_XOPEN_REALTIME_THREADS
+#define _SC_XOPEN_REALTIME_THREADS	_SC_XOPEN_REALTIME_THREADS
   };
 
 #if (defined __USE_POSIX2 || defined __USE_UNIX98 \
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index e72836d3c7..e29be98210 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/bits/resource.h
@@ -66,11 +66,20 @@ enum __rlimit_resource
 
     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
   };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
 typedef __rlim_t rlim_t;
diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h
index a0edf2be52..bdc3a48de9 100644
--- a/sysdeps/generic/bits/stat.h
+++ b/sysdeps/generic/bits/stat.h
@@ -31,13 +31,21 @@ struct stat
     /* These are the members that POSIX.1 requires.  */
 
     __mode_t st_mode;		/* File mode.  */
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File serial number.  */
+#else
+    __ino64_t st_ino;		/* File serial number.	*/
+#endif
     __dev_t st_dev;		/* Device containing the file.  */
     __nlink_t st_nlink;		/* Link count.  */
 
     __uid_t st_uid;		/* User ID of the file's owner.  */
     __gid_t st_gid;		/* Group ID of the file's group.  */
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;		/* Size of file, in bytes.  */
+#endif
 
     __time_t st_atime;		/* Time of last access.  */
     __time_t st_mtime;		/* Time of last modification.  */
@@ -70,11 +78,11 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-    __dev_t st_dev;		/* Device.  */
-
-    __ino64_t st_ino;		/* File serial number.	*/
     __mode_t st_mode;		/* File mode.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __dev_t st_dev;		/* Device.  */
     __nlink_t st_nlink;		/* Link count.  */
+
     __uid_t st_uid;		/* User ID of the file's owner.	*/
     __gid_t st_gid;		/* Group ID of the file's group.*/
     __off64_t st_size;		/* Size of file, in bytes.  */
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
index a92cf52315..03b92d8faa 100644
--- a/sysdeps/generic/bits/statfs.h
+++ b/sysdeps/generic/bits/statfs.h
@@ -35,12 +35,36 @@ struct statfs
   {
     unsigned int f_type;
     unsigned int f_bsize;
+#ifndef __USE_FILE_OFFSET64
     __fsblkcnt_t f_blocks;
     __fsblkcnt_t f_bfree;
     __fsblkcnt_t f_bavail;
     __fsblkcnt_t f_files;
     __fsblkcnt_t f_ffree;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+#endif
+    __fsid_t f_fsid;
+    unsigned int f_namelen;
+    unsigned int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    unsigned int f_type;
+    unsigned int f_bsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
     __fsid_t f_fsid;
     unsigned int f_namelen;
     unsigned int f_spare[6];
   };
+#endif
diff --git a/sysdeps/generic/bits/stdio_lim.h b/sysdeps/generic/bits/stdio_lim.h
index d9b8fbc749..86e83cf1e2 100644
--- a/sysdeps/generic/bits/stdio_lim.h
+++ b/sysdeps/generic/bits/stdio_lim.h
@@ -17,17 +17,24 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _STDIO_H
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX
 # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
 #endif
 
-#define	L_tmpnam	1
-#define	TMP_MAX		0
+#ifndef __need_FOPEN_MAX
+# define L_tmpnam	1
+# define TMP_MAX	0
 
-#ifdef __USE_POSIX
-# define L_ctermid	1
-# define L_cuserid	1
+# ifdef __USE_POSIX
+#  define L_ctermid	1
+#  define L_cuserid	1
+# endif
+
+# define FILENAME_MAX	14
 #endif
 
-#define	FOPEN_MAX	16
-#define	FILENAME_MAX	14
+#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
+# define __defined_FOPEN_MAX
+# define FOPEN_MAX	16
+#endif
+#undef __need_FOPEN_MAX
diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c
index 99a2452558..e34af2aa45 100644
--- a/sysdeps/generic/fstatfs64.c
+++ b/sysdeps/generic/fstatfs64.c
@@ -25,8 +25,21 @@
 int
 fstatfs64 (int fd, struct statfs64 *buf)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct statfs buf32;
+
+  if (fstatfs (fd, &buf32) < 0)
+    return -1;
+
+  buf->f_type = buf32.f_type;
+  buf->f_bsize = buf32.f_bsize;
+  buf->f_blocks = buf32.f_blocks;
+  buf->f_bfree = buf32.f_bfree;
+  buf->f_bavail = buf32.f_bavail;
+  buf->f_files = buf32.f_files;
+  buf->f_ffree = buf32.f_ffree;
+  buf->f_fsid = buf32.f_fsid;
+  buf->f_namelen = buf32.f_namelen;
+  memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+  return 0;
 }
-stub_warning (fstatfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c
new file mode 100644
index 0000000000..40c312c21b
--- /dev/null
+++ b/sysdeps/generic/ftruncate64.c
@@ -0,0 +1,35 @@
+/* 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.  */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate the file FD refers to to LENGTH bytes.  */
+int
+ftruncate64 (fd, length)
+     int fd;
+     off64_t length;
+{
+  if ((off_t) length != length)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  return ftruncate (fd, (off_t) length);
+}
diff --git a/sysdeps/generic/getrlimit.c b/sysdeps/generic/getrlimit.c
index c283f77038..285133c1a1 100644
--- a/sysdeps/generic/getrlimit.c
+++ b/sysdeps/generic/getrlimit.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c
index 6c581edf72..742505f4b5 100644
--- a/sysdeps/generic/getrlimit64.c
+++ b/sysdeps/generic/getrlimit64.c
@@ -16,17 +16,28 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
 getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
 {
-  __set_errno (ENOSYS);
-  return -1;
-}
+  struct rlimit rlimits32;
 
-stub_warning (getrlimit64)
-#include <stub-tag.h>
+  if (getrlimit (resource, &rlimits32) < 0)
+    return -1;
+
+  if (rlimits32.rlim_cur == RLIM_INFINITY)
+    rlimits->rlim_cur = RLIM64_INFINITY;
+  else
+    rlimits->rlim_cur = rlimits32.rlim_cur;
+  if (rlimits32.rlim_max == RLIM_INFINITY)
+    rlimits->rlim_max = RLIM64_INFINITY;
+  else
+    rlimits->rlim_max = rlimits32.rlim_max;
+
+  return 0;
+}
diff --git a/sysdeps/generic/setrlimit.c b/sysdeps/generic/setrlimit.c
index b969ea19f7..85eb74051b 100644
--- a/sysdeps/generic/setrlimit.c
+++ b/sysdeps/generic/setrlimit.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c
index 3d1a12279f..97329c58d8 100644
--- a/sysdeps/generic/setrlimit64.c
+++ b/sysdeps/generic/setrlimit64.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
@@ -27,8 +28,18 @@ setrlimit64 (resource, rlimits)
      enum __rlimit_resource resource;
      struct rlimit64 *rlimits;
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct rlimit rlimits32;
+
+  if (rlimits->rlim_cur >= RLIM_INFINITY)
+    rlimits32.rlim_cur = RLIM_INFINITY;
+  else
+    rlimits32.rlim_cur = rlimits->rlim_cur;
+  if (rlimits->rlim_max >= RLIM_INFINITY)
+    rlimits32.rlim_max = RLIM_INFINITY;
+  else
+    rlimits32.rlim_max = rlimits->rlim_max;
+
+  return setrlimit (resource, &rlimits32);
 }
 
 stub_warning (setrlimit64)
diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c
index 93b640eb74..050c05d659 100644
--- a/sysdeps/generic/statfs64.c
+++ b/sysdeps/generic/statfs64.c
@@ -25,8 +25,21 @@
 int
 statfs64 (const char *file, struct statfs64 *buf)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct statfs buf32;
+
+  if (statfs (file, &buf32) < 0)
+    return -1;
+
+  buf->f_type = buf32.f_type;
+  buf->f_bsize = buf32.f_bsize;
+  buf->f_blocks = buf32.f_blocks;
+  buf->f_bfree = buf32.f_bfree;
+  buf->f_bavail = buf32.f_bavail;
+  buf->f_files = buf32.f_files;
+  buf->f_ffree = buf32.f_ffree;
+  buf->f_fsid = buf32.f_fsid;
+  buf->f_namelen = buf32.f_namelen;
+  memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+  return 0;
 }
-stub_warning (statfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sysconf.c b/sysdeps/generic/sysconf.c
index b3fa62aa9a..bb6955d212 100644
--- a/sysdeps/generic/sysconf.c
+++ b/sysdeps/generic/sysconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 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
@@ -242,6 +242,15 @@ __sysconf (name)
     case _SC_NL_SETMAX:
     case _SC_NL_TEXTMAX:
 
+    case _SC_XBS5_ILP32_OFF32:
+    case _SC_XBS5_ILP32_OFFBIG:
+    case _SC_XBS5_LP64_OFF64:
+    case _SC_XBS5_LPBIG_OFFBIG:
+
+    case _SC_XOPEN_LEGACY:
+    case _SC_XOPEN_REALTIME:
+    case _SC_XOPEN_REALTIME_THREADS:
+
       break;
     }
 
diff --git a/sysdeps/generic/testrtsig.h b/sysdeps/generic/testrtsig.h
index 25eb488f84..6937372b8b 100644
--- a/sysdeps/generic/testrtsig.h
+++ b/sysdeps/generic/testrtsig.h
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-int
+static int
 kernel_has_rtsig (void)
 {
   return 0;
diff --git a/sysdeps/generic/truncate64.c b/sysdeps/generic/truncate64.c
new file mode 100644
index 0000000000..6a9d91f6d0
--- /dev/null
+++ b/sysdeps/generic/truncate64.c
@@ -0,0 +1,35 @@
+/* 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.  */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate PATH to LENGTH bytes.  */
+int
+truncate64 (path, length)
+     const char *path;
+     off64_t length;
+{
+  if ((off_t) length != length)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  return truncate (path, (off_t) length);
+}
diff --git a/sysdeps/generic/ulimit.c b/sysdeps/generic/ulimit.c
index 3d90170b50..d62ba32a54 100644
--- a/sysdeps/generic/ulimit.c
+++ b/sysdeps/generic/ulimit.c
@@ -16,8 +16,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
 
 /* Function depends on CMD:
    1 = Return the limit on the size of a file, in units of 512 bytes.
@@ -28,9 +28,7 @@
        can open.
    Returns -1 on errors.  */
 long int
-__ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+__ulimit (int cmd, ...)
 {
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
index 8843977a01..4454f7d34b 100644
--- a/sysdeps/generic/waitid.c
+++ b/sysdeps/generic/waitid.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
+#include <sys/types.h>
 #include <sys/wait.h>
 
 int
diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h
index 034b6f8294..569e5a06c4 100644
--- a/sysdeps/m68k/fpu/bits/mathinline.h
+++ b/sysdeps/m68k/fpu/bits/mathinline.h
@@ -173,7 +173,6 @@ __inline_mathop(significand, getman)
 
 # ifdef __USE_ISOC9X
 __inline_mathop(log2, log2)
-__inline_mathop(exp2, twotox)
 __inline_mathop(trunc, intrz)
 # endif
 
@@ -445,7 +444,6 @@ __inline_forward_c(double,ceil, (double __x), (__x))
 __inline_forward_c(int,isinf, (double __value), (__value))
 __inline_forward_c(int,finite, (double __value), (__value))
 __inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n))
-__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n))
 # endif
 # if defined __USE_MISC || defined __USE_XOPEN
 #  ifndef __USE_ISOC9X /* Conflict with macro of same name.  */
@@ -453,6 +451,7 @@ __inline_forward_c(int,isnan, (double __value), (__value))
 #  endif
 # endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n))
 __inline_forward_c(double,nearbyint, (double __value), (__value))
 __inline_forward_c(long int,lrint, (double __value), (__value))
 __inline_forward_c(double,fma, (double __x, double __y, double __z),
@@ -473,10 +472,10 @@ __inline_forward_c(float,ceilf, (float __x), (__x))
 __inline_forward_c(int,isinff, (float __value), (__value))
 __inline_forward_c(int,finitef, (float __value), (__value))
 __inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
-__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n))
 __inline_forward_c(int,isnanf, (float __value), (__value))
 #  endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n))
 __inline_forward_c(float,nearbyintf, (float __value), (__value))
 __inline_forward_c(long int,lrintf, (float __value), (__value))
 __inline_forward_c(float,fmaf, (float __x, float __y, float __z),
@@ -495,11 +494,11 @@ __inline_forward_c(long double,ceill, (long double __x), (__x))
 __inline_forward_c(int,isinfl, (long double __value), (__value))
 __inline_forward_c(int,finitel, (long double __value), (__value))
 __inline_forward_c(long double,scalbnl, (long double __x, int __n), (__x, __n))
-__inline_forward_c(long double,scalblnl, (long double __x, long int __n),
-		   (__x, __n))
 __inline_forward_c(int,isnanl, (long double __value), (__value))
 # endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(long double,scalblnl, (long double __x, long int __n),
+		   (__x, __n))
 __inline_forward_c(long double,nearbyintl, (long double __value), (__value))
 __inline_forward_c(long int,lrintl, (long double __value), (__value))
 __inline_forward_c(long double,fmal,
diff --git a/sysdeps/posix/mk-stdiolim.c b/sysdeps/posix/mk-stdiolim.c
index c268b642de..8858ebeae5 100644
--- a/sysdeps/posix/mk-stdiolim.c
+++ b/sysdeps/posix/mk-stdiolim.c
@@ -42,27 +42,48 @@ main()
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
    Boston, MA 02111-1307, USA.  */\n\
 \n\
-#ifndef _STDIO_H\n\
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX\n\
 # error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
 #endif\n\
 \n");
 
   /* These values correspond to the code in sysdeps/posix/tempname.c.
      Change the values here if you change that code.  */
-  printf ("#define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
-  printf ("#define TMP_MAX %u\n", 62 * 62 * 62);
+  puts ("#ifndef __need_FOPEN_MAX");
+  printf ("# define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
+  printf ("# define TMP_MAX %u\n", 62 * 62 * 62);
 
-  puts   ("#ifdef __USE_POSIX");
-  printf ("# define L_ctermid %u\n", sizeof ("/dev/tty"));
-  printf ("# define L_cuserid 9\n");
-  puts   ("#endif");
+  puts   ("# ifdef __USE_POSIX");
+  printf ("#  define L_ctermid %u\n", sizeof ("/dev/tty"));
+  printf ("#  define L_cuserid 9\n");
+  puts   ("# endif");
+
+  printf (" #define FILENAME_MAX %u\n",
+#ifdef	PATH_MAX
+	  PATH_MAX
+#else
+	 /* This is supposed to be the size needed to hold the longest file
+	    name string the implementation guarantees can be opened.
+	    PATH_MAX not being defined means the actual limit on the length
+	    of a file name is runtime-variant (or it is unlimited).  ISO
+	    says in such a case FILENAME_MAX should be a good size to
+	    allocate for a file name string.  POSIX.1 guarantees that a
+	    file name up to _POSIX_PATH_MAX chars long can be opened, so
+	    this value must be at least that.  */
+	  1024		/* _POSIX_PATH_MAX is 255.  */
+#endif
+	  );
+
+  puts ("#endif\n");
 
   /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
      <bits/local_lim.h> will not define them if they are run-time
      variant (which is the case in the Hurd).  ISO still requires
      that FOPEN_MAX and FILENAME_MAX be defined, however.  */
 
-  printf ("#define FOPEN_MAX %u\n",
+  puts ("#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX");
+  puts ("# define __defined_FOPEN_MAX");
+  printf ("# define FOPEN_MAX %u\n",
 #ifdef	OPEN_MAX
 
 	  OPEN_MAX
@@ -76,22 +97,8 @@ main()
 #endif
 
 	  );
+  puts ("#endif");
+  puts ("#undef __need_FOPEN_MAX");
 
-  printf ("#define FILENAME_MAX %u\n",
-#ifdef	PATH_MAX
-	  PATH_MAX
-#else
-	 /* This is supposed to be the size needed to hold the longest file
-	    name string the implementation guarantees can be opened.
-	    PATH_MAX not being defined means the actual limit on the length
-	    of a file name is runtime-variant (or it is unlimited).  ISO
-	    says in such a case FILENAME_MAX should be a good size to
-	    allocate for a file name string.  POSIX.1 guarantees that a
-	    file name up to _POSIX_PATH_MAX chars long can be opened, so
-	    this value must be at least that.  */
-	  1024		/* _POSIX_PATH_MAX is 255.  */
-#endif
-	  );
-
-  exit(0);
+  exit (0);
 }
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index 8dde095b79..b0c559f70b 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 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
@@ -443,9 +443,7 @@ __sysconf (name)
 #endif
 
     case _SC_2_VERSION:
-      /* This is actually supposed to return the version
-	 of the 1003.2 utilities on the system {POSIX2_VERSION}.  */
-      return _POSIX2_C_VERSION;
+      return _POSIX2_VERSION;
 
     case _SC_2_C_BIND:
 #ifdef	_POSIX2_C_BIND
@@ -783,6 +781,47 @@ __sysconf (name)
 #else
       return -1;
 #endif
+
+    case _SC_XBS5_ILP32_OFF32:
+#ifdef _XBS5_ILP32_OFF32
+      return _XBS5_ILP32_OFF32;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_ILP32_OFFBIG:
+#ifdef _XBS5_ILP32_OFFBIG
+      return _XBS5_ILP32_OFFBIG;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_LP64_OFF64:
+#ifdef _XBS5_LP64_OFF64
+      return _XBS5_LP64_OFF64;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_LPBIG_OFFBIG:
+#ifdef _XBS5_LPBIG_OFFBIG
+      return _XBS5_LPBIG_OFFBIG;
+#else
+      return -1;
+#endif
+
+    case _SC_XOPEN_LEGACY:
+      return _XOPEN_LEGACY;
+
+    case _SC_XOPEN_REALTIME:
+#ifdef _XOPEN_REALTIME
+      return _XOPEN_REALTIME;
+#else
+      return -1;
+#endif
+    case _SC_XOPEN_REALTIME_THREADS:
+#ifdef _XOPEN_REALTIME_THREADS
+      return _XOPEN_REALTIME_THREADS;
+#else
+      return -1;
+#endif
     }
 }
 
diff --git a/sysdeps/standalone/arm/bits/errno.h b/sysdeps/standalone/arm/bits/errno.h
index 391f92548f..373d701bc3 100644
--- a/sysdeps/standalone/arm/bits/errno.h
+++ b/sysdeps/standalone/arm/bits/errno.h
@@ -56,6 +56,7 @@
 # define EIO		28
 # define ENOSPC		29
 # define EEXIST		30
+# define EBUSY		31
 #endif
 
 #define __set_errno(val) errno = (val)
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index 6978c87dd2..c0b40ba0d1 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -65,11 +65,11 @@ enum __rlimit_resource
 #ifndef __USE_FILE_OFFSET64
 # define RLIM_INFINITY 0x7fffffff
 #else
-# define RLIM_INFINITY 0x7fffffffffffffffL
+# define RLIM_INFINITY 0x7fffffffffffffffLL
 #endif
 
 #ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffL
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
 #endif
 
 
diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c
index b25a58314d..4a242efe1c 100644
--- a/sysdeps/unix/bsd/ulimit.c
+++ b/sysdeps/unix/bsd/ulimit.c
@@ -16,10 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
+#include <stdarg.h>
 #include <sysdep.h>
-#include <sys/resource.h>
 #include <unistd.h>
-#include <errno.h>
+#include <sys/resource.h>
 
 #ifndef	 HAVE_GNU_LD
 #define	 _etext	etext
@@ -36,51 +37,50 @@ extern int _etext;
        can open.
    Returns -1 on errors.  */
 long int
-ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+ulimit (int cmd, ...)
 {
-  int status;
+  struct rlimit limit;
+  va_list va;
+  long int result = -1;
+
+  va_start (va, cmd);
 
   switch (cmd)
     {
-    case 1:
-      {
-	/* Get limit on file size.  */
-	struct rlimit fsize;
-
-	status = getrlimit (RLIMIT_FSIZE, &fsize);
-	if (status < 0)
-	  return -1;
-
+    case UL_GETFSIZE:
+      /* Get limit on file size.  */
+      if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
 	/* Convert from bytes to 512 byte units.  */
-	return fsize.rlim_cur / 512;
-      }
-    case 2:
+	result = limit.rlim_cur / 512;
+      break;
+
+    case UL_SETFSIZE:
       /* Set limit on file size.  */
       {
-	struct rlimit fsize;
-	fsize.rlim_cur = newlimit * 512;
-	fsize.rlim_max = newlimit * 512;
+	long int newlimit = va_arg (va, long int);
+
+	limit.rlim_cur = newlimit * 512;
+	limit.rlim_max = newlimit * 512;
 
-	return setrlimit (RLIMIT_FSIZE, &fsize);
+	result = setrlimit (RLIMIT_FSIZE, &limit);
       }
-    case 3:
-      /* Get maximum address for `brk'.  */
-      {
-	struct rlimit dsize;
+      break;
 
-	status = getrlimit (RLIMIT_DATA, &dsize);
-	if (status < 0)
-	  return -1;
+    case __UL_GETMAXBRK:
+      /* Get maximum address for `brk'.  */
+      if (getrlimit (RLIMIT_DATA, &limit) == 0)
+	result = ((long int) &_etext) + limit.rlim_cur;
+      break;
 
-	return ((long int) &_etext) + dsize.rlim_cur;
-      }
-    case 4:
-      return sysconf (_SC_OPEN_MAX);
+    case __UL_GETOPENMAX:
+      result = sysconf (_SC_OPEN_MAX);
+      break;
 
     default:
       __set_errno (EINVAL);
-      return -1;
     }
+
+  va_end (va);
+
+  return result;
 }
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index fa95317ec9..e22cec7dec 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -32,6 +32,7 @@ netinet/udp.h
 netipx/ipx.h
 nfs/nfs.h
 rt_sigaction.c
+rt_sigpending.c
 rt_sigprocmask.c
 rt_sigqueueinfo.c
 rt_sigreturn.c
@@ -61,3 +62,4 @@ sys/ultrasound.h
 sys/user.h
 sys/vt.h
 xstatconv.c
+getdents64.c
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 27684ef3fe..152c7984bd 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -120,4 +120,8 @@ sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait	\
 		   rt_sigqueueinfo rt_sigaction rt_sigpending
 endif
 
+ifeq ($(subdir),dirent)
+sysdep_routines += getdents64
+endif
+
 common-generated += bits/stdio_lim.h bits/stdio_lim.d
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 9acdf0c490..9033fdb362 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -77,6 +77,9 @@ typedef long int __swblk_t;		/* Type of a swap block maybe?  */
 typedef long int __clock_t;
 typedef int __key_t;			/* Type of a SYSV IPC key. */
 
+/* Used in `struct shmid_ds'.  */
+typedef int __ipc_pid_t;
+
 /* One element in the file descriptor mask array.  */
 typedef unsigned long int __fd_mask;
 
diff --git a/sysdeps/unix/sysv/linux/alpha/fstatfs64.c b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/alpha/ftruncate64.c b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/alpha/init-first.h b/sysdeps/unix/sysv/linux/alpha/init-first.h
index ffbcaf1521..a3f5d8f0c4 100644
--- a/sysdeps/unix/sysv/linux/alpha/init-first.h
+++ b/sysdeps/unix/sysv/linux/alpha/init-first.h
@@ -2,28 +2,26 @@
    This is done in one of two ways: either in the stack context
    of program start, or having dlopen pass them in.  */
 
-#define SYSDEP_CALL_INIT(NAME, INIT)		\
-    asm(".weak _dl_starting_up\n\t"		\
-        ".globl " #NAME "\n\t"			\
-	".ent " #NAME "\n"			\
-	#NAME ":\n\t"				\
-	"ldgp	$29, 0($27)\n\t"		\
-	".prologue 1\n\t"			\
-	".set at\n\t"				\
-	/* Are we a dynamic libc being loaded into a static program?  */ \
-	"lda	$0, _dl_starting_up\n\t"	\
-	"beq	$0, 1f\n\t"			\
-	"ldl	$0, 0($0)\n"			\
-	"cmpeq	$31, $0, $0\n"			\
-	"1:\t"					\
-	"stl	$0, __libc_multiple_libcs\n\t"	\
-	/* If so, argc et al are in a0-a2 already.  Otherwise, load them.  */ \
-	"bne	$0, 2f\n\t"			\
-	"ldl	$16, 0($30)\n\t"		\
-	"lda	$17, 8($30)\n\t"		\
-	"s8addq	$16, $17, $18\n\t"		\
-	"addq	$18, 8, $18\n"			\
-	"2:\t"					\
-	"br $31, " #INIT "..ng\n\t"		\
-	".set noat\n\t"				\
-	".end " #NAME);
+#define SYSDEP_CALL_INIT(NAME, INIT) asm("\
+	.weak _dl_starting_up
+	.globl " #NAME "
+	.ent " #NAME "
+" #NAME ":
+	ldgp	$29, 0($27)
+	.prologue 1
+	.set at
+	/* Are we a dynamic libc being loaded into a static program?  */
+	lda	$0, _dl_starting_up
+	beq	$0, 1f
+	ldl	$0, 0($0)
+	cmpeq	$31, $0, $0
+1:	stl	$0, __libc_multiple_libcs
+	/* If so, argc et al are in a0-a2 already.  Otherwise, load them.  */
+	bne	$0, 2f
+	ldl	$16, 0($30)
+	lda	$17, 8($30)
+	s8addq	$16, $17, $18
+	addq	$18, 8, $18
+2:	br $31, " ASM_ALPHA_NG_SYMBOL_PREFIX #INIT "..ng
+	.set noat
+	.end " #NAME);
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir.c b/sysdeps/unix/sysv/linux/alpha/readdir.c
new file mode 100644
index 0000000000..96a6a76945
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir.c
@@ -0,0 +1,4 @@
+#define readdir64 __no_readdir64_decl
+#include <sysdeps/unix/readdir.c>
+#undef readdir64
+weak_alias (__readdir, readdir64)
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64.c b/sysdeps/unix/sysv/linux/alpha/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64_r.c b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir_r.c b/sysdeps/unix/sysv/linux/alpha/readdir_r.c
new file mode 100644
index 0000000000..adb92db6af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir_r.c
@@ -0,0 +1,4 @@
+#define readdir64_r __no_readdir64_r_decl
+#include <sysdeps/unix/readdir_r.c>
+#undef readdir64_r
+weak_alias (__readdir_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/alpha/statfs64.c b/sysdeps/unix/sysv/linux/alpha/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index d3bc033b3d..af964718bc 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -23,10 +23,14 @@ mmap		-	mmap		6	__mmap		mmap
 llseek		EXTRA	lseek		3	__llseek	llseek lseek64
 pread		EXTRA	pread		4	__pread		pread __pread64 pread64
 pwrite		EXTRA	pwrite		4	__pwrite	pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		2	__fstatfs	fstatfs fstatfs64
+statfs		-	statfs		2	__statfs	statfs statfs64
+getrlimit	-	getrlimit	2	getrlimit	getrlimit64
+setrlimit	-	setrlimit	2	setrlimit	setrlimit64
+ftruncate	-	ftruncate	2	ftruncate	ftruncate64
+truncate	-	truncate	2	truncate	truncate64
 
 # these are actually common with the x86:
-fstatfs		-	fstatfs		2	__fstatfs	fstatfs
-statfs		-	statfs		2	__statfs	statfs
 sys_ustat	ustat	ustat		2	__syscall_ustat
 sys_mknod	xmknod	mknod		3	__syscall_mknod
 
diff --git a/sysdeps/unix/sysv/linux/alpha/truncate64.c b/sysdeps/unix/sysv/linux/alpha/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
index 9d0b9a9afa..d7a8e5ee0f 100644
--- a/sysdeps/unix/sysv/linux/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MSG_H
-#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
 #include <sys/types.h>
@@ -28,7 +28,7 @@
 
 
 /* Structure of record for one message inside the kernel.
-   The type `struct __msg' is opaque.  */
+   The type `struct msg' is opaque.  */
 struct msqid_ds
 {
   struct ipc_perm msg_perm;	/* structure describing operation permission */
@@ -42,17 +42,17 @@ struct msqid_ds
   unsigned short int __msg_cbytes;/* current number of bytes on queue */
   unsigned short int msg_qnum;	/* number of messages currently on queue */
   unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
-  int msg_lspid;		/* pid of last msgsnd() */
-  int msg_lrpid;		/* pid of last msgrcv() */
+  __ipc_pid_t msg_lspid;	/* pid of last msgsnd() */
+  __ipc_pid_t msg_lrpid;	/* pid of last msgrcv() */
 };
 
 #ifdef __USE_MISC
 
-#define msg_cbytes	__msg_cbytes
+# define msg_cbytes	__msg_cbytes
 
 /* ipcs ctl commands */
-#define MSG_STAT 11
-#define MSG_INFO 12
+# define MSG_STAT 11
+# define MSG_INFO 12
 
 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
 struct msginfo
@@ -64,7 +64,7 @@ struct msginfo
     int msgmni;
     int msgssz;
     int msgtql;
-    ushort  msgseg;
+    unsigned short int msgseg;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index f825cba929..c649217e7e 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -102,12 +102,20 @@ enum __rlimit_resource
   RLIM_NLIMITS = RLIMIT_NLIMITS,
 #define RLIMIT_NLIMITS RLIMIT_NLIMITS
 #define RLIM_NLIMITS RLIM_NLIMITS
-
-  /* Value to indicate that there is no limit.  */
-  RLIM_INFINITY = (long int)(~0UL >> 1)
-#define RLIM_INFINITY RLIM_INFINITY
 };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((long int)(~0UL >> 1))
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
 typedef __rlim_t rlim_t;
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 6f5f840909..c7070595b8 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -44,8 +44,8 @@ struct shmid_ds
     __time_t shm_atime;			/* time of last shmat() */
     __time_t shm_dtime;			/* time of last shmdt() */
     __time_t shm_ctime;			/* time of last change by shmctl() */
-    int shm_cpid;			/* pid of creator */
-    int shm_lpid;			/* pid of last shmop */
+    __ipc_pid_t shm_cpid;		/* pid of creator */
+    __ipc_pid_t shm_lpid;		/* pid of last shmop */
     unsigned short int shm_nattch;	/* number of current attaches */
     unsigned short int __shm_npages;	/* size of segment (pages) */
     unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
@@ -73,12 +73,12 @@ struct	shminfo
 
 struct shm_info
   {
-    int   used_ids;
-    ulong shm_tot;	/* total allocated shm */
-    ulong shm_rss;	/* total resident shm */
-    ulong shm_swp;	/* total swapped shm */
-    ulong swap_attempts;
-    ulong swap_successes;
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 926c3f32f4..0a5891210e 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -82,32 +82,40 @@ struct termios
 #define ONLRET	0000040
 #define OFILL	0000100
 #define OFDEL	0000200
-#define NLDLY	0000400
-#define   NL0	0000000
-#define   NL1	0000400
-#define CRDLY	0003000
-#define   CR0	0000000
-#define   CR1	0001000
-#define   CR2	0002000
-#define   CR3	0003000
-#define TABDLY	0014000
-#define   TAB0	0000000
-#define   TAB1	0004000
-#define   TAB2	0010000
-#define   TAB3	0014000
-#define   XTABS	0014000
-#define BSDLY	0020000
-#define   BS0	0000000
-#define   BS1	0020000
+#if !defined __USE_POSIX || defined __USE_UNIX98
+# define NLDLY	0000400
+# define   NL0	0000000
+# define   NL1	0000400
+# define CRDLY	0003000
+# define   CR0	0000000
+# define   CR1	0001000
+# define   CR2	0002000
+# define   CR3	0003000
+# define TABDLY	0014000
+# define   TAB0	0000000
+# define   TAB1	0004000
+# define   TAB2	0010000
+# define   TAB3	0014000
+# define BSDLY	0020000
+# define   BS0	0000000
+# define   BS1	0020000
+# define FFDLY	0100000
+# define   FF0	0000000
+# define   FF1	0100000
+#endif
+
 #define VTDLY	0040000
 #define   VT0	0000000
 #define   VT1	0040000
-#define FFDLY	0100000
-#define   FF0	0000000
-#define   FF1	0100000
+
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define XTABS	0014000
+#endif
 
 /* c_cflag bit meaning */
-#define CBAUD	0010017
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CBAUD	0010017
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -124,8 +132,10 @@ struct termios
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define EXTA B19200
+# define EXTB B38400
+#endif
 #define CSIZE	0000060
 #define   CS5	0000000
 #define   CS6	0000020
@@ -137,29 +147,37 @@ struct termios
 #define PARODD	0001000
 #define HUPCL	0002000
 #define CLOCAL	0004000
-#define CBAUDEX 0010000
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CBAUDEX 0010000
+#endif
 #define  B57600  0010001
 #define  B115200 0010002
 #define  B230400 0010003
 #define  B460800 0010004
-#define CIBAUD	  002003600000	/* input baud rate (not used) */
-#define CRTSCTS	  020000000000		/* flow control */
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CIBAUD	  002003600000		/* input baud rate (not used) */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0000001
 #define ICANON	0000002
-#define XCASE	0000004
+#if !defined __USE_POSIX || defined __USE_UNIX98
+# define XCASE	0000004
+#endif
 #define ECHO	0000010
 #define ECHOE	0000020
 #define ECHOK	0000040
 #define ECHONL	0000100
 #define NOFLSH	0000200
 #define TOSTOP	0000400
-#define ECHOCTL	0001000
-#define ECHOPRT	0002000
-#define ECHOKE	0004000
-#define FLUSHO	0010000
-#define PENDIN	0040000
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define ECHOCTL 0001000
+# define ECHOPRT 0002000
+# define ECHOKE	 0004000
+# define FLUSHO	 0010000
+# define PENDIN	 0040000
+#endif
 #define IEXTEN	0100000
 
 /* tcflow() and TCXONC use these */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index dec60e244b..723e0ff223 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -103,6 +103,9 @@ typedef struct
 
 typedef int __key_t;
 
+/* Used in `struct shmid_ds'.  */
+typedef short int __ipc_pid_t;
+
 
 /* Types from the Large File Support interface.  */
 
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
new file mode 100644
index 0000000000..f6884998c7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -0,0 +1,41 @@
+/* fxstat64 using old-style Unix fstat system call.
+   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.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_fstat (int, struct kernel_stat *);
+
+/* Get information about the file FD in BUF.  */
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_fstat (fd, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index b4b12d48eb..b1b532a396 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -46,6 +46,10 @@ struct kernel_dirent
     char d_name[256];
   };
 
+#ifdef GETDENTS64
+#define __getdirentries __getdirentries64
+#define dirent dirent64
+#endif
 
 /* The problem here is that we cannot simply read the next NBYTES
    bytes.  We need to take the additional field into account.  We use
@@ -111,4 +115,6 @@ __getdirentries (fd, buf, nbytes, basep)
   return (char *) dp - buf;
 }
 
+#ifndef GETDENTS64
 weak_alias (__getdirentries, getdirentries)
+#endif
diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
new file mode 100644
index 0000000000..f50b0be615
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getdents64.c
@@ -0,0 +1,2 @@
+#define GETDENTS64
+#include <getdents.c>
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
new file mode 100644
index 0000000000..8813fadd4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -0,0 +1,41 @@
+/* lxstat64 using old-style Unix lstat system call.
+   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.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_lstat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_lstat (name, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h
new file mode 100644
index 0000000000..56075d13c2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/types.h
@@ -0,0 +1,130 @@
+/* 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
+
+#include <features.h>
+
+/* 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 int __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 __u_quad_t __dev_t;		/* Type of device numbers.  */
+typedef __u_int __uid_t;		/* Type of user identifications.  */
+typedef __u_int __gid_t;		/* Type of group identifications.  */
+typedef __u_long __ino_t;		/* Type of file serial numbers.  */
+typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
+typedef __u_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 long int __rlim_t;		/* Type of resource counts.  */
+typedef __quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_int __id_t;			/* General type for ID.  */
+
+typedef struct
+  {
+    int __val[2];
+  } __fsid_t;				/* Type of file system IDs.  */
+
+/* Everythin' else.  */
+typedef 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 __clock_t;
+
+/* One element in the file descriptor mask array.  */
+typedef unsigned long int __fd_mask;
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
+#define __NFDBITS	(8 * sizeof (__fd_mask))
+#define	__FDELT(d)	((d) / __NFDBITS)
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
+
+/* fd_set for select and pselect.  */
+typedef struct
+  {
+    /* XPG4.2 requires this member name.  */
+    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+  } __fd_set;
+
+
+typedef int __key_t;
+
+/* Used in `struct shmid_ds'.  */
+typedef long int __ipc_pid_t;
+
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef __u_long __blkcnt_t;
+typedef __u_quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef long int __fsblkcnt_t;
+typedef __quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers.  */
+typedef __u_long __ino64_t;
+
+/* Type of file sizes and offsets.  */
+typedef __loff_t __off64_t;
+
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
new file mode 100644
index 0000000000..37623655f4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -0,0 +1,103 @@
+/* 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.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+extern ssize_t __getdirentries64 (int, char *, size_t, off_t *);
+
+
+/* Read a directory entry from DIRP.  */
+struct dirent64 *
+readdir64 (DIR *dirp)
+{
+  struct dirent64 *dp;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      size_t reclen;
+
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  off_t base;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  base = dirp->filepos;
+	  bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base);
+	  if (bytes <= 0)
+	    {
+	      dp = NULL;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (struct dirent64 *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent64' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read jst one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp;
+}
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
new file mode 100644
index 0000000000..57ae4c786e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -0,0 +1,107 @@
+/* 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.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+extern ssize_t __getdirentries64 (int, char *, size_t, off_t *);
+
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+   pointer to result in *RESULT.  */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
+{
+  struct dirent64 *dp;
+  size_t reclen;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  off_t base;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  base = dirp->filepos;
+	  bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base);
+	  if (bytes <= 0)
+	    {
+	      dp = NULL;
+	      reclen = 0;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (struct dirent64 *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent64' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read just one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+  if (dp != NULL)
+    *result = memcpy (entry, dp, reclen);
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp != NULL ? 0 : errno;
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S b/sysdeps/unix/sysv/linux/rt_sigpending.c
index 9b9413e2f3..b605315644 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S
+++ b/sysdeps/unix/sysv/linux/rt_sigpending.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sysdep.h>
+#include <errno.h>
+#include <signal.h>
 
-PSEUDO (__sigreturn, sigreturn, 1)
-	/* Shouldn't get here.  */
-PSEUDO_END(__sigreturn)
+int
+__syscall_rt_sigpending (sigset_t *set, size_t setsize)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/siglist.c b/sysdeps/unix/sysv/linux/siglist.c
index 9f42cc0a87..6bb8562899 100644
--- a/sysdeps/unix/sysv/linux/siglist.c
+++ b/sysdeps/unix/sysv/linux/siglist.c
@@ -21,6 +21,6 @@ default_symbol_version (__new_sys_siglist, _sys_siglist, GLIBC_2.1);
 default_symbol_version (_new_sys_siglist, sys_siglist, GLIBC_2.1);
 default_symbol_version (__new_sys_sigabbrev, sys_sigabbrev, GLIBC_2.1);
 #else
-weak_alias(_sys_siglist, sys_siglist)
-weak_alias(_sys_sigabbrev, sys_sigabbrev)
+weak_alias(__new_sys_siglist, sys_siglist)
+weak_alias(__new_sys_sigabbrev, sys_sigabbrev)
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 0c421fb7a7..5ee6c0ee7a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -95,6 +95,9 @@ typedef struct
 
 typedef int __key_t;
 
+/* Used in `struct shmid_ds'.  */
+typedef int __ipc_pid_t;
+
 
 /* Types from the Large File Support interface.  */
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
new file mode 100644
index 0000000000..96a6a76945
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
@@ -0,0 +1,4 @@
+#define readdir64 __no_readdir64_decl
+#include <sysdeps/unix/readdir.c>
+#undef readdir64
+weak_alias (__readdir, readdir64)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
new file mode 100644
index 0000000000..adb92db6af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
@@ -0,0 +1,4 @@
+#define readdir64_r __no_readdir64_r_decl
+#include <sysdeps/unix/readdir_r.c>
+#undef readdir64_r
+weak_alias (__readdir_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 6491a9ccac..7e64daf578 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -4,6 +4,12 @@
 llseek		EXTRA	lseek		3	__llseek	llseek lseek64
 pread		EXTRA	pread		4	__pread		pread __pread64 pread64
 pwrite		EXTRA	pwrite		4	__pwrite	pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		2	__fstatfs	fstatfs fstatfs64
+statfs		-	statfs		2	__statfs	statfs statfs64
+getrlimit	-	getrlimit	2	getrlimit	getrlimit64
+setrlimit	-	setrlimit	2	setrlimit	setrlimit64
+ftruncate	-	ftruncate	2	ftruncate	ftruncate64
+truncate	-	truncate	2	truncate	truncate64
 
 # Override select.S in parent directory:
 select		-	select		5	__select	select
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in
index 7fa98f7733..07280956f2 100644
--- a/sysdeps/unix/sysv/linux/stdio_lim.h.in
+++ b/sysdeps/unix/sysv/linux/stdio_lim.h.in
@@ -17,17 +17,24 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _STDIO_H
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX
 # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
 #endif
 
-#define L_tmpnam 19
-#define TMP_MAX 238328
+#ifndef __need_FOPEN_MAX
+# define L_tmpnam 19
+# define TMP_MAX 238328
 
-#ifdef __USE_POSIX
-# define L_ctermid 9
-# define L_cuserid 9
+# ifdef __USE_POSIX
+#  define L_ctermid 9
+#  define L_cuserid 9
+# endif
+
+# define FILENAME_MAX	DEFAULT_FILENAME_MAX
 #endif
 
-#define FOPEN_MAX	DEFAULT_FOPEN_MAX
-#define FILENAME_MAX	DEFAULT_FILENAME_MAX
+#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
+# define __defined_FOPEN_MAX
+# define FOPEN_MAX	DEFAULT_FOPEN_MAX
+#endif
+#undef __need_FOPEN_MAX
diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h
index 7256d71227..7c41877e66 100644
--- a/sysdeps/unix/sysv/linux/testrtsig.h
+++ b/sysdeps/unix/sysv/linux/testrtsig.h
@@ -21,10 +21,10 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-int
+static int
 kernel_has_rtsig (void)
 {
   struct utsname name;
 
-  return uname (&name) < 0 || __strverscmp (name.release, "2.1.70") >= 0;
+  return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0;
 }
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c
index ef224d22ac..58ff111612 100644
--- a/sysdeps/unix/sysv/linux/ulimit.c
+++ b/sysdeps/unix/sysv/linux/ulimit.c
@@ -16,10 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
+#include <stdarg.h>
 #include <sysdep.h>
-#include <sys/resource.h>
 #include <unistd.h>
-#include <errno.h>
+#include <sys/resource.h>
 
 /* Function depends on CMD:
    1 = Return the limit on the size of a file, in units of 512 bytes.
@@ -31,42 +32,46 @@
        can open.
    Returns -1 on errors.  */
 long int
-__ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+__ulimit (int cmd, ...)
 {
-  int status;
+  struct rlimit limit;
+  va_list va;
+  long int result = -1;
+
+  va_start (va, cmd);
 
   switch (cmd)
     {
-    case 1:
-      {
-	/* Get limit on file size.  */
-	struct rlimit fsize;
-
-	status = getrlimit (RLIMIT_FSIZE, &fsize);
-	if (status < 0)
-	  return -1;
-
+    case UL_GETFSIZE:
+      /* Get limit on file size.  */
+      if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
 	/* Convert from bytes to 512 byte units.  */
-	return fsize.rlim_cur / 512;
-      }
-    case 2:
+	result =  limit.rlim_cur / 512;
+      break;
+
+    case UL_SETFSIZE:
       /* Set limit on file size.  */
       {
-	struct rlimit fsize;
-	fsize.rlim_cur = newlimit * 512;
-	fsize.rlim_max = newlimit * 512;
+	long int newlimit = va_arg (va, long int);
+
+	limit.rlim_cur = newlimit * 512;
+	limit.rlim_max = newlimit * 512;
 
-	return setrlimit (RLIMIT_FSIZE, &fsize);
+	result = setrlimit (RLIMIT_FSIZE, &limit);
       }
-    case 4:
-      return sysconf (_SC_OPEN_MAX);
+      break;
+
+    case __UL_GETOPENMAX:
+      result = sysconf (_SC_OPEN_MAX);
+      break;
 
     default:
       __set_errno (EINVAL);
-      return -1;
     }
+
+  va_end (va);
+
+  return result;
 }
 
 weak_alias (__ulimit, ulimit);
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
new file mode 100644
index 0000000000..02f70c5c51
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -0,0 +1,41 @@
+/* xstat64 using old-style Unix stat system call.
+   Copyright (C) 1991, 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.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_stat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_stat (name, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c
index fcf2f3b9f6..0a8e0c47f9 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/xstatconv.c
@@ -81,3 +81,65 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 
   return 0;
 }
+
+static inline int
+xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+{
+#ifdef XSTAT_IS_XSTAT64
+  return xstat_conv (vers, kbuf, ubuf);
+#else
+  switch (vers)
+    {
+    case _STAT_VER_LINUX:
+      {
+	struct stat64 *buf = ubuf;
+
+	/* Convert to current kernel version of `struct stat64'.  */
+	buf->st_dev = kbuf->st_dev;
+#ifdef _HAVE___PAD1
+	buf->__pad1 = 0;
+#endif
+	buf->st_ino = kbuf->st_ino;
+	buf->st_mode = kbuf->st_mode;
+	buf->st_nlink = kbuf->st_nlink;
+	buf->st_uid = kbuf->st_uid;
+	buf->st_gid = kbuf->st_gid;
+	buf->st_rdev = kbuf->st_rdev;
+#ifdef _HAVE___PAD2
+	buf->__pad2 = 0;
+#endif
+	buf->st_size = kbuf->st_size;
+	buf->st_blksize = kbuf->st_blksize;
+	buf->st_blocks = kbuf->st_blocks;
+	buf->st_atime = kbuf->st_atime;
+#ifdef _HAVE___UNUSED1
+	buf->__unused1 = 0;
+#endif
+	buf->st_mtime = kbuf->st_mtime;
+#ifdef _HAVE___UNUSED2
+	buf->__unused2 = 0;
+#endif
+	buf->st_ctime = kbuf->st_ctime;
+#ifdef _HAVE___UNUSED3
+	buf->__unused3 = 0;
+#endif
+#ifdef _HAVE___UNUSED4
+	buf->__unused4 = 0;
+#endif
+#ifdef _HAVE___UNUSED5
+	buf->__unused5 = 0;
+#endif
+      }
+      break;
+
+      /* If struct stat64 is different from struct stat then
+	 _STAT_VER_KERNEL does not make sense.  */
+    case _STAT_VER_KERNEL:
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return 0;
+#endif
+}
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index f569be5b51..9200b8c2b8 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -313,20 +313,29 @@ typedef unsigned long long int uint_fast64_t;
 /* Macros for printing format specifiers.  */
 
 /* Decimal notation.  */
+#define SCNd8		"hhd"
 #define SCNd16		"hd"
 #define SCNd32		"d"
 #define SCNd64		"lld"
 
+#define SCNi8		"hhi"
 #define SCNi16		"hi"
 #define SCNi32		"i"
 #define SCNi64		"lli"
 
+#define SCNu8		"hhu"
+#define SCNu16		"hu"
+#define SCNu32		"u"
+#define SCNu64		"llu"
+
 /* Octal notation.  */
+#define SCNo8		"hho"
 #define SCNo16		"ho"
 #define SCNo32		"o"
 #define SCNo64		"llo"
 
 /* Hexadecimal notation.  */
+#define SCNx8		"hhx"
 #define SCNx16		"hx"
 #define SCNx32		"x"
 #define SCNx64		"llx"
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index c62d516c4b..8ec8095620 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -313,20 +313,29 @@ typedef unsigned long int uint_fast64_t;
 /* Macros for printing format specifiers.  */
 
 /* Decimal notation.  */
+#define SCNd8		"hhd"
 #define SCNd16		"hd"
 #define SCNd32		"d"
 #define SCNd64		"ld"
 
+#define SCNi8		"hhi"
 #define SCNi16		"hi"
 #define SCNi32		"i"
 #define SCNi64		"li"
 
+#define SCNu8		"hhu"
+#define SCNu16		"hu"
+#define SCNu32		"u"
+#define SCNu64		"lu"
+
 /* Octal notation.  */
+#define SCNo8		"hho"
 #define SCNo16		"ho"
 #define SCNo32		"o"
 #define SCNo64		"lo"
 
 /* Hexadecimal notation.  */
+#define SCNx8		"hhx"
 #define SCNx16		"hx"
 #define SCNx32		"x"
 #define SCNx64		"lx"
diff --git a/time/README b/time/README
index 1c3160106e..7875a92922 100644
--- a/time/README
+++ b/time/README
@@ -1,14 +1,14 @@
 The files
 	zic.c zdump.c ialloc.c scheck.c tzfile.h
 	private.h tzselect.ksh checktab.awk
-come from the tzcode1997g package by Arthur David Olson et.al.
+come from the tzcode1997h package by Arthur David Olson et.al.
 
 The files
 	africa antarctica asia australasia europe
 	northamerica southamerica pacificnew etcetera factory
 	backward systemv solar87 solar88 solar89
 	iso3166.tab zone.tab leapseconds yearistype
-come from the tzdata1997i package by Arthur David Olson et.al.
+come from the tzdata1997j package by Arthur David Olson et.al.
 
 These packages may be found at ftp://elsie.nci.nih.gov/pub/.  Commentary
 should be addressed to tz@elsie.nci.nih.gov.
diff --git a/time/africa b/time/africa
index f58719da5b..4b56816f40 100644
--- a/time/africa
+++ b/time/africa
@@ -1,4 +1,4 @@
-# @(#)africa	7.20
+# @(#)africa	7.22
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
diff --git a/time/antarctica b/time/antarctica
index 83f0cfed76..75d2cf63e4 100644
--- a/time/antarctica
+++ b/time/antarctica
@@ -1,4 +1,4 @@
-# @(#)antarctica	7.8
+# @(#)antarctica	7.10
 
 # From Paul Eggert (1997-03-28):
 # To keep things manageable, we list only locations occupied year-round;
diff --git a/time/asia b/time/asia
index 6734749179..34960d88e6 100644
--- a/time/asia
+++ b/time/asia
@@ -1,4 +1,4 @@
-# @(#)asia	7.30
+# @(#)asia	7.33
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -45,8 +45,6 @@
 #	9:30	CST	(Australian) Central Standard Time
 #
 # See the `europe' file for Russia and Turkey in Asia.
-#
-# See the `africa' file for time zone naming and abbreviation conventions.
 
 # From Guy Harris:
 # Incorporates data for Singapore from Robert Elz' asia 1.1, as well as
diff --git a/time/australasia b/time/australasia
index d981a6a916..2726a25d3d 100644
--- a/time/australasia
+++ b/time/australasia
@@ -1,4 +1,4 @@
-# @(#)australasia	7.34
+# @(#)australasia	7.37
 # This file also includes Pacific islands.
 
 # Notes are at the end of this file
@@ -472,8 +472,6 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 #
 # See the `northamerica' file for Hawaii.
 # See the `southamerica' file for Easter I and the Galapagos Is.
-#
-# See the `africa' file for time zone naming and abbreviation conventions.
 
 ###############################################################################
 
diff --git a/time/backward b/time/backward
index 59fcffcdff..4c7a19d2cf 100644
--- a/time/backward
+++ b/time/backward
@@ -1,4 +1,4 @@
-# @(#)backward	7.13
+# @(#)backward	7.14
 
 # This file provides links between current names for time zones
 # and their old names.  Many names changed in late 1993.
diff --git a/time/etcetera b/time/etcetera
index c47fae7a68..a6a65db40a 100644
--- a/time/etcetera
+++ b/time/etcetera
@@ -1,4 +1,4 @@
-# @(#)etcetera	7.6
+# @(#)etcetera	7.8
 
 # These entries are mostly present for historical reasons, so that
 # people in areas not otherwise covered by the tz files could "zic -l"
diff --git a/time/europe b/time/europe
index 2948ba1caf..4e30ab4934 100644
--- a/time/europe
+++ b/time/europe
@@ -1,4 +1,4 @@
-# @(#)europe	7.46
+# @(#)europe	7.49
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -37,8 +37,6 @@
 #	 2:00	EET EEST Eastern Europe
 #	 3:00	MSK MSD	Moscow
 #
-# See the `africa' file for time zone naming and abbreviation conventions.
-#
 # A reliable and entertaining source about time zones, especially in Britain,
 # is Derek Howse, Greenwich time and the discovery of the longitude,
 # Oxford University Press (1980).
diff --git a/time/factory b/time/factory
index d95df23c1d..ba27c63269 100644
--- a/time/factory
+++ b/time/factory
@@ -1,4 +1,4 @@
-# @(#)factory	7.1
+# @(#)factory	7.3
 
 # For companies who don't want to put time zone specification in
 # their installation procedures.  When users run date, they'll get the message.
diff --git a/time/northamerica b/time/northamerica
index 635c4ef180..a978333503 100644
--- a/time/northamerica
+++ b/time/northamerica
@@ -1,4 +1,4 @@
-# @(#)northamerica	7.32
+# @(#)northamerica	7.35
 # also includes Central America and the Caribbean
 
 # This data is by no means authoritative; if you think you know better,
@@ -481,8 +481,6 @@ Link	Pacific/Honolulu	HST
 # I found in the UCLA library.
 #
 # See the `europe' file for Greenland.
-#
-# See the `africa' file for time zone naming and abbreviation conventions.
 
 # Canada
 
diff --git a/time/pacificnew b/time/pacificnew
index 883ccdca69..86dd688341 100644
--- a/time/pacificnew
+++ b/time/pacificnew
@@ -1,4 +1,4 @@
-# @(#)pacificnew	7.9
+# @(#)pacificnew	7.10
 
 # From Arthur David Olson (1989-04-05):
 # On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill
diff --git a/time/southamerica b/time/southamerica
index 09e0aa6d28..4f8cb906d9 100644
--- a/time/southamerica
+++ b/time/southamerica
@@ -1,4 +1,4 @@
-# @(#)southamerica	7.18
+# @(#)southamerica	7.21
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -28,7 +28,6 @@
 #	-4:00	AST	ADT	Atlantic
 #	-5:00	AST	ADT	Acre
 #
-# See the `africa' file for time zone naming and abbreviation conventions.
 # Earlier editions of these tables used the North American style (e.g. ARST and
 # ARDT for Argentine Standard and Daylight Time), but the following quote
 # suggests that it's better to use European style (e.g. ART and ARST).
diff --git a/time/tzfile.h b/time/tzfile.h
index a26fbbeefc..90441cbbc3 100644
--- a/time/tzfile.h
+++ b/time/tzfile.h
@@ -21,7 +21,7 @@
 
 #ifndef lint
 #ifndef NOID
-static char	tzfilehid[] = "@(#)tzfile.h	7.9";
+static char	tzfilehid[] = "@(#)tzfile.h	7.13";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -45,8 +45,11 @@ static char	tzfilehid[] = "@(#)tzfile.h	7.9";
 ** Each file begins with. . .
 */
 
+#define	TZ_MAGIC	"TZif"
+
 struct tzhead {
-	char	tzh_reserved[20];	/* reserved for future use */
+ 	char	tzh_magic[4];		/* TZ_MAGIC */
+	char	tzh_reserved[16];	/* reserved for future use */
 	char	tzh_ttisgmtcnt[4];	/* coded number of trans. time flags */
 	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */
 	char	tzh_leapcnt[4];		/* coded number of leap seconds */
diff --git a/time/zic.c b/time/zic.c
index c95887c9b4..2780e4c996 100644
--- a/time/zic.c
+++ b/time/zic.c
@@ -1,6 +1,6 @@
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)zic.c	7.87";
+static char	elsieid[] = "@(#)zic.c	7.91";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -1464,7 +1464,9 @@ const char * const	name;
 	convert(eitol(timecnt), tzh.tzh_timecnt);
 	convert(eitol(typecnt), tzh.tzh_typecnt);
 	convert(eitol(charcnt), tzh.tzh_charcnt);
+	(void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
 #define DO(field)	(void) fwrite((void *) tzh.field, (size_t) sizeof tzh.field, (size_t) 1, fp)
+	DO(tzh_magic);
 	DO(tzh_reserved);
 	DO(tzh_ttisgmtcnt);
 	DO(tzh_ttisstdcnt);
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 4c8f9a4dcf..4bba959387 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -26,7 +26,9 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
+/* Get FILE definition.  */
+#define __need_FILE
+#include <stdio.h>
 
 /* Get size_t, wchar_t, wint_t and NULL from <stddef.h>.  */
 #define __need_size_t
@@ -35,7 +37,6 @@ __BEGIN_DECLS
 #define __need_NULL
 #include <stddef.h>
 
-
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
 #ifndef _WINT_T
@@ -65,6 +66,12 @@ typedef struct
 # define WEOF (0xffffffffu)
 #endif
 
+/* This incomplete type is defined in <time.h> but needed here because
+   of `wcsftime'.  */
+struct tm;
+
+
+__BEGIN_DECLS
 
 /* Copy SRC to DEST.  */
 extern wchar_t *wcscpy __P ((wchar_t *__restrict __dest,
@@ -283,17 +290,18 @@ extern size_t wmemrtombs __P ((char *__restrict __dst,
 			       __const wchar_t **__restrict __src,
 			       size_t __nwc, size_t len,
 			       mbstate_t *__restrict __ps));
+#endif	/* use GNU */
 
 
 /* The following functions are extensions found in X/Open CAE.  */
-
+#ifdef __USE_XOPEN
 /* Determine number of column positions required for C.  */
 extern int wcwidth __P ((wint_t __c));
 
 /* Determine number of column positions required for first N wide
    characters (or fewer if S ends before this) in S.  */
 extern int wcswidth __P ((__const wchar_t *__s, size_t __n));
-#endif	/* use GNU */
+#endif	/* Use X/Open.  */
 
 
 /* Convert initial portion of the wide string NPTR to `double'
@@ -494,6 +502,17 @@ extern wchar_t *wcpncpy __P ((wchar_t *__dest, __const wchar_t *__src,
 #endif	/* use GNU */
 
 
+/* The X/Open standard demands that most of the functions defined in
+   the <wctype.h> header must also appear here.  This is probably
+   because some X/Open members wrote their implementation before the
+   ISO C standard was published and introduced the better solution.
+   We have to provide these definitions for compliance reasons but we
+   do this nonsense only if really necessary.  */
+#if defined __USE_UNIX98 && !defined __USE_GNU
+# define __need_iswxxx
+# include <wctype.h>
+#endif
+
 __END_DECLS
 
 #endif /* wchar.h  */
diff --git a/wctype/towctrans.c b/wctype/towctrans.c
index 91e591dbb3..b0180fde55 100644
--- a/wctype/towctrans.c
+++ b/wctype/towctrans.c
@@ -23,7 +23,7 @@
 #include "cname-lookup.h"
 
 wint_t
-towctrans (wint_t wc, wctrans_t desc)
+__towctrans (wint_t wc, wctrans_t desc)
 {
   size_t idx;
 
@@ -34,3 +34,4 @@ towctrans (wint_t wc, wctrans_t desc)
 
   return (wint_t) desc[idx];
 }
+weak_alias (__towctrans, towctrans)
diff --git a/wctype/wctype.h b/wctype/wctype.h
index ffa4b25808..8ab8d7b793 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -22,51 +22,55 @@
  */
 
 #ifndef _WCTYPE_H
-#define _WCTYPE_H	1
 
-#include <features.h>
-#include <bits/types.h>
+#ifndef __need_iswxxx
+# define _WCTYPE_H	1
 
-__BEGIN_DECLS
+# include <features.h>
+# include <bits/types.h>
 
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
-#define __need_wint_t
-#include <stddef.h>
-#ifndef _WINT_T
+# define __need_wint_t
+# include <stddef.h>
+# ifndef _WINT_T
 /* Integral type unchanged by default argument promotions that can
    hold any value corresponding to members of the extended character
    set, as well as at least one value that does not correspond to any
    member of the extended character set.  */
-# define _WINT_T
+#  define _WINT_T
 typedef unsigned int wint_t;
+# endif
+
+/* Constant expression of type `wint_t' whose value does not correspond
+   to any member of the extended character set.  */
+# ifndef WEOF
+#  define WEOF (0xffffffffu)
+# endif
 #endif
+#undef __need_iswxxx
 
-/* Scalar type that can hold values which represent locale-specific
-   character mappings.  */
-typedef __const unsigned int *wctrans_t;
+
+/* The following part is also used in the <wcsmbs.h> header when compiled
+   in the Unix98 compatibility mode.  */
+#ifndef __iswxxx_defined
+# define __iswxxx_defined	1
 
 /* Scalar type that can hold values which represent locale-specific
    character classifications.  */
 typedef unsigned long int wctype_t;
 
-/* Constant expression of type `wint_t' whose value does not correspond
-   to any member of the extended character set.  */
-#ifndef WEOF
-# define WEOF (0xffffffffu)
-#endif
-
-#ifndef _ISbit
+# ifndef _ISbit
 /* The characteristics are stored always in network byte order (big
    endian).  We define the bit value interpretations here dependent on the
    machine's byte order.  */
 
-# include <endian.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define _ISbit(bit)	(1 << bit)
-# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
-#  define _ISbit(bit)	(bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
-# endif
+#  include <endian.h>
+#  if __BYTE_ORDER == __BIG_ENDIAN
+#   define _ISbit(bit)	(1 << bit)
+#  else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#   define _ISbit(bit)	(bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
+#  endif
 
 enum
 {
@@ -83,9 +87,11 @@ enum
   _ISpunct = _ISbit (10),	/* Punctuation.  */
   _ISalnum = _ISbit (11)	/* Alphanumeric.  */
 };
-#endif /* Not _ISbit  */
+# endif /* Not _ISbit  */
 
 
+__BEGIN_DECLS
+
 /*
  * Wide-character classification functions: 7.15.2.1.
  */
@@ -157,54 +163,72 @@ extern int iswctype __P ((wint_t __wc, wctype_t __desc));
  * Wide-character case-mapping functions: 7.15.3.1.
  */
 
+/* Scalar type that can hold values which represent locale-specific
+   character mappings.  */
+typedef __const __int32_t *wctrans_t;
+
 /* Converts an uppercase letter to the corresponding lowercase letter.  */
 extern wint_t towlower __P ((wint_t __wc));
 
 /* Converts an lowercase letter to the corresponding uppercase letter.  */
 extern wint_t towupper __P ((wint_t __wc));
 
-/*
- * Extensible wide-character mapping functions: 7.15.3.2.
- */
-
-/* Construct value that describes a mapping between wide characters
-   identified by the string argument PROPERTY.  */
-extern wctrans_t wctrans __P ((__const char *__property));
-
 /* Map the wide character WC using the mapping described by DESC.  */
-extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc));
+extern wint_t __towctrans __P ((wint_t __wc, wctrans_t __desc));
 
 
+# ifndef __NO_WCTYPE
+#  define iswalnum(wc)	__iswctype ((wc), _ISalnum)
+#  define iswalpha(wc)	__iswctype ((wc), _ISalpha)
+#  define iswcntrl(wc)	__iswctype ((wc), _IScntrl)
+#  define iswdigit(wc)	__iswctype ((wc), _ISdigit)
+#  define iswlower(wc)	__iswctype ((wc), _ISlower)
+#  define iswgraph(wc)	__iswctype ((wc), _ISgraph)
+#  define iswprint(wc)	__iswctype ((wc), _ISprint)
+#  define iswpunct(wc)	__iswctype ((wc), _ISpunct)
+#  define iswspace(wc)	__iswctype ((wc), _ISspace)
+#  define iswupper(wc)	__iswctype ((wc), _ISupper)
+#  define iswxdigit(wc)	__iswctype ((wc), _ISxdigit)
+
+#  ifdef __USE_GNU
+#   define iswblank(wc)	__iswctype ((wc), _ISblank)
+#  endif
 
-#ifndef	__NO_WCTYPE
-# define iswalnum(wc)	__iswctype ((wc), _ISalnum)
-# define iswalpha(wc)	__iswctype ((wc), _ISalpha)
-# define iswcntrl(wc)	__iswctype ((wc), _IScntrl)
-# define iswdigit(wc)	__iswctype ((wc), _ISdigit)
-# define iswlower(wc)	__iswctype ((wc), _ISlower)
-# define iswgraph(wc)	__iswctype ((wc), _ISgraph)
-# define iswprint(wc)	__iswctype ((wc), _ISprint)
-# define iswpunct(wc)	__iswctype ((wc), _ISpunct)
-# define iswspace(wc)	__iswctype ((wc), _ISspace)
-# define iswupper(wc)	__iswctype ((wc), _ISupper)
-# define iswxdigit(wc)	__iswctype ((wc), _ISxdigit)
-
-# ifdef	__USE_GNU
-#  define iswblank(wc)	__iswctype ((wc), _ISblank)
-# endif
 
 /* Pointer to conversion tables.  */
 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)
+#  define towlower(wc)	__towctrans ((wc), __ctype_tolower)
+#  define towupper(wc)	__towctrans ((wc), __ctype_toupper)
+
+# endif /* Not __NO_WCTYPE.  */
+
+__END_DECLS
+
+#endif	/* need iswxxx.  */
+
 
-#endif /* Not __NO_WCTYPE.  */
+/* The remaining definitions and declarations must not appear in the
+   <wcsmbs.h> header.  */
+#ifdef _WCTYPE_H
 
-#ifdef __USE_GNU
+/*
+ * Extensible wide-character mapping functions: 7.15.3.2.
+ */
+
+__BEGIN_DECLS
+
+/* Construct value that describes a mapping between wide characters
+   identified by the string argument PROPERTY.  */
+extern wctrans_t wctrans __P ((__const char *__property));
+
+/* Map the wide character WC using the mapping described by DESC.  */
+extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc));
+
+# ifdef __USE_GNU
 /* Declare the interface to extended locale model.  */
-# include <xlocale.h>
+#  include <xlocale.h>
 
 /* Test for any wide character for which `iswalpha' or `iswdigit' is
    true.  */
@@ -282,30 +306,32 @@ extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
 				  __locale_t __locale));
 
 
-# ifndef __NO_WCTYPE
-#  define __iswalnum_l(wc, loc)	 __iswctype_l ((wc), _ISalnum, (loc))
-#  define __iswalpha_l(wc, loc)	 __iswctype_l ((wc), _ISalpha, (loc))
-#  define __iswcntrl_l(wc, loc)	 __iswctype_l ((wc), _IScntrl, (loc))
-#  define __iswdigit_l(wc, loc)	 __iswctype_l ((wc), _ISdigit, (loc))
-#  define __iswlower_l(wc, loc)	 __iswctype_l ((wc), _ISlower, (loc))
-#  define __iswgraph_l(wc, loc)	 __iswctype_l ((wc), _ISgraph, (loc))
-#  define __iswprint_l(wc, loc)	 __iswctype_l ((wc), _ISprint, (loc))
-#  define __iswpunct_l(wc, loc)	 __iswctype_l ((wc), _ISpunct, (loc))
-#  define __iswspace_l(wc, loc)	 __iswctype_l ((wc), _ISspace, (loc))
-#  define __iswupper_l(wc, loc)	 __iswctype_l ((wc), _ISupper, (loc))
-#  define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISxdigit, (loc))
-
-#  define __iswblank_l(wc, loc)	 __iswctype_l ((wc), _ISblank, (loc))
-
-#  define __towlower_l(wc, loc)	 __towctrans_l ((wc), (loc)->__ctype_tolower, \
+#  ifndef __NO_WCTYPE
+#   define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISalnum, (loc))
+#   define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISalpha, (loc))
+#   define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _IScntrl, (loc))
+#   define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISdigit, (loc))
+#   define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISlower, (loc))
+#   define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISgraph, (loc))
+#   define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISprint, (loc))
+#   define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISpunct, (loc))
+#   define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISspace, (loc))
+#   define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISupper, (loc))
+#   define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISxdigit, (loc))
+
+#   define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISblank, (loc))
+
+#   define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
 						(loc))
-#  define __towupper_l(wc, loc)	 __towctrans_l ((wc), (loc)->__ctype_toupper, \
+#   define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \
 						(loc))
 
-# endif /* Not __NO_WCTYPE.  */
+#  endif /* Not __NO_WCTYPE.  */
 
-#endif /* Use GNU.  */
+# endif /* Use GNU.  */
 
 __END_DECLS
 
+#endif	/* __WCTYPE_H defined.  */
+
 #endif /* wctype.h  */