about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-29 12:34:57 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-29 12:34:57 +0000
commitec986e237a6c0fe52f172c254d3da2ef57b85eb2 (patch)
treeb938227b19ad155bf8c5b5a9960b0ebba90c80a5 /sysdeps
parentceeeaa3dcf76e7bc68ad276a1a54d988bef58934 (diff)
downloadglibc-ec986e237a6c0fe52f172c254d3da2ef57b85eb2.tar.gz
glibc-ec986e237a6c0fe52f172c254d3da2ef57b85eb2.tar.xz
glibc-ec986e237a6c0fe52f172c254d3da2ef57b85eb2.zip
Update.
1998-07-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* manual/pattern.texi (More Flags for Globbing): Fix typo.

	* manual/math.texi (Special Functions): Fix typo.

	* sysdeps/unix/sysv/linux/bits/in.h (IPV6_ROUTER_ALERT): New
	constant from Linux 2.1.112.

	* posix/Makefile (install-lib): Compile libposix.a only if
	build-static == yes.

1998-07-28  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/glob.c: Maintain const correctness.  Move extern
	declarations to file level.  Cope with unsupported
	_SC_GETPW_R_SIZE_MAX.

1998-07-29  Ulrich Drepper  <drepper@cygnus.com>

	* stdio-common/tst-printf.c: %z is now recognized by printf.

	* sysdeps/libm-ieee754/c_csqrt.c: Fix problems with some cancelation
	errors.
	* sysdeps/libm-ieee754/c_csqrtf.c: Likewise.
	* sysdeps/libm-ieee754/c_csqrtlc: Likewise.
	Patch by Stephen L Moshier <moshier@mediaone.net>.

	* math/libm-test.c (csqrt_test): Correct typo in one test, add
	another one.

	* sysdeps/unix/sysv/linux/bits/siginfo.h: Adjust siginfo_t after
	latest kernel change.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/glob.c82
-rw-r--r--sysdeps/libm-ieee754/s_csqrt.c31
-rw-r--r--sysdeps/libm-ieee754/s_csqrtf.c31
-rw-r--r--sysdeps/libm-ieee754/s_csqrtl.c31
-rw-r--r--sysdeps/unix/sysv/linux/bits/in.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo.h1
6 files changed, 105 insertions, 74 deletions
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index f54c3b3d21..2d7ee67ca3 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -155,6 +155,12 @@ extern void abort (), exit ();
 
 #endif	/* Standard headers.  */
 
+#ifdef HAVE_GETLOGIN_R
+extern int getlogin_r __P ((char *, size_t));
+#else
+extern char *getlogin __P ((void));
+#endif
+
 #ifndef	ANSI_STRING
 
 # ifndef bzero
@@ -180,7 +186,6 @@ extern void bcopy ();
 # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
 #endif
 
-
 #ifndef	__GNU_LIBRARY__
 # ifdef	__GNUC__
 __inline
@@ -245,6 +250,8 @@ extern char *alloca ();
 # define closedir(dir) __closedir (dir)
 # define opendir(name) __opendir (name)
 # define readdir(str) __readdir (str)
+# define getpwnam_r(name, bufp, buf, len, res) \
+   __getpwnam_r (name, bufp, buf, len, res)
 #endif
 
 #if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
