From ec986e237a6c0fe52f172c254d3da2ef57b85eb2 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 29 Jul 1998 12:34:57 +0000 Subject: Update. 1998-07-29 Andreas Jaeger * 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 * 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 * 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 . * 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. --- ChangeLog | 34 ++++++++++++++ manual/math.texi | 2 +- manual/pattern.texi | 2 +- math/libm-test.c | 8 +++- posix/Makefile | 2 + sysdeps/generic/glob.c | 82 +++++++++++++++++++++------------- sysdeps/libm-ieee754/s_csqrt.c | 31 +++++++------ sysdeps/libm-ieee754/s_csqrtf.c | 31 +++++++------ sysdeps/libm-ieee754/s_csqrtl.c | 31 +++++++------ sysdeps/unix/sysv/linux/bits/in.h | 3 +- sysdeps/unix/sysv/linux/bits/siginfo.h | 1 + 11 files changed, 150 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86ec5808d1..7db898fbf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +1998-07-29 Andreas Jaeger + + * 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 + + * 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 + + * 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 . + + * 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. + 1998-07-29 6:39 Kazushige Goto * sysdeps/alpha/fpu/e_sqrt.c [!_IEEE_FP]: Correctly handle diff --git a/manual/math.texi b/manual/math.texi index e1d597d06a..2b804300f2 100644 --- a/manual/math.texi +++ b/manual/math.texi @@ -886,7 +886,7 @@ instead of in the @var{signgam} global. @deftypefunx {long double} gammal (long double @var{x}) These functions exist for compatibility reasons. They are equivalent to @code{lgamma} etc. It is better to use @code{lgamma} since for one the -name reflect better the actual computation and @code{lgamma} is also +name reflects better the actual computation and @code{lgamma} is also standardized in @w{ISO C 9x} while @code{gamma} is not. @end deftypefun diff --git a/manual/pattern.texi b/manual/pattern.texi index f2c3f8e584..e81a29fb74 100644 --- a/manual/pattern.texi +++ b/manual/pattern.texi @@ -484,7 +484,7 @@ the home directory cannot be determined for other reasons this leads to an error. @code{glob} will return @code{GLOB_NOMATCH} instead of using the pattern itself as the name. -This funcationality is equivalent to what is available in C-shells if +This functionality is equivalent to what is available in C-shells if @code{nonomatch} flag is not set. @comment glob.h diff --git a/math/libm-test.c b/math/libm-test.c index 95d285e1c7..049086641a 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -5157,10 +5157,16 @@ csqrt_test (void) 0.5870453129635652115L, CHOOSE(7e-18L, 0, 0)); result = FUNC(csqrt) (BUILD_COMPLEX (-2, -3)); - check_eps ("real(csqrt(-2 - i 3)) == -0.89597...", __real__ result, + check_eps ("real(csqrt(-2 - i 3)) == 0.89597...", __real__ result, 0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8)); check_eps ("imag(csqrt(-2 - i 3)) == -1.67414...", __imag__ result, -1.6741492280355400404L, CHOOSE(0, 5e-16, 0)); + + result = FUNC(csqrt) (BUILD_COMPLEX (-2, 3)); + check_eps ("real(csqrt(-2 + i 3)) == 0.89597...", __real__ result, + 0.8959774761298381247L, CHOOSE(6e-20L, 2e-16, 6e-8)); + check_eps ("imag(csqrt(-2 + i 3)) == 1.67414...", __imag__ result, + 1.6741492280355400404L, CHOOSE(0, 5e-16, 0)); } diff --git a/posix/Makefile b/posix/Makefile index 5eadf35eb7..daf4960d86 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -57,7 +57,9 @@ tests := tstgetopt testfnm runtests wordexp-test runptests test-srcs := globtest others := getconf install-bin := getconf +ifeq (yes,$(build-static)) install-lib := libposix.a +endif gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h before-compile := testcases.h ptestcases.h 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 . Contributed by Ulrich Drepper , 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 . Contributed by Ulrich Drepper , 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 . Contributed by Ulrich Drepper , 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; -- cgit v1.2.3