summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-06-14 23:17:05 +0000
committerUlrich Drepper <drepper@redhat.com>1997-06-14 23:17:05 +0000
commit900bec852d0bd53eb27b8b2193899f5cf470b38f (patch)
treecb4504e7abecc289fcdd2fb43efad14ec6302d8e
parentce37fa887b0ea89614d9538e90ade7356b80f48c (diff)
1997-06-15 00:43 Ulrich Drepper <drepper@cygnus.com> * Makeconfig: Define libc-map here. * Makefile: And remove definition here. * Makerules (load-map-file): Handle case where map file is in other directory. (build-shlib): Likewise. * libc.map: Add more symbols. * resolv/libresolv.map: Likewise. * db/libdb.map: Add __dbopen. Patch by HJ Lu. * libio/stdio.h: Remove "optmizations" for vfscanf and vsscanf. * locale/programs/localedef.c: Add normalize_codeset function. We don't want to use the _nl_normalize_codeset functions from libc. * sysdeps/libm-i387/s_asinh.S: Handle +-Inf and NaN correctly. * sysdeps/libm-i387/s_asinhf.S: Likewise. * sysdeps/libm-i387/s_asinhl.S: Likewise. * sysdeps/libm-i387/s_nearbyint.S: Correctly leave function. * sysdeps/libm-i387/s_nearbyintf.S: Likewise. * sysdeps/libm-i387/s_nearbyintl.S: Likewise. 1997-06-14 12:45 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_nis/nis-ethers.c: Add static to internal_nis_setetherent. * nis/nss_nis/nis-proto.c: Add static to internal_nis_setprotoent. * nis/nss_nisplus/nisplus-hosts.c: Rewrite parser and fix _nss_nisplus_gethostbyaddr_r interface. * nis/libnsl.map: Add all GLOBAL functions. 1997-06-13 18:32 Andreas Jaeger <aj@arthur.rhein-neckar.de> * libm-test.c (main): Call new tests, reorder tests. (fmod_test): Test function fmod. (nearbyint_test): Test function nearbyint. (acos_test): Add more test cases. (signbit_test): Test macro signbit. (output_result_bool): Output result if test fails. (asin_test): Add another test case. (atan2_test): Add more tests. (asinh_test): Add more tests. (atanh_test): Add more tests. (hypot_test): Add more tests. (isfinite_test): Test macro isfinite. (isnormal_test): Test macro isnormal. (sincos_test): Tests for sincos. (main): Enable remquo_test since the tests are correct (according to ANSI/IEEE 754-1985). (remquo_test): Corrected tests cases and added more tests. (remainder_test): Tests for remainder. (check_int): New Function to compare int values. (check_isnan_exc_ext): New function. (sqrt_test): Add some extra tests for sqrt. (erf_test): Tests for erf. (erfc_test): Tests for erfc. (gamma_test): Tests for gamma. (lgamma_test): Tests for lgamma. 1997-06-08 10:54 H.J. Lu <hjl@gnu.ai.mit.edu> * sysdeps/unix/sysv/linux/configure.in: Try to generate stdio_lim.h using the target C preprocessor and mk-stdiolim.c. * sysdeps/unix/sysv/linux/stdio_lim.h.in: New, template for stdio_lim.h. * sysdeps/unix/sysv/linux/mk-stdiolim.c: New, used by the target C preprocessor to extract OPEN_MAX and PATH_MAX. 1997-06-14 17:32 Andreas Jaeger <aj@arthur.rhein-neckar.de> * math/libm.map: Add inline functions, global variables.
-rw-r--r--ChangeLog77
-rw-r--r--Makeconfig8
-rw-r--r--Makefile3
-rw-r--r--Makerules12
-rw-r--r--db/libdb.map2
-rw-r--r--libc.map14
-rw-r--r--libio/stdio.h19
-rw-r--r--locale/programs/localedef.c48
-rw-r--r--math/libm-test.c542
-rw-r--r--math/libm.map10
-rw-r--r--nis/libnsl.map64
-rw-r--r--nis/nss_nis/nis-ethers.c2
-rw-r--r--nis/nss_nis/nis-proto.c2
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c197
-rw-r--r--resolv/libresolv.map2
-rw-r--r--sysdeps/libm-i387/s_asinh.S6
-rw-r--r--sysdeps/libm-i387/s_asinhf.S6
-rw-r--r--sysdeps/libm-i387/s_asinhl.S6
-rw-r--r--sysdeps/libm-i387/s_nearbyint.S2
-rw-r--r--sysdeps/libm-i387/s_nearbyintf.S2
-rw-r--r--sysdeps/libm-i387/s_nearbyintl.S2
-rw-r--r--sysdeps/unix/sysv/linux/configure.in24
-rw-r--r--sysdeps/unix/sysv/linux/mk-stdiolim.c4
-rw-r--r--sysdeps/unix/sysv/linux/stdio_lim.h.in8
24 files changed, 885 insertions, 177 deletions
diff --git a/ChangeLog b/ChangeLog
index a3bb6da727..06ac3afb21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,80 @@
+1997-06-15 00:43 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makeconfig: Define libc-map here.
+ * Makefile: And remove definition here.
+ * Makerules (load-map-file): Handle case where map file is in
+ other directory.
+ (build-shlib): Likewise.
+
+ * libc.map: Add more symbols.
+ * resolv/libresolv.map: Likewise.
+
+ * db/libdb.map: Add __dbopen. Patch by HJ Lu.
+
+ * libio/stdio.h: Remove "optmizations" for vfscanf and vsscanf.
+
+ * locale/programs/localedef.c: Add normalize_codeset function. We
+ don't want to use the _nl_normalize_codeset functions from libc.
+
+ * sysdeps/libm-i387/s_asinh.S: Handle +-Inf and NaN correctly.
+ * sysdeps/libm-i387/s_asinhf.S: Likewise.
+ * sysdeps/libm-i387/s_asinhl.S: Likewise.
+ * sysdeps/libm-i387/s_nearbyint.S: Correctly leave function.
+ * sysdeps/libm-i387/s_nearbyintf.S: Likewise.
+ * sysdeps/libm-i387/s_nearbyintl.S: Likewise.
+
+1997-06-14 12:45 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * nis/nss_nis/nis-ethers.c: Add static to internal_nis_setetherent.
+
+ * nis/nss_nis/nis-proto.c: Add static to internal_nis_setprotoent.
+
+ * nis/nss_nisplus/nisplus-hosts.c: Rewrite parser and fix
+ _nss_nisplus_gethostbyaddr_r interface.
+
+ * nis/libnsl.map: Add all GLOBAL functions.
+
+1997-06-13 18:32 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * libm-test.c (main): Call new tests, reorder tests.
+ (fmod_test): Test function fmod.
+ (nearbyint_test): Test function nearbyint.
+ (acos_test): Add more test cases.
+ (signbit_test): Test macro signbit.
+ (output_result_bool): Output result if test fails.
+ (asin_test): Add another test case.
+ (atan2_test): Add more tests.
+ (asinh_test): Add more tests.
+ (atanh_test): Add more tests.
+ (hypot_test): Add more tests.
+ (isfinite_test): Test macro isfinite.
+ (isnormal_test): Test macro isnormal.
+ (sincos_test): Tests for sincos.
+ (main): Enable remquo_test since the tests are
+ correct (according to ANSI/IEEE 754-1985).
+ (remquo_test): Corrected tests cases and added more tests.
+ (remainder_test): Tests for remainder.
+ (check_int): New Function to compare int values.
+ (check_isnan_exc_ext): New function.
+ (sqrt_test): Add some extra tests for sqrt.
+ (erf_test): Tests for erf.
+ (erfc_test): Tests for erfc.
+ (gamma_test): Tests for gamma.
+ (lgamma_test): Tests for lgamma.
+
+1997-06-08 10:54 H.J. Lu <hjl@gnu.ai.mit.edu>
+
+ * sysdeps/unix/sysv/linux/configure.in: Try to generate
+ stdio_lim.h using the target C preprocessor and mk-stdiolim.c.
+ * sysdeps/unix/sysv/linux/stdio_lim.h.in: New, template for
+ stdio_lim.h.
+ * sysdeps/unix/sysv/linux/mk-stdiolim.c: New, used by the
+ target C preprocessor to extract OPEN_MAX and PATH_MAX.
+
+1997-06-14 17:32 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * math/libm.map: Add inline functions, global variables.
+
1997-06-14 00:39 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Add more libio functions which are used in libio.h.
diff --git a/Makeconfig b/Makeconfig
index 9c7df17ffd..73cae78aed 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -380,6 +380,14 @@ else
link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
endif
endif
+
+# We have a versioning file for libc.so. We must define this here since
+# otherwise in the subdirs this definition is not available and a rebuild
+# of libc.so happens without versioning.
+ifndef libc-map
+libc-map = libc.map
+endif
+
ifndef link-extra-libs
ifeq (yes,$(build-shared))
ifneq ($(common-objpfx),$(objpfx))
diff --git a/Makefile b/Makefile
index 2d9b3b86d6..7c5ba3bf31 100644
--- a/Makefile
+++ b/Makefile
@@ -107,9 +107,6 @@ $(objpfx)munch-init.c: munch.awk munch-tmpl.c $(+subdir_inits)
generated := $(generated) munch-init.c
endif
-# We have a versioning file for libc.so.
-libc-map = libc.map
-
include Makerules
diff --git a/Makerules b/Makerules
index 18a17587fa..26676c674b 100644
--- a/Makerules
+++ b/Makerules
@@ -345,7 +345,11 @@ no-whole-archive =
endif
ifeq ($(versioning),yes)
-load-map-file = $($(@F:%.so=%)-map:%=-Wl,--version-script=%)
+ifneq ($(..),)
+load-map-file = $(wildcard $($(@F:%.so=%)-map) $(..)$($(@F:%.so=%)-map))
+else
+load-map-file = $($(@F:%.so=%)-map)
+endif
else
load-map-file =
endif
@@ -361,11 +365,11 @@ $(patsubst %,$(objpfx)%.so,$(extra-libs)): $(interp-obj)
define build-shlib
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
- -B$(csu-objpfx) $(load-map-file) \
+ -B$(csu-objpfx) $(load-map-file:%=-Wl,--version-script=%) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
- -Wl,--whole-archive $(filter-out $($(@F:%.so=%-map)),$^) \
+ -Wl,--whole-archive $(filter-out $(load-map-file),$^) \
$(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
test -z "$($(@F)-version)" || \
(rm -f $@$($(@F)-version); $(LN_S) $(@F) $@$($(@F)-version))
@@ -383,7 +387,7 @@ LDFLAGS-c.so += -e __libc_main
$(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
$(common-objpfx)libc_pic.a \
$(elfobjdir)/sofini.so $(elfobjdir)/ld.so \
- $(libc-map)
+ $(libc-map:%=$(..)%)
$(build-shlib)
endif
diff --git a/db/libdb.map b/db/libdb.map
index 3ce01866f2..01414a1708 100644
--- a/db/libdb.map
+++ b/db/libdb.map
@@ -1,7 +1,7 @@
GLIBC_2.0 {
global:
# the real DB entry point.
- dbopen;
+ dbopen; __dbopen;
# The compatibility functions.
dbm_clearerr; dbm_close; dbm_delete; dbm_dirfno; dbm_error;
diff --git a/libc.map b/libc.map
index dabe1893a8..c912859231 100644
--- a/libc.map
+++ b/libc.map
@@ -4,10 +4,11 @@ GLIBC_2.0 {
_errno; _itoa_lower_digits; _itoa_upper_digits;
__ctype_b; __ctype_tolower; __ctype_toupper;
_IO_stderr_; _IO_stdin_; _IO_stdout_;
- _nl_msg_cat_cntr; __environ; _environ;
+ _nl_msg_cat_cntr; __environ; _environ; _res;
+ ___brk_addr; __curbrk; _nl_current_LC_CTYPE; _libc_intl_domainname;
# helper functions
- __errno_location; __libc_init_first;
+ __errno_location; __libc_init_first; __h_errno_location;
# functions with special/multiple interfaces
__sigsetjmp; _setjmp; __sigaddset; __sigdelset; __sigismember;
@@ -34,6 +35,7 @@ GLIBC_2.0 {
# functions used in inline functions or macros
__strto*_internal; __wcsto*_internal; __getdelim;
__isnan; __isnanf; __isnanl; __finite; __finitef; __finitel;
+ __isinf; __isinff; __isinfl;
__signbit; __signbitf; __signbitl; __cmsg_nxthdr;
_obstack_allocated_p; _obstack_begin; _obstack_begin_1;
_obstack_free; _obstack_memory_used; _obstack_newchunk;
@@ -41,7 +43,13 @@ GLIBC_2.0 {
_IO_getc; _IO_peekc_unlocked; _IO_putc; _IO_feof; _IO_ferror;
# functions used in other libraries
- __printf_fp;
+ __printf_fp; __stpncpy; _dcgettext;
+ _nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
+ __nss_database_lookup; __internal_endnetgrent; __internal_getnetgrent_r;
+ __internal_setnetgrent; __gmtime_r; __secure_getenv;
+ __select; __sched_get_priority_max; __sched_get_priority_min;
+ __sched_getparam; __sched_getscheduler; __sched_setscheduler;
+ __sched_yield; __on_exit; __gettimeofday; __fork; __clone;
# all functions and variables in the normal name space
a*; b*; c*; d*; e*; f*; g*; h*; i*; j*; k*; l*; m*;
diff --git a/libio/stdio.h b/libio/stdio.h
index 0ed711a8cb..8ab11e6a91 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -291,25 +291,6 @@ extern int __vsscanf __P ((__const char *__s, __const char *__format,
_G_va_list __arg));
extern int vsscanf __P ((__const char *__s, __const char *__format,
_G_va_list __arg));
-
-
-#ifdef __OPTIMIZE__
-extern __inline int
-vfscanf (FILE *__s, const char *__fmt, _G_va_list __arg)
-{
- return __vfscanf (__s, __fmt, __arg);
-}
-extern __inline int
-vscanf (const char *__fmt, _G_va_list __arg)
-{
- return __vfscanf (stdin, __fmt, __arg);
-}
-extern __inline int
-vsscanf (const char *__s, const char *__fmt, _G_va_list __arg)
-{
- return __vsscanf (__s, __fmt, __arg);
-}
-#endif /* Optimizing. */
#endif /* Use GNU. */
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 1830be3da4..34c7394d3d 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -36,7 +36,6 @@
#include "error.h"
#include "charset.h"
#include "locfile.h"
-#include "../intl/loadinfo.h"
/* Undefine the following line in the production version. */
/* #define NDEBUG 1 */
@@ -138,6 +137,7 @@ void *xmalloc (size_t __n);
/* Prototypes for local functions. */
static void error_print (void);
static const char *construct_output_path (char *path);
+static const char *normalize_codeset (const char *codeset, size_t name_len);
int
@@ -475,7 +475,7 @@ construct_output_path (char *path)
++endp;
if (endp > startp)
- normal = _nl_normalize_codeset (startp, endp - startp);
+ normal = normalize_codeset (startp, endp - startp);
}
else
/* This is to keep gcc quiet. */
@@ -512,3 +512,47 @@ construct_output_path (char *path)
return result;
}
+
+/* Normalize codeset name. There is no standard for the codeset
+ names. Normalization allows the user to use any of the common
+ names. */
+static const char *
+normalize_codeset (codeset, name_len)
+ const char *codeset;
+ size_t name_len;
+{
+ int len = 0;
+ int only_digit = 1;
+ char *retval;
+ char *wp;
+ size_t cnt;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+ if (isalnum (codeset[cnt]))
+ {
+ ++len;
+
+ if (isalpha (codeset[cnt]))
+ only_digit = 0;
+ }
+
+ retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
+
+ if (retval != NULL)
+ {
+ if (only_digit)
+ wp = stpcpy (retval, "iso");
+ else
+ wp = retval;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+ if (isalpha (codeset[cnt]))
+ *wp++ = tolower (codeset[cnt]);
+ else if (isdigit (codeset[cnt]))
+ *wp++ = codeset[cnt];
+
+ *wp = '\0';
+ }
+
+ return (const char *) retval;
+}
diff --git a/math/libm-test.c b/math/libm-test.c
index b66371c212..156c7ebf98 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -41,12 +41,15 @@
/* This program isn't finished yet.
It has tests for:
acos, acosh, asin, asinh, atan, atan2, atanh,
- 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, rint, rinttol, rinttoll, round, roundtol, roundtoll,
- scalb, scalbn, sin, sinh, sqrt, tan, tanh, trunc
+ cbrt, ceil, copysign, cos, cosh, erf, erfc, exp, exp2, expm1,
+ fabs, fdim, floor, fmin, fmax, fmod, fpclassify,
+ frexp, gamma, hypot,
+ ilogb, isfinite, isinf, isnan, isnormal,
+ ldexp, lgamma, log, log10, log1p, log2, logb,
+ modf, nearbyint, nextafter,
+ pow, remainder, remquo, rint, rinttol, rinttoll,
+ round, roundtol, roundtoll,
+ scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, trunc
and for the following complex math functions:
cacos, cacosh, casin, casinh, catan, catanh,
@@ -54,9 +57,9 @@
At the moment the following functions aren't tested:
cabs, carg, conj, cproj, cimag, creal, drem,
- erf, erfc, gamma, lgamma,
j0, j1, jn, y0, y1, yn,
- nearbyint, remainder, remquo, signbit, significant, sincos.
+ significand,
+ nan, comparison macros (isless,isgreater,...).
The routines using random variables are still under construction. I don't
like it the way it's working now and will change it.
@@ -81,6 +84,14 @@
checked against. These implemented tests should check all cases
that are specified in ISO C 9X.
+ Exception testing: At the moment only divide-by-zero and invalid
+ exceptions are tested. Overflow/underflow and inexact exceptions
+ aren't checked at the moment.
+
+ NaN values: There exist signalling and quiet NaNs. This implementation
+ only uses signalling NaN as parameter but does not differenciate
+ between the two kinds of NaNs as result.
+
Inline functions: Inlining functions should give an improvement in
speed - but not in precission. The inlined functions return
reasonable values for a reasonable range of input values. The
@@ -98,6 +109,7 @@
- Compiler has errors
With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error.
+
*/
#ifndef _GNU_SOURCE
@@ -201,13 +213,11 @@ random_greater (MATHTYPE min_value)
}
/* Get a random value x with x < max_value. */
-#ifndef TEST_INLINE
static MATHTYPE
random_less (MATHTYPE max_value)
{
return random_value (-1e6, max_value);
}
-#endif
static void
@@ -359,6 +369,8 @@ output_result_bool (const char *test_name, int result)
else
{
output_fail_value (test_name);
+ if (verbose > 1)
+ printf (" Value: %d\n", result);
++noErrors;
}
@@ -548,6 +560,40 @@ check_bool (const char *test_name, int computed)
output_result_bool (test_name, computed);
}
+
+
+/*
+ check that computed and expected values are equal (int values)
+ */
+static void
+check_int (const char *test_name, int computed, int expected)
+{
+ int diff = computed - expected;
+ int result = diff == 0;
+
+ output_new_test (test_name);
+ test_exceptions (test_name, NO_EXCEPTION);
+
+ if (result)
+ {
+ output_pass_value ();
+ }
+ else
+ {
+ output_fail_value (test_name);
+ if (verbose > 1)
+ {
+ printf ("Result:\n");
+ printf (" is: %d\n", computed);
+ printf (" should be: %d\n", expected);
+ }
+ noErrors++;
+ }
+
+ fpstack_test (test_name);
+}
+
+
/*
check that computed and expected values are equal (long int values)
*/
@@ -648,7 +694,6 @@ check_isnan_maybe_exc (const char *test_name, MATHTYPE computed,
output_isvalue (test_name, isnan (computed), computed);
}
-
/*
check that computed value is not-a-number and supply parameter
*/
@@ -663,6 +708,19 @@ check_isnan_ext (const char *test_name, MATHTYPE computed,
}
#endif
+/*
+ check that computed value is not-a-number, test for exceptions
+ and supply parameter
+ */
+static void
+check_isnan_exc_ext (const char *test_name, MATHTYPE computed,
+ short exception, MATHTYPE parameter)
+{
+ output_new_test (test_name);
+ test_exceptions (test_name,exception);
+ output_isvalue_ext (test_name, isnan (computed), computed, parameter);
+}
+
/* Tests if computed is +Inf */
static void
@@ -741,11 +799,18 @@ acos_test (void)
check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
FUNC(acos) (x),
INVALID_EXCEPTION);
+
+ x = random_less (1);
+ check_isnan_exc ("acos (x) == NaN plus invalid exception for |x| > 1",
+ FUNC(acos) (x),
+ INVALID_EXCEPTION);
#endif
check ("acos (1) == 0", FUNC(acos) (1), 0);
+ check ("acos (-1) == pi", FUNC(acos) (-1), M_PI);
}
+
static void
acosh_test (void)
{
@@ -773,6 +838,11 @@ asin_test (void)
check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
FUNC(asin) (x),
INVALID_EXCEPTION);
+
+ x = random_less (1);
+ check_isnan_exc ("asin x == NaN plus invalid exception for |x| > 1",
+ FUNC(asin) (x),
+ INVALID_EXCEPTION);
#endif
check ("asin (0) == 0", FUNC(asin) (0), 0);
@@ -786,7 +856,10 @@ asinh_test (void)
check ("asinh(+0) == +0", FUNC(asinh) (0), 0);
#ifndef TEST_INLINE
check ("asinh(-0) == -0", FUNC(asinh) (minus_zero), minus_zero);
+ check_isinfp ("asinh(+inf) == +inf", FUNC(asinh) (plus_infty));
+ check_isinfn ("asinh(-inf) == -inf", FUNC(asinh) (minus_infty));
#endif
+
}
@@ -800,6 +873,7 @@ atan_test (void)
check ("atan (-inf) == -pi/2", FUNC(atan) (minus_infty), -M_PI_2);
}
+
static void
atan2_test (void)
{
@@ -830,6 +904,28 @@ atan2_test (void)
x = random_greater (0);
check ("atan2 (y,-0) == pi/2 for y > 0", FUNC(atan2) (x, minus_zero), M_PI_2);
+ x = random_less (0);
+ check ("atan2 (y,+0) == -pi/2 for y < 0", FUNC(atan2) (x, 0), -M_PI_2);
+
+ x = random_less (0);
+ check ("atan2 (y,-0) == -pi/2 for y < 0", FUNC(atan2) (x, minus_zero), -M_PI_2);
+
+ x = random_greater (0);
+ check ("atan2 (y,inf) == +0 for finite y > 0",
+ FUNC(atan2) (x, plus_infty), 0);
+
+ x = -random_greater (0);
+ check ("atan2 (y,inf) == -0 for finite y < 0",
+ FUNC(atan2) (x, plus_infty), minus_zero);
+
+ x = random_value (-1e4, 1e4);
+ check ("atan2(+inf, x) == pi/2 for finite x",
+ FUNC(atan2) (plus_infty, x), M_PI_2);
+
+ x = random_value (-1e4, 1e4);
+ check ("atan2(-inf, x) == -pi/2 for finite x",
+ FUNC(atan2) (minus_infty, x), -M_PI_2);
+
x = random_greater (0);
check ("atan2 (y,-inf) == +pi for finite y > 0",
FUNC(atan2) (x, minus_infty), M_PI);
@@ -849,12 +945,15 @@ atan2_test (void)
check ("atan2 (-inf,-inf) == -3*pi/4",
FUNC(atan2) (minus_infty, minus_infty), -3 * M_PI_4);
+
+ /* FIXME: Add some specific tests */
}
static void
atanh_test (void)
{
+ MATHTYPE x;
check ("atanh(+0) == +0", FUNC(atanh) (0), 0);
#ifndef TEST_INLINE
@@ -864,6 +963,15 @@ atanh_test (void)
FUNC(atanh) (1), DIVIDE_BY_ZERO_EXCEPTION);
check_isinfn_exc ("atanh(-1) == -inf plus divide-by-zero exception",
FUNC(atanh) (-1), DIVIDE_BY_ZERO_EXCEPTION);
+
+ x = random_greater (1.0);
+ check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
+ FUNC(atanh) (x), INVALID_EXCEPTION, x);
+
+ x = random_less (1.0);
+ check_isnan_exc_ext ("atanh (x) == NaN plus invalid exception if |x| > 1",
+ FUNC(atanh) (x), INVALID_EXCEPTION, x);
+
#endif
}
@@ -932,6 +1040,38 @@ cosh_test (void)
static void
+erf_test (void)
+{
+ errno = 0;
+ FUNC(erf) (0);
+ if (errno == ENOSYS)
+ /* Function not implemented. */
+ return;
+
+ check ("erf (+0) == +0", FUNC(erf) (0), 0);
+ check ("erf (-0) == -0", FUNC(erf) (minus_zero), minus_zero);
+ check ("erf (+inf) == +1", FUNC(erf) (plus_infty), 1);
+ check ("erf (-inf) == -1", FUNC(erf) (minus_infty), -1);
+}
+
+
+static void
+erfc_test (void)
+{
+ errno = 0;
+ FUNC(erfc) (0);
+ if (errno == ENOSYS)
+ /* Function not implemented. */
+ return;
+
+ check ("erfc (+inf) == 0", FUNC(erfc) (plus_infty), 0.0);
+ check ("erfc (-inf) == 2", FUNC(erfc) (minus_infty), 2.0);
+ check ("erfc (+0) == 1", FUNC(erfc) (0.0), 1.0);
+ check ("erfc (-0) == 1", FUNC(erfc) (minus_zero), 1.0);
+}
+
+
+static void
exp_test (void)
{
check ("exp (+0) == 1", FUNC(exp) (0), 1);
@@ -1084,6 +1224,110 @@ fpclassify_test (void)
static void
+isfinite_test (void)
+{
+ check_bool ("isfinite (0) != 0", isfinite (0));
+ check_bool ("isfinite (-0) != 0", isfinite (minus_zero));
+ check_bool ("isfinite (10) != 0", isfinite (10));
+ check_bool ("isfinite (+inf) == 0", isfinite (plus_infty) == 0);
+ check_bool ("isfinite (-inf) == 0", isfinite (minus_infty) == 0);
+ check_bool ("isfinite (NaN) == 0", isfinite (nan_value) == 0);
+}
+
+
+static void
+isnormal_test (void)
+{
+ check_bool ("isnormal (0) == 0", isnormal (0) == 0);
+ check_bool ("isnormal (-0) == 0", isnormal (minus_zero) == 0);
+ check_bool ("isnormal (10) != 0", isnormal (10));
+ check_bool ("isnormal (+inf) == 0", isnormal (plus_infty) == 0);
+ check_bool ("isnormal (-inf) == 0", isnormal (minus_infty) == 0);
+ check_bool ("isnormal (NaN) == 0", isnormal (nan_value) == 0);
+
+}
+
+
+static void
+signbit_test (void)
+{
+ MATHTYPE x;
+
+ check_bool ("signbit (+0) == 0", signbit (0) == 0);
+ check_bool ("signbit (-0) != 0", signbit (minus_zero));
+ check_bool ("signbit (+inf) == 0", signbit (plus_infty) == 0);
+ check_bool ("signbit (-inf) != 0", signbit (minus_infty));
+ check_bool ("signbit (NaN) == 0", signbit (nan_value));
+
+ x = random_less (0);
+ check_bool ("signbit (x) != 0 for x < 0", signbit (x));
+
+ x = random_greater (0);
+ check_bool ("signbit (x) == 0 for x > 0", signbit (x) == 0);
+
+}
+
+
+
+static void
+gamma_test (void)
+{
+ MATHTYPE x;
+
+ check_isinfp ("gamma (+inf) == +inf", FUNC(gamma) (plus_infty));
+ check_isnan_exc ("gamma (0) == NaN plus invalid exception",
+ FUNC(gamma) (0), INVALID_EXCEPTION);
+
+ x = random_less (0.0);
+ check_isnan_exc_ext ("gamma (x) == NaN plus invalid exception for x <= 0",
+ FUNC(gamma) (x), INVALID_EXCEPTION, x);
+ check_isnan_exc ("gamma (-inf) == NaN plus invalid exception",
+ FUNC(gamma) (minus_infty), INVALID_EXCEPTION);
+
+ check ("gamma (0.5) == sqrt(pi)", FUNC(gamma) (0.5), FUNC(sqrt) (M_PI));
+ check ("gamma (-0.5) == -2*sqrt(pi)", FUNC(gamma) (-0.5),
+ -2*FUNC(sqrt) (M_PI));
+
+ check ("gamma (1) == 1", FUNC(gamma) (1), 1);
+ check ("gamma (4) == 6", FUNC(gamma) (4), 6);
+
+}
+
+
+static void
+lgamma_test (void)
+{
+ MATHTYPE x;
+
+ check_isinfp ("lgamma (+inf) == +inf", FUNC(lgamma) (plus_infty));
+ check_isnan_exc ("lgamma (0) == +inf plus divide by zero exception",
+ FUNC(lgamma) (0), DIVIDE_BY_ZERO_EXCEPTION);
+
+ x = random_less (0.0);
+ check_isnan_exc_ext ("lgamma (x) == +inf plus divide by zero exception for x <= 0",
+ FUNC(lgamma) (x), DIVIDE_BY_ZERO_EXCEPTION, x);
+ check_isnan_exc ("lgamma (-inf) == NaN plus invalid exception",
+ FUNC(lgamma) (minus_infty), INVALID_EXCEPTION);
+
+ check ("lgamma (1) == 0", FUNC(lgamma) (1), 0);
+ check_int ("lgamma (0) sets signgam to 1", signgam, 1);
+
+ check ("lgamma (3) == M_LN2", FUNC(lgamma) (3), M_LN2);
+ check_int ("lgamma (3) sets signgam to 1", signgam, 1);
+
+ check_eps ("lgamma (0.5) == log(sqrt(pi))", FUNC(lgamma) (0.5),
+ FUNC(log) (FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 1e-7));
+ check_int ("lgamma (0.5) sets signgam to 1", signgam, 1);
+
+ check_eps ("lgamma (-0.5) == log(2*sqrt(pi))", FUNC(lgamma) (-0.5),
+ FUNC(log) (2*FUNC(sqrt) (M_PI)), CHOOSE (0, 1e-15, 0));
+
+ check_int ("lgamma (-0.5) sets signgam to -1", signgam, -1);
+
+}
+
+
+static void
ilogb_test (void)
{
@@ -1348,6 +1592,58 @@ sinh_test (void)
static void
+sincos_test (void)
+{
+ MATHTYPE sin_res, cos_res;
+ fenv_t fenv;
+
+ FUNC(sincos) (0, &sin_res, &cos_res);
+ fegetenv (&fenv);
+ check ("sincos (+0, &sin, &cos) puts +0 in sin", sin_res, 0);
+ fesetenv (&fenv);
+ check ("sincos (+0, &sin, &cos) puts 1 in cos", cos_res, 1);
+
+ FUNC(sincos) (minus_zero, &sin_res, &cos_res);
+ fegetenv (&fenv);
+ check ("sincos (-0, &sin, &cos) puts -0 in sin", sin_res, minus_zero);
+ fesetenv (&fenv);
+ check ("sincos (-0, &sin, &cos) puts 1 in cos", cos_res, 1);
+
+ FUNC(sincos) (plus_infty, &sin_res, &cos_res);
+ fegetenv (&fenv);
+ check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in sin plus invalid exception",
+ sin_res, INVALID_EXCEPTION);
+ fesetenv (&fenv);
+ check_isnan_exc ("sincos (+inf, &sin, &cos) puts NaN in cos plus invalid exception",
+ cos_res, INVALID_EXCEPTION);
+
+ FUNC(sincos) (minus_infty, &sin_res, &cos_res);
+ fegetenv (&fenv);
+ check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in sin plus invalid exception",
+ sin_res, INVALID_EXCEPTION);
+ fesetenv (&fenv);
+ check_isnan_exc ("sincos (-inf,&sin, &cos) puts NaN in cos plus invalid exception",
+ cos_res, INVALID_EXCEPTION);
+
+ FUNC(sincos) (M_PI_2, &sin_res, &cos_res);
+ fegetenv (&fenv);
+ check ("sincos (pi/2, &sin, &cos) puts 1 in sin", sin_res, 1);
+ fesetenv (&fenv);
+ check_eps ("sincos (pi/2, &sin, &cos) puts 0 in cos", cos_res, 0,
+ CHOOSE(0, 1e-16, 1e-7));
+
+ FUNC(sincos) (M_PI / 6.0, &sin_res, &cos_res);
+ check ("sincos (pi/6, &sin, &cos) puts 0.5 in sin", sin_res, 0.5);
+
+ FUNC(sincos) (M_PI / 3.0, &sin_res, &cos_res);
+ check_eps ("sincos (pi/3, &sin, &cos) puts 0.5 in cos", cos_res, 0.5,
+ CHOOSE(0, 1e-15, 1e-7));
+
+
+}
+
+
+static void
tan_test (void)
{
check ("tan (+0) == +0", FUNC(tan) (0), 0);
@@ -1411,6 +1707,11 @@ hypot_test (void)
check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot) (plus_infty, a), a);
check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot) (minus_infty, a), a);
+#ifndef TEST_INLINE
+ check_isinfp ("hypot (+inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
+ check_isinfp ("hypot (-inf, NaN) == +inf", FUNC(hypot) (minus_infty, nan_value));
+#endif
+
check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot) (nan_value, nan_value));
a = FUNC(hypot) (12.4L, 0.7L);
@@ -1716,6 +2017,47 @@ fmax_test (void)
static void
+fmod_test (void)
+{
+ MATHTYPE x;
+
+ x = random_greater (0);
+ check_ext ("fmod (+0, y) == +0 for y != 0", FUNC(fmod) (0, x), 0, x);
+
+ x = random_greater (0);
+ check_ext ("fmod (-0, y) == -0 for y != 0", FUNC(fmod) (minus_zero, x),
+ minus_zero, x);
+
+ check_isnan_exc_ext ("fmod (+inf, y) == NaN plus invalid exception",
+ FUNC(fmod) (plus_infty, x), INVALID_EXCEPTION, x);
+ check_isnan_exc_ext ("fmod (-inf, y) == NaN plus invalid exception",
+ FUNC(fmod) (minus_infty, x), INVALID_EXCEPTION, x);
+ check_isnan_exc_ext ("fmod (x, +0) == NaN plus invalid exception",
+ FUNC(fmod) (x, 0), INVALID_EXCEPTION, x);
+ check_isnan_exc_ext ("fmod (x, -0) == NaN plus invalid exception",
+ FUNC(fmod) (x, minus_zero), INVALID_EXCEPTION, x);
+
+ x = random_greater (0);
+ check_ext ("fmod (x, +inf) == x for x not infinite",
+ FUNC(fmod) (x, plus_infty), x, x);
+ x = random_greater (0);
+ check_ext ("fmod (x, -inf) == x for x not infinite",
+ FUNC(fmod) (x, minus_infty), x, x);
+
+ check_eps ("fmod (6.5, 2.3) == 1.9", FUNC(fmod) (6.5, 2.3), 1.9,
+ CHOOSE(0, 1e-15, 0));
+ check_eps ("fmod (-6.5, 2.3) == 1.9", FUNC(fmod) (-6.5, 2.3), -1.9,
+ CHOOSE(0, 1e-15, 0));
+ check_eps ("fmod (6.5, -2.3) == 1.9", FUNC(fmod) (6.5, -2.3), 1.9,
+ CHOOSE(0, 1e-15, 0));
+ check_eps ("fmod (-6.5, -2.3) == 1.9", FUNC(fmod) (-6.5, -2.3), -1.9,
+ CHOOSE(0, 1e-15, 0));
+
+
+}
+
+
+static void
nextafter_test (void)
{
MATHTYPE x;
@@ -1823,12 +2165,58 @@ sqrt_test (void)
check_isnan ("sqrt (NaN) == NaN", FUNC(sqrt) (nan_value));
check_isinfp ("sqrt (+inf) == +inf", FUNC(sqrt) (plus_infty));
+ check ("sqrt (-0) == -0", FUNC(sqrt) (0), 0);
+
+ x = random_less (0.0);
+ check_isnan_exc_ext ("sqrt (x) == NaN plus invalid exception for x < 0",
+ FUNC(sqrt) (x), INVALID_EXCEPTION, x);
+
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);
}
+static void
+remainder_test (void)
+{
+ MATHTYPE result;
+
+ result = FUNC(remainder) (1, 0);
+ check_isnan_exc ("remainder(1, +0) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remainder) (1, minus_zero);
+ check_isnan_exc ("remainder(1, -0) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remainder) (plus_infty, 1);
+ check_isnan_exc ("remainder(+inf, 1) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remainder) (minus_infty, 1);
+ check_isnan_exc ("remainder(-inf, 1) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remainder) (1.625, 1.0);
+ check ("remainder(1.625, 1.0) == -0.375", result, -0.375);
+
+ result = FUNC(remainder) (-1.625, 1.0);
+ check ("remainder(-1.625, 1.0) == 0.375", result, 0.375);
+
+ result = FUNC(remainder) (1.625, -1.0);
+ check ("remainder(1.625, -1.0) == -0.375", result, -0.375);
+
+ result = FUNC(remainder) (-1.625, -1.0);
+ check ("remainder(-1.625, -1.0) == 0.375", result, 0.375);
+
+ result = FUNC(remainder) (5.0, 2.0);
+ check ("remainder(5.0, 2.0) == 1.0", result, 1.0);
+
+ result = FUNC(remainder) (3.0, 2.0);
+ check ("remainder(3.0, 2.0) == -1.0", result, -1.0);
+}
+
static void
remquo_test (void)
@@ -1836,21 +2224,45 @@ remquo_test (void)
int quo;
MATHTYPE result;
+ result = FUNC(remquo) (1, 0, &quo);
+ check_isnan_exc ("remquo(1, +0, &x) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remquo) (1, minus_zero, &quo);
+ check_isnan_exc ("remquo(1, -0, &x) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remquo) (plus_infty, 1, &quo);
+ check_isnan_exc ("remquo(+inf, 1, &x) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
+ result = FUNC(remquo) (minus_infty, 1, &quo);
+ check_isnan_exc ("remquo(-inf, 1, &x) == NaN plus invalid exception",
+ result, INVALID_EXCEPTION);
+
result = FUNC(remquo) (1.625, 1.0, &quo);
check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
- check_long ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
-
+ check_long ("remquo(1.625, 1.0, &x) puts 2 in x", quo, 2);
+
result = FUNC(remquo) (-1.625, 1.0, &quo);
check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
- check_long ("remquo(-1.625, 1.0, &x) puts -1 in x", quo, -1);
-
+ check_long ("remquo(-1.625, 1.0, &x) puts -2 in x", quo, -2);
+
result = FUNC(remquo) (1.625, -1.0, &quo);
check ("remquo(1.625, -1.0, &x) == -0.375", result, -0.375);
- check_long ("remquo(1.625, -1.0, &x) puts -1 in x", quo, -1);
-
+ check_long ("remquo(1.625, -1.0, &x) puts -2 in x", quo, -2);
+
result = FUNC(remquo) (-1.625, -1.0, &quo);
check ("remquo(-1.625, -1.0, &x) == 0.375", result, 0.375);
- check_long ("remquo(-1.625, -1.0, &x) puts 1 in x", quo, 1);
+ check_long ("remquo(-1.625, -1.0, &x) puts 2 in x", quo, 2);
+
+ result = FUNC(remquo) (5.0, 2.0, &quo);
+ check ("remquo(5.0, 2.0, &x) == 1.0", result, 1.0);
+ check_long ("remquo (5.0, 2.0, &x) puts 2 in x", quo, 2);
+
+ result = FUNC(remquo) (3.0, 2.0, &quo);
+ check ("remquo(3.0, 2.0, &x) == -1.0", result, -1.0);
+ check_long ("remquo (3.0, 2.0, &x) puts 2 in x", quo, 2);
}
@@ -3923,6 +4335,16 @@ cpow_test (void)
static void
+nearbyint_test (void)
+{
+ check ("nearbyint(+0) = 0", FUNC(nearbyint) (0.0), 0.0);
+ check ("nearbyint(-0) = -0", FUNC(nearbyint) (minus_zero), minus_zero);
+ check_isinfp ("nearbyint(+Inf) = +Inf", FUNC(nearbyint) (plus_infty));
+ check_isinfn ("nearbyint(-Inf) = -Inf", FUNC(nearbyint) (minus_infty));
+}
+
+
+static void
rint_test (void)
{
check ("rint(0) = 0", FUNC(rint) (0.0), 0.0);
@@ -4330,22 +4752,36 @@ main (int argc, char *argv[])
basic_tests ();
+ /* keep the tests a wee bit ordered (according to ISO 9X) */
+ /* classification functions */
+ fpclassify_test ();
+ isfinite_test ();
+ isnormal_test ();
+ signbit_test ();
+
+ /* trigonometric functions */
acos_test ();
- acosh_test ();
asin_test ();
- asinh_test ();
atan_test ();
- atanh_test ();
atan2_test ();
- cbrt_test ();
- ceil_test ();
cos_test ();
+ sin_test ();
+ sincos_test ();
+ tan_test ();
+
+ /* hyperbolic functions */
+ acosh_test ();
+ asinh_test ();
+ atanh_test ();
cosh_test ();
+ sinh_test ();
+ tanh_test ();
+
+ /* exponential and logarithmic functions */
exp_test ();
exp2_test ();
expm1_test ();
frexp_test ();
- ilogb_test ();
ldexp_test ();
log_test ();
log10_test ();
@@ -4353,28 +4789,50 @@ main (int argc, char *argv[])
log2_test ();
logb_test ();
modf_test ();
+ ilogb_test ();
scalb_test ();
scalbn_test ();
- sin_test ();
- sinh_test ();
- tan_test ();
- tanh_test ();
+
+ /* power and absolute value functions */
+ cbrt_test ();
fabs_test ();
- floor_test ();
- fpclassify_test ();
hypot_test ();
pow_test ();
- fdim_test ();
- fmin_test ();
- fmax_test ();
- nextafter_test ();
- copysign_test ();
sqrt_test ();
+
+ /* error and gamma functions */
+ erf_test ();
+ erfc_test ();
+ gamma_test ();
+ lgamma_test ();
+
+ /* nearest integer functions */
+ ceil_test ();
+ floor_test ();
+ nearbyint_test ();
+ rint_test ();
+ rinttol_test ();
+ rinttoll_test ();
+ round_test ();
+ roundtol_test ();
+ roundtoll_test ();
trunc_test ();
-#if 0
- /* XXX I'm not sure what is the correct result. */
+
+ /* remainder functions */
+ fmod_test ();
+ remainder_test ();
remquo_test ();
-#endif
+
+ /* manipulation functions */
+ copysign_test ();
+ nextafter_test ();
+
+ /* maximum, minimum and positive difference functions */
+ fdim_test ();
+ fmin_test ();
+ fmax_test ();
+
+ /* complex functions */
cexp_test ();
csin_test ();
csinh_test ();
@@ -4391,13 +4849,7 @@ main (int argc, char *argv[])
csqrt_test ();
cpow_test ();
- rint_test ();
- rinttol_test ();
- rinttoll_test ();
- round_test ();
- roundtol_test ();
- roundtoll_test ();
-
+ /* special tests */
identities ();
inverse_functions ();
diff --git a/math/libm.map b/math/libm.map
index 205578d2c2..b7c9b363d9 100644
--- a/math/libm.map
+++ b/math/libm.map
@@ -4,6 +4,16 @@ GLIBC_2.0 {
a*; b*; c*; d*; e*; f*; g*; h*; i*; j*; k*; l*; m*;
n*; o*; p*; q*; r*; s*; t*; u*; v*; w*; x*; y*; z*;
+ # global variables
+ _LIB_VERSION;
+
+ # functions used in inline functions or macros
+ __fpclassify; __fpclassifyf; __fpclassifyl;
+ __signbit; __signbitf; __signbitl;
+ __finite; __finitef; __fintitel;
+
+ __log1p;
+
local:
*;
};
diff --git a/nis/libnsl.map b/nis/libnsl.map
index ab88de6cb8..36bb857093 100644
--- a/nis/libnsl.map
+++ b/nis/libnsl.map
@@ -1,13 +1,61 @@
GLIBC_2.0 {
global:
- nis_add; nis_add_entry; nis_addmember; nis_checkpoint; nis_clone_directory;
- nis_clone_entry; nis_clone_group; nis_clone_link; nis_clone_nis_attr;
- nis_clone_objdata; nis_clone_object; nis_clone_result; nis_clone_table;
- nis_creategroup; nis_destroy_object; nis_destroygroup; nis_dir_cmp;
- nis_domain_of; nis_domain_of_r; nis_first_entry; nis_free_attr;
- nis_free_directory; nis_free_endpoints; nis_free_entry; nis_free_group;
- nis_free_link; nis_free_object; nis_free_request; nis_free_servers;
- nis_free_table;
+ __nis_default_access; __nis_default_group; __nis_default_owner;
+ __nis_default_ttl; __yp_check; nis_add;
+ nis_add_entry; nis_addmember; nis_checkpoint;
+ nis_clone_directory; nis_clone_entry; nis_clone_group;
+ nis_clone_link; nis_clone_nis_attr; nis_clone_objdata;
+ nis_clone_object; nis_clone_result; nis_clone_table;
+ nis_creategroup; nis_destroy_object; nis_destroygroup;
+ nis_dir_cmp; nis_domain_of; nis_domain_of_r;
+ nis_first_entry; nis_free_attr; nis_free_directory;
+ nis_free_endpoints; nis_free_entry; nis_free_group;
+ nis_free_link; nis_free_object; nis_free_request;
+ nis_free_servers; nis_free_table; nis_freenames;
+ nis_freeresult; nis_freeservlist; nis_freetags;
+ nis_getnames; nis_getservlist; nis_ismember;
+ nis_leaf_of; nis_leaf_of_r; nis_lerror;
+ nis_list; nis_local_directory; nis_local_group;
+ nis_local_host; nis_local_principal; nis_lookup;
+ nis_mkdir; nis_modify; nis_modify_entry;
+ nis_name_of; nis_name_of_r; nis_next_entry;
+ nis_perror; nis_ping; nis_print_directory;
+ nis_print_entry; nis_print_group; nis_print_group_entry;
+ nis_print_link; nis_print_object; nis_print_result;
+ nis_print_rights; nis_print_table; nis_read_obj;
+ nis_remove; nis_remove_entry; nis_removemember;
+ nis_rmdir; nis_servstate; nis_sperrno;
+ nis_sperror; nis_sperror_r; nis_stats;
+ nis_verifygroup; nis_write_obj;
+
+ readColdStartFile; writeColdStartFile;
+
+ xdr_cp_result; xdr_directory_obj; xdr_domainname;
+ xdr_dump_args; xdr_endpoint; xdr_entry_col;
+ xdr_entry_obj; xdr_fd_args; xdr_fd_result;
+ xdr_group_obj; xdr_ib_request; xdr_keydat;
+ xdr_link_obj; xdr_log_entry; xdr_log_entry_t;
+ xdr_log_result; xdr_mapname; xdr_nis_attr;
+ xdr_nis_error; xdr_nis_name; xdr_nis_object;
+ xdr_nis_oid; xdr_nis_result; xdr_nis_server;
+ xdr_nis_tag; xdr_nis_taglist; xdr_ns_request;
+ xdr_nstype; xdr_oar_mask; xdr_objdata;
+ xdr_peername; xdr_ping_args; xdr_table_col;
+ xdr_table_obj; xdr_valdat; xdr_yp_buf;
+ xdr_ypbind_binding; xdr_ypbind_resp; xdr_ypbind_resptype;
+ xdr_ypbind_setdom; xdr_ypdelete_args; xdr_ypmap_parms;
+ xdr_ypmaplist; xdr_yppush_status; xdr_yppushresp_xfr;
+ xdr_ypreq_key; xdr_ypreq_nokey; xdr_ypreq_xfr;
+ xdr_ypresp_all; xdr_ypresp_key_val; xdr_ypresp_maplist;
+ xdr_ypresp_master; xdr_ypresp_order; xdr_ypresp_val;
+ xdr_ypresp_xfr; xdr_ypstat; xdr_ypupdate_args;
+ xdr_ypxfrstat; xdr_zotypes;
+
+ yp_all; yp_bind; yp_first;
+ yp_get_default_domain; yp_maplist; yp_master;
+ yp_match; yp_next; yp_order;
+ yp_unbind; yp_update; ypbinderr_string;
+ yperr_string; ypprot_err;
local:
*;
diff --git a/nis/nss_nis/nis-ethers.c b/nis/nss_nis/nis-ethers.c
index a9730a3744..32c683415d 100644
--- a/nis/nss_nis/nis-ethers.c
+++ b/nis/nss_nis/nis-ethers.c
@@ -80,7 +80,7 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
-enum nss_status
+static enum nss_status
internal_nis_setetherent (void)
{
char *domainname;
diff --git a/nis/nss_nis/nis-proto.c b/nis/nss_nis/nis-proto.c
index d939c9d5c7..3df99190a2 100644
--- a/nis/nss_nis/nis-proto.c
+++ b/nis/nss_nis/nis-proto.c
@@ -72,7 +72,7 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
-enum nss_status
+static enum nss_status
internal_nis_setprotoent (void)
{
char *domainname;
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index e6d584dac8..0fdeb8f3f1 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -44,72 +44,14 @@ static nis_name *names = NULL;
/* Get implementation for some internal functions. */
#include "../../resolv/mapv4v6addr.h"
-#define ENTNAME hostent
-#define DATABASE "hosts"
-#define NEED_H_ERRNO
-
-#define ENTDATA hostent_data
-struct hostent_data
- {
- unsigned char host_addr[16]; /* IPv4 or IPv6 address. */
- char *h_addr_ptrs[2]; /* Points to that and null terminator. */
- };
-
-#define TRAILING_LIST_MEMBER h_aliases
-#define TRAILING_LIST_SEPARATOR_P isspace
-#include "../../nss/nss_files/files-parse.c"
-LINE_PARSER
-("#",
- {
- char *addr;
-
- STRING_FIELD (addr, isspace, 1);
-
- /* Parse address. */
- if (inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
- {
- result->h_addrtype = AF_INET6;
- result->h_length = IN6ADDRSZ;
- }
- else
- if (inet_pton (AF_INET, addr, entdata->host_addr) > 0)
- {
- if (_res.options & RES_USE_INET6)
- {
- map_v4v6_address ((char *) entdata->host_addr,
- (char *) entdata->host_addr);
- result->h_addrtype = AF_INET6;
- result->h_length = IN6ADDRSZ;
- }
- else
- {
- result->h_addrtype = AF_INET;
- result->h_length = INADDRSZ;
- }
- }
- else
- /* Illegal address: ignore line. */
- return 0;
-
- /* Store a pointer to the address in the expected form. */
- entdata->h_addr_ptrs[0] = entdata->host_addr;
- entdata->h_addr_ptrs[1] = NULL;
- result->h_addr_list = entdata->h_addr_ptrs;
-
- STRING_FIELD (result->h_name, isspace, 1);
- }
-)
-
-
static int
-_nss_nisplus_parse_hostent (nis_result *result, struct hostent *host,
+_nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
char *buffer, size_t buflen)
{
- char *p = buffer;
- size_t room_left = buflen;
- int parse_res;
unsigned int i;
- struct parser_data *data = (void *) buffer;
+ char *first_unused = buffer;
+ size_t room_left = buflen;
+ char *data, *p, *line;
if (result == NULL)
return 0;
@@ -121,43 +63,117 @@ _nss_nisplus_parse_hostent (nis_result *result, struct hostent *host,
result->objects.objects_val[0].zo_data.objdata_u.en_data.en_cols.en_cols_len < 4)
return 0;
- memset (p, '\0', room_left);
-
- /* Generate the hosts entry format and use the normal parser */
- if (NISENTRYLEN (0, 2, result) + 1 > room_left)
+ if (room_left < NISENTRYLEN (0, 2, result) + 1)
{
__set_errno (ERANGE);
return 0;
}
- strncpy (p, NISENTRYVAL (0, 2, result),
- NISENTRYLEN (0, 2, result));
- room_left -= (NISENTRYLEN (0, 2, result) + 1);
+
+ data = first_unused;
+ if (inet_pton (af, NISENTRYVAL (0, 2, result), data) < 1)
+ /* Illegal address: ignore line. */
+ return 0;
+
+ host->h_addrtype = af;
+ if (af == AF_INET6)
+ host->h_length = IN6ADDRSZ;
+ else
+ {
+ if (_res.options & RES_USE_INET6)
+ {
+ map_v4v6_address (data, data);
+ host->h_addrtype = AF_INET6;
+ host->h_length = IN6ADDRSZ;
+ }
+ else
+ {
+ host->h_addrtype = AF_INET;
+ host->h_length = INADDRSZ;
+ }
+ }
+ first_unused+=host->h_length;
+ room_left-=host->h_length;
if (NISENTRYLEN (0, 0, result) + 1 > room_left)
{
__set_errno (ERANGE);
return 0;
}
- strcat (p, "\t");
- strncat (p, NISENTRYVAL (0, 0, result), NISENTRYLEN (0, 0, result));
+ p = stpncpy (first_unused, NISENTRYVAL (0, 0, result),
+ NISENTRYLEN (0, 0, result));
+ *p = '\0';
room_left -= (NISENTRYLEN (0, 0, result) + 1);
- /* + 1: We overwrite the last \0 */
+ host->h_name = first_unused;
+ first_unused += NISENTRYLEN (0, 0, result) +1;
+ p = first_unused;
- for (i = 1; i < result->objects.objects_len; i++)
+ line = p;
+ for (i = 0; i < result->objects.objects_len; i++)
{
- if (NISENTRYLEN (i, 1, result) + 1 > room_left)
+ if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
+ {
+ if (NISENTRYLEN (i, 1, result) + 2 > room_left)
+ {
+ __set_errno (ERANGE);
+ return 0;
+ }
+ p = stpcpy(p, " ");
+ p = stpncpy (p, NISENTRYVAL (i, 1, result),
+ NISENTRYLEN (i, 1, result));
+ *p = '\0';
+ room_left -= (NISENTRYLEN (i, 1, result) + 1);
+ }
+ }
+ ++p;
+ first_unused = p;
+ /* Adjust the pointer so it is aligned for
+ storing pointers. */
+ first_unused += __alignof__ (char *) - 1;
+ first_unused -= ((first_unused - (char *) 0) % __alignof__ (char *));
+ host->h_addr_list = (char **) first_unused;
+ if (room_left < 2 * sizeof (char *))
+ {
+ __set_errno (ERANGE);
+ return 0;
+ }
+ room_left -= (2 * sizeof (char *));
+ host->h_addr_list[0] = data;
+ host->h_addr_list[1] = NULL;
+ host->h_aliases = &host->h_addr_list[2];
+ host->h_aliases[0] = NULL;
+
+ i = 0;
+ while (*line != '\0')
+ {
+ /* Skip leading blanks. */
+ while (isspace (*line))
+ line++;
+
+ if (*line == '\0')
+ break;
+
+ if (room_left < sizeof (char *))
{
__set_errno (ERANGE);
return 0;
}
- strcat (p, " ");
- strcat (p, NISENTRYVAL (i, 1, result));
- room_left -= (NISENTRYLEN (i, 1, result) + 1);
+
+ room_left -= sizeof (char *);
+ host->h_aliases[i] = line;
+
+ while (*line != '\0' && *line != ' ')
+ line++;
+
+ if (line != host->h_aliases[i])
+ {
+ *line = '\0';
+ line++;
+ i++;
+ }
}
- parse_res = parse_line (p, host, data, buflen);
+ return 1;
- return parse_res;
}
enum nss_status
@@ -249,7 +265,11 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
}
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res = _nss_nisplus_parse_hostent (result, AF_INET6,
+ host, buffer, buflen);
+ if (!parse_res && errno != ERANGE)
+ parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host,
+ buffer, buflen);
if (!parse_res && errno == ERANGE)
{
*herrnop = NETDB_INTERNAL;
@@ -326,7 +346,8 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
return retval;
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res =
+ _nss_nisplus_parse_hostent (result, af, host, buffer, buflen);
nis_freeresult (result);
@@ -360,19 +381,20 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
}
enum nss_status
-_nss_nisplus_gethostbyaddr_r (const char *addr, struct hostent *host,
- char *buffer, size_t buflen, int *herrnop)
+_nss_nisplus_gethostbyaddr_r (const char *addr, int addrlen, int type,
+ struct hostent *host, char *buffer,
+ size_t buflen, int *herrnop)
{
if (addr == NULL)
return NSS_STATUS_NOTFOUND;
else
{
nis_result *result;
- char buf[24 + strlen (addr)];
+ char buf[1025];
int retval, parse_res;
- sprintf(buf, "[addr=%s],hosts.org_dir", addr);
-
+ snprintf(buf, sizeof (buf) -1, "[addr=%s],hosts.org_dir",
+ inet_ntoa (*(struct in_addr *)addr));
result = nis_list(buf, EXPAND_NAME, NULL, NULL);
retval = niserr2nss (result->status);
@@ -387,7 +409,8 @@ _nss_nisplus_gethostbyaddr_r (const char *addr, struct hostent *host,
return retval;
}
- parse_res = _nss_nisplus_parse_hostent (result, host, buffer, buflen);
+ parse_res = _nss_nisplus_parse_hostent (result, type, host,
+ buffer, buflen);
nis_freeresult (result);
diff --git a/resolv/libresolv.map b/resolv/libresolv.map
index d9ac72e93f..326264668c 100644
--- a/resolv/libresolv.map
+++ b/resolv/libresolv.map
@@ -5,6 +5,8 @@ GLIBC_2.0 {
inet_net_ntop; inet_net_pton; inet_neta; res_gethostbyaddr;
res_gethostbyname; res_gethostbyname2; res_mkquery; res_query;
res_querydomain; res_search; res_send_setqhook; res_send_setrhook;
+ __res_dnok; __res_hnok; __p_class; __hostalias; __dn_skipname;
+ __p_type;
local:
*;
diff --git a/sysdeps/libm-i387/s_asinh.S b/sysdeps/libm-i387/s_asinh.S
index a71d0b66f4..45153fe2d3 100644
--- a/sysdeps/libm-i387/s_asinh.S
+++ b/sysdeps/libm-i387/s_asinh.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -51,8 +51,12 @@ ENTRY(__asinh)
andl $0x80000000, %ecx
xorl %ecx, 8(%esp)
fldl 4(%esp) // |x|
+ movl %eax, %edx
cmpl $0x3e300000, %eax
jb 2f // |x| < 2^-28
+ orl $0x800fffff, %edx
+ incl %edx
+ jz 4f // x in ħInf or NaN
fldln2 // log(2) : |x|
cmpl $0x41b00000, %eax
fxch // |x| : log(2)
diff --git a/sysdeps/libm-i387/s_asinhf.S b/sysdeps/libm-i387/s_asinhf.S
index f47bc9e0ac..7e5176c4a6 100644
--- a/sysdeps/libm-i387/s_asinhf.S
+++ b/sysdeps/libm-i387/s_asinhf.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -51,8 +51,12 @@ ENTRY(__asinhf)
andl $0x80000000, %ecx
xorl %ecx, 8(%esp)
flds 4(%esp) // |x|
+ movl %eax, %edx
cmpl $0x38000000, %eax
jb 2f // |x| < 2^-14
+ orl $0x807fffff, %edx
+ incl %edx
+ jz 4f // x in ħInf or NaN
fldln2 // log(2) : |x|
cmpl $0x47000000, %eax
fxch // |x| : log(2)
diff --git a/sysdeps/libm-i387/s_asinhl.S b/sysdeps/libm-i387/s_asinhl.S
index e112244908..f764381aab 100644
--- a/sysdeps/libm-i387/s_asinhl.S
+++ b/sysdeps/libm-i387/s_asinhl.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -58,8 +58,12 @@ ENTRY(__asinhl)
andl $0x8000, %ecx
xorl %ecx, 12(%esp)
fldt 4(%esp) // |x|
+ movl %eax, %edx
cmpl $0x3fde, %eax
jb 2f // |x| < 2^-34
+ orl $0xffff8000, %edx
+ incl %edx
+ jz 4f // x in ħInf or NaN
fldln2 // log(2) : |x|
cmpl $0x4020, %eax
fxch // |x| : log(2)
diff --git a/sysdeps/libm-i387/s_nearbyint.S b/sysdeps/libm-i387/s_nearbyint.S
index 566c075c37..65ce4f76a1 100644
--- a/sysdeps/libm-i387/s_nearbyint.S
+++ b/sysdeps/libm-i387/s_nearbyint.S
@@ -18,6 +18,8 @@ ENTRY(__nearbyint)
frndint
fclex
fldcw (%esp)
+ popl %ecx
+ popl %eax
ret
END (__nearbyint)
weak_alias (__nearbyint, nearbyint)
diff --git a/sysdeps/libm-i387/s_nearbyintf.S b/sysdeps/libm-i387/s_nearbyintf.S
index 715434031c..090c631607 100644
--- a/sysdeps/libm-i387/s_nearbyintf.S
+++ b/sysdeps/libm-i387/s_nearbyintf.S
@@ -18,6 +18,8 @@ ENTRY(__nearbyintf)
frndint
fclex
fldcw (%esp)
+ popl %ecx
+ popl %eax
ret
END (__nearbyintf)
weak_alias (__nearbyintf, nearbyintf)
diff --git a/sysdeps/libm-i387/s_nearbyintl.S b/sysdeps/libm-i387/s_nearbyintl.S
index c50b42d961..2f60af8f18 100644
--- a/sysdeps/libm-i387/s_nearbyintl.S
+++ b/sysdeps/libm-i387/s_nearbyintl.S
@@ -18,6 +18,8 @@ ENTRY(__nearbyintl)
frndint
fclex
fldcw (%esp)
+ popl %ecx
+ popl %eax
ret
END (__nearbyintl)
weak_alias (__nearbyintl, nearbyintl)
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index 18bb6dc469..f24af67f1e 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -83,3 +83,27 @@ fi
if test -f $srcdir/elf/ldconfig.c; then
has_ldconfig=yes
fi
+
+# Generate stdio_lim.h
+default_fopen_max="`${CC-gcc} -E $srcdir/sysdeps/unix/sysv/linux/mk-stdiolim.c | grep DEFAULT_FOPEN_MAX | cut -f2 -d':'`"
+default_filename_max="`${CC-gcc} -E $srcdir/sysdeps/unix/sysv/linux/mk-stdiolim.c | grep DEFAULT_FILENAME_MAX | cut -f2 -d':'`"
+# We double check if "default_fopen_max" and "default_filename_max" are
+# ok or not.
+if test "x$default_fopen_max" != "xOPEN_MAX" \
+ -a "x$default_filename_max" != "xPATH_MAX"
+then
+ sed -e "s/DEFAULT_FOPEN_MAX/$default_fopen_max/" \
+ -e "s/DEFAULT_FILENAME_MAX/$default_filename_max/" \
+ $srcdir/sysdeps/unix/sysv/linux/stdio_lim.h.in > stdio_lim.h.new
+ if test -r stdio_lim.h.new && cmp -s stdio_lim.h.new stdio_lim.h
+ then
+ echo stdio_lim.h unchanged
+ rm -f stdio_lim.h.new
+ else
+ mv -f stdio_lim.h.new stdio_lim.h
+ fi
+else
+ # We remove the old one if we cannot generate the new one during
+ # configure.
+ rm -f stdio_lim.h
+fi
diff --git a/sysdeps/unix/sysv/linux/mk-stdiolim.c b/sysdeps/unix/sysv/linux/mk-stdiolim.c
new file mode 100644
index 0000000000..23295f007d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mk-stdiolim.c
@@ -0,0 +1,4 @@
+#include <linux/limits.h>
+
+DEFAULT_FOPEN_MAX:OPEN_MAX
+DEFAULT_FILENAME_MAX:PATH_MAX
diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in
new file mode 100644
index 0000000000..9d6a957028
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/stdio_lim.h.in
@@ -0,0 +1,8 @@
+#define L_tmpnam 19
+#define TMP_MAX 238328
+#ifdef __USE_POSIX
+#define L_ctermid 9
+#define L_cuserid 9
+#endif
+#define FOPEN_MAX DEFAULT_FOPEN_MAX
+#define FILENAME_MAX DEFAULT_FILENAME_MAX