@@ -349,7 +356,7 @@ glob (pattern, flags, errfunc, pglob)
      glob_t *pglob;
 {
   const char *filename;
-  char *dirname;
+  const char *dirname;
   size_t dirlen;
   int status;
   int oldcount;
@@ -507,9 +514,9 @@ glob (pattern, flags, errfunc, pglob)
 	{
 	  filename = pattern;
 #ifdef _AMIGA
-	  dirname = (char *) "";
+	  dirname = "";
 #else
-	  dirname = (char *) ".";
+	  dirname = ".";
 #endif
 	  dirlen = 0;
 	}
@@ -517,20 +524,22 @@ glob (pattern, flags, errfunc, pglob)
   else if (filename == pattern)
     {
       /* "/pattern".  */
-      dirname = (char *) "/";
+      dirname = "/";
       dirlen = 1;
       ++filename;
     }
   else
     {
+      char *newp;
       dirlen = filename - pattern;
-      dirname = (char *) __alloca (dirlen + 1);
+      newp = (char *) __alloca (dirlen + 1);
 #ifdef HAVE_MEMPCPY
-      *((char *) mempcpy (dirname, pattern, dirlen)) = '\0';
+      *((char *) mempcpy (newp, pattern, dirlen)) = '\0';
 #else
-      memcpy (dirname, pattern, dirlen);
-      dirname[dirlen] = '\0';
+      memcpy (newp, pattern, dirlen);
+      newp[dirlen] = '\0';
 #endif
+      dirname = newp;
       ++filename;
 
       if (filename[0] == '\0' && dirlen > 1)
@@ -558,7 +567,7 @@ glob (pattern, flags, errfunc, pglob)
       if (dirname[1] == '\0' || dirname[1] == '/')
 	{
 	  /* Look up home directory.  */
-	  char *home_dir = getenv ("HOME");
+	  const char *home_dir = getenv ("HOME");
 # ifdef _AMIGA
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    home_dir = "SYS:";
@@ -570,37 +579,38 @@ glob (pattern, flags, errfunc, pglob)
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {
 	      int success;
+	      char *name;
 #   if defined HAVE_GETLOGIN_R || defined _LIBC
-	      extern int getlogin_r __P ((char *, size_t));
 	      size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
-	      char *name;
 
 	      if (buflen == 0)
 		/* `sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
 		   a moderate value.  */
-		buflen = 16;
+		buflen = 20;
 	      name = (char *) __alloca (buflen);
 
 	      success = getlogin_r (name, buflen) >= 0;
 #   else
-	      extern char *getlogin __P ((void));
-	      char *name;
-
 	      success = (name = getlogin ()) != NULL;
 #   endif
 	      if (success)
 		{
+		  struct passwd *p;
 #   if defined HAVE_GETPWNAM_R || defined _LIBC
 		  size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
 		  char *pwtmpbuf;
-		  struct passwd pwbuf, *p;
+		  struct passwd pwbuf;
 
+		  if (pwbuflen == -1)
+		    /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
+		       Try a moderate value.  */
+		    pwbuflen = 1024;
 		  pwtmpbuf = (char *) __alloca (pwbuflen);
 
-		  success = (__getpwnam_r (name, &pwbuf, pwtmpbuf,
-					   pwbuflen, &p) >= 0);
+		  success = (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
+			     >= 0);
 #   else
-		  struct passwd *p = getpwnam (name);
+		  p = getpwnam (name);
 		  success = p != NULL;
 #   endif
 		  if (success)
@@ -611,7 +621,7 @@ glob (pattern, flags, errfunc, pglob)
 	    if (flags & GLOB_TILDE_CHECK)
 	      return GLOB_NOMATCH;
 	    else
-	      home_dir = (char *) "~"; /* No luck.  */
+	      home_dir = "~"; /* No luck.  */
 #  endif /* WINDOWS32 */
 # endif
 	  /* Now construct the full directory.  */
@@ -636,35 +646,45 @@ glob (pattern, flags, errfunc, pglob)
       else
 	{
 	  char *end_name = strchr (dirname, '/');
-	  char *user_name;
-	  char *home_dir;
+	  const char *user_name;
+	  const char *home_dir;
 
 	  if (end_name == NULL)
 	    user_name = dirname + 1;
 	  else
 	    {
-	      user_name = (char *) __alloca (end_name - dirname);
+	      char *newp;
+	      newp = (char *) __alloca (end_name - dirname);
 # ifdef HAVE_MEMPCPY
-	      *((char *) mempcpy (user_name, dirname + 1, end_name - dirname))
+	      *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
 		= '\0';
 # else
-	      memcpy (user_name, dirname + 1, end_name - dirname);
-	      user_name[end_name - dirname - 1] = '\0';
+	      memcpy (newp, dirname + 1, end_name - dirname);
+	      newp[end_name - dirname - 1] = '\0';
 # endif
+	      user_name = newp;
 	    }
 
 	  /* Look up specific user's home directory.  */
 	  {
+	    struct passwd *p;
 #  if defined HAVE_GETPWNAM_R || defined _LIBC
 	    size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
-	    char *pwtmpbuf = (char *) __alloca (buflen);
-	    struct passwd pwbuf, *p;
-	    if (__getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
+	    char *pwtmpbuf;
+	    struct passwd pwbuf;
+
+	    if (buflen == -1)
+	      /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.  Try a
+		 moderate value.  */
+	      buflen = 1024;
+	    pwtmpbuf = (char *) __alloca (buflen);
+
+	    if (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
 	      home_dir = p->pw_dir;
 	    else
 	      home_dir = NULL;
 #  else
-	    struct passwd *p = getpwnam (user_name);
+	    p = getpwnam (user_name);
 	    if (p != NULL)
 	      home_dir = p->pw_dir;
 	    else
diff --git a/sysdeps/libm-ieee754/s_csqrt.c b/sysdeps/libm-ieee754/s_csqrt.c
index cda23c702d..ae106bdad8 100644
--- a/sysdeps/libm-ieee754/s_csqrt.c
+++ b/sysdeps/libm-ieee754/s_csqrt.c
@@ -1,5 +1,5 @@
 /* Complex square root of double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -84,22 +84,25 @@ __csqrt (__complex__ double x)
 	}
       else
 	{
-#if 0 /* FIXME: this is broken. */
-	  __complex__ double q;
-	  double t, r;
+#if 0
+	  double d, r, s;
 
-	  if (fabs (__imag__ x) < 2.0e-4 * fabs (__real__ x))
-	    t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+	  d = __ieee754_hypot (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x);
+	      s = (0.5 * __imag__ x) / r;
+	    }
 	  else
-	    t = 0.5 * (__ieee754_hypot (__real__ x, __imag__ x) - __real__ x);
-
-	  r = __ieee754_sqrt (t);
-
-	  __real__ q = __imag__ x / (2.0 * r);
-	  __imag__ q = r;
+	    {
+	      s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
+	      r = (0.5 * __imag__ x) / s;
+	    }
 
-	  /* Heron iteration in complex arithmetic.  */
-	  res = 0.5 * (q + q / x);
+	  __real__ res = r;
+	  __imag__ res = __copysign (s, __imag__ x);
 #else
 	  double d, imag;
 
diff --git a/sysdeps/libm-ieee754/s_csqrtf.c b/sysdeps/libm-ieee754/s_csqrtf.c
index 5fdf2c1d66..015b0cd57f 100644
--- a/sysdeps/libm-ieee754/s_csqrtf.c
+++ b/sysdeps/libm-ieee754/s_csqrtf.c
@@ -1,5 +1,5 @@
 /* Complex square root of float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -84,22 +84,25 @@ __csqrtf (__complex__ float x)
 	}
       else
 	{
-#if 0 /* FIXME: this is broken. */
-	  __complex__ float q;
-	  float t, r;
+#if 0
+	  float d, r, s;
 
-	  if (fabsf (__imag__ x) < 2.0e-4 * fabsf (__real__ x))
-	    t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+	  d = __ieee754_hypotf (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x);
+	      s = (0.5f * __imag__ x) / r;
+	    }
 	  else
-	    t = 0.5 * (__ieee754_hypotf (__real__ x, __imag__ x) - __real__ x);
-
-	  r = __ieee754_sqrtf (t);
-
-	  __real__ q = __imag__ x / (2.0 * r);
-	  __imag__ q = r;
+	    {
+	      s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
+	      r = (0.5f * __imag__ x) / s;
+	    }
 
-	  /* Heron iteration in complex arithmetic.  */
-	  res = 0.5 * (q + q / x);
+	  __real__ res = r;
+	  __imag__ res = __copysignf (s, __imag__ x);
 #else
 	  float d, imag;
 
diff --git a/sysdeps/libm-ieee754/s_csqrtl.c b/sysdeps/libm-ieee754/s_csqrtl.c
index b772709947..4b7ed983d8 100644
--- a/sysdeps/libm-ieee754/s_csqrtl.c
+++ b/sysdeps/libm-ieee754/s_csqrtl.c
@@ -1,5 +1,5 @@
 /* Complex square root of long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -84,22 +84,25 @@ __csqrtl (__complex__ long double x)
 	}
       else
 	{
-#if 0 /* FIXME: this is broken. */
-	  __complex__ long double q;
-	  long double t, r;
+#if 0
+	  long double d, r, s;
 
-	  if (fabsl (__imag__ x) < 2.0e-4 * fabsl (__real__ x))
-	    t = 0.25 * __imag__ x * (__imag__ x / __real__ x);
+	  d = __ieee754_hypotl (__real__ x, __imag__ x);
+	  /* Use the identity   2  Re res  Im res = Im x
+	     to avoid cancellation error in  d +/- Re x.  */
+	  if (__real__ x > 0)
+	    {
+	      r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
+	      s = (0.5L * __imag__ x) / r;
+	    }
 	  else
-	    t = 0.5 * (__ieee754_hypotl (__real__ x, __imag__ x) - __real__ x);
-
-	  r = __ieee754_sqrtl (t);
-
-	  __real__ q = __imag__ x / (2.0 * r);
-	  __imag__ q = r;
+	    {
+	      s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
+	      r = (0.5L * __imag__ x) / s;
+	    }
 
-	  /* Heron iteration in complex arithmetic.  */
-	  res = 0.5 * (q + q / x);
+	  __real__ res = r;
+	  __imag__ res = __copysignl (s, __imag__ x);
 #else
 	  long double d, imag;
 
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index bfa7aae571..2e9b66fc4c 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98 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
@@ -74,3 +74,4 @@ struct ip_mreq
 #define IPV6_MULTICAST_LOOP	19
 #define IPV6_ADD_MEMBERSHIP	20
 #define IPV6_DROP_MEMBERSHIP	21
+#define IPV6_ROUTER_ALERT	22
diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
index 429edac748..25cd78293e 100644
--- a/sysdeps/unix/sysv/linux/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
@@ -72,6 +72,7 @@ typedef struct siginfo
 	struct
 	  {
 	    __pid_t si_pid;	/* Which child.  */
+	    __uid_t si_uid;	/* Real user ID of sending process.  */
 	    int si_status;	/* Exit value or signal.  */
 	    __clock_t si_utime;
 	    __clock_t si_stime;