summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog189
-rw-r--r--Makeconfig2
-rwxr-xr-xconfigure277
-rw-r--r--configure.in2
-rw-r--r--elf/rtld.c1
-rw-r--r--gmon/gmon.c62
-rw-r--r--inet/rcmd.c2
-rw-r--r--math/Makefile11
-rw-r--r--math/cmathcalls.h8
-rw-r--r--math/libm-test.c253
-rw-r--r--math/math.h5
-rw-r--r--math/mathcalls.h24
-rw-r--r--nis/nis_call.c5
-rw-r--r--nis/nis_file.c22
-rw-r--r--nis/nis_free.c4
-rw-r--r--nis/nis_local_names.c33
-rw-r--r--nis/rpcsvc/nis.h4
-rw-r--r--nis/rpcsvc/ypclnt.h59
-rw-r--r--nis/ypclnt.c12
-rw-r--r--po/.cvsignore1
-rw-r--r--posix/getopt.c4
-rw-r--r--posix/getopt_init.c4
-rw-r--r--stdio-common/Makefile2
-rw-r--r--stdio-common/printf-parse.h27
-rw-r--r--stdio-common/printf.h17
-rw-r--r--stdio-common/printf_size.c250
-rw-r--r--stdio-common/vfprintf.c4
-rw-r--r--sysdeps/generic/setenv.c10
-rw-r--r--sysdeps/i386/huge_val.h16
-rw-r--r--sysdeps/libm-i387/e_scalb.S1
-rw-r--r--sysdeps/libm-i387/e_scalbf.S1
-rw-r--r--sysdeps/libm-i387/e_scalbl.S1
-rw-r--r--sysdeps/libm-ieee754/e_atan2l.c2
-rw-r--r--sysdeps/libm-ieee754/s_asinhl.c2
-rw-r--r--sysdeps/libm-ieee754/s_cexpf.c63
-rw-r--r--sysdeps/libm-ieee754/s_cexpl.c63
-rw-r--r--sysdeps/libm-ieee754/s_finitel.c2
-rw-r--r--sysdeps/libm-ieee754/s_fpclassifyl.c12
-rw-r--r--sysdeps/libm-ieee754/s_nan.c3
-rw-r--r--sysdeps/libm-ieee754/s_nanf.c3
-rw-r--r--sysdeps/libm-ieee754/s_nanl.c3
-rw-r--r--sysdeps/m68k/fpu/__math.h86
-rw-r--r--sysdeps/m68k/fpu/e_atan2.c100
-rw-r--r--sysdeps/m68k/fpu/e_atan2f.c5
-rw-r--r--sysdeps/m68k/fpu/e_atan2l.c5
-rw-r--r--sysdeps/m68k/fpu/e_pow.c137
-rw-r--r--sysdeps/m68k/fpu/e_powf.c5
-rw-r--r--sysdeps/m68k/fpu/e_powl.c5
-rw-r--r--sysdeps/m68k/fpu/s_exp2.c (renamed from sysdeps/m68k/fpu/s_logb.c)2
-rw-r--r--sysdeps/m68k/fpu/s_exp2f.c (renamed from sysdeps/m68k/fpu/s_logbf.c)2
-rw-r--r--sysdeps/m68k/fpu/s_exp2l.c (renamed from sysdeps/m68k/fpu/s_logbl.c)2
-rw-r--r--sysdeps/m68k/fpu/s_log2.c2
-rw-r--r--sysdeps/m68k/fpu/s_log2f.c2
-rw-r--r--sysdeps/m68k/fpu/s_log2l.c2
-rw-r--r--sysdeps/m68k/huge_val.h16
-rw-r--r--sysdeps/unix/sysv/linux/iovec.h48
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c30
-rw-r--r--sysdeps/unix/sysv/linux/msgget.c30
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c32
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c30
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip.h4
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c30
-rw-r--r--sysdeps/unix/sysv/linux/semget.c30
-rw-r--r--sysdeps/unix/sysv/linux/semop.c30
-rw-r--r--sysdeps/unix/sysv/linux/shmat.c36
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c30
-rw-r--r--sysdeps/unix/sysv/linux/shmdt.c32
-rw-r--r--sysdeps/unix/sysv/linux/shmget.c30
-rw-r--r--sysdeps/unix/sysv/linux/sys/kd.h26
-rw-r--r--sysvipc/sys/shm.h8
70 files changed, 1689 insertions, 574 deletions
diff --git a/ChangeLog b/ChangeLog
index ea83c11b61..7b6672c406 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,190 @@
+1997-03-25 02:15  Ulrich Drepper  <drepper@cygnus.com>
+
+	* gmon/gmon.c: Optimize a bit by using more sets of records to
+	write in a single writev call.
+
+	* math/math.h: Add definitions of macros __MATHCALLX and __MATHDECLX.
+	* math/mathcalls.h: Use __MATHCALLX for fabs, infnan, copysign,
+	nan, isnan, nextafter, trunc, __fpclassify and signbit to mark as
+	`const'.
+	Use __MATHDECLX for isinf and finite.
+
+	* sysdeps/generic/setenv.c [_LIBC]: Define __clearenv and make
+	clearenv a weak alias.
+
+	Implement complex exponential function.
+	* sysdeps/libm-ieee754/s_cexp.c: New file.
+	* sysdeps/libm-ieee754/s_cexpf.c: New file.
+	* sysdeps/libm-ieee754/s_cexpl.c: New file.
+
+	* sysdeps/libm-ieee754/s_nan.c: Define function as __nan and make
+	nan a weak alias.
+	* sysdeps/libm-ieee754/s_nanf.c: Likewise for nanf.
+	* sysdeps/libm-ieee754/s_nanl.c: Likewise for nanl.
+
+	* sysdeps/unix/sysv/linux/iovec.h: Don't use kernel header because
+	of type clashes.  Add all definitions here.
+
+	* sysdeps/unix/sysv/linux/shmat.c: Likewise.  Correct types according
+	to XPG4.2.
+	* sysdeps/unix/sysv/linux/shmdt.c: Likewise.
+	* sysdeps/unix/sysv/linux/msgrcv.c: Likewise.
+
+	* sysvipc/sys/shm.h (shmat, shmdt): Correct types.
+
+	* sysdeps/unix/sysv/linux/sys/kd.h: Define _LINUX_TYPES_H to avoid
+	use of kernel types.
+
+1997-03-25 00:00  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/netinet/ip.h (struct ip_timestamp):
+	Correct typos.  Reported by a sun <asun@zoology.washington.edu>.
+
+1997-03-20 21:58  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/libm-ieee754/s_asinhl.c: Fix sign of result.
+
+1997-03-20 16:20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/libm-ieee754/e_atan2l.c: Fix typo.
+
+1997-03-20 14:23  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/m68k/fpu/__math.h (__logb, logb): Don't define.
+	* sysdeps/m68k/fpu/s_logb.c: Removed.
+	* sysdeps/m68k/fpu/s_logbf.c: Removed.
+	* sysdeps/m68k/fpu/s_logbl.c: Removed.
+
+	* sysdeps/m68k/fpu/__math.h (__ieee754_atan2, __ieee754_pow):
+	Don't define here.
+	* sysdeps/m68k/fpu/e_atan2.c: Rewritten.
+	* sysdeps/m68k/fpu/e_pow.c: Likewise.
+	* sysdeps/m68k/fpu/e_atan2f.c: Based on e_atan2.c.
+	* sysdeps/m68k/fpu/e_atan2l.c: Likewise.
+	* sysdeps/m68k/fpu/e_powf.c: Based on e_pow.c.
+	* sysdeps/m68k/fpu/e_powl.c: Likewise.
+
+	* sysdeps/m68k/fpu/s_log2.c: New file.
+	* sysdeps/m68k/fpu/s_log2f.c: New file.
+	* sysdeps/m68k/fpu/s_log2l.c: New file.
+	* sysdeps/m68k/fpu/s_exp2.c: New file.
+	* sysdeps/m68k/fpu/s_exp2f.c: New file.
+	* sysdeps/m68k/fpu/s_exp2l.c: New file.
+
+1997-03-20 14:46  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makeconfig (all): Make sure this is always the default goal.
+
+1997-03-20 11:09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* math/libm-test.c: Increase epsilon in many places.  Fix many
+	typos.  Allow optinal argument also for short option.
+
+1997-03-20 11:09  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* math/Makefile ($(objpfx)$(tests)): Link against libm.
+
+1997-03-24 23:14  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/libm-ieee754/s_fpclassifyl.c: Correct recognition of
+	denormalized numbers.
+
+	* sysdeps/i386/huge_val.h: Remove references to byte order macros.
+	Don't include <endian.h>.
+
+1997-03-19 15:18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+	* sysdeps/m68k/huge_val.h: Remove references to byte order macros.
+	Don't include <endian.h>.
+
+1997-03-24 23:09  Ulrich Drepper  <drepper@cygnus.com>
+
+	* inet/rcmd.c (iruserok): Use access instead of euidaccess.
+
+1997-03-15 18:08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* math/cmathcalls.h: Remove whitespace before function name in use
+	of __MATHDECL macro, to make it compilable with a traditional
+	preprocessor.
+
+1997-03-24 15:31  Ulrich Drepper  <drepper@cygnus.com>
+
+	* configure.in: Use AC_PROG_CC instead of AC_PROG_TOOL to find
+	compiler.
+
+1997-03-24 02:34  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/libm-ieee754/s_finitel.c (__finitel): Shift return value
+	by 31 positions to get 0/1 result.
+	Patch by Joe Keane <jgk@jgk.org>.
+
+1997-03-23 12:15  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* posix/getopt.c (__getopt_nonoption_flags): Make it extern
+	to prevent from ld linking in getopt.o even if there is another
+	incompatible one.
+
+	* posix/getopt_init.c (__getopt_nonoption_flags): Remove extern.
+
+1997-03-23 23:30   Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* nis/nis_call.c (__do_niscall): Print message if cold start file
+	does not exist.
+	* nis/nis_file.c: Don't print error messages.
+	* nis/nis_local_name.c (nis_local_host): Fix pointer errors.
+	* nis/rpcsvc/ypclnt.h: Fix copyright and prototypes.
+	* nis/rpcsvc/nis.h: Likewise.
+	* nis/ypclnt.c: Fix prototypes.
+
+1997-03-24 01:36  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/libm-i387/e_scalb.S: Pop additional result before
+	returning.
+	* sysdeps/libm-i387/e_scalbf.S: Likewise.
+	* sysdeps/libm-i387/e_scalbl.S: Likewise.
+	Reported by Andreas Jaeger <aj@arthur.pfalz.de>.
+
+	* elf/rtld.c (dl_main): Set main_map->l_opencount to 1 also if
+	dynamic linker was called implicitly by the kernel.
+	Reported by Eric Youngdale <eric@andante.jic.com>.
+
+	* math/Makefile (CFLAGS-test-float.c, CFLAGS-test-double.c,
+	CFLAGS-test-longdouble.c): New variables.  Set to -fno-inline to
+	prevent clever optimizations which corrupt the tests.
+
+1997-03-23 21:33  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* math/libm-test.c (scalb_test): New function.
+	(sqrt_test): New function.
+	(scalbn_test): New function.
+	(ilogb_test): New function.
+	(main): Added calls for new test functions.
+	(ldexp_test): Add another test for ldexp(x,0).
+
+1997-03-23 12:35  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* math/libm-test.c (remquo_test): Correct messages so that they
+	match the tests.
+	(copysign_test): Likewise.
+
+1997-03-23 16:28  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdio-common/Makefile (routines): Add printf_size.
+
+	* stdio-common/printf.h: Add declarations for printf_size and
+	printf_size_info.
+
+	* stdio-common/printf-parse.h (__printf_arginfo_table): Correct
+	declaration.
+	(parse_one_spec): Test whether __printf_function_table is not NULL
+	before using registered handlers and don't test
+	__printf_arginfo_table.  Update nargs also when handler is
+	registered.
+
+	* stdio-common/vfprintf.c (vfprintf): Count number of specifiers
+	processed in fast loop.
+
+	* stdio-common/printf_size: New file.
+
 1997-03-23 02:11  Ulrich Drepper  <drepper@cygnus.com>
 
 	* time/sys/time.h: Make values ITIMER_* also available as macros.
@@ -43,7 +230,7 @@
 	New functions.  Test these functions.
 	(main): Call above new functions.
 
-1997-03-22 04:53  Ulrich Drepper  <drepper@cygnus.com>
+1997-03-22 04:53  Ulgmon_out_readrich Drepper  <drepper@cygnus.com>
 
 	* Net release 2.0.2.
 
diff --git a/Makeconfig b/Makeconfig
index 38437d4dd2..d026b46743 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -23,6 +23,8 @@ ifneq (,)
 This makefile requires GNU Make.
 endif
 
+all: # Make this the default goal
+
 ifneq "$(origin +included-Makeconfig)" "file"
 
 +included-Makeconfig := yes
diff --git a/configure b/configure
index 3edb97d984..f7bda11980 100755
--- a/configure
+++ b/configure
@@ -1120,34 +1120,39 @@ done
 test -n "$MSGFMT" || MSGFMT=":"
 
 
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1125: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
-  case $nonopt in
-  NONE) build_alias=$host_alias ;;
-  *) build_alias=$nonopt ;;
-  esac ;;
-esac
-
-build=`$ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
-  ac_tool_prefix=${host_alias}-
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1127: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_tool_prefix=
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
 fi
 
-# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1151: checking for $ac_word" >&5
+echo "configure:1156: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1155,15 +1160,33 @@ else
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  ac_prog_rejected=no
   for ac_dir in $PATH; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="${ac_tool_prefix}gcc"
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+	continue
+      fi
+      ac_cv_prog_CC="cc"
       break
     fi
   done
   IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
 fi
 fi
 CC="$ac_cv_prog_CC"
