From d111572f2f7c595060b9bafcadba98d5391d464c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 26 Feb 1998 11:20:59 +0000 Subject: Update. 1998-02-26 Ulrich Drepper * nis/ypclnt.c (yp_master): Check result of strdup. Patch by Thorsten Kukuk. 1998-02-26 Thorsten Kukuk * nis/ypclnt.c: Give clnt handle after error checking free, change return codes to fix problems with rpc.nisd in YP mode on Ultra's. 1998-02-26 09:00 Ulrich Drepper * misc/fstab.c: Partly rewritten to use dynamically allocated buffer. Patch by Joe Keane . * misc/fstab.h (struct fstab): Change fs_type member to be const. * misc/fstab.c: Remove casts in fs_type assignments. 1998-02-26 Andreas Jaeger * sysdeps/i386/fpu/bits/fenv.h: Correct typo. ISO C 9X defines FE_TOWARDZERO and not FE_TOWARDSZERO. Reported by H.J. Lu. * sysdeps/sparc/sparc64/fpu/bits/fenv.h: Likewise. * sysdeps/sparc/sparc32/fpu/bits/fenv.h: Likewise. * sysdeps/powerpc/bits/fenv.h: Likewise. * sysdeps/m68k/fpu/bits/fenv.h: Likewise. * sysdeps/generic/bits/fenv.h: Likewise. * sysdeps/alpha/fpu/bits/fenv.h: Likewise. * sysdeps/i386/fpu/fesetenv.c (fesetenv): Likewise. * sysdeps/powerpc/test-arith.c (main): Likewise. 1998-02-25 Ulrich Drepper * sysdeps/i386/fpu/bits/mathinline.h: Also fix i386 versions of the comparison macros. 1998-02-21 20:14 H.J. Lu * sysdeps/libm-ieee754/s_log2.c (ln2): Added. (__log2): Fixed return values. * sysdeps/libm-ieee754/s_log2f.c: Likewise. 1998-02-25 Ulrich Drepper * math/math.h (isunordered): Rename local variables to ensure correct code. Reported by HJ Lu. 1998-02-25 10:34 Ulrich Drepper * sysdpes/i386/fpu/bits/mathinline.h (isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered): Fix syntax for fucompip instruction. (isless, islessequal): Fix logic. 1998-02-21 Andreas Jaeger * math/libm-test.c (sqrt_test): Add test for sqrt(2). (comparisons_test): New tests for comparison macros. --- BUGS | 10 +- ChangeLog | 59 ++++++++++ FAQ.in | 15 ++- bits/fenv.h | 4 +- math/libm-test.c | 97 ++++++++++++++++- math/math.h | 6 +- math/test-fenv.c | 44 ++++---- misc/fstab.c | 195 ++++++++++++++++++++++++---------- nis/ypclnt.c | 70 ++++++------ sysdeps/alpha/fpu/bits/fenv.h | 6 +- sysdeps/generic/bits/fenv.h | 4 +- sysdeps/i386/fpu/bits/fenv.h | 6 +- sysdeps/i386/fpu/bits/mathinline.h | 24 ++--- sysdeps/i386/fpu/fesetenv.c | 8 +- sysdeps/libm-ieee754/s_log2.c | 7 +- sysdeps/libm-ieee754/s_log2f.c | 7 +- sysdeps/m68k/fpu/bits/fenv.h | 6 +- sysdeps/powerpc/bits/fenv.h | 6 +- sysdeps/powerpc/test-arith.c | 4 +- sysdeps/sparc/sparc32/fpu/bits/fenv.h | 6 +- sysdeps/sparc/sparc64/fpu/bits/fenv.h | 6 +- 21 files changed, 420 insertions(+), 170 deletions(-) diff --git a/BUGS b/BUGS index e889251557..9c1eac3c65 100644 --- a/BUGS +++ b/BUGS @@ -1,7 +1,7 @@ List of known bugs (certainly very incomplete) ---------------------------------------------- -Time-stamp: <1998-02-20T15:02:41-0800 drepper> +Time-stamp: <1998-02-26T09:19:15-0800 drepper> This following list contains those bugs which I'm aware of. Please make sure that bugs you report are not listed here. If you can fix one @@ -27,8 +27,6 @@ Severity: [ *] to [***] [ **] There are problems with signal handling when using LinuxThreads. -[ **] The libm-ieee `log2' function seems to be very inaccurate. - [ *] The precision of the `sinhl' and/or `asinhl' function do not seem to be the best. @@ -56,7 +54,11 @@ Severity: [ *] to [***] category. [PR libc/207] -[ *] The libm-ieee `asin' function gives wrong results (at least for 0.5). +[ *] The libm-ieee `gamma' function gives wrong results (at least for + -0.5). + +[ *] The libm-ieee `scalb' function gives wrong results for + non-integral second parameters. [ *] _IO_getline can loop forever, at least with C++ [PR libc/332] diff --git a/ChangeLog b/ChangeLog index 6a636083c1..ca8e3f3976 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,62 @@ +1998-02-26 Ulrich Drepper + + * nis/ypclnt.c (yp_master): Check result of strdup. + Patch by Thorsten Kukuk. + +1998-02-26 Thorsten Kukuk + + * nis/ypclnt.c: Give clnt handle after error checking free, change + return codes to fix problems with rpc.nisd in YP mode on Ultra's. + +1998-02-26 09:00 Ulrich Drepper + + * misc/fstab.c: Partly rewritten to use dynamically allocated buffer. + Patch by Joe Keane . + + * misc/fstab.h (struct fstab): Change fs_type member to be const. + * misc/fstab.c: Remove casts in fs_type assignments. + +1998-02-26 Andreas Jaeger + + * sysdeps/i386/fpu/bits/fenv.h: Correct typo. ISO C 9X defines + FE_TOWARDZERO and not FE_TOWARDSZERO. Reported by H.J. Lu. + * sysdeps/sparc/sparc64/fpu/bits/fenv.h: Likewise. + * sysdeps/sparc/sparc32/fpu/bits/fenv.h: Likewise. + * sysdeps/powerpc/bits/fenv.h: Likewise. + * sysdeps/m68k/fpu/bits/fenv.h: Likewise. + * sysdeps/generic/bits/fenv.h: Likewise. + * sysdeps/alpha/fpu/bits/fenv.h: Likewise. + * sysdeps/i386/fpu/fesetenv.c (fesetenv): Likewise. + * sysdeps/powerpc/test-arith.c (main): Likewise. + +1998-02-25 Ulrich Drepper + + * sysdeps/i386/fpu/bits/mathinline.h: Also fix i386 versions of + the comparison macros. + +1998-02-21 20:14 H.J. Lu + + * sysdeps/libm-ieee754/s_log2.c (ln2): Added. + (__log2): Fixed return values. + * sysdeps/libm-ieee754/s_log2f.c: Likewise. + +1998-02-25 Ulrich Drepper + + * math/math.h (isunordered): Rename local variables to ensure + correct code. Reported by HJ Lu. + +1998-02-25 10:34 Ulrich Drepper + + * sysdpes/i386/fpu/bits/mathinline.h (isgreater, isgreaterequal, + isless, islessequal, islessgreater, isunordered): Fix syntax for + fucompip instruction. + (isless, islessequal): Fix logic. + +1998-02-21 Andreas Jaeger + + * math/libm-test.c (sqrt_test): Add test for sqrt(2). + (comparisons_test): New tests for comparison macros. + 1998-02-24 15:12 Ulrich Drepper * Makeconfig: Filter out frame-pointer effecting options when diff --git a/FAQ.in b/FAQ.in index 70121cfc6e..fb3e5ac235 100644 --- a/FAQ.in +++ b/FAQ.in @@ -150,6 +150,17 @@ in configparms. Later versions of egcs may fix these problems. If you have some more measurements let me know. +?? What version of the Linux kernel headers should be used? + +{AJ,UD} The headers from the most recent Linux kernel should be used. +The headers used while compiling the GNU C library and the kernel +binary used when using the library do not need to match. The GNU C +library runs without problems on kernels that are older than the +kernel headers used. The other way round (compiling the GNU C library +with old kernel headers and running on a recent kernel) does not +necessarily work. For example you can't use new kernel features when +using old kernel headers for compiling the GNU C library. + ?? When I run `nm -u libc.so' on the produced library I still find unresolved symbols. Can this be ok? @@ -601,10 +612,10 @@ problem. ?? What do I need for C++ development? {HJ,AJ} You need either egcs 1.0.1 or gcc-2.8.0 with libstdc++ -2.8.0. libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work very +2.8.0. libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work very well with the GNU C library due to vtable thunks. If you're upgrading from glibc 2.0.x to 2.1 you have to recompile -libstc++ the library compiled for 2.0 is not compatible due to the new +libstc++ the library compiled for 2.0 is not compatible due to the new Large File Support (LFS) in version 2.1. ? Source and binary incompatibilities, and what to do about them diff --git a/bits/fenv.h b/bits/fenv.h index c42540fa61..7552677d84 100644 --- a/bits/fenv.h +++ b/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -36,7 +36,7 @@ FE_TONEAREST FE_DOWNWARD FE_UPWARD - FE_TOWARDSZERO + FE_TOWARDZERO We define no macro which signals no rounding mode is selectable. */ diff --git a/math/libm-test.c b/math/libm-test.c index 7093fdcf14..e51bfe3eb6 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -46,6 +46,7 @@ fabs, fdim, floor, fma, fmax, fmin, fmod, fpclassify, frexp, gamma, hypot, ilogb, isfinite, isinf, isnan, isnormal, + isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered, ldexp, lgamma, log, log10, log1p, log2, logb, modf, nearbyint, nextafter, pow, remainder, remquo, rint, lrint, llrint, @@ -60,7 +61,7 @@ conj, cproj, cimag, creal, drem, j0, j1, jn, y0, y1, yn, significand, - nan, comparison macros (isless,isgreater,...). + nan The routines using random variables are still under construction. I don't like it the way it's working now and will change it. @@ -361,7 +362,7 @@ check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff ret_value = (*diff <= eps && (signbit (computed) == signbit (supplied) || eps != 0.0)); - /* Make sure the subtraction/comparsion have no influence on the exceptions. */ + /* Make sure the subtraction/comparison have no influence on the exceptions. */ feclearexcept (FE_ALL_EXCEPT); return ret_value; @@ -2458,6 +2459,7 @@ sqrt_test (void) x = random_value (0, 10000); check_ext ("sqrt (x*x) == x", FUNC(sqrt) (x*x), x, x); check ("sqrt (4) == 2", FUNC(sqrt) (4), 2); + check ("sqrt (2) == 1.14142...", FUNC(sqrt) (2), M_SQRT2l); check ("sqrt (0.25) == 0.5", FUNC(sqrt) (0.25), 0.5); check ("sqrt (6642.25) == 81.5", FUNC(sqrt) (6642.25), 81.5); check_eps ("sqrt (15239.903) == 123.45", FUNC(sqrt) (15239.903), 123.45, @@ -5530,6 +5532,95 @@ fma_test (void) } +/* + Tests for the comparison macros + */ +typedef enum {is_less, is_equal, is_greater, is_unordered} comp_result; + + +static void +comparison2_test (MATHTYPE x, MATHTYPE y, comp_result comp) +{ + char buf[255]; + int result; + int expected; + + expected = (comp == is_greater); + sprintf (buf, "isgreater (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (isgreater (x, y) == expected); + check_bool (buf, result); + + expected = (comp == is_greater || comp == is_equal); + sprintf (buf, "isgreaterequal (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (isgreaterequal (x, y) == expected); + check_bool (buf, result); + + expected = (comp == is_less); + sprintf (buf, "isless (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (isless (x, y) == expected); + check_bool (buf, result); + + expected = (comp == is_less || comp == is_equal); + sprintf (buf, "islessequal (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (islessequal (x, y) == expected); + check_bool (buf, result); + + expected = (comp == is_greater || comp == is_less); + sprintf (buf, "islessgreater (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (islessgreater (x, y) == expected); + check_bool (buf, result); + + expected = (comp == is_unordered); + sprintf (buf, "isunordered (%" PRINTF_EXPR ", %" PRINTF_EXPR ") == %d", x, y, + expected); + result = (isunordered (x, y) == expected); + check_bool (buf, result); + +} + + +static void +comparison1_test (MATHTYPE x, MATHTYPE y, comp_result comp) +{ + comp_result comp_swap; + switch (comp) + { + case is_less: + comp_swap = is_greater; + break; + case is_greater: + comp_swap = is_less; + break; + default: + comp_swap = comp; + break; + } + comparison2_test (x, y, comp); + comparison2_test (y, x, comp_swap); +} + + +static void +comparisons_test (void) +{ + comparison1_test (1, 2, is_less); + comparison1_test (-30, 30, is_less); + comparison1_test (42, 42, is_equal); + comparison1_test (1, plus_infty, is_less); + comparison1_test (35, minus_infty, is_greater); + comparison1_test (1, nan_value, is_unordered); + comparison1_test (nan_value, nan_value, is_unordered); + comparison1_test (plus_infty, nan_value, is_unordered); + comparison1_test (minus_infty, nan_value, is_unordered); + comparison1_test (plus_infty, minus_infty, is_greater); +} + + static void inverse_func_pair_test (const char *test_name, mathfunc f1, mathfunc inverse, @@ -5838,6 +5929,8 @@ main (int argc, char *argv[]) isnormal_test (); signbit_test (); + comparisons_test (); + /* trigonometric functions */ acos_test (); asin_test (); diff --git a/math/math.h b/math/math.h index 5103f2ef3c..6c2ef27811 100644 --- a/math/math.h +++ b/math/math.h @@ -354,10 +354,10 @@ extern int matherr __P ((struct exception *__exc)); /* Return nonzero value if arguments are unordered. */ # ifndef isunordered -# define isunordered(x, y) \ +# define isunordered(u, v) \ (__extension__ \ - ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ - fpclassify (__x) == FP_NAN || fpclassify (__y) == FP_NAN; })) + ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \ + fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; })) # endif #endif diff --git a/math/test-fenv.c b/math/test-fenv.c index ab09410690..3a5a7ed692 100644 --- a/math/test-fenv.c +++ b/math/test-fenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger and Ulrich Drepper , 1997. @@ -117,28 +117,29 @@ static void print_rounding (int rounding) { - switch (rounding) { + switch (rounding) + { #ifdef FE_TONEAREST - case FE_TONEAREST: - printf ("TONEAREST"); - break; + case FE_TONEAREST: + printf ("TONEAREST"); + break; #endif #ifdef FE_UPWARD - case FE_UPWARD: - printf ("UPWARD"); - break; + case FE_UPWARD: + printf ("UPWARD"); + break; #endif #ifdef FE_DOWNWARD - case FE_DOWNWARD: - printf ("DOWNWARD"); - break; + case FE_DOWNWARD: + printf ("DOWNWARD"); + break; #endif #ifdef FE_TOWARDZERO - case FE_TOWARDZERO: - printf ("TOWARDZERO"); - break; + case FE_TOWARDZERO: + printf ("TOWARDZERO"); + break; #endif - } + } printf (".\n"); } @@ -154,11 +155,12 @@ test_rounding (const char *test_name, int rounding_mode) printf (" Pass: Rounding mode is "); print_rounding (curr_rounding); } - else { - ++count_errors; - printf (" Fail: Rounding mode is "); - print_rounding (curr_rounding); - } + else + { + ++count_errors; + printf (" Fail: Rounding mode is "); + print_rounding (curr_rounding); + } } @@ -247,7 +249,7 @@ feenv_nomask_test (const char *flag_name, int fe_exc) printf ("Test: after fesetenv (FE_NOMASK_ENV) processes will abort\n"); printf (" when feraiseexcept (%s) is called.\n", flag_name); - pid = fork (); + pid = fork (); if (pid == 0) { #ifdef RLIMIT_CORE diff --git a/misc/fstab.c b/misc/fstab.c index 8b87a1f1f0..d241051ec9 100644 --- a/misc/fstab.c +++ b/misc/fstab.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 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 @@ -19,98 +19,175 @@ #include #include #include +#include +#include -static FILE *fstab; -static struct mntent mntres; -static char buffer[8192]; +#define BUFFER_SIZE 0x1fc0 - -static FILE * -fstab_stream (void) +struct fstab_state { - if (! fstab) - fstab = setmntent (_PATH_FSTAB, "r"); - return fstab; -} + FILE *fs_fp; + char *fs_buffer; + struct mntent fs_mntres; + struct fstab fs_ret; +}; + +static struct fstab_state *fstab_init (int opt_rewind); +static struct mntent *fstab_fetch (struct fstab_state *state); +static struct fstab *fstab_convert (struct fstab_state *state); + +static struct fstab_state fstab_state; + int setfsent (void) { - if (fstab) - { - rewind (fstab); - return 1; - } - else - fstab = setmntent (_PATH_FSTAB, "r"); - return fstab ? 0 : 1; + return fstab_init (1) != NULL; } -static struct fstab * -internal_function -mnt2fs (struct mntent *m) -{ - static struct fstab f; - - if (m == NULL) - return NULL; - - f.fs_spec = m->mnt_fsname; - f.fs_file = m->mnt_dir; - f.fs_vfstype = m->mnt_type; - f.fs_mntops = m->mnt_opts; - f.fs_type = (hasmntopt (m, FSTAB_RW) ? (char *) FSTAB_RW : - hasmntopt (m, FSTAB_RQ) ? (char *) FSTAB_RQ : - hasmntopt (m, FSTAB_RO) ? (char *) FSTAB_RO : - hasmntopt (m, FSTAB_SW) ? (char *) FSTAB_SW : - hasmntopt (m, FSTAB_XX) ? (char *) FSTAB_XX : - (char *) "??"); - f.fs_freq = m->mnt_freq; - f.fs_passno = m->mnt_passno; - return &f; -} struct fstab * getfsent (void) { - FILE *s = fstab_stream (); + struct fstab_state *state; - if (! s) + state = fstab_init (0); + if (state == NULL) return NULL; - - return mnt2fs (__getmntent_r (s, &mntres, buffer, sizeof buffer)); + if (fstab_fetch (state) == NULL) + return NULL; + return fstab_convert (state); } + struct fstab * getfsspec (name) - register const char *name; + const char *name; { + struct fstab_state *state; struct mntent *m; - if (setfsent ()) - while (m = __getmntent_r (fstab, &mntres, buffer, sizeof buffer)) - if (!strcmp (m->mnt_fsname, name)) - return mnt2fs (m); + + state = fstab_init (1); + if (state == NULL) + return NULL; + while ((m = fstab_fetch (state)) != NULL) + if (strcmp (m->mnt_fsname, name) == 0) + return fstab_convert (state); return NULL; } + struct fstab * getfsfile (name) - register const char *name; + const char *name; { + struct fstab_state *state; struct mntent *m; - if (setfsent ()) - while (m = __getmntent_r (fstab, &mntres, buffer, sizeof buffer)) - if (!strcmp (m->mnt_dir, name)) - return mnt2fs (m); + + state = fstab_init (1); + if (state == NULL) + return NULL; + while ((m = fstab_fetch (state)) != NULL) + if (strcmp (m->mnt_dir, name) == 0) + return fstab_convert (state); return NULL; } + void endfsent () { - if (fstab) + struct fstab_state *state; + + state = &fstab_state; + if (state->fs_fp != NULL) { - (void) endmntent (fstab); - fstab = NULL; + (void) endmntent (state->fs_fp); + state->fs_fp = NULL; } } + + +static struct fstab_state * +fstab_init (int opt_rewind) +{ + struct fstab_state *state; + char *buffer; + FILE *fp; + + state = &fstab_state; + + buffer = state->fs_buffer; + if (buffer == NULL) + { + buffer = (char *) malloc (BUFFER_SIZE); + if (buffer == NULL) + return NULL; + state->fs_buffer = buffer; + } + + fp = state->fs_fp; + if (fp != NULL) + { + if (opt_rewind) + rewind (fp); + } + else + { + fp = setmntent (_PATH_FSTAB, "r"); + if (fp == NULL) + return NULL; + state->fs_fp = fp; + } + + return state; +} + + +static struct mntent * +fstab_fetch (struct fstab_state *state) +{ + return __getmntent_r (state->fs_fp, &state->fs_mntres, + state->fs_buffer, BUFFER_SIZE); +} + + +static struct fstab * +fstab_convert (struct fstab_state *state) +{ + struct mntent *m; + struct fstab *f; + + m = &state->fs_mntres; + f = &state->fs_ret; + + f->fs_spec = m->mnt_fsname; + f->fs_file = m->mnt_dir; + f->fs_vfstype = m->mnt_type; + f->fs_mntops = m->mnt_opts; + f->fs_type = (hasmntopt (m, FSTAB_RW) ? FSTAB_RW : + hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ : + hasmntopt (m, FSTAB_RO) ? FSTAB_RO : + hasmntopt (m, FSTAB_SW) ? FSTAB_SW : + hasmntopt (m, FSTAB_XX) ? FSTAB_XX : + "??"); + f->fs_freq = m->mnt_freq; + f->fs_passno = m->mnt_passno; + return f; +} + + +/* Make sure the memory is freed if the programs ends while in + memory-debugging mode and something actually was allocated. */ +static void +__attribute__ ((unused)) +fstab_free (void) +{ + char *buffer; + + buffer = fstab_state.fs_buffer; + if (buffer != NULL) + free ((void *) buffer); +} + +text_set_element (__libc_subfreeres, fstab_free); diff --git a/nis/ypclnt.c b/nis/ypclnt.c index f67a8f8b86..5b4cab3e8b 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -98,7 +98,7 @@ __yp_bind (const char *domain, dom_binding **ypdb) } #if USE_BINDINGDIR - if (ysd->dom_vers < 1) + if (ysd->dom_vers < 1 && try < 3) { char path[sizeof (BINDINGDIR) - 1 + strlen (domain) + 10]; struct iovec vec[2]; @@ -220,7 +220,7 @@ __yp_bind (const char *domain, dom_binding **ypdb) /* If the program exists, close the socket */ if (fcntl (ysd->dom_socket, F_SETFD, 1) == -1) - perror (_("fcntl: F_SETFD")); + perror ("fcntl: F_SETFD"); if (is_new && ypdb != NULL) { @@ -245,10 +245,11 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, { dom_binding *ydb = NULL; bool_t use_ypbindlist = FALSE; - int try, result; + int try, status; + enum clnt_stat result; try = 0; - result = YPERR_YPERR; + status = YPERR_YPERR; __libc_lock_lock (ypbindlist_lock); if (__ypbindlist != NULL) @@ -268,7 +269,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, else __libc_lock_unlock (ypbindlist_lock); - while (try < MAXTRIES && result != RPC_SUCCESS) + while (try < MAXTRIES && status != YPERR_SUCCESS)) { if (__yp_bind (domain, &ydb) != 0) { @@ -290,8 +291,11 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, free (ydb); ydb = NULL; } - result = YPERR_RPC; + status = YPERR_RPC;; } + else + status = YPERR_SUCCESS; + try++; } if (use_ypbindlist) @@ -307,7 +311,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, ydb = NULL; } - return result; + return status; } int @@ -407,7 +411,7 @@ yp_match (const char *indomain, const char *inmap, const char *inkey, { ypreq_key req; ypresp_val resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || inmap == NULL || inmap[0] == '\0' || @@ -428,7 +432,7 @@ yp_match (const char *indomain, const char *inmap, const char *inkey, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); @@ -448,7 +452,7 @@ yp_first (const char *indomain, const char *inmap, char **outkey, { ypreq_nokey req; ypresp_key_val resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || inmap == NULL || inmap[0] == '\0') @@ -466,7 +470,7 @@ yp_first (const char *indomain, const char *inmap, char **outkey, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); @@ -491,7 +495,7 @@ yp_next (const char *indomain, const char *inmap, const char *inkey, { ypreq_key req; ypresp_key_val resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || inmap == NULL || inmap[0] == '\0' || @@ -512,7 +516,7 @@ yp_next (const char *indomain, const char *inmap, const char *inkey, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); @@ -535,7 +539,7 @@ yp_master (const char *indomain, const char *inmap, char **outname) { ypreq_nokey req; ypresp_master resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || inmap == NULL || inmap[0] == '\0') @@ -550,14 +554,14 @@ yp_master (const char *indomain, const char *inmap, char **outname) (caddr_t) & req, (xdrproc_t) xdr_ypresp_master, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); *outname = strdup (resp.peer); xdr_free ((xdrproc_t) xdr_ypresp_master, (char *) &resp); - return YPERR_SUCCESS; + return *outname == NULL ? YPERR_YPERR : YPERR_SUCCESS; } int @@ -565,7 +569,7 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder) { struct ypreq_nokey req; struct ypresp_order resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0' || inmap == NULL || inmap == '\0') @@ -580,7 +584,7 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder) (caddr_t) & req, (xdrproc_t) xdr_ypresp_order, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); @@ -606,13 +610,13 @@ __xdr_ypresp_all (XDR * xdrs, u_long * objp) { xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp); *objp = YP_YPERR; - return (FALSE); + return FALSE; } if (resp.more == 0) { xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp); *objp = YP_NOMORE; - return (FALSE); + return TRUE; } switch (resp.ypresp_all_u.val.stat) @@ -654,7 +658,8 @@ yp_all (const char *indomain, const char *inmap, { struct ypreq_nokey req; dom_binding *ydb = NULL; - int try, result; + int try, res; + enum clnt_stat result; struct sockaddr_in clnt_sin; CLIENT *clnt; unsigned long status; @@ -665,9 +670,9 @@ yp_all (const char *indomain, const char *inmap, return YPERR_BADARGS; try = 0; - result = YPERR_YPERR; + res = YPERR_YPERR; - while (try < MAXTRIES && result != RPC_SUCCESS) + while (try < MAXTRIES && res != YPERR_SUCCESS) { if (__yp_bind (indomain, &ydb) != 0) { @@ -691,31 +696,30 @@ yp_all (const char *indomain, const char *inmap, (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all, (caddr_t) &status, RPCTIMEOUT); - clnt_destroy (clnt); - close (clnt_sock); if (result != RPC_SUCCESS) { - clnt_perror (ydb->dom_client, "yp_all: clnt_call"); - __yp_unbind (ydb); - free (ydb); - result = YPERR_RPC; + clnt_perror (clnt, "yp_all: clnt_call"); + res = YPERR_RPC; } else - result = YPERR_SUCCESS; + res = YPERR_SUCCESS; + + clnt_destroy (clnt); + close (clnt_sock); if (status != YP_NOMORE) return ypprot_err (status); try++; } - return result; + return res; } int yp_maplist (const char *indomain, struct ypmaplist **outmaplist) { struct ypresp_maplist resp; - int result; + enum clnt_stat result; if (indomain == NULL || indomain[0] == '\0') return YPERR_BADARGS; @@ -726,7 +730,7 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist) (caddr_t) & indomain, (xdrproc_t) xdr_ypresp_maplist, (caddr_t) & resp); if (result != RPC_SUCCESS) - return result; + return YPERR_RPC; if (resp.stat != YP_TRUE) return ypprot_err (resp.stat); diff --git a/sysdeps/alpha/fpu/bits/fenv.h b/sysdeps/alpha/fpu/bits/fenv.h index 4482f0a2dd..2ccf149f0a 100644 --- a/sysdeps/alpha/fpu/bits/fenv.h +++ b/sysdeps/alpha/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -68,8 +68,8 @@ enum enum { - FE_TOWARDSZERO = 0, -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = 0, +#define FE_TOWARDZERO FE_TOWARDZERO FE_DOWNWARD = 1, #define FE_DOWNWARD FE_DOWNWARD diff --git a/sysdeps/generic/bits/fenv.h b/sysdeps/generic/bits/fenv.h index c42540fa61..7552677d84 100644 --- a/sysdeps/generic/bits/fenv.h +++ b/sysdeps/generic/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -36,7 +36,7 @@ FE_TONEAREST FE_DOWNWARD FE_UPWARD - FE_TOWARDSZERO + FE_TOWARDZERO We define no macro which signals no rounding mode is selectable. */ diff --git a/sysdeps/i386/fpu/bits/fenv.h b/sysdeps/i386/fpu/bits/fenv.h index 4d06b01be3..cc2aa41634 100644 --- a/sysdeps/i386/fpu/bits/fenv.h +++ b/sysdeps/i386/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -52,8 +52,8 @@ enum #define FE_DOWNWARD FE_DOWNWARD FE_UPWARD = 0x800, #define FE_UPWARD FE_UPWARD - FE_TOWARDSZERO = 0xc00 -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = 0xc00 +#define FE_TOWARDZERO FE_TOWARDZERO }; diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index 9917316f7a..77b6cd5e51 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -39,36 +39,36 @@ better code. */ # define isgreater(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; seta %%al" \ + __asm__ ("fucomip %%st(1), %%st; seta %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isgreaterequal(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; setae %%al" \ + __asm__ ("fucomip %%st(1), %%st; setae %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isless(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; setb %%al" \ - : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ + __asm__ ("fucomip %%st(1), %%st; seta %%al" \ + : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; setbe %%al" \ - : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ + __asm__ ("fucomip %%st(1), %%st; setae %%al" \ + : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \ __result; }) # define islessgreater(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; setne %%al" \ + __asm__ ("fucomip %%st(1), %%st; setne %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # define isunordered(x, y) \ ({ register char __result; \ - __asm__ ("fucomip; setp %%al" \ + __asm__ ("fucomip %%st(1), %%st; setp %%al" \ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \ __result; }) # else @@ -87,14 +87,14 @@ # define isless(x, y) \ ({ register char __result; \ - __asm__ ("fucompp; fnstsw; sahf; setb %%al" \ - : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ + __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \ + : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessequal(x, y) \ ({ register char __result; \ - __asm__ ("fucompp; fnstsw; sahf; setbe %%al" \ - : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \ + __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \ + : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \ __result; }) # define islessgreater(x, y) \ diff --git a/sysdeps/i386/fpu/fesetenv.c b/sysdeps/i386/fpu/fesetenv.c index e7300ea1e6..3faf01a568 100644 --- a/sysdeps/i386/fpu/fesetenv.c +++ b/sysdeps/i386/fpu/fesetenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -50,7 +50,7 @@ fesetenv (const fenv_t *envp) } else if (envp == FE_NOMASK_ENV) { - temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO); + temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO); temp.status_word &= ~FE_ALL_EXCEPT; temp.eip = 0; temp.cs_selector = 0; @@ -60,9 +60,9 @@ fesetenv (const fenv_t *envp) } else { - temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDSZERO); + temp.control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO); temp.control_word |= (envp->control_word - & (FE_ALL_EXCEPT | FE_TOWARDSZERO)); + & (FE_ALL_EXCEPT | FE_TOWARDZERO)); temp.status_word &= ~FE_ALL_EXCEPT; temp.status_word |= envp->status_word & FE_ALL_EXCEPT; temp.eip = envp->eip; diff --git a/sysdeps/libm-ieee754/s_log2.c b/sysdeps/libm-ieee754/s_log2.c index 93c20b3db1..7379ce85e7 100644 --- a/sysdeps/libm-ieee754/s_log2.c +++ b/sysdeps/libm-ieee754/s_log2.c @@ -62,6 +62,7 @@ static const double #else static double #endif +ln2 = 0.69314718055994530942, two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ @@ -109,7 +110,7 @@ static double zero = 0.0; if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ if(f==zero) return dk; R = f*f*(0.5-0.33333333333333333*f); - return dk-(R-f); + return dk-(R-f)/ln2; } s = f/(2.0+f); z = s*s; @@ -122,9 +123,9 @@ static double zero = 0.0; R = t2+t1; if(i>0) { hfsq=0.5*f*f; - return dk-((hfsq-(s*(hfsq+R)))-f); + return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; } else { - return dk-((s*(f-R))-f); + return dk-((s*(f-R))-f)/ln2; } } diff --git a/sysdeps/libm-ieee754/s_log2f.c b/sysdeps/libm-ieee754/s_log2f.c index da9dfb8324..2377acd36a 100644 --- a/sysdeps/libm-ieee754/s_log2f.c +++ b/sysdeps/libm-ieee754/s_log2f.c @@ -23,6 +23,7 @@ static const float #else static float #endif +ln2 = 0.69314718055994530942, two25 = 3.355443200e+07, /* 0x4c000000 */ Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ @@ -69,7 +70,7 @@ static float zero = 0.0; if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ if(f==zero) return dk; R = f*f*((float)0.5-(float)0.33333333333333333*f); - return dk-(R-f); + return dk-(R-f)/ln2; } s = f/((float)2.0+f); z = s*s; @@ -82,9 +83,9 @@ static float zero = 0.0; R = t2+t1; if(i>0) { hfsq=(float)0.5*f*f; - return dk-((hfsq-(s*(hfsq+R)))-f); + return dk-((hfsq-(s*(hfsq+R)))-f)/ln2; } else { - return dk-((s*(f-R))-f); + return dk-((s*(f-R))-f)/ln2; } } weak_alias (__log2f, log2f) diff --git a/sysdeps/m68k/fpu/bits/fenv.h b/sysdeps/m68k/fpu/bits/fenv.h index b1608b9ddc..e1a278d333 100644 --- a/sysdeps/m68k/fpu/bits/fenv.h +++ b/sysdeps/m68k/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,8 +47,8 @@ enum { FE_TONEAREST = 0, #define FE_TONEAREST FE_TONEAREST - FE_TOWARDSZERO = 1 << 4, -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = 1 << 4, +#define FE_TOWARDZERO FE_TOWARDZERO FE_DOWNWARD = 2 << 4, #define FE_DOWNWARD FE_DOWNWARD FE_UPWARD = 3 << 4 diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h index 14fbda8db0..4f394fd64f 100644 --- a/sysdeps/powerpc/bits/fenv.h +++ b/sysdeps/powerpc/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -106,8 +106,8 @@ enum { FE_TONEAREST = 0, #define FE_TONEAREST FE_TONEAREST - FE_TOWARDSZERO = 1, -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = 1, +#define FE_TOWARDZERO FE_TOWARDZERO FE_UPWARD = 2, #define FE_UPWARD FE_UPWARD FE_DOWNWARD = 3, diff --git a/sysdeps/powerpc/test-arith.c b/sysdeps/powerpc/test-arith.c index 9e1be88098..3cefc3b8cc 100644 --- a/sysdeps/powerpc/test-arith.c +++ b/sysdeps/powerpc/test-arith.c @@ -1,5 +1,5 @@ /* Test floating-point arithmetic operations. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 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 @@ -574,7 +574,7 @@ int main(int argc, char **argv) fesetenv(FE_DFL_ENV); fesetround(FE_TONEAREST); fegetenv(rmodes+0); - fesetround(FE_TOWARDSZERO); + fesetround(FE_TOWARDZERO); fegetenv(rmodes+1); fesetround(FE_UPWARD); fegetenv(rmodes+2); diff --git a/sysdeps/sparc/sparc32/fpu/bits/fenv.h b/sysdeps/sparc/sparc32/fpu/bits/fenv.h index 9fb33cef28..6858caac97 100644 --- a/sysdeps/sparc/sparc32/fpu/bits/fenv.h +++ b/sysdeps/sparc/sparc32/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,8 +47,8 @@ enum { FE_TONEAREST = (0U << 30), #define FE_TONEAREST FE_TONEAREST - FE_TOWARDSZERO = (1U << 30), -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = (1U << 30), +#define FE_TOWARDZERO FE_TOWARDZERO FE_UPWARD = (2U << 30), #define FE_UPWARD FE_UPWARD FE_DOWNWARD = (3U << 30) diff --git a/sysdeps/sparc/sparc64/fpu/bits/fenv.h b/sysdeps/sparc/sparc64/fpu/bits/fenv.h index 5728e2b588..b864abdedf 100644 --- a/sysdeps/sparc/sparc64/fpu/bits/fenv.h +++ b/sysdeps/sparc/sparc64/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,8 +47,8 @@ enum { FE_TONEAREST = (0U << 30), #define FE_TONEAREST FE_TONEAREST - FE_TOWARDSZERO = (1U << 30), -#define FE_TOWARDSZERO FE_TOWARDSZERO + FE_TOWARDZERO = (1U << 30), +#define FE_TOWARDZERO FE_TOWARDZERO FE_UPWARD = (2U << 30), #define FE_UPWARD FE_UPWARD FE_DOWNWARD = (3U << 30) -- cgit 1.4.1