@@ -1173,13 +1196,105 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1204: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 1214 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:1218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
+  else
+    ac_cv_prog_cc_cross=yes
+  fi
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1238: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
 
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1243: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
+else
+  ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1267: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+  if test "$ac_test_CFLAGS" = set; then
+    CFLAGS="$ac_save_CFLAGS"
+  elif test $ac_cv_prog_cc_g = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
 
 if test $host != $build; then
   # Extract the first word of "gcc cc", so it can be a program name with args.
 set dummy gcc cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1183: checking for $ac_word" >&5
+echo "configure:1298: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_BUILD_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1206,7 +1321,7 @@ fi
 
 fi
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1210: checking how to run the C preprocessor" >&5
+echo "configure:1325: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1221,13 +1336,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1225 "configure"
+#line 1340 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1346: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1238,13 +1353,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1242 "configure"
+#line 1357 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1266,10 +1381,34 @@ else
 fi
 echo "$ac_t""$CPP" 1>&6
 
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1386: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+  case $nonopt in
+  NONE) build_alias=$host_alias ;;
+  *) build_alias=$nonopt ;;
+  esac ;;
+esac
+
+build=`$ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1273: checking for $ac_word" >&5
+echo "configure:1412: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1300,7 +1439,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1304: checking for $ac_word" >&5
+echo "configure:1443: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1331,7 +1470,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1335: checking for $ac_word" >&5
+echo "configure:1474: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1366,7 +1505,7 @@ fi
 # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1370: checking for $ac_word" >&5
+echo "configure:1509: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1407,7 +1546,7 @@ if test "$BASH" = no; then
   # Extract the first word of "ksh", so it can be a program name with args.
 set dummy ksh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1411: checking for $ac_word" >&5
+echo "configure:1550: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1449,7 +1588,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1453: checking for signed size_t type" >&5
+echo "configure:1592: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1473,12 +1612,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1477: checking for libc-friendly stddef.h" >&5
+echo "configure:1616: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1482 "configure"
+#line 1621 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1493,7 +1632,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1512,7 +1651,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1516: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1655: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1535,7 +1674,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1539: checking for assembler global-symbol directive" >&5
+echo "configure:1678: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1565,7 +1704,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1569: checking for .set assembler directive" >&5
+echo "configure:1708: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1599,7 +1738,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:1603: checking for .symver assembler directive" >&5
+echo "configure:1742: checking for .symver assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1618,7 +1757,7 @@ fi
 
 echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:1622: checking for ld --version-script" >&5
+echo "configure:1761: checking for ld --version-script" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1635,7 +1774,7 @@ VERS {
 EOF
   if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
     if { ac_try='${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
-					-Wl,--version-script,conftest.map'; { (eval echo configure:1639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+					-Wl,--version-script,conftest.map'; { (eval echo configure:1778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -1665,7 +1804,7 @@ fi
 
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1669: checking for .previous assembler directive" >&5
+echo "configure:1808: checking for .previous assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1673,7 +1812,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1689,7 +1828,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1693: checking for .popsection assembler directive" >&5
+echo "configure:1832: checking for .popsection assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1697,7 +1836,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1717,12 +1856,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1721: checking for .init and .fini sections" >&5
+echo "configure:1860: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1726 "configure"
+#line 1865 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1731,7 +1870,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1756,19 +1895,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1760: checking for _ prefix on C symbol names" >&5
+echo "configure:1899: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1765 "configure"
+#line 1904 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1795,7 +1934,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1799: checking for assembler .weak directive" >&5
+echo "configure:1938: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1818,7 +1957,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1822: checking for assembler .weakext directive" >&5
+echo "configure:1961: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1855,7 +1994,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:1859: checking for ld --no-whole-archive" >&5
+echo "configure:1998: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1866,7 +2005,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c'; { (eval echo configure:1870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -1877,7 +2016,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:1881: checking for gcc -fno-exceptions" >&5
+echo "configure:2020: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1888,7 +2027,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c'; { (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:2031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -1940,7 +2079,7 @@ if test "$uname" = generic; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:1944: checking OS release for uname" >&5
+echo "configure:2083: 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
@@ -1962,7 +2101,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:1966: checking OS version for uname" >&5
+echo "configure:2105: 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
@@ -1984,7 +2123,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:1988: checking stdio selection" >&5
+echo "configure:2127: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -2189,14 +2328,14 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@LN_S@%$LN_S%g
 s%@MSGFMT@%$MSGFMT%g
+s%@CC@%$CC%g
+s%@BUILD_CC@%$BUILD_CC%g
+s%@CPP@%$CPP%g
 s%@build@%$build%g
 s%@build_alias@%$build_alias%g
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@BUILD_CC@%$BUILD_CC%g
-s%@CPP@%$CPP%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
 s%@BASH@%$BASH%g
diff --git a/configure.in b/configure.in
index f36bcaf1bf..1cf1290496 100644
--- a/configure.in
+++ b/configure.in
@@ -359,7 +359,7 @@ fi
 AC_PROG_LN_S
 AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
 
-AC_CHECK_TOOL(CC, gcc)
+AC_PROG_CC
 if test $host != $build; then
   AC_CHECK_PROG(BUILD_CC, gcc cc)
 fi
diff --git a/elf/rtld.c b/elf/rtld.c
index 295a6aed7d..d6bd516dfc 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -266,6 +266,7 @@ of this helper program; chances are you did not intend to run this program.\n",
       main_map->l_phdr = phdr;
       main_map->l_phnum = phent;
       main_map->l_entry = *user_entry;
+      main_map->l_opencount = 1;
     }
 
   /* Scan the program header table for the dynamic section.  */
diff --git a/gmon/gmon.c b/gmon/gmon.c
index e00b339367..f1ecb9e459 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -195,16 +195,23 @@ write_call_graph (fd)
      int fd;
 {
   u_char tag = GMON_TAG_CG_ARC;
-  struct gmon_cg_arc_record raw_arc
+  struct gmon_cg_arc_record raw_arc[4]
     __attribute__ ((aligned (__alignof__ (char*))));
   int from_index, to_index, from_len;
   u_long frompc;
 
-  struct iovec iov[2] =
+  struct iovec iov[8] =
     {
       { &tag, sizeof (tag) },
-      { &raw_arc, sizeof (struct gmon_cg_arc_record) }
+      { &raw_arc[0], sizeof (struct gmon_cg_arc_record) },
+      { &tag, sizeof (tag) },
+      { &raw_arc[1], sizeof (struct gmon_cg_arc_record) },
+      { &tag, sizeof (tag) },
+      { &raw_arc[2], sizeof (struct gmon_cg_arc_record) },
+      { &tag, sizeof (tag) },
+      { &raw_arc[3], sizeof (struct gmon_cg_arc_record) },
     };
+  int nfilled = 0;
 
   from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms);
   for (from_index = 0; from_index < from_len; ++from_index)
@@ -219,13 +226,19 @@ write_call_graph (fd)
 	   to_index != 0;
 	   to_index = _gmonparam.tos[to_index].link)
 	{
-	  *(char **) raw_arc.from_pc = (char *)frompc;
-	  *(char **) raw_arc.self_pc = (char *)_gmonparam.tos[to_index].selfpc;
-	  *(int *) raw_arc.count = _gmonparam.tos[to_index].count;
-
-	  __writev (fd, iov, 2);
+	  if (nfilled > 3)
+	    {
+	      __writev (fd, iov, 2 * nfilled);
+	      nfilled = 0;
+	    }
+	  *(char **) raw_arc[nfilled].from_pc = (char *)frompc;
+	  *(char **) raw_arc[nfilled].self_pc =
+	    (char *)_gmonparam.tos[to_index].selfpc;
+	  *(int *) raw_arc[nfilled].count = _gmonparam.tos[to_index].count;
+	  ++nfilled;
 	}
     }
+  __writev (fd, iov, 2 * nfilled);
 }
 
 
@@ -235,33 +248,50 @@ write_bb_counts (fd)
 {
   struct __bb *grp;
   u_char tag = GMON_TAG_BB_COUNT;
-  int ncounts;
-  int i;
+  size_t ncounts;
+  size_t i;
 
   struct iovec bbhead[2] =
     {
       { &tag, sizeof (tag) },
       { &ncounts, sizeof (ncounts) }
     };
-  struct iovec bbbody[2];
+  struct iovec bbbody[8];
+  size_t nfilled;
 
-  bbbody[0].iov_len = sizeof (grp->addresses[0]);
-  bbbody[1].iov_len = sizeof (grp->addresses[0]);
+  for (i = 0; i < (sizeof (bbbody) / sizeof (bbbody[0])); i += 2)
+    {
+      bbbody[i].iov_len = sizeof (grp->addresses[0]);
+      bbbody[i + 1].iov_len = sizeof (grp->counts[0]);
+    }
 
   /* Write each group of basic-block info (all basic-blocks in a
      compilation unit form a single group). */
 
+  nfilled = 0;
   for (grp = __bb_head; grp; grp = grp->next)
     {
       ncounts = grp->ncounts;
+      if (nfilled > 0)
+	{
+	  __writev (fd, bbbody, nfilled);
+	  nfilled = 0;
+	}
       __writev (fd, bbhead, 2);
       for (i = 0; i < ncounts; ++i)
 	{
-	  bbbody[0].iov_base = (char *) &grp->addresses[i];
-	  bbbody[1].iov_base = &grp->counts[i];
-	  __writev (fd, bbbody, 2);
+	  if (nfilled > (sizeof (bbbody) / sizeof (bbbody[0])) - 2)
+	    {
+	      __writev (fd, bbbody, nfilled);
+	      nfilled = 0;
+	    }
+
+	  bbbody[nfilled++].iov_base = (char *) &grp->addresses[i];
+	  bbbody[nfilled++].iov_base = &grp->counts[i];
 	}
     }
+  if (nfilled > 0)
+    __writev (fd, bbbody, nfilled);
 }
 
 
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 342c1c909e..d390a8d809 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -338,7 +338,7 @@ again:
 		 * reading an NFS mounted file system, can't read files that
 		 * are protected read/write owner only.
 		 */
-		if (__euidaccess (pbuf, R_OK) != 0)
+		if (__access (pbuf, R_OK) != 0)
 		  hostf = NULL;
 		else
 		  {
diff --git a/math/Makefile b/math/Makefile
index 31b3684997..d0c05835f5 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -49,7 +49,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt	\
 	     s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc	\
 	     s_remquo							\
-	     conj cimag creal cabs
+	     conj cimag creal cabs s_cexp
 libm-routines = $(libm-support) $(libm-calls) \
 		$(patsubst %_rf,%f_r,$(libm-calls:=f))	\
 		$(long-m-$(long-double-fcts))
@@ -73,6 +73,9 @@ tests = test-float test-double $(test-longdouble-$(long-double-fcts))
 # XXX This test is disabled for now since the functions are too buggy.
 #test-longdouble-yes = test-longdouble
 
+CFLAGS-test-float.c = -fno-inline
+CFLAGS-test-double.c = -fno-inline
+CFLAGS-test-longdouble.c = -fno-inline
 LDLIBS-test-float = libm
 LDLIBS-test-double = libm
 LDLIBS-test-longdouble = libm
@@ -116,3 +119,9 @@ override CFLAGS += -Wno-uninitialized -Wno-write-strings
 $(objpfx)libieee.a: $(objpfx)ieee-math.o
 	rm -f $@
 	ln $< $@
+
+ifeq ($(build-shared),yes)
+$(addprefix $(objpfx),$(tests)): $(objpfx)libm.so$(libm.so-version)
+else
+$(addprefix $(objpfx),$(tests)): $(objpfx)libm.a
+endif
diff --git a/math/cmathcalls.h b/math/cmathcalls.h
index 658c3a729d..b2a8382721 100644
--- a/math/cmathcalls.h
+++ b/math/cmathcalls.h
@@ -103,10 +103,10 @@ __MATHCALL (csqrt, (_Mdouble_complex_ __z));
 /* Absolute value, projections, conjugates, and projection.  */
 
 /* Absolute value of Z.  */
-__MATHDECL (_Mdouble_, cabs, (_Mdouble_complex_ __z));
+__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
 
 /* Argument value of Z.  */
-__MATHDECL (_Mdouble_, carg, (_Mdouble_complex_ __z));
+__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
 
 /* Complex conjugate of Z.  */
 __MATHCALL (conj, (_Mdouble_complex_ __z));
@@ -118,10 +118,10 @@ __MATHCALL (cproj, (_Mdouble_complex_ __z));
 /* Decomposing complex values.  */
 
 /* Imaginary part of Z.  */
-__MATHDECL (_Mdouble_, cimag, (_Mdouble_complex_ __z));
+__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
 
 /* Real part of Z.  */
-__MATHDECL (_Mdouble_, creal, (_Mdouble_complex_ __z));
+__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
 
 
 /* Now some optimized versions.  GCC has handy notations for these
diff --git a/math/libm-test.c b/math/libm-test.c
index 8995f85475..05acca2c53 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -40,10 +40,11 @@
 
 /* This program isn't finished yet.
    It has tests for acos, acosh, asin, asinh, atan, atan2, atanh,
-   cbrt, ceil, cos, cosh, exp, exp2, expm1, fabs, floor, fpclassify,
-   frexp, hypot, ldexp,
-   log, log10, log1p, log2, logb, modf,
-   pow, sin, sinh, tan, tanh.
+   cbrt, ceil, copysign, cos, cosh, exp, exp2, expm1,
+   fabs, fdim, floor, fmin, fmax, fpclassify,
+   frexp, hypot, ilogb, ldexp,
+   log, log10, log1p, log2, logb, modf, nextafter,
+   pow, scalb, scalbn, sin, sinh, sqrt, tan, tanh, trunc.
    Tests for the other libm-functions will come later.
 
    The routines using random variables are still under construction. I don't
@@ -70,6 +71,7 @@
 # define _GNU_SOURCE
 #endif
 
+#include <complex.h>
 #include <math.h>
 #include <float.h>
 
@@ -612,8 +614,8 @@ cos_test (void)
 		   INVALID_EXCEPTION);
 
   check_eps ("cos (pi/3) == 0.5", FUNC(cos) (M_PI / 3.0),
-	     0.5, CHOOSE (0, 1e-15L, 1e-7L));
-  check_eps ("cos (pi/2) == 0.5", FUNC(cos) (M_PI_2),
+	     0.5, CHOOSE (4e-18L, 1e-15L, 1e-7L));
+  check_eps ("cos (pi/2) == 0", FUNC(cos) (M_PI_2),
 	     0, CHOOSE (1e-19L, 1e-16L, 1e-7L));
 
 }
@@ -638,7 +640,7 @@ exp_test (void)
   check_isinfp ("exp (+inf) == +inf", FUNC(exp) (plus_infty));
   check ("exp (-inf) == 0", FUNC(exp) (minus_infty), 0);
 
-  check ("exp (1) == e", FUNC(exp) (1), M_E);
+  check_eps ("exp (1) == e", FUNC(exp) (1), M_E, CHOOSE (4e-18L, 0, 0));
 }
 
 
@@ -665,7 +667,8 @@ expm1_test (void)
   check_isinfp ("expm1 (+inf) == +inf", FUNC(expm1) (plus_infty));
   check ("expm1 (-inf) == -1", FUNC(expm1) (minus_infty), -1);
 
-  check ("expm1 (1) == e-1", FUNC(expm1) (1), M_E - 1.0);
+  check_eps ("expm1 (1) == e-1", FUNC(expm1) (1), M_E - 1.0,
+	     CHOOSE (4e-18L, 0, 0));
 }
 
 
@@ -776,8 +779,35 @@ fpclassify_test (void)
 
 
 static void
+ilogb_test (void)
+{
+
+  /* XXX Are these tests correct? I couldn't find any specification */
+#if 0
+  /* the source suggests that the following calls should fail -
+     but shall we test these special cases or just ignore them? */
+  check_isinfp ("ilogb (+inf) == +inf", FUNC(ilogb) (plus_infty));
+  check_isinfp ("ilogb (-inf) == +inf", FUNC(ilogb) (minus_infty));
+
+  check_isinfn_exc ("ilogb (+0) == -inf plus divide-by-zero exception",
+		    FUNC(ilogb) (0), DIVIDE_BY_ZERO_EXCEPTION);
+
+  check_isinfn_exc ("ilogb (-0) == -inf plus divide-by-zero exception",
+		    FUNC(ilogb) (minus_zero), DIVIDE_BY_ZERO_EXCEPTION);
+#endif
+  check ("ilogb (1) == 0", FUNC(ilogb) (1), 0);
+  check ("ilogb (e) == 1", FUNC(ilogb) (M_E), 1);
+  check ("ilogb (1024) == 10", FUNC(ilogb) (1024), 10);
+  check ("ilogb (-2000) == 10", FUNC(ilogb) (-2000), 10);
+
+}
+
+
+static void
 ldexp_test (void)
 {
+  MATHTYPE x;
+
   check ("ldexp (0, 0) == 0", FUNC(ldexp) (0, 0), 0);
 
   check_isinfp ("ldexp (+inf, 1) == +inf", FUNC(ldexp) (plus_infty, 1));
@@ -786,6 +816,10 @@ ldexp_test (void)
 
   check ("ldexp (0.8, 4) == 12.8", FUNC(ldexp) (0.8L, 4), 12.8L);
   check ("ldexp (-0.854375, 5) == -27.34", FUNC(ldexp) (-0.854375L, 5), -27.34L);
+
+  x = random_greater (0.0);
+  check_ext ("ldexp (x, 0) == x", FUNC(ldexp) (x, 0L), x, x);
+
 }
 
 
@@ -803,10 +837,12 @@ log_test (void)
 		   FUNC(log) (-1), INVALID_EXCEPTION);
   check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty));
 
-  check_eps ("log (e) == 1", FUNC(log) (M_E), 1, CHOOSE (0, 0, 9e-8L));
-  check ("log (1/e) == -1", FUNC(log) (1.0 / M_E), -1);
+  check_eps ("log (e) == 1", FUNC(log) (M_E), 1, CHOOSE (1e-18L, 0, 9e-8L));
+  check_eps ("log (1/e) == -1", FUNC(log) (1.0 / M_E), -1,
+	     CHOOSE (2e-18L, 0, 0));
   check ("log (2) == M_LN2", FUNC(log) (2), M_LN2);
-  check ("log (10) == M_LN10", FUNC(log) (10), M_LN10);
+  check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10,
+	     CHOOSE (1e-18L, 0, 0));
 }
 
 
@@ -825,12 +861,15 @@ log10_test (void)
 
   check_isinfp ("log10 (+inf) == +inf", FUNC(log10) (plus_infty));
 
-  check ("log10 (0.1) == -1", FUNC(log10) (0.1L), -1);
-  check ("log10 (10) == 1", FUNC(log10) (10.0), 1);
-  check ("log10 (100) == 2", FUNC(log10) (100.0), 2);
+  check_eps ("log10 (0.1) == -1", FUNC(log10) (0.1L), -1,
+	     CHOOSE (1e-18L, 0, 0));
+  check_eps ("log10 (10) == 1", FUNC(log10) (10.0), 1,
+	     CHOOSE (1e-18L, 0, 0));
+  check_eps ("log10 (100) == 2", FUNC(log10) (100.0), 2,
+	     CHOOSE (1e-18L, 0, 0));
   check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
   check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_E), M_LOG10E,
-	     CHOOSE (9e-20, 0, 9e-8));
+	     CHOOSE (1e-18, 0, 9e-8));
 }
 
 
@@ -847,7 +886,8 @@ log1p_test (void)
 
   check_isinfp ("log1p (+inf) == +inf", FUNC(log1p) (plus_infty));
 
-  check ("log1p (e-1) == 1", FUNC(log1p) (M_E - 1.0), 1);
+  check_eps ("log1p (e-1) == 1", FUNC(log1p) (M_E - 1.0), 1,
+	     CHOOSE (1e-18L, 0, 0));
 
 }
 
@@ -934,6 +974,44 @@ modf_test (void)
 
 
 static void
+scalb_test (void)
+{
+  MATHTYPE x;
+
+  check ("scalb (0, 0) == 0", FUNC(scalb) (0, 0), 0);
+
+  check_isinfp ("scalb (+inf, 1) == +inf", FUNC(scalb) (plus_infty, 1));
+  check_isinfn ("scalb (-inf, 1) == -inf", FUNC(scalb) (minus_infty, 1));
+  check_isnan ("scalb (NaN, 1) == NaN", FUNC(scalb) (nan_value, 1));
+
+  check ("scalb (0.8, 4) == 12.8", FUNC(scalb) (0.8L, 4), 12.8L);
+  check ("scalb (-0.854375, 5) == -27.34", FUNC(scalb) (-0.854375L, 5), -27.34L);
+
+  x = random_greater (0.0);
+  check_ext ("scalb (x, 0) == x", FUNC(scalb) (x, 0L), x, x);
+}
+
+
+static void
+scalbn_test (void)
+{
+  MATHTYPE x;
+
+  check ("scalbn (0, 0) == 0", FUNC(scalbn) (0, 0), 0);
+
+  check_isinfp ("scalbn (+inf, 1) == +inf", FUNC(scalbn) (plus_infty, 1));
+  check_isinfn ("scalbn (-inf, 1) == -inf", FUNC(scalbn) (minus_infty, 1));
+  check_isnan ("scalbn (NaN, 1) == NaN", FUNC(scalbn) (nan_value, 1));
+
+  check ("scalbn (0.8, 4) == 12.8", FUNC(scalbn) (0.8L, 4), 12.8L);
+  check ("scalbn (-0.854375, 5) == -27.34", FUNC(scalbn) (-0.854375L, 5), -27.34L);
+
+  x = random_greater (0.0);
+  check_ext ("scalbn (x, 0) == x", FUNC(scalbn) (x, 0L), x, x);
+}
+
+
+static void
 sin_test (void)
 {
   check ("sin (+0) == +0", FUNC(sin) (0), 0);
@@ -945,7 +1023,8 @@ sin_test (void)
 		   FUNC(sin) (minus_infty),
 		   INVALID_EXCEPTION);
 
-  check ("sin (pi/6) == 0.5", FUNC(sin) (M_PI / 6.0), 0.5);
+  check_eps ("sin (pi/6) == 0.5", FUNC(sin) (M_PI / 6.0), 0.5,
+	     CHOOSE (4e-18L, 0, 0));
   check ("sin (pi/2) == 1", FUNC(sin) (M_PI_2), 1);
 }
 
@@ -964,14 +1043,15 @@ sinh_test (void)
 static void
 tan_test (void)
 {
-  check ("tan (+0) == -0", FUNC(tan) (0), 0);
+  check ("tan (+0) == +0", FUNC(tan) (0), 0);
   check ("tan (-0) == -0", FUNC(tan) (minus_zero), minus_zero);
   check_isnan_exc ("tan (+inf) == NaN plus invalid exception",
 		   FUNC(tan) (plus_infty), INVALID_EXCEPTION);
   check_isnan_exc ("tan (-inf) == NaN plus invalid exception",
 		   FUNC(tan) (minus_infty), INVALID_EXCEPTION);
 
-  check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4), 1, CHOOSE (0, 1e-15L, 0));
+  check_eps ("tan (pi/4) == 1", FUNC(tan) (M_PI_4), 1,
+	     CHOOSE (2e-18L, 1e-15L, 0));
 }
 
 
@@ -1067,15 +1147,15 @@ pow_test (void)
   check ("pow (-0.9, +inf) == +0", FUNC(pow) (-0.9L, plus_infty), 0);
   check ("pow (-1e-7, +inf) == +0", FUNC(pow) (-1e-7L, plus_infty), 0);
 
-  check ("pow (+1.1, -inf) == +inf", FUNC(pow) (1.1, minus_infty), 0);
-  check ("pow (+inf, -inf) == +inf", FUNC(pow) (plus_infty, minus_infty), 0);
-  check ("pow (-1.1, -inf) == +inf", FUNC(pow) (-1.1, minus_infty), 0);
-  check ("pow (-inf, -inf) == +inf", FUNC(pow) (minus_infty, minus_infty), 0);
+  check ("pow (+1.1, -inf) == 0", FUNC(pow) (1.1, minus_infty), 0);
+  check ("pow (+inf, -inf) == 0", FUNC(pow) (plus_infty, minus_infty), 0);
+  check ("pow (-1.1, -inf) == 0", FUNC(pow) (-1.1, minus_infty), 0);
+  check ("pow (-inf, -inf) == 0", FUNC(pow) (minus_infty, minus_infty), 0);
 
-  check_isinfp ("pow (0.9, -inf) == +0", FUNC(pow) (0.9L, minus_infty));
-  check_isinfp ("pow (1e-7, -inf) == +0", FUNC(pow) (1e-7L, minus_infty));
-  check_isinfp ("pow (-0.9, -inf) == +0", FUNC(pow) (-0.9L, minus_infty));
-  check_isinfp ("pow (-1e-7, -inf) == +0", FUNC(pow) (-1e-7L, minus_infty));
+  check_isinfp ("pow (0.9, -inf) == +inf", FUNC(pow) (0.9L, minus_infty));
+  check_isinfp ("pow (1e-7, -inf) == +inf", FUNC(pow) (1e-7L, minus_infty));
+  check_isinfp ("pow (-0.9, -inf) == +inf", FUNC(pow) (-0.9L, minus_infty));
+  check_isinfp ("pow (-1e-7, -inf) == +inf", FUNC(pow) (-1e-7L, minus_infty));
 
   check_isinfp ("pow (+inf, 1e-7) == +inf", FUNC(pow) (plus_infty, 1e-7L));
   check_isinfp ("pow (+inf, 1) == +inf", FUNC(pow) (plus_infty, 1));
@@ -1121,11 +1201,11 @@ pow_test (void)
 
   check_isnan_exc ("pow (+1, +inf) == NaN", FUNC(pow) (1, plus_infty),
 		   INVALID_EXCEPTION);
-  check_isnan_exc ("pow (-1, +inf) == NaN", FUNC(pow) (1, plus_infty),
+  check_isnan_exc ("pow (-1, +inf) == NaN", FUNC(pow) (-1, plus_infty),
 		   INVALID_EXCEPTION);
-  check_isnan_exc ("pow (+1, -inf) == NaN", FUNC(pow) (1, plus_infty),
+  check_isnan_exc ("pow (+1, -inf) == NaN", FUNC(pow) (1, minus_infty),
 		   INVALID_EXCEPTION);
-  check_isnan_exc ("pow (-1, -inf) == NaN", FUNC(pow) (1, plus_infty),
+  check_isnan_exc ("pow (-1, -inf) == NaN", FUNC(pow) (-1, minus_infty),
 		   INVALID_EXCEPTION);
 
   check_isnan_exc ("pow (-0.1, 1.1) == NaN", FUNC(pow) (-0.1, 1.1),
@@ -1165,7 +1245,7 @@ pow_test (void)
   check ("pow (-0, 2) == +0", FUNC(pow) (minus_zero, 2), 0);
   check ("pow (-0, 11.1) == +0", FUNC(pow) (minus_zero, 11.1), 0);
 
-  x = random_greater (0.0);
+  x = random_greater (1.0);
   check_isinfp_ext ("pow (x, +inf) == +inf for |x| > 1",
 		    FUNC(pow) (x, plus_infty), x);
 
@@ -1173,7 +1253,7 @@ pow_test (void)
   check_ext ("pow (x, +inf) == +0 for |x| < 1",
 	     FUNC(pow) (x, plus_infty), 0.0, x);
 
-  x = random_greater (0.0);
+  x = random_greater (1.0);
   check_ext ("pow (x, -inf) == +0 for |x| > 1",
 	     FUNC(pow) (x, minus_infty), 0.0, x);
 
@@ -1202,7 +1282,7 @@ pow_test (void)
 	     FUNC(pow) (minus_infty, x), minus_zero, x);
 
   x = ((rand () % 1000000) + 1) * -2.0;	/* Get random even integer < 0 */
-  check_ext ("pow (-inf, y) == 0 for y < 0 and not an odd integer",
+  check_ext ("pow (-inf, y) == +0 for y < 0 and not an odd integer",
 	     FUNC(pow) (minus_infty, x), 0.0, x);
 
   x = (rand () % 1000000) * 2.0 + 1;	/* Get random odd integer > 0 */
@@ -1372,11 +1452,11 @@ copysign_test (void)
 	 minus_zero);
 
   /* XXX More correctly we would have to check the sign of the NaN.  */
-  check_isnan ("copysign (+NaN, 0) = +inf", FUNC(copysign) (nan_value, 0));
-  check_isnan ("copysign (+NaN, -0) = -inf", FUNC(copysign) (nan_value,
+  check_isnan ("copysign (+NaN, 0) = +NaN", FUNC(copysign) (nan_value, 0));
+  check_isnan ("copysign (+NaN, -0) = -NaN", FUNC(copysign) (nan_value,
 							     minus_zero));
-  check_isnan ("copysign (-NaN, 0) = +inf", FUNC(copysign) (-nan_value, 0));
-  check_isnan ("copysign (-NaN, -0) = -inf", FUNC(copysign) (-nan_value,
+  check_isnan ("copysign (-NaN, 0) = +NaN", FUNC(copysign) (-nan_value, 0));
+  check_isnan ("copysign (-NaN, -0) = -NaN", FUNC(copysign) (-nan_value,
 							     minus_zero));
 }
 
@@ -1415,6 +1495,23 @@ trunc_test (void)
 
 
 static void
+sqrt_test (void)
+{
+  MATHTYPE x;
+
+
+  /* XXX Tests fuer negative x are missing */
+  check ("sqrt (0) == 0", FUNC(sqrt) (0), 0);
+  check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt) (nan_value));
+  check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt) (plus_infty));
+
+  x = random_value (0, 10000);
+  check_ext ("sqrt (x*x) == x", sqrt (x*x), x, x);
+  check ("sqrt (4) == 2", FUNC(sqrt) (4), 2);
+}
+
+
+static void
 remquo_test (void)
 {
   int quo;
@@ -1426,11 +1523,11 @@ remquo_test (void)
 
   result = FUNC(remquo) (-1.625, 1.0, &quo);
   check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
-  check ("remquo(-1.625, 1.0, &x) puts 1 in x", quo, -1);
+  check ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
 
   result = FUNC(remquo) (1.625, -1.0, &quo);
   check ("remquo(1.125, -1.0, &x) == 0.125", result, 0.125);
-  check ("remquo(1.125, -1.0, &x) puts 1 in x", quo, -1);
+  check ("remquo(1.125, -1.0, &x) puts -1 in x", quo, -1);
 
   result = FUNC(remquo) (-1.625, -1.0, &quo);
   check ("remquo(-1.125, -1.0, &x) == 0.125", result, 0.125);
@@ -1439,6 +1536,40 @@ remquo_test (void)
 
 
 static void
+cexp_test (void)
+{
+  __complex__ MATHTYPE result;
+
+  result = FUNC(cexp) (plus_zero + 1.0i * plus_zero);
+  check ("real(cexp(0 + 0i)) = 1", __real__ result, 1);
+  check ("imag(cexp(0 + 0i)) = 0", __imag__ result, 0);
+  result = FUNC(cexp) (minus_zero + 1.0i * plus_zero);
+  check ("real(cexp(-0 + 0i)) = 1", __real__ result, 1);
+  check ("imag(cexp(-0 + 0i)) = 0", __imag__ result, 0);
+  result = FUNC(cexp) (plus_zero + 1.0i * minus_zero);
+  check ("real(cexp(0 - 0i)) = 1", __real__ result, 1);
+  check ("imag(cexp(0 - 0i)) = 0", __imag__ result, 0);
+  result = FUNC(cexp) (minus_zero + 1.0i * minus_zero);
+  check ("real(cexp(-0 - 0i)) = 1", __real__ result, 1);
+  check ("imag(cexp(-0 - 0i)) = 0", __imag__ result, 0);
+
+  result = FUNC(cexp) (plus_infty + 1.0i * plus_zero);
+  check_isinfp ("real(cexp(+inf + 0i)) = +inf", __real__ result);
+  check ("imag(cexp(+inf + 0i)) = 0", __imag__ result, 0);
+  result = FUNC(cexp) (plus_infty + 1.0i * minus_zero);
+  check_isinfp ("real(cexp(+inf - 0i)) = +inf", __real__ result);
+  check ("imag(cexp(+inf - 0i)) = 0", __imag__ result, 0);
+
+  result = FUNC(cexp) (minus_infty + 1.0i * plus_zero);
+  check ("real(cexp(-inf + 0i)) = 0", __real__ result, 0);
+  check ("imag(cexp(-inf + 0i)) = 0", __imag__ result, 0);
+  result = FUNC(cexp) (minus_infty + 1.0i * minus_zero);
+  check ("real(cexp(-inf - 0i)) = 0", __real__ result, 0);
+  check ("imag(cexp(-inf - 0i)) = 0", __imag__ result, 0);
+}
+
+
+static void
 inverse_func_pair_test (const char *test_name,
 			mathfunc f1, mathfunc inverse,
 			MATHTYPE x, MATHTYPE epsilon)
@@ -1461,23 +1592,23 @@ static void
 inverse_functions (void)
 {
   inverse_func_pair_test ("asin(sin(x)) == x",
-			FUNC(sin), FUNC(asin), 1.0, CHOOSE (0, 0, 1e-7L));
+			FUNC(sin), FUNC(asin), 1.0, CHOOSE (2e-18L, 0, 1e-7L));
   inverse_func_pair_test ("sin(asin(x)) == x",
 			  FUNC(asin), FUNC(sin), 1.0, 0.0);
 
   inverse_func_pair_test ("acos(cos(x)) == x",
-		       FUNC(cos), FUNC(acos), 1.0, CHOOSE (0, 1e-15L, 0));
+		       FUNC(cos), FUNC(acos), 1.0, CHOOSE (4e-18L, 1e-15L, 0));
   inverse_func_pair_test ("cos(acos(x)) == x",
 			  FUNC(acos), FUNC(cos), 1.0, 0.0);
   inverse_func_pair_test ("atan(tan(x)) == x",
-			  FUNC(tan), FUNC(atan), 1.0, 0.0);
+			  FUNC(tan), FUNC(atan), 1.0, CHOOSE (2e-18L, 0, 0));
   inverse_func_pair_test ("tan(atan(x)) == x",
-		       FUNC(atan), FUNC(tan), 1.0, CHOOSE (0, 1e-15L, 0));
+		       FUNC(atan), FUNC(tan), 1.0, CHOOSE (2e-18L, 1e-15L, 0));
 
   inverse_func_pair_test ("asinh(sinh(x)) == x",
-		     FUNC(sinh), FUNC(asinh), 1.0, CHOOSE (1e-18L, 0, 0));
+		     FUNC(sinh), FUNC(asinh), 1.0, CHOOSE (1e-18L, 0, 1e-7));
   inverse_func_pair_test ("sinh(asinh(x)) == x",
-			  FUNC(asinh), FUNC(sinh), 1.0, 0.0);
+			  FUNC(asinh), FUNC(sinh), 1.0, CHOOSE (2e-18L, 0, 0));
 
   inverse_func_pair_test ("acosh(cosh(x)) == x",
 		FUNC(cosh), FUNC(acosh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
@@ -1485,7 +1616,7 @@ inverse_functions (void)
 			  FUNC(acosh), FUNC(cosh), 1.0, 0.0);
 
   inverse_func_pair_test ("atanh(tanh(x)) == x",
-		     FUNC(tanh), FUNC(atanh), 1.0, CHOOSE (0, 1e-15L, 0));
+		     FUNC(tanh), FUNC(atanh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
   inverse_func_pair_test ("tanh(atanh(x)) == x",
 			  FUNC(atanh), FUNC(tanh), 1.0, 0.0);
 
@@ -1556,17 +1687,17 @@ identities3_test (MATHTYPE x, MATHTYPE epsilon)
 static void
 identities (void)
 {
-  identities1_test (0.2L, CHOOSE (1e-19L, 0, 0));
-  identities1_test (0.9L, 0);
+  identities1_test (0.2L, CHOOSE (1e-18L, 0, 2e-7));
+  identities1_test (0.9L, CHOOSE (1e-18L, 0, 0));
   identities1_test (0, 0);
-  identities1_test (-1, CHOOSE (0, 0, 1e-7));
+  identities1_test (-1, CHOOSE (1e-18L, 0, 1e-7));
 
   identities2_test (0.2L, CHOOSE (0, 1e-16, 0));
   identities2_test (0.9L, CHOOSE (0, 1e-15, 0));
   identities2_test (0, 0);
   identities2_test (-1, CHOOSE (1e-18L, 1e-15, 0));
 
-  identities3_test (0.2L, CHOOSE (0, 0, 1e-7));
+  identities3_test (0.2L, CHOOSE (1e-18L, 0, 1e-7));
   identities3_test (0.9L, CHOOSE (1e-18L, 1e-15, 1e-6));
   identities3_test (0, CHOOSE (0, 0, 1e-6));
   identities3_test (-1, CHOOSE (1e-18L, 0, 1e-6));
@@ -1592,15 +1723,15 @@ basic_tests (void)
 
   this_does_nothing ();
 
-  check_isinfp ("isinf (1/0) == +1", Inf_var);
-  check_isinfn ("isinf (-1/0) == -1", -Inf_var);
+  check_isinfp ("isinf (inf) == +1", Inf_var);
+  check_isinfn ("isinf (-inf) == -1", -Inf_var);
   check_bool ("!isinf (1)", !(FUNC(isinf) (one_var)));
-  check_bool ("!isinf (0/0)", !(FUNC(isinf) (NaN_var)));
+  check_bool ("!isinf (NaN)", !(FUNC(isinf) (NaN_var)));
 
-  check_isnan ("isnan (0/0)", NaN_var);
-  check_isnan ("isnan (-(0/0))", -NaN_var);
+  check_isnan ("isnan (NaN)", NaN_var);
+  check_isnan ("isnan (-NaN)", -NaN_var);
   check_bool ("!isnan (1)", !(FUNC(isnan) (one_var)));
-  check_bool ("!isnan (0/0)", !(FUNC(isnan) (Inf_var)));
+  check_bool ("!isnan (inf)", !(FUNC(isnan) (Inf_var)));
 
   check_bool ("inf == inf", Inf_var == Inf_var);
   check_bool ("-inf == -inf", -Inf_var == -Inf_var);
@@ -1647,10 +1778,11 @@ basic_tests (void)
 static void
 initialize (void)
 {
+  fpstack_test ("*init*");
   plus_zero = 0.0;
   nan_value = plus_zero / plus_zero;	/* Suppress GCC warning */
 
-  minus_zero = copysign (0.0, -1.0);
+  minus_zero = FUNC (copysign) (0.0, -1.0);
   plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
   minus_infty = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
 
@@ -1677,7 +1809,7 @@ parse_options (int argc, char *argv[])
 
   while (1)
     {
-      c = getopt_long (argc, argv, "vs",
+      c = getopt_long (argc, argv, "v::s",
 		       long_options, &option_index);
 
       /* Detect the end of the options. */
@@ -1727,6 +1859,7 @@ main (int argc, char *argv[])
 #endif
   expm1_test ();
   frexp_test ();
+  ilogb_test ();
   ldexp_test ();
   log_test ();
   log10_test ();
@@ -1736,6 +1869,8 @@ main (int argc, char *argv[])
 #endif
   logb_test ();
   modf_test ();
+  scalb_test ();
+  scalbn_test ();
   sin_test ();
   sinh_test ();
   tan_test ();
@@ -1750,11 +1885,13 @@ main (int argc, char *argv[])
   fmax_test ();
   nextafter_test ();
   copysign_test ();
+  sqrt_test ();
   trunc_test ();
 #if 0
   /* XXX I'm not sure what is the correct result.  */
   remquo_test ();
 #endif
+  cexp_test ();
 
   identities ();
   inverse_functions ();
diff --git a/math/math.h b/math/math.h
index 89c1cfa9bb..4d88f06673 100644
--- a/math/math.h
+++ b/math/math.h
@@ -48,6 +48,11 @@ __BEGIN_DECLS
 #define __MATHDECL(type, function,suffix, args) \
   __MATHDECL_1(type, function,suffix, args); \
   __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
+#define __MATHCALLX(function,suffix, args, attrib)	\
+  __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
+#define __MATHDECLX(type, function,suffix, args, attrib) \
+  __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
+  __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib)
 #define __MATHDECL_1(type, function,suffix, args) \
   extern type __MATH_PRECNAME(function,suffix) args
 
diff --git a/math/mathcalls.h b/math/mathcalls.h
index d529c1a8e2..d566020aee 100644
--- a/math/mathcalls.h
+++ b/math/mathcalls.h
@@ -147,7 +147,7 @@ __MATHCALL (cbrt,, (_Mdouble_ __x));
 __MATHCALL (ceil,, (_Mdouble_ __x));
 
 /* Absolute value of X.  */
-__MATHCALL (fabs,, (_Mdouble_ __x));
+__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
 
 /* Largest integer not greater than X.  */
 __MATHCALL (floor,, (_Mdouble_ __x));
@@ -159,10 +159,10 @@ __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
 #ifdef __USE_MISC
 /* Return 0 if VALUE is finite or NaN, +1 if it
    is +Infinity, -1 if it is -Infinity.  */
-__MATHDECL (int,isinf,, (_Mdouble_ __value));
+__MATHDECLX (int,isinf,, (_Mdouble_ __value), (__const__));
 
 /* Return nonzero if VALUE is finite and not NaN.  */
-__MATHDECL (int,finite,, (_Mdouble_ __value));
+__MATHDECLX (int,finite,, (_Mdouble_ __value), (__const__));
 
 /* Deal with an infinite or NaN result.
    If ERROR is ERANGE, result is +Inf;
@@ -170,7 +170,7 @@ __MATHDECL (int,finite,, (_Mdouble_ __value));
    otherwise result is NaN.
    This will set `errno' to either ERANGE or EDOM,
    and may return an infinity or NaN, or may do something else.  */
-__MATHCALL (infnan,, (int __error));
+__MATHCALLX (infnan,, (int __error), (__const__));
 
 /* Return X times (2 to the Nth power).  */
 __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
@@ -185,18 +185,18 @@ __MATHCALL (significand,, (_Mdouble_ __x));
 
 #if defined __USE_MISC || defined __USE_ISOC9X
 /* Return X with its signed changed to Y's.  */
-__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
+__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 #endif
 
 #ifdef __USE_ISOC9X
 /* Return representation of NaN for double type.  */
-__MATHCALL (nan,, (__const char *__tagb));
+__MATHCALLX (nan,, (__const char *__tagb), (__const__));
 #endif
 
 
 #if defined __USE_MISC || defined __USE_XOPEN
 /* Return nonzero if VALUE is not a number.  */
-__MATHDECL (int,isnan,, (_Mdouble_ __value));
+__MATHDECLX (int,isnan,, (_Mdouble_ __value), (__const__));
 
 /* Return the binary exponent of X, which must be nonzero.  */
 __MATHDECL (int,ilogb,, (_Mdouble_ __x));
@@ -235,7 +235,7 @@ __MATHCALL (lgamma,_r, (_Mdouble_, int *));
 __MATHCALL (rint,, (_Mdouble_ __x));
 
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
-__MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
+__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 
 /* Return the remainder of integer divison X / Y with infinite precision.  */
 __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
@@ -257,7 +257,7 @@ __MATHCALL (round,, (_Mdouble_ __x));
 
 /* Round X to the integral value in floating-point format nearest but
    not larger in magnitude.  */
-__MATHCALL (trunc,, (_Mdouble_ __x));
+__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
 
 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
    and magnitude congruent `mod 2^n' to the magnitude of the integral
@@ -276,8 +276,10 @@ __MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
 
 
 /* Classify given number.  */
-__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value));
+__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
+     __attribute__ ((__const__));
 
 /* Test for negative number.  */
-__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value));
+__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
+     __attribute__ ((__const__));
 #endif /* Use ISO C 9X.  */
diff --git a/nis/nis_call.c b/nis/nis_call.c
index cd1b6170d4..bf64558adc 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -176,7 +176,10 @@ __do_niscall (const nis_server *serv, int serv_len, u_long prog,
     {
       dir = readColdStartFile ();
       if (dir == NULL)
-	return NIS_UNAVAIL;
+	{
+	  fputs (_("Error: could not find a NIS_COLD_START file\n"), stderr);
+	  return NIS_UNAVAIL;
+	}
       server = dir->do_servers.do_servers_val;
       server_len = dir->do_servers.do_servers_len;
     }
diff --git a/nis/nis_file.c b/nis/nis_file.c
index ccff52f0bc..84818519b0 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -35,17 +35,11 @@ readColdStartFile (void)
 
   in = fopen (cold_start_file, "rb");
   if (in == NULL)
-    {
-      printf (_("Error while opening %s for reading: %m"), cold_start_file);
-      return NULL;
-    }
+    return NULL;
   memset (&obj, '\0', sizeof (obj));
   xdrstdio_create (&xdrs, in, XDR_DECODE);
   if (!xdr_directory_obj (&xdrs, &obj))
-    {
-      printf (_("Error while reading %s: %m"), cold_start_file);
-      return NULL;
-    }
+    return NULL;
 
   return nis_clone_directory (&obj, NULL);
 }
@@ -58,19 +52,11 @@ writeColdStartFile (const directory_obj *obj)
 
   out = fopen (cold_start_file, "wb");
   if (out == NULL)
-    {
-      printf (_("Error while opening %s for writing: %m"), cold_start_file);
-      return FALSE;
-    }
+    return FALSE;
 
   xdrstdio_create (&xdrs, out, XDR_ENCODE);
-  /* XXX The following cast is bad!  Shouldn't the XDR functions take
-     pointers to const objects?  */
   if (!xdr_directory_obj (&xdrs, (directory_obj *) obj))
-    {
-      printf (_("Error while writing %s: %m"), cold_start_file);
-      return FALSE;
-    }
+    return FALSE;
 
   return TRUE;
 }
diff --git a/nis/nis_free.c b/nis/nis_free.c
index 60399c1655..a4ab7378e6 100644
--- a/nis/nis_free.c
+++ b/nis/nis_free.c
@@ -69,7 +69,7 @@ nis_free_request (ib_request *ibreq)
 void
 nis_free_endpoints (endpoint *ep, unsigned int len)
 {
-  int i;
+  unsigned int i;
 
   if (ep == NULL)
     return;
@@ -97,7 +97,7 @@ nis_free_endpoints (endpoint *ep, unsigned int len)
 void
 nis_free_servers (nis_server *obj, unsigned int len)
 {
-  int i;
+  unsigned int i;
 
   if (obj == NULL)
     return;
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index 50120a6f73..e760f433b2 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -158,26 +158,29 @@ nis_local_host (void)
 
   if (__nishostname[0] == '\0')
     {
-      char *cp = __nishostname;
-
       if (gethostname (__nishostname, NIS_MAXNAMELEN) < 0)
-	cp = stpcpy (cp, "\0");
+	__nishostname[0] = '\0';
+      else
+	{
+	  char *cp;
+	  len = strlen(__nishostname);
 
-      len = cp - __nishostname;
+	  /* Hostname already fully qualified? */
+	  if (__nishostname[len - 1] == '.')
+	    return __nishostname;
 
-      /* Hostname already fully qualified? */
-      if (__nishostname[len - 1] == '.')
-	return __nishostname;
+	  if ((strlen (__nishostname) + strlen (nis_local_directory ()) + 1) >
+	      NIS_MAXNAMELEN)
+	    {
+	      __nishostname[0] = '\0';
+	      return __nishostname;
+	    }
 
-      if (strlen (__nishostname + strlen (nis_local_directory ()) + 1) >
-	  NIS_MAXNAMELEN)
-	{
-	  __nishostname[0] = '\0';
-	  return __nishostname;
+	  cp = &__nishostname[len];
+	  *cp++ = '.';
+	  strncpy (cp, nis_local_directory (), NIS_MAXNAMELEN - len -1);
+	  __nishostname[NIS_MAXNAMELEN] = '\0';
 	}
-
-      *cp++ = '.';
-      stpcpy (cp, nis_local_directory ());
     }
 
   return __nishostname;
diff --git a/nis/rpcsvc/nis.h b/nis/rpcsvc/nis.h
index c2c5319abd..b91ce19903 100644
--- a/nis/rpcsvc/nis.h
+++ b/nis/rpcsvc/nis.h
@@ -998,7 +998,11 @@ extern  nis_error * nis_updkeys_3();
 extern  nis_error * nis_updkeys_3_svc();
 #endif /* Old Style C */
 struct rpcgen_table {
+#if defined __cplusplus || __STDC__
+	char	*(*proc)(void);
+#else
 	char	*(*proc)();
+#endif
 	xdrproc_t	xdr_arg;
 	unsigned	len_arg;
 	xdrproc_t	xdr_res;
diff --git a/nis/rpcsvc/ypclnt.h b/nis/rpcsvc/ypclnt.h
index b61a498417..ed5e1e72d6 100644
--- a/nis/rpcsvc/ypclnt.h
+++ b/nis/rpcsvc/ypclnt.h
@@ -1,23 +1,22 @@
-/*
-** Copyright (c) 1996 Thorsten Kukuk, Germany
-**
-** This 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.
-** 
-** This 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 this library; if not, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Author: Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
-**
-*/
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
+
+   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	__RPCSVC_YPCLNT_H__
 #define	__RPCSVC_YPCLNT_H__
@@ -52,24 +51,26 @@
 __BEGIN_DECLS
 
 /* struct ypall_callback * is the arg which must be passed to yp_all */
-struct ypall_callback {
-	int (*foreach)();
-	char *data;
-};
+struct ypall_callback
+  {
+    int (*foreach) __P ((int __status, char *__key, int __keylen,
+			 char *__val, int __vallen, char *__data));
+    char *data;
+  };
 
 /* External NIS client function references. */
 extern int yp_bind __P ((__const char *));
 extern void yp_unbind __P ((__const char *));
 extern int yp_get_default_domain __P ((char **));
-extern int yp_match __P ((__const char *, __const char *, __const char *, 
+extern int yp_match __P ((__const char *, __const char *, __const char *,
 			  __const int, char **, int *));
-extern int yp_first __P ((__const char *, __const char *, char **, 
+extern int yp_first __P ((__const char *, __const char *, char **,
 			  int *, char **, int *));
-extern int yp_next __P ((__const char *, __const char *, __const char *, 
+extern int yp_next __P ((__const char *, __const char *, __const char *,
 			 __const int, char **, int *, char **, int *));
 extern int yp_master __P ((__const char *, __const char *, char **));
 extern int yp_order __P ((__const char *, __const char *, unsigned int *));
-extern int yp_all __P ((__const char *, __const char *, 
+extern int yp_all __P ((__const char *, __const char *,
 			__const struct ypall_callback *));
 extern __const char *yperr_string __P ((__const int));
 extern __const char *ypbinderr_string __P ((__const int));
@@ -81,7 +82,7 @@ extern int yp_maplist __P ((__const char *, struct ypmaplist **));
 #endif
 
 /* Exist only under BSD and Linux systems */
-extern int __yp_check __P ((char **)); 
+extern int __yp_check __P ((char **));
 
 __END_DECLS
 
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index b128ad6366..e4667f79a6 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -123,9 +123,9 @@ __yp_bind (const char *domain, dom_binding ** ypdb)
             }
 
           if (clnt_call (client, YPBINDPROC_DOMAIN,
-                         (xdrproc_t) xdr_domainname, &domain,
+                         (xdrproc_t) xdr_domainname, (caddr_t) &domain,
                          (xdrproc_t) xdr_ypbind_resp,
-                         &ypbr, TIMEOUT) != RPC_SUCCESS)
+                         (caddr_t) &ypbr, TIMEOUT) != RPC_SUCCESS)
             {
               clnt_destroy (client);
               if (is_new)
@@ -526,7 +526,8 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder)
 }
 
 static void *ypall_data;
-static int (*ypall_foreach) ();
+static int (*ypall_foreach) __P ((int status, char *key, int keylen,
+				  char *val, int vallen, char *data));
 
 static bool_t
 __xdr_ypresp_all (XDR * xdrs, u_long * objp)
@@ -628,8 +629,9 @@ yp_all (const char *indomain, const char *inmap,
       ypall_foreach = incallback->foreach;
       ypall_data = (void *) incallback->data;
 
-      result = clnt_call (clnt, YPPROC_ALL, (xdrproc_t) xdr_ypreq_nokey, &req,
-			  (xdrproc_t) __xdr_ypresp_all, &status, TIMEOUT);
+      result = clnt_call (clnt, YPPROC_ALL, (xdrproc_t) xdr_ypreq_nokey,
+			  (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all,
+			  (caddr_t) &status, TIMEOUT);
 
       if (result != RPC_SUCCESS)
 	{
diff --git a/po/.cvsignore b/po/.cvsignore
index 6f03266fbe..6733a7efc3 100644
--- a/po/.cvsignore
+++ b/po/.cvsignore
@@ -1 +1,2 @@
 [a-z]*.pot *.mo
+ttt
diff --git a/posix/getopt.c b/posix/getopt.c
index aa0c01ce59..47fdda8080 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -253,7 +253,9 @@ static int last_nonopt;
 /* Bash 2.0 gives us an environment variable containing flags
    indicating ARGV elements that should not be considered arguments.  */
 
-char *__getopt_nonoption_flags;
+/* Defined in getopt_init.c  */
+extern char *__getopt_nonoption_flags;
+
 static int nonoption_flags_max_len;
 static int nonoption_flags_len;
 
diff --git a/posix/getopt_init.c b/posix/getopt_init.c
index e90c9d7d8a..80b6f96254 100644
--- a/posix/getopt_init.c
+++ b/posix/getopt_init.c
@@ -29,8 +29,8 @@
 
 #include "../stdio-common/_itoa.h"
 
-/* External variable to synchronize work.  */
-extern char *__getopt_nonoption_flags;
+/* Variable to synchronize work.  */
+char *__getopt_nonoption_flags;
 
 extern pid_t __libc_pid;
 
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index d1d922ed36..b09a3a2eeb 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -26,7 +26,7 @@ headers	:= stdio_lim.h printf.h
 routines	:=							      \
 	ctermid cuserid							      \
 	vfprintf vprintf printf_fp reg-printf printf-prs _itoa printf_fphex   \
-	fprintf printf snprintf sprintf asprintf dprintf		      \
+	printf_size fprintf printf snprintf sprintf asprintf dprintf	      \
 	vfscanf 							      \
 	fscanf scanf sscanf						      \
 	perror psignal							      \
diff --git a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h
index 141164b04b..f1fecdb275 100644
--- a/stdio-common/printf-parse.h
+++ b/stdio-common/printf-parse.h
@@ -1,5 +1,5 @@
 /* Internal header for parsing printf format strings.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of th GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -106,8 +106,9 @@ find_spec (const char *format, mbstate_t *ps)
 }
 
 
-/* This is defined in reg-printf.c.  */
-extern printf_arginfo_function **__printf_arginfo_table;
+/* These are defined in reg-printf.c.  */
+extern printf_arginfo_function *__printf_arginfo_table[];
+extern printf_function **__printf_function_table;
 
 
 /* FORMAT must point to a '%' at the beginning of a spec.  Fills in *SPEC
@@ -299,8 +300,9 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
 
   /* Get the format specification.  */
   spec->info.spec = (wchar_t) *format++;
-  if (__printf_arginfo_table != NULL &&
-      __printf_arginfo_table[spec->info.spec] != NULL)
+  if (__printf_function_table != NULL
+      && spec->info.spec <= UCHAR_MAX
+      && __printf_arginfo_table[spec->info.spec] != NULL)
     /* We don't try to get the types for all arguments if the format
        uses more than one.  The normal case is covered though.  */
     spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
@@ -362,15 +364,14 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
 	  spec->ndata_args = 0;
 	  break;
 	}
+    }
 
-      if (spec->data_arg == -1 && spec->ndata_args > 0)
-	{
-	  /* There are args consumed, but no positional spec.
-	     Use the next sequential arg position.  */
-	  spec->data_arg = posn;
-	  posn += spec->ndata_args;
-	  nargs += spec->ndata_args;
-	}
+  if (spec->data_arg == -1 && spec->ndata_args > 0)
+    {
+      /* There are args consumed, but no positional spec.  Use the
+	 next sequential arg position.  */
+      spec->data_arg = posn;
+      nargs += spec->ndata_args;
     }
 
   if (spec->info.spec == L'\0')
diff --git a/stdio-common/printf.h b/stdio-common/printf.h
index 6d9e8a455f..c49172b88c 100644
--- a/stdio-common/printf.h
+++ b/stdio-common/printf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 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
@@ -122,6 +122,21 @@ enum
 #define	PA_FLAG_PTR		(1 << 11)
 
 
+
+/* Function which can be registered as `printf'-handlers.  */
+
+/* Print floating point value using using abbreviations for the orders
+   of magnitude used for numbers ('k' for kilo, 'm' for mega etc).  If
+   the format specifier is a uppercase character powers of 1000 are
+   used.  Otherwise powers of 1024.  */
+extern int printf_size __P ((FILE *__fp, __const struct printf_info *__info,
+			     __const void *__const *args));
+
+/* This is the appropriate argument information function for `printf_size'.  */
+extern int printf_size_info __P ((__const struct printf_info *__info,
+				  size_t __n, int *__argtypes));
+
+
 __END_DECLS
 
 #endif /* printf.h  */
diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
new file mode 100644
index 0000000000..0184269181
--- /dev/null
+++ b/stdio-common/printf_size.c
@@ -0,0 +1,250 @@
+/* Print size value using units for orders of magnitude.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+   Based on a proposal by Larry McVoy <lm@sgi.com>.
+
+   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 <ctype.h>
+#include <ieee754.h>
+#include <math.h>
+#include <printf.h>
+#ifdef USE_IN_LIBIO
+#  include <libioP.h>
+#else
+#  include <stdio.h>
+#endif
+
+
+/* This defines make it possible to use the same code for GNU C library and
+   the GNU I/O library.	 */
+#ifdef USE_IN_LIBIO
+#  define PUT(f, s, n) _IO_sputn (f, s, n)
+#  define PAD(f, c, n) _IO_padn (f, c, n)
+/* We use this file GNU C library and GNU I/O library.	So make
+   names equal.	 */
+#  undef putc
+#  define putc(c, f) _IO_putc_unlocked (c, f)
+#  define size_t     _IO_size_t
+#  define FILE	     _IO_FILE
+#else	/* ! USE_IN_LIBIO */
+#  define PUT(f, s, n) fwrite (s, 1, n, f)
+#  define PAD(f, c, n) __printf_pad (f, c, n)
+ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c.  */
+#endif	/* USE_IN_LIBIO */
+
+/* Macros for doing the actual output.  */
+
+#define outchar(ch)							      \
+  do									      \
+    {									      \
+      register const int outc = (ch);					      \
+      if (putc (outc, fp) == EOF)					      \
+	return -1;							      \
+      ++done;								      \
+    } while (0)
+
+#define PRINT(ptr, len)							      \
+  do									      \
+    {									      \
+      register size_t outlen = (len);					      \
+      if (len > 20)							      \
+	{								      \
+	  if (PUT (fp, ptr, outlen) != outlen)				      \
+	    return -1;							      \
+	  ptr += outlen;						      \
+	  done += outlen;						      \
+	}								      \
+      else								      \
+	{								      \
+	  while (outlen-- > 0)						      \
+	    outchar (*ptr++);						      \
+	}								      \
+    } while (0)
+
+#define PADN(ch, len)							      \
+  do									      \
+    {									      \
+      if (PAD (fp, ch, len) != len)					      \
+	return -1;							      \
+      done += len;							      \
+    }									      \
+  while (0)
+
+/* Prototype for helper functions.  */
+extern int __printf_fp (FILE *fp, const struct printf_info *info,
+			const void *const *args);
+
+
+int
+printf_size (FILE *fp, const struct printf_info *info, const void *const *args)
+{
+  /* Units for the both formats.  */
+  static const char units[2][8] =
+  {
+    " kmgtps",	/* For binary format.  */
+    " KMGTPS"	/* For decimal format.  */
+  };
+  const char *tag = units[isupper (info->spec) != 0];
+  int divisor = isupper (info->spec) ? 1000 : 1024;
+
+  /* The floating-point value to output.  */
+  union
+    {
+      union ieee754_double dbl;
+      union ieee854_long_double ldbl;
+    }
+  fpnum;
+  const void *ptr = &fpnum;
+
+  int negative = 0;
+
+  /* "NaN" or "Inf" for the special cases.  */
+  const char *special = NULL;
+
+  struct printf_info fp_info;
+  int done = 0;
+
+
+  /* Fetch the argument value.	*/
+  if (info->is_long_double && sizeof (long double) > sizeof (double))
+    {
+      fpnum.ldbl.d = *(const long double *) args[0];
+
+      /* Check for special values: not a number or infinity.  */
+      if (__isnanl (fpnum.ldbl.d))
+	{
+	  special = "nan";
+	  negative = 0;
+	}
+      else if (__isinfl (fpnum.ldbl.d))
+	{
+	  special = "inf";
+
+	  negative = fpnum.ldbl.d < 0;
+	}
+      else
+	while (fpnum.ldbl.d >= divisor && tag[1] != '\0')
+	  {
+	    fpnum.ldbl.d /= divisor;
+	    ++tag;
+	  }
+    }
+  else
+    {
+      fpnum.dbl.d = *(const double *) args[0];
+
+      /* Check for special values: not a number or infinity.  */
+      if (__isnan (fpnum.dbl.d))
+	{
+	  special = "nan";
+	  negative = 0;
+	}
+      else if (__isinf (fpnum.dbl.d))
+	{
+	  special = "inf";
+
+	  negative = fpnum.dbl.d < 0;
+	}
+      else
+	while (fpnum.dbl.d >= divisor && tag[1] != '\0')
+	  {
+	    fpnum.dbl.d /= divisor;
+	    ++tag;
+	  }
+    }
+
+  if (special)
+    {
+      int width = info->prec > info->width ? info->prec : info->width;
+
+      if (negative || info->showsign || info->space)
+	--width;
+      width -= 3;
+
+      if (!info->left && width > 0)
+	PADN (' ', width);
+
+      if (negative)
+	outchar ('-');
+      else if (info->showsign)
+	outchar ('+');
+      else if (info->space)
+	outchar (' ');
+
+      PRINT (special, 3);
+
+      if (info->left && width > 0)
+	PADN (' ', width);
+
+      return done;
+    }
+
+  /* Prepare to print the number.  We want to use `__printf_fp' so we
+     have to prepare a `printf_info' structure.  */
+  fp_info.spec = 'f';
+  fp_info.prec = info->prec < 0 ? 3 : info->prec;
+  fp_info.is_long_double = info->is_long_double;
+  fp_info.is_short = info->is_short;
+  fp_info.is_long = info->is_long;
+  fp_info.alt = info->alt;
+  fp_info.space = info->space;
+  fp_info.left = info->left;
+  fp_info.showsign = info->showsign;
+  fp_info.group = info->group;
+  fp_info.extra = info->extra;
+  fp_info.pad = info->pad;
+
+  if (fp_info.left && fp_info.pad == L' ')
+    {
+      /* We must do the padding ourself since the unit character must
+	 be placed before the padding spaces.  */
+      fp_info.width = 0;
+
+      done = __printf_fp (fp, &fp_info, &ptr);
+      if (done > 0)
+	{
+	  outchar (*tag);
+	  if (info->width > done)
+	    PADN (' ', info->width - done);
+	}
+    }
+  else
+    {
+      /* We can let __printf_fp do all the printing and just add our
+	 unit character afterwards.  */
+      fp_info.width = info->width - 1;
+
+      done = __printf_fp (fp, &fp_info, &ptr);
+      if (done > 0)
+	outchar (*tag);
+    }
+
+  return done;
+}
+
+/* This is the function used by `vfprintf' to determine number and
+   type of the arguments.  */
+int
+printf_size_info (const struct printf_info *info, size_t n, int *argtypes)
+{
+  /* We need only one double or long double argument.  */
+  if (n >= 1)
+    argtypes[0] = PA_DOUBLE | (info->is_long_double ? PA_FLAG_LONG_DOUBLE : 0);
+
+  return 1;
+}
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index c206c2f0ac..856c65dbb5 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1117,7 +1117,6 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       is_long = sizeof (size_t) > sizeof (unsigned int);
       JUMP (*++f, step4_jumps);
 
-
       /* Process current format.  */
       while (1)
 	{
@@ -1136,6 +1135,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 	  goto do_positional;
 	}
 
+      /* The format is correctly handled.  */
+      ++nspecs_done;
+
       /* Look for next format specifier.  */
       f = find_spec ((end_of_spec = ++f), &mbstate);
 
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index 94dc7472ec..11b5906a9d 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -56,6 +56,12 @@ __libc_lock_define_initialized (static, envlock)
 # define UNLOCK
 #endif
 
+/* In the GNU C library we must keep the namespace clean.  */
+#ifdef _LIBC
+# define clearenv __clearenv
+#endif
+
+
 /* If this variable is not a null pointer we allocated the current
    environment.  */
 static char **last_environ;
@@ -188,3 +194,7 @@ clearenv ()
 
   return 0;
 }
+#ifdef _LIBC
+# undef clearenv
+weak_alias (__clearenv, clearenv)
+#endif
diff --git a/sysdeps/i386/huge_val.h b/sysdeps/i386/huge_val.h
index 8af745f6c1..0aad84902c 100644
--- a/sysdeps/i386/huge_val.h
+++ b/sysdeps/i386/huge_val.h
@@ -23,16 +23,10 @@
 
 #include <features.h>
 #include <sys/cdefs.h>
-#include <endian.h>
 
 /* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__HUGE_VAL_bytes	{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define	__HUGE_VAL_bytes	{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
-#endif
 
 #define __huge_val_t	union { unsigned char __c[8]; double __d; }
 #ifdef	__GNUC__
@@ -48,12 +42,7 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 
 #ifdef __USE_ISOC9X
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__HUGE_VALF_bytes	{ 0x7f, 0x80, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define	__HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
-#endif
 
 #define __huge_valf_t	union { unsigned char __c[4]; float __f; }
 #ifdef	__GNUC__
@@ -65,12 +54,7 @@ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
 #endif	/* GCC.  */
 
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__HUGE_VALL_bytes	{ 0x7f, 0xff, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define	__HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
-#endif
 
 #define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
 #ifdef	__GNUC__
diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S
index db63dde56e..427a3b905e 100644
--- a/sysdeps/libm-i387/e_scalb.S
+++ b/sysdeps/libm-i387/e_scalb.S
@@ -11,5 +11,6 @@ ENTRY(__ieee754_scalb)
 	fldl	12(%esp)
 	fldl	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END(__ieee754_scalb)
diff --git a/sysdeps/libm-i387/e_scalbf.S b/sysdeps/libm-i387/e_scalbf.S
index 7de03db287..4c62134a0c 100644
--- a/sysdeps/libm-i387/e_scalbf.S
+++ b/sysdeps/libm-i387/e_scalbf.S
@@ -12,5 +12,6 @@ ENTRY(__ieee754_scalbf)
 	flds	8(%esp)
 	flds	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END(__ieee754_scalbf)
diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S
index 7b20cc6f9c..3b746ad363 100644
--- a/sysdeps/libm-i387/e_scalbl.S
+++ b/sysdeps/libm-i387/e_scalbl.S
@@ -13,5 +13,6 @@ ENTRY(__ieee754_scalbl)
 	fldt	16(%esp)
 	fldt	4(%esp)
 	fscale
+	fstp	%st(1)
 	ret
 END(__ieee754_scalbl)
diff --git a/sysdeps/libm-ieee754/e_atan2l.c b/sysdeps/libm-ieee754/e_atan2l.c
index 6b76f96533..e60f2d41c1 100644
--- a/sysdeps/libm-ieee754/e_atan2l.c
+++ b/sysdeps/libm-ieee754/e_atan2l.c
@@ -126,7 +126,7 @@ pi_lo   = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
 	    case 1: {
 	    	      u_int32_t sz;
 		      GET_LDOUBLE_EXP(sz,z);
-		      SET_LDOUBLE_EXP(z,sy ^ 0x8000);
+		      SET_LDOUBLE_EXP(z,sz ^ 0x8000);
 		    }
 		    return       z  ;	/* atan(-,+) */
 	    case 2: return  pi-(z-pi_lo);/* atan(+,-) */
diff --git a/sysdeps/libm-ieee754/s_asinhl.c b/sysdeps/libm-ieee754/s_asinhl.c
index 865bc31052..d5b307753e 100644
--- a/sysdeps/libm-ieee754/s_asinhl.c
+++ b/sysdeps/libm-ieee754/s_asinhl.c
@@ -65,6 +65,6 @@ huge=  1.000000000000000000e+4900L;
 	    t = x*x;
 	    w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
 	}
-	if(hx>0x7fff) return w; else return -w;
+	if(hx>0x8000) return -w; else return w;
 }
 weak_alias (__asinhl, asinhl)
diff --git a/sysdeps/libm-ieee754/s_cexpf.c b/sysdeps/libm-ieee754/s_cexpf.c
new file mode 100644
index 0000000000..14cfb19766
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_cexpf.c
@@ -0,0 +1,63 @@
+/* Return value of complex exponential function for float complex value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <complex.h>
+#include <math.h>
+
+
+__complex__ float
+__cexpf (__complex__ float x)
+{
+  __complex__ float retval;
+
+  if (isfinite (__real__ x))
+    {
+      if (isfinite (__imag__ x))
+	{
+	  retval = __expf (__real__ x) * (__cosf (__imag__ x)
+					  + 1i * __sinf (__imag__ x));
+	}
+      else
+	/* If the imaginary part is +-inf or NaN and the real part is
+	   not +-inf the result is NaN + iNan.  */
+	retval = __nanf ("") + 1.0i * __nanf ("");
+    }
+  else if (__isinff (__real__ x))
+    {
+      if (isfinite (__imag__ x))
+	{
+	  if (signbit (__real__ x) == 0 && __imag__ x == 0.0)
+	    retval = HUGE_VALF;
+	  else
+	    retval = ((signbit (__real__ x) ? 0.0 : HUGE_VALF)
+		      * (__cosf (__imag__ x) + 1i * __sinf (__imag__ x)));
+	}
+      else if (signbit (__real__ x))
+	retval = HUGE_VALF + 1.0i * __nanf ("");
+      else
+	retval = 0.0;
+    }
+  else
+    /* If the real part is NaN the result is NaN + iNan.  */
+    retval = __nanf ("") + 1.0i * __nanf ("");
+
+  return retval;
+}
+weak_alias (__cexpf, cexpf)
diff --git a/sysdeps/libm-ieee754/s_cexpl.c b/sysdeps/libm-ieee754/s_cexpl.c
new file mode 100644
index 0000000000..6b3d409158
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_cexpl.c
@@ -0,0 +1,63 @@
+/* Return value of complex exponential function for long double complex value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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 <complex.h>
+#include <math.h>
+
+
+__complex__ long double
+__cexpl (__complex__ long double x)
+{
+  __complex__ long double retval;
+
+  if (isfinite (__real__ x))
+    {
+      if (isfinite (__imag__ x))
+	{
+	  retval = __expl (__real__ x) * (__cosl (__imag__ x)
+					  + 1i * __sinl (__imag__ x));
+	}
+      else
+	/* If the imaginary part is +-inf or NaN and the real part is
+	   not +-inf the result is NaN + iNan.  */
+	retval = __nanl ("") + 1.0i * __nanl ("");
+    }
+  else if (__isinfl (__real__ x))
+    {
+      if (isfinite (__imag x))
+	{
+	  if (signbit (__real__ x) == 0 && __imag__ x == 0.0)
+	    retval = HUGE_VALL;
+	  else
+	    retval = ((signbit (__real__ x) ? 0.0 : HUGE_VALL)
+		      * (__cosl (__imag__ x) + 1i * __sinl (__imag__ x)));
+	}
+      else if (signbit (__real__ x))
+	retval = HUGE_VALL + 1.0i * __nanl ("");
+      else
+	retval = 0.0;
+    }
+  else
+    /* If the real part is NaN the result is NaN + iNan.  */
+    retval = __nanl ("") + 1.0i * __nanl ("");
+
+  return retval;
+}
+weak_alias (__cexpl, cexpl)
diff --git a/sysdeps/libm-ieee754/s_finitel.c b/sysdeps/libm-ieee754/s_finitel.c
index 4423726645..6e444e90d0 100644
--- a/sysdeps/libm-ieee754/s_finitel.c
+++ b/sysdeps/libm-ieee754/s_finitel.c
@@ -35,6 +35,6 @@ static char rcsid[] = "$NetBSD: $";
 {
 	int32_t exp;
 	GET_LDOUBLE_EXP(exp,x);
-	return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>15);
+	return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>31);
 }
 weak_alias (__finitel, finitel)
diff --git a/sysdeps/libm-ieee754/s_fpclassifyl.c b/sysdeps/libm-ieee754/s_fpclassifyl.c
index d7a0e943cf..4df0b44f75 100644
--- a/sysdeps/libm-ieee754/s_fpclassifyl.c
+++ b/sysdeps/libm-ieee754/s_fpclassifyl.c
@@ -2,6 +2,7 @@
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+   Fixed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
 
    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
@@ -26,19 +27,18 @@
 int
 __fpclassifyl (long double x)
 {
-  u_int32_t ex, hx, lx;
+  u_int32_t ex, hx, lx, m;
   int retval = FP_NORMAL;
 
   GET_LDOUBLE_WORDS (ex, hx, lx, x);
-  hx &= 0x7fffffff;
-  hx |= lx;
+  m = (hx & 0x7fffffff) | lx;
   ex &= 0x7fff;
-  if ((ex | hx) == 0)
+  if ((ex | m) == 0)
     retval = FP_ZERO;
-  else if (ex == 0)
+  else if (ex == 0 && (hx & 0x80000000) == 0)
     retval = FP_SUBNORMAL;
   else if (ex == 0x7fff)
-    retval = hx != 0 ? FP_NAN : FP_INFINITE;
+    retval = m != 0 ? FP_NAN : FP_INFINITE;
 
   return retval;
 }
diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c
index 58551c1ad5..0d065d5c72 100644
--- a/sysdeps/libm-ieee754/s_nan.c
+++ b/sysdeps/libm-ieee754/s_nan.c
@@ -31,7 +31,7 @@
 
 
 double
-nan (const char *tagp)
+__nan (const char *tagp)
 {
 #ifdef HANDLE_TAGP
   /* If we ever should have use of the TAGP parameter we will use the
@@ -45,3 +45,4 @@ nan (const char *tagp)
   return nan_value.d;
 #endif
 }
+weak_alias (__nan, nan)
diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c
index e965b94b33..660f30daf3 100644
--- a/sysdeps/libm-ieee754/s_nanf.c
+++ b/sysdeps/libm-ieee754/s_nanf.c
@@ -31,7 +31,7 @@
 
 
 float
-nanf (const char *tagp)
+__nanf (const char *tagp)
 {
 #ifdef HANDLE_TAGP
   /* If we ever should have use of the TAGP parameter we will use the
@@ -45,3 +45,4 @@ nanf (const char *tagp)
   return nan_value.f;
 #endif
 }
+weak_alias (__nanf, nanf)
diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c
index df0180ee46..4ade80424f 100644
--- a/sysdeps/libm-ieee754/s_nanl.c
+++ b/sysdeps/libm-ieee754/s_nanl.c
@@ -31,7 +31,7 @@
 
 
 long double
-nanl (const char *tagp)
+__nanl (const char *tagp)
 {
 #ifdef HANDLE_TAGP
   /* If we ever should have use of the TAGP parameter we will use the
@@ -46,3 +46,4 @@ nanl (const char *tagp)
   return nan_value.d;
 #endif
 }
+weak_alias (__nanl, nanl)
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h
index fe01c254d7..d6187015ea 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/__math.h
@@ -85,7 +85,6 @@ __inline_mathop(__fabs, abs)
 __inline_mathop(__rint, int)
 __inline_mathop(__expm1, etoxm1)
 __inline_mathop(__log1p, lognp1)
-__inline_mathop(__logb, log2)
 __inline_mathop(__significand, getman)
 
 __inline_mathop(__log2, log2)
@@ -103,7 +102,6 @@ __inline_mathop(tanh, tanh)
 __inline_mathop(rint, int)
 __inline_mathop(expm1, etoxm1)
 __inline_mathop(log1p, lognp1)
-__inline_mathop(logb, log2)
 #endif
 
 #ifdef __USE_MISC
@@ -140,90 +138,6 @@ __m81_defun (float_type, __CONCAT(__ieee754_fmod,s),			     \
   return __result;							     \
 }									     \
 									     \
-__m81_defun (float_type, __CONCAT(__ieee754_atan2,s),			     \
-	     (float_type __y, float_type __x))				     \
-{									     \
-  float_type __pi, __pi_2;						     \
-									     \
-  __asm ("fmovecr%.x %#0, %0" : "=f" (__pi));				     \
-  __asm ("fscale%.w %#-1, %0" : "=f" (__pi_2) : "0" (__pi));		     \
-  if (__x > 0)								     \
-    {									     \
-      if (__y > 0)							     \
-	{								     \
-	  if (__x > __y)						     \
-	    return __m81_u(__CONCAT(__atan,s)) (__y / __x);		     \
-	  else								     \
-	    return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
-	}								     \
-      else								     \
-	{								     \
-	  if (__x > -__y)						     \
-	    return __m81_u(__CONCAT(__atan,s)) (__y / __x);		     \
-	  else								     \
-	    return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
-	}								     \
-    }									     \
-  else									     \
-    {									     \
-      if (__y > 0)							     \
-	{								     \
-	  if (-__x < __y)						     \
-	    return __pi + __m81_u(__CONCAT(__atan,s)) (__y / __x);	     \
-	  else								     \
-	    return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
-	}								     \
-      else								     \
-	{								     \
-	  if (-__x > -__y)						     \
-	    return -__pi + __m81_u(__CONCAT(__atan,s)) (__y / __x);	     \
-	  else								     \
-	    return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
-	}								     \
-    }									     \
-}									     \
-									     \
-__m81_defun (float_type, __CONCAT(__ieee754_pow,s),			     \
-	     (float_type __x, float_type __y))				     \
-{									     \
-  float_type __result;							     \
-  if (__x == 0.0)							     \
-    {									     \
-      if (__y <= 0.0)							     \
-	__result = 0.0 / 0.0;						     \
-      else								     \
-	__result = 0.0;							     \
-    }									     \
-  else if (__y == 0.0 || __x == 1.0)					     \
-    __result = 1.0;							     \
-  else if (__y == 1.0)							     \
-    __result = __x;							     \
-  else if (__y == 2.0)							     \
-    __result = __x * __x;						     \
-  else if (__x == 10.0)							     \
-    __asm("ftentox%.x %1, %0" : "=f" (__result) : "f" (__y));		     \
-  else if (__x == 2.0)							     \
-    __asm("ftwotox%.x %1, %0" : "=f" (__result) : "f" (__y));		     \
-  else if (__x < 0.0)							     \
-    {									     \
-      float_type __temp = __m81_u (__CONCAT(__rint,s)) (__y);		     \
-      if (__y == __temp)						     \
-	{								     \
-	  int __i = (int) __y;						     \
-	  __result = (__m81_u(__CONCAT(__ieee754_exp,s))		     \
-		      (__y * __m81_u(__CONCAT(__ieee754_log,s)) (-__x)));    \
-	  if (__i & 1)							     \
-	    __result = -__result;					     \
-	}								     \
-      else								     \
-	__result = 0.0 / 0.0;						     \
-    }									     \
-  else									     \
-    __result = (__m81_u(__CONCAT(__ieee754_exp,s))			     \
-		(__y * __m81_u(__CONCAT(__ieee754_log,s)) (__x)));	     \
-  return __result;							     \
-}									     \
-									     \
 __m81_defun (float_type, __CONCAT(__ieee754_scalb,s),			     \
 	     (float_type __x, float_type __n))				     \
 {									     \
diff --git a/sysdeps/m68k/fpu/e_atan2.c b/sysdeps/m68k/fpu/e_atan2.c
index ae7a799ad1..58d7555f41 100644
--- a/sysdeps/m68k/fpu/e_atan2.c
+++ b/sysdeps/m68k/fpu/e_atan2.c
@@ -1,2 +1,98 @@
-#define FUNC __ieee754_atan2
-#include <e_fmod.c>
+/* 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.  */
+
+#define __LIBC_M81_MATH_INLINES
+#include <math.h>
+#include "math_private.h"
+
+#ifndef SUFF
+#define SUFF
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+__CONCATX(__ieee754_atan2,SUFF) (float_type y, float_type x)
+{
+  float_type pi, pi_2, z;
+
+  __asm ("fmovecr%.x %#0, %0" : "=f" (pi));
+  __asm ("fscale%.w %#-1, %0" : "=f" (pi_2) : "0" (pi));
+  if (x != x || y != y)
+    z = x + y;
+  else if (y == 0)
+    {
+      if (signbit (x))
+	z = signbit (y) ? -pi : pi;
+      else
+	z = y;
+    }
+  else if (__m81_u(__CONCATX(__isinf,SUFF)) (x))
+    {
+      if (__m81_u(__CONCATX(__isinf,SUFF)) (y))
+	{
+	  float_type pi_4;
+	  __asm ("fscale%.w %#-1, %0" : "=f" (pi_4) : "0" (pi_2));
+	  z = x > 0 ? pi_4 : 3 * pi_4;
+	}
+      else
+	z = x > 0 ? 0 : pi;
+      if (signbit (y))
+	z = -z;
+    }
+  else if (__m81_u(__CONCATX(__isinf,SUFF)) (y))
+    z = y > 0 ? pi_2 : -pi_2;
+  else if (x > 0)
+    {
+      if (y > 0)
+	{
+	  if (x > y)
+	    z = __m81_u(__CONCATX(__atan,SUFF)) (y / x);
+	  else
+	    z = pi_2 - __m81_u(__CONCATX(__atan,SUFF)) (x / y);
+	}
+      else
+	{
+	  if (x > -y)
+	    z = __m81_u(__CONCATX(__atan,SUFF)) (y / x);
+	  else
+	    z = -pi_2 - __m81_u(__CONCATX(__atan,SUFF)) (x / y);
+	}
+    }
+  else
+    {
+      if (y < 0)
+	{
+	  if (-x > y)
+	    z = -pi + __m81_u(__CONCATX(__atan,SUFF)) (y / x);
+	  else
+	    z = -pi_2 - __m81_u(__CONCATX(__atan,SUFF)) (x / y);
+	}
+      else
+	{
+	  if (-x > y)
+	    z = pi + __m81_u(__CONCATX(__atan,SUFF)) (y / x);
+	  else
+	    z = pi_2 - __m81_u(__CONCATX(__atan,SUFF)) (x / y);
+	}
+    }
+  return z;
+}
diff --git a/sysdeps/m68k/fpu/e_atan2f.c b/sysdeps/m68k/fpu/e_atan2f.c
index a4c5ebdfd3..a0c750a759 100644
--- a/sysdeps/m68k/fpu/e_atan2f.c
+++ b/sysdeps/m68k/fpu/e_atan2f.c
@@ -1,2 +1,3 @@
-#define FUNC __ieee754_atan2f
-#include <e_fmodf.c>
+#define SUFF f
+#define float_type float
+#include <e_atan2.c>
diff --git a/sysdeps/m68k/fpu/e_atan2l.c b/sysdeps/m68k/fpu/e_atan2l.c
index 0d43a77b9e..426ca94baa 100644
--- a/sysdeps/m68k/fpu/e_atan2l.c
+++ b/sysdeps/m68k/fpu/e_atan2l.c
@@ -1,2 +1,3 @@
-#define FUNC __ieee754_atan2l
-#include <e_fmodl.c>
+#define SUFF l
+#define float_type long double
+#include <e_atan2.c>
diff --git a/sysdeps/m68k/fpu/e_pow.c b/sysdeps/m68k/fpu/e_pow.c
index 29798a15ca..970e8b821b 100644
--- a/sysdeps/m68k/fpu/e_pow.c
+++ b/sysdeps/m68k/fpu/e_pow.c
@@ -1,2 +1,135 @@
-#define FUNC __ieee754_pow
-#include <e_fmod.c>
+/* 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.  */
+
+#define __LIBC_M81_MATH_INLINES
+#include <math.h>
+#include "math_private.h"
+
+#ifndef SUFF
+#define SUFF
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+__CONCATX(__ieee754_pow,SUFF) (float_type x, float_type y)
+{
+  float_type z;
+  float_type ax;
+
+  if (y == 0.0)
+    return 1.0;
+  if (x != x || y != y)
+    return x + y;
+
+  if (__m81_u(__CONCATX(__isinf,SUFF)) (y))
+    {
+      ax = __CONCATX(fabs,SUFF) (x);
+      if (ax == 1)
+	return y - y;
+      if (ax > 1)
+	return y > 0 ? y : 0;
+      else
+	return y < 0 ? -y : 0;
+    }
+
+  if (__CONCATX(fabs,SUFF) (y) == 1)
+    return y > 0 ? x : 1 / x;
+
+  if (y == 2)
+    return x * x;
+  if (y == 0 && x >= 0)
+    return __m81_u(__CONCATX(__ieee754_sqrt,SUFF)) (x);
+
+  if (x == 10.0)
+    {
+      __asm ("ftentox%.x %1, %0" : "=f" (z) : "f" (y));
+      return z;
+    }
+  if (x == 2.0)
+    {
+      __asm ("ftwotox%.x %1, %0" : "=f" (z) : "f" (y));
+      return z;
+    }
+
+  ax = __CONCATX(fabs,SUFF) (x);
+  if (__m81_u(__CONCATX(__isinf,SUFF)) (x) || x == 0 || ax == 1)
+    {
+      z = ax;
+      if (y < 0)
+	z = 1 / z;
+      if (signbit (x))
+	{
+	  float_type temp = __m81_u (__CONCATX(__rint,SUFF)) (y);
+	  if (y != temp)
+	    {
+	      if (x == -1)
+		z = (z - z) / (z - z);
+	    }
+	  else
+	    {
+	      if (sizeof (float_type) == sizeof (float))
+		{
+		  long i = (long) y;
+		  if (i & 1)
+		    z = -z;
+		}
+	      else
+		{
+		  long long i = (long long) y;
+		  if ((float_type) i == y && i & 1)
+		    z = -z;
+		}
+	    }
+	}
+      return z;
+    }
+
+  if (x < 0.0)
+    {
+      float_type temp = __m81_u (__CONCATX(__rint,SUFF)) (y);
+      if (y == temp)
+	{
+	  long long i = (long long) y;
+	  z = (__m81_u(__CONCATX(__ieee754_exp,SUFF))
+	       (y * __m81_u(__CONCATX(__ieee754_log,SUFF)) (-x)));
+	  if (sizeof (float_type) == sizeof (float))
+	    {
+	      long i = (long) y;
+	      if (i & 1)
+		z = -z;
+	    }
+	  else
+	    {
+	      /* If the conversion to long long was inexact assume that y
+		 is an even integer.  */
+	      if ((float_type) i == y && i & 1)
+		z = -z;
+	    }
+	}
+      else
+	z = (x - x) / (x - x);
+    }
+  else
+    z = (__m81_u(__CONCATX(__ieee754_exp,SUFF))
+	 (y * __m81_u(__CONCATX(__ieee754_log,SUFF)) (x)));
+  return z;
+}
diff --git a/sysdeps/m68k/fpu/e_powf.c b/sysdeps/m68k/fpu/e_powf.c
index 978d32eacc..379014355a 100644
--- a/sysdeps/m68k/fpu/e_powf.c
+++ b/sysdeps/m68k/fpu/e_powf.c
@@ -1,2 +1,3 @@
-#define FUNC __ieee754_powf
-#include <e_fmodf.c>
+#define SUFF f
+#define float_type float
+#include <e_pow.c>
diff --git a/sysdeps/m68k/fpu/e_powl.c b/sysdeps/m68k/fpu/e_powl.c
index 0feec54fec..f71fa34a26 100644
--- a/sysdeps/m68k/fpu/e_powl.c
+++ b/sysdeps/m68k/fpu/e_powl.c
@@ -1,2 +1,3 @@
-#define FUNC __ieee754_powl
-#include <e_fmodl.c>
+#define SUFF l
+#define float_type long double
+#include <e_pow.c>
diff --git a/sysdeps/m68k/fpu/s_logb.c b/sysdeps/m68k/fpu/s_exp2.c
index 9903b3089a..389528092a 100644
--- a/sysdeps/m68k/fpu/s_logb.c
+++ b/sysdeps/m68k/fpu/s_exp2.c
@@ -1,2 +1,2 @@
-#define	FUNC	logb
+#define FUNC exp2
 #include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_logbf.c b/sysdeps/m68k/fpu/s_exp2f.c
index 6dcfee5807..20ac916d1a 100644
--- a/sysdeps/m68k/fpu/s_logbf.c
+++ b/sysdeps/m68k/fpu/s_exp2f.c
@@ -1,2 +1,2 @@
-#define	FUNC	logbf
+#define FUNC exp2f
 #include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_logbl.c b/sysdeps/m68k/fpu/s_exp2l.c
index 7d06ac13c4..19121b929d 100644
--- a/sysdeps/m68k/fpu/s_logbl.c
+++ b/sysdeps/m68k/fpu/s_exp2l.c
@@ -1,2 +1,2 @@
-#define FUNC logbl
+#define FUNC exp2l
 #include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_log2.c b/sysdeps/m68k/fpu/s_log2.c
new file mode 100644
index 0000000000..26e26bae95
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_log2.c
@@ -0,0 +1,2 @@
+#define FUNC log2
+#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_log2f.c b/sysdeps/m68k/fpu/s_log2f.c
new file mode 100644
index 0000000000..68494322b8
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_log2f.c
@@ -0,0 +1,2 @@
+#define FUNC log2f
+#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_log2l.c b/sysdeps/m68k/fpu/s_log2l.c
new file mode 100644
index 0000000000..c4eb06332b
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_log2l.c
@@ -0,0 +1,2 @@
+#define FUNC log2l
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/huge_val.h b/sysdeps/m68k/huge_val.h
index c2139580e8..79e87dc2db 100644
--- a/sysdeps/m68k/huge_val.h
+++ b/sysdeps/m68k/huge_val.h
@@ -23,16 +23,10 @@
 
 #include <features.h>
 #include <sys/cdefs.h>
-#include <endian.h>
 
 /* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
 
-#if __BYTE_ORDER == __BIG_ENDIAN
 #define	__HUGE_VAL_bytes	{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__HUGE_VAL_bytes	{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
-#endif
 
 #define __huge_val_t	union { unsigned char __c[8]; double __d; }
 #ifdef	__GNUC__
@@ -48,12 +42,7 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 
 #ifdef __USE_ISOC9X
 
-#if __BYTE_ORDER == __BIG_ENDIAN
 #define	__HUGE_VALF_bytes	{ 0x7f, 0x80, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
-#endif
 
 #define __huge_valf_t	union { unsigned char __c[4]; float __f; }
 #ifdef	__GNUC__
@@ -65,12 +54,7 @@ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
 #endif	/* GCC.  */
 
 
-#if __BYTE_ORDER == __BIG_ENDIAN
 #define	__HUGE_VALL_bytes	{ 0x7f, 0xff, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
-#endif
 
 #define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
 #ifdef	__GNUC__
diff --git a/sysdeps/unix/sysv/linux/iovec.h b/sysdeps/unix/sysv/linux/iovec.h
index 6e5e01d9b3..430edfc029 100644
--- a/sysdeps/unix/sysv/linux/iovec.h
+++ b/sysdeps/unix/sysv/linux/iovec.h
@@ -1,3 +1,47 @@
-/* The Linux kernel header defines `struct iovec' for us.  */
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-#include <linux/uio.h>
+   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 _IOVEC_H
+
+#define _IOVEC_H	1
+
+#include <sys/types.h>
+
+
+/* We should normally use the Linux kernel header file to define this
+   type and macros but this calls for trouble because of the header
+   includes other kernel headers.  */
+
+/* Size of object which can be written atomically.
+
+   This macro has different values in different kernel versions.  The
+   latest versions of ther kernel use 1024 and this is good choice.  Since
+   the C library implementation of readv/writev is able to emulate the
+   functionality even if the currently running kernel does not support
+   this large value the readv/writev call will not fail because of this.  */
+#define UIO_MAXIOV	1024
+
+
+/* Structure for scatter/gather I/O.  */
+struct iovec
+  {
+    void *iov_base;	/* Pointer to data.  */
+    size_t iov_len;	/* Length of data.  */
+  };
+
+#endif	/* iovec.h */
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index cd64d15cbe..6a0b7d683d 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/msg.h>
 
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index b1c29d6780..c073614ef1 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/msg.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index 21c6b75cac..40c3c95728 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/msg.h>
 
@@ -24,7 +24,7 @@ msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
      int msqid;
      void *msgp;
      size_t msgsz;
-     long msgtyp;
+     long int msgtyp;
      int msgflg;
 {
   /* The problem here is that Linux' calling convention only allows up to
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index 6d2d3ef26b..739323495c 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/msg.h>
 
diff --git a/sysdeps/unix/sysv/linux/netinet/ip.h b/sysdeps/unix/sysv/linux/netinet/ip.h
index 89c2b1d296..6d50bb41d1 100644
--- a/sysdeps/unix/sysv/linux/netinet/ip.h
+++ b/sysdeps/unix/sysv/linux/netinet/ip.h
@@ -163,11 +163,11 @@ struct ip_timestamp
     u_int8_t ipt_len;			/* size of structure (variable) */
     u_int8_t ipt_ptr;			/* index of current entry */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-    u_int8_t ipt_flg:4,			/* flags, see below */
+    u_int8_t ipt_flg:4;			/* flags, see below */
     u_int8_t ipt_oflw:4;		/* overflow counter */
 #endif
 #if __BYTE_ORDER == __BIG_ENDIAN
-    u_int8_t ipt_oflw:4,		/* overflow counter */
+    u_int8_t ipt_oflw:4;		/* overflow counter */
     u_int8_t ipt_flg:4;			/* flags, see below */
 #endif
     u_int32_t data[9];
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index dd0e7b9484..3d95e08d98 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/sem.h>
 
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index 6320e4720e..b9f41f5c7c 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/sem.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 57f074e90e..563aaae414 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/sem.h>
 
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index b74b8a56ec..2ac07f21d0 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/shm.h>
 
@@ -23,15 +23,15 @@ Boston, MA 02111-1307, USA.  */
    segment of the calling process.  SHMADDR and SHMFLG determine how
    and where the segment is attached.  */
 
-char *
+void *
 shmat (shmid, shmaddr, shmflg)
      int shmid;
-     char *shmaddr;
+     const void *shmaddr;
      int shmflg;
 {
   int retval;
   unsigned long raddr;
 
   retval = __ipc (IPCOP_shmat, shmid, shmflg, (int) &raddr, shmaddr);
-  return retval < 0 ? (char *) retval : (char *) raddr;
+  return retval < 0 ? (void *) retval : (void *) raddr;
 }
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index 81192a8996..f25d4194b5 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/shm.h>
 
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 1e5bbe13b1..dcda701e45 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/shm.h>
 
@@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA.  */
 
 int
 shmdt (shmaddr)
-     char *shmaddr;
+     const void *shmaddr;
 {
   return __ipc (IPCOP_shmdt, 0, 0, 0, shmaddr);
 }
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index f0b2b6531d..8754191862 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sys/shm.h>
 #include <stdlib.h>		/* for definition of NULL */
diff --git a/sysdeps/unix/sysv/linux/sys/kd.h b/sysdeps/unix/sysv/linux/sys/kd.h
index 33b873f49c..0ff5220014 100644
--- a/sysdeps/unix/sysv/linux/sys/kd.h
+++ b/sysdeps/unix/sysv/linux/sys/kd.h
@@ -1 +1,27 @@
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_KD_H
+#define _SYS_KD_H	1
+
+/* Make sure the <linux/types.h> header is not loaded.  */
+#define _LINUX_TYPES_H	1
+
 #include <linux/kd.h>
+
+#endif	/* sys/kd.h */
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index 9da57284f3..2a1e7c664d 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -38,7 +38,7 @@
 __BEGIN_DECLS
 
 /* The following System V style IPC functions implement a shared memory
-   facility.  The definition is found in XPG2.  */
+   facility.  The definition is found in XPG4.2.  */
 
 /* Shared memory control operation.  */
 extern int shmctl __P ((int __shmid, int __cmd, struct shmid_ds *__buf));
@@ -47,10 +47,10 @@ extern int shmctl __P ((int __shmid, int __cmd, struct shmid_ds *__buf));
 extern int shmget __P ((key_t __key, int __size, int __shmflg));
 
 /* Attach shared memory segment.  */
-extern char *shmat __P ((int __shmid, char *__shmaddr, int __shmflg));
+extern void *shmat __P ((int __shmid, __const void *__shmaddr, int __shmflg));
 
 /* Detach shared memory segment.  */
-extern int shmdt __P ((char *__shmaddr));
+extern int shmdt __P ((__const void *__shmaddr));
 
 __END_DECLS