summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog77
-rw-r--r--elf/dl-lookup.c50
-rw-r--r--elf/link.h6
-rw-r--r--elf/rtld.c47
-rw-r--r--io/Makefile2
-rw-r--r--posix/Makefile2
-rw-r--r--posix/unistd.h6
-rw-r--r--resolv/res_debug.c391
-rw-r--r--resolv/resolv.h4
-rw-r--r--sysdeps/libm-i387/e_asinl.S21
-rw-r--r--sysdeps/libm-i387/e_atan2l.S16
-rw-r--r--sysdeps/libm-i387/e_expl.S40
-rw-r--r--sysdeps/libm-i387/e_fmodl.S20
-rw-r--r--sysdeps/libm-i387/e_log10l.S16
-rw-r--r--sysdeps/libm-i387/e_logl.S16
-rw-r--r--sysdeps/libm-i387/e_remainderl.S19
-rw-r--r--sysdeps/libm-i387/e_scalbl.S16
-rw-r--r--sysdeps/libm-i387/e_sqrtl.S15
-rw-r--r--sysdeps/libm-i387/s_atanl.S17
-rw-r--r--sysdeps/libm-i387/s_cosl.S29
-rw-r--r--sysdeps/libm-i387/s_finitef.S6
-rw-r--r--sysdeps/libm-i387/s_ilogbl.S24
-rw-r--r--sysdeps/libm-i387/s_log1pl.S25
-rw-r--r--sysdeps/libm-i387/s_logbl.S15
-rw-r--r--sysdeps/libm-i387/s_scalbnl.S16
-rw-r--r--sysdeps/libm-i387/s_sinl.S29
-rw-r--r--sysdeps/libm-i387/s_tanl.S31
-rw-r--r--sysdeps/libm-ieee754/k_standard.c183
-rw-r--r--sysdeps/libm-ieee754/s_ilogbl.c56
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c1
-rw-r--r--sysdeps/libm-ieee754/s_logbl.c47
-rw-r--r--sysdeps/libm-ieee754/s_modfl.c88
-rw-r--r--sysdeps/libm-ieee754/w_acoshl.c47
-rw-r--r--sysdeps/libm-ieee754/w_acosl.c48
-rw-r--r--sysdeps/libm-ieee754/w_asinl.c49
-rw-r--r--sysdeps/libm-ieee754/w_atan2l.c48
-rw-r--r--sysdeps/libm-ieee754/w_atanhl.c52
-rw-r--r--sysdeps/libm-ieee754/w_cabsl.c18
-rw-r--r--sysdeps/libm-ieee754/w_coshl.c47
-rw-r--r--sysdeps/libm-ieee754/w_dreml.c18
-rw-r--r--sysdeps/libm-ieee754/w_expl.c60
-rw-r--r--sysdeps/libm-ieee754/w_fmodl.c48
-rw-r--r--sysdeps/libm-ieee754/w_gammal.c54
-rw-r--r--sysdeps/libm-ieee754/w_gammal_r.c52
-rw-r--r--sysdeps/libm-ieee754/w_hypotl.c48
-rw-r--r--sysdeps/libm-ieee754/w_j0l.c75
-rw-r--r--sysdeps/libm-ieee754/w_j1l.c76
-rw-r--r--sysdeps/libm-ieee754/w_jnl.c98
-rw-r--r--sysdeps/libm-ieee754/w_lgammal.c54
-rw-r--r--sysdeps/libm-ieee754/w_lgammal_r.c52
-rw-r--r--sysdeps/libm-ieee754/w_log10l.c51
-rw-r--r--sysdeps/libm-ieee754/w_logl.c48
-rw-r--r--sysdeps/libm-ieee754/w_powl.c64
-rw-r--r--sysdeps/libm-ieee754/w_remainderl.c48
-rw-r--r--sysdeps/libm-ieee754/w_scalbl.c65
-rw-r--r--sysdeps/libm-ieee754/w_sinhl.c47
-rw-r--r--sysdeps/libm-ieee754/w_sqrtl.c47
-rw-r--r--sysdeps/mach/hurd/getlogin_r.c41
-rw-r--r--sysdeps/posix/ttyname_r.c8
-rw-r--r--sysdeps/stub/getlogin_r.c35
-rw-r--r--sysdeps/unix/getlogin.c54
-rw-r--r--sysdeps/unix/getlogin_r.c80
62 files changed, 2730 insertions, 133 deletions
diff --git a/ChangeLog b/ChangeLog
index 577278e53b..1048926992 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,78 @@
+Tue Jun 4 21:01:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * sysdeps/mach/hurd/getlogin_r.c: New file.
+
+Wed Jun 5 02:11:30 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * io/Makefile (routines): Add ttyname_r.
+
+ * resolv/res_debug.c, resolv/resolv.h: Update from bind-4.3.4-T4A.
+
+ * sysdeps/libm-i387/e_asinl.S, sysdeps/libm-i387/e_atan2l.S,
+ sysdeps/libm-i387/e_expl.S, sysdeps/libm-i387/e_fmodl.S,
+ sysdeps/libm-i387/e_log10l.S, sysdeps/libm-i387/e_logl.S,
+ sysdeps/libm-i387/e_remainderl.S, sysdeps/libm-i387/e_scalbl.S,
+ sysdeps/libm-i387/e_sqrtl.S, sysdeps/libm-i387/s_atanl.S,
+ sysdeps/libm-i387/s_cosl.S, sysdeps/libm-i387/s_ilogbl.S,
+ sysdeps/libm-i387/s_log1pl.S, sysdeps/libm-i387/s_logbl.S,
+ sysdeps/libm-i387/s_scalbnl.S, sysdeps/libm-i387/s_sinl.S,
+ sysdeps/libm-i387/s_tanl.S: New files. i387 assembler versions
+ of `long double' math functions.
+
+ * sysdeps/libm-ieee754/k_standard.c: Add handling for errors
+ in long double functions.
+
+ * sysdeps/libm-ieee754/s_ilogbl.c, sysdeps/libm-ieee754/s_logbl.c,
+ sysdeps/libm-ieee754/s_modfl.c: New files. Generic versions
+ of `long double' math functions.
+
+ * sysdeps/libm-ieee754/s_isinf.c [NO_LONG_DOUBLE]: Add string
+ alias for __isinfl.
+
+ * sysdeps/libm-ieee754/w_acoshl.c, sysdeps/libm-ieee754/w_acosl.c,
+ sysdeps/libm-ieee754/w_asinl.c, sysdeps/libm-ieee754/w_atan2l.c,
+ sysdeps/libm-ieee754/w_atanhl.c, sysdeps/libm-ieee754/w_cabsl.c,
+ sysdeps/libm-ieee754/w_coshl.c, sysdeps/libm-ieee754/w_dreml.c,
+ sysdeps/libm-ieee754/w_expl.c, sysdeps/libm-ieee754/w_fmodl.c,
+ sysdeps/libm-ieee754/w_gammal.c, sysdeps/libm-ieee754/w_gammal_r.c,
+ sysdeps/libm-ieee754/w_hypotl.c, sysdeps/libm-ieee754/w_j0l.c,
+ sysdeps/libm-ieee754/w_j1l.c, sysdeps/libm-ieee754/w_jnl.c,
+ sysdeps/libm-ieee754/w_lgammal.c, sysdeps/libm-ieee754/w_lgammal_r.c,
+ sysdeps/libm-ieee754/w_log10l.c, sysdeps/libm-ieee754/w_logl.c,
+ sysdeps/libm-ieee754/w_powl.c, sysdeps/libm-ieee754/w_remainderl.c,
+ sysdeps/libm-ieee754/w_scalbl.c, sysdeps/libm-ieee754/w_sinhl.c,
+ sysdeps/libm-ieee754/w_sqrtl.c: New files. Wrapper functions
+ around long double function implementations.
+
+ * sysdeps/posix/ttyname_r.c (ttyname_r): Use _D_EXACT_NAMLEN
+ to determine length of directory entry name.
+
+ * posix/Makefile (routines): Add getlogin_r.
+ * posix/unistd.h: Add prototype for getlogin_r.
+ * sysdeps/stub/getlogin_r.c: New file. Reentrant version of
+ getlogin function, specified in P1003.1c/D6. Stub version.
+ * sysdeps/unix/getlogin.c (getlogin): Use ttyname_r instead of
+ ttyname. This avoids saving and restoring the old content.
+ Also use setutent_r, getutline_r and endutent_r instead of
+ accing UTMP file directly.
+ * sysdeps/unix/getlogin_r.c: New file. Reentrant version of
+ getlogin function, specified in P1003.1c/D6.
+
+Tue Jun 4 20:10:09 1996 J.T. Conklin <jtc@cygnus.com>
+
+ * sysdeps/libm-i387/s_finitef.S: Fix mask for exponent.
+
Tue Jun 4 18:57:57 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+ * elf/dl-lookup.c (_dl_lookup_symbol): Grok magical undefined symbols
+ _GNU_libc_dl_{open,close,symbol} and resolve them to dl functions.
+
+ * elf/rtld.c (rtld_map): Renamed to _dl_rtld_map, made global.
+ * elf/link.h: Declare _dl_rtld_map.
+
+ * elf/dl-lookup.c (_dl_symbol_value): New function.
+ * elf/link.h: Declare it.
+
* elf/dladdr.c: Remove #include <setjmp.h>, we don't use it.
* shlib-versions: Set libdl=2.
@@ -1353,12 +1426,12 @@ Tue May 7 23:43:07 1996 Ulrich Drepper <drepper@cygnus.com>
libio/iosetvbuf.c, libio/ioungetc.c, libio/iovsprintf.c,
libio/libio.h, libio/putc.c, libio/putchar.c, libio/rewind.c,
libio/stdio.h, stdio-common/printf_fp.c, stdio-common/vfprintf.c,
- stdio-common/vfscanf.c: Prepare for reentrent libio.
+ stdio-common/vfscanf.c: Prepare for reentrant libio.
* libio/clearerr_u.c, libio/feof_u.c, libio/ferror_u.c,
libio/fputc_u.c, libio/getc_u.c, libio/getchar_u.c,
libio/iofflush_u.c, libio/putc_u.c, libio/putchar_u.c: New files.
- Used in reentrent libio.
+ Used in reentrant libio.
* misc/getusershell.c: Prevent warnings.
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 26357c2484..b2e9bff984 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -110,11 +110,39 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
if (weak_value.s == NULL && ELF32_ST_BIND ((*ref)->st_info) != STB_WEAK)
{
- const char msg[] = "undefined symbol: ";
- char buf[sizeof msg + strlen (undef_name)];
- memcpy (buf, msg, sizeof msg - 1);
- memcpy (&buf[sizeof msg - 1], undef_name, sizeof buf - sizeof msg + 1);
- _dl_signal_error (0, reference_name, buf);
+ /* The symbol was not defined by any object in scope. To allow
+ access to dynamic linker functionality without using -ldl and
+ thereby brining the dynamic linker's symbols into scope, we
+ recognize a few magical symbol names and resolve them to the
+ addresses of functions inside the dynamic linker. */
+
+ struct magic
+ {
+ unsigned long int hash;
+ const char *name;
+ Elf32_Addr value;
+ };
+ static struct magic magic[] =
+ {
+ { 0xd6a2a5e, "_GNU_libc_dl_open", (Elf32_Addr) &_dl_open },
+ { 0x69ef845, "_GNU_libc_dl_close", (Elf32_Addr) &_dl_close },
+ { 0xae4d63c, "_GNU_libc_dl_symbol", (Elf32_Addr) &_dl_symbol_value },
+ { 0, NULL, 0 }
+ };
+ struct magic *m;
+
+ for (m = magic; m->hash; ++m)
+ if (hash == m->hash && !strcmp (name, m->name))
+ return m->value;
+
+ {
+ const char msg[] = "undefined symbol: ";
+ char buf[sizeof msg + strlen (undef_name)];
+ memcpy (buf, msg, sizeof msg - 1);
+ memcpy (&buf[sizeof msg - 1], undef_name,
+ sizeof buf - sizeof msg + 1);
+ _dl_signal_error (0, reference_name, buf);
+ }
}
*ref = weak_value.s;
@@ -135,3 +163,15 @@ _dl_setup_hash (struct link_map *map)
hash += map->l_nbuckets;
map->l_chain = hash;
}
+
+/* Look up symbol NAME in MAP's scope and return its run-time address. */
+
+Elf32_Addr
+_dl_symbol_value (struct link_map *map, const char *name)
+{
+ Elf32_Addr loadbase;
+ const Elf32_Sym *ref = NULL;
+ struct link_map *scope[2] = { map, NULL };
+ loadbase = _dl_lookup_symbol (name, &ref, scope, map->l_name, 0, 0);
+ return loadbase + ref->st_value;
+}
diff --git a/elf/link.h b/elf/link.h
index 51740eeeee..a89e25846e 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -216,6 +216,12 @@ extern Elf32_Addr _dl_lookup_symbol (const char *undef,
Elf32_Addr reloc_addr,
int noplt);
+/* Look up symbol NAME in MAP's scope and return its run-time address. */
+extern Elf32_Addr _dl_symbol_value (struct link_map *map, const char *name);
+
+
+/* Structure describing the dynamic linker itself. */
+extern struct link_map _dl_rtld_map;
/* List of objects currently loaded. */
extern struct link_map *_dl_loaded;
diff --git a/elf/rtld.c b/elf/rtld.c
index 6dc68226db..032bb8ee87 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -52,7 +52,7 @@ static void dl_main (const Elf32_Phdr *phdr,
Elf32_Word phent,
Elf32_Addr *user_entry);
-static struct link_map rtld_map;
+struct link_map _dl_rtld_map;
Elf32_Addr
_dl_start (void *arg)
@@ -92,16 +92,17 @@ _dl_start (void *arg)
/* Transfer data about ourselves to the permanent link_map structure. */
- rtld_map.l_addr = bootstrap_map.l_addr;
- rtld_map.l_ld = bootstrap_map.l_ld;
- memcpy (rtld_map.l_info, bootstrap_map.l_info, sizeof rtld_map.l_info);
- _dl_setup_hash (&rtld_map);
+ _dl_rtld_map.l_addr = bootstrap_map.l_addr;
+ _dl_rtld_map.l_ld = bootstrap_map.l_ld;
+ memcpy (_dl_rtld_map.l_info, bootstrap_map.l_info,
+ sizeof _dl_rtld_map.l_info);
+ _dl_setup_hash (&_dl_rtld_map);
/* Cache the DT_RPATH stored in ld.so itself; this will be
the default search path. */
- _dl_rpath = (void *) (rtld_map.l_addr +
- rtld_map.l_info[DT_STRTAB]->d_un.d_ptr +
- rtld_map.l_info[DT_RPATH]->d_un.d_val);
+ _dl_rpath = (void *) (_dl_rtld_map.l_addr +
+ _dl_rtld_map.l_info[DT_STRTAB]->d_un.d_ptr +
+ _dl_rtld_map.l_info[DT_RPATH]->d_un.d_val);
/* Call the OS-dependent function to set up life so we can do things like
file access. It will call `dl_main' (below) to do all the real work
@@ -243,12 +244,12 @@ of this helper program; chances are you did not intend to run this program.\n",
/* Put the link_map for ourselves on the chain so it can be found by
name. */
- rtld_map.l_name = (char *) rtld_map.l_libname = interpreter_name;
- rtld_map.l_type = lt_interpreter;
+ _dl_rtld_map.l_name = (char *) _dl_rtld_map.l_libname = interpreter_name;
+ _dl_rtld_map.l_type = lt_interpreter;
while (l->l_next)
l = l->l_next;
- l->l_next = &rtld_map;
- rtld_map.l_prev = l;
+ l->l_next = &_dl_rtld_map;
+ _dl_rtld_map.l_prev = l;
/* Load all the libraries specified by DT_NEEDED entries. */
_dl_map_object_deps (l);
@@ -257,12 +258,12 @@ of this helper program; chances are you did not intend to run this program.\n",
it will determine gdb's search order.
Perhaps do this always, so later dlopen by name finds it?
XXX But then gdb always considers it present. */
- if (rtld_map.l_opencount == 0)
+ if (_dl_rtld_map.l_opencount == 0)
{
/* No DT_NEEDED entry referred to the interpreter object itself,
so remove it from the list of visible objects. */
- rtld_map.l_prev->l_next = rtld_map.l_next;
- rtld_map.l_next->l_prev = rtld_map.l_prev;
+ _dl_rtld_map.l_prev->l_next = _dl_rtld_map.l_next;
+ _dl_rtld_map.l_next->l_prev = _dl_rtld_map.l_prev;
}
if (list_only)
@@ -325,7 +326,7 @@ of this helper program; chances are you did not intend to run this program.\n",
l = l->l_next;
do
{
- if (l != &rtld_map)
+ if (l != &_dl_rtld_map)
_dl_relocate_object (l, lazy);
l = l->l_prev;
} while (l);
@@ -337,28 +338,28 @@ of this helper program; chances are you did not intend to run this program.\n",
_dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
_dl_sysdep_start_cleanup ();
- if (rtld_map.l_opencount > 0)
+ if (_dl_rtld_map.l_opencount > 0)
/* There was an explicit ref to the dynamic linker as a shared lib.
Re-relocate ourselves with user-controlled symbol definitions. */
- _dl_relocate_object (&rtld_map, lazy);
+ _dl_relocate_object (&_dl_rtld_map, lazy);
/* Tell the debugger where to find the map of loaded objects. */
dl_r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */;
- dl_r_debug.r_ldbase = rtld_map.l_addr; /* Record our load address. */
+ dl_r_debug.r_ldbase = _dl_rtld_map.l_addr; /* Record our load address. */
dl_r_debug.r_map = _dl_loaded;
dl_r_debug.r_brk = (Elf32_Addr) &_dl_r_debug_state;
- if (rtld_map.l_info[DT_INIT])
+ if (_dl_rtld_map.l_info[DT_INIT])
{
/* Call the initializer for the compatibility version of the
dynamic linker. There is no additional initialization
required for the ABI-compliant dynamic linker. */
- (*(void (*) (void)) (rtld_map.l_addr +
- rtld_map.l_info[DT_INIT]->d_un.d_ptr)) ();
+ (*(void (*) (void)) (_dl_rtld_map.l_addr +
+ _dl_rtld_map.l_info[DT_INIT]->d_un.d_ptr)) ();
/* Clear the field so a future dlopen won't run it again. */
- rtld_map.l_info[DT_INIT] = NULL;
+ _dl_rtld_map.l_info[DT_INIT] = NULL;
}
/* Once we return, _dl_sysdep_start will invoke
diff --git a/io/Makefile b/io/Makefile
index ce8708c7ba..8648235463 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -40,7 +40,7 @@ routines := \
chdir fchdir \
getcwd getwd getdirname \
chown fchown \
- ttyname isatty \
+ ttyname ttyname_r isatty \
link symlink readlink \
unlink rmdir \
ftw fts poll
diff --git a/posix/Makefile b/posix/Makefile
index 6766a8a17d..e3eaad4369 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -39,7 +39,7 @@ routines := \
getpid getppid \
getuid geteuid getgid getegid getgroups setuid setgid group_member \
getpgid setpgid getpgrp setpgrp getsid setsid \
- getlogin setlogin \
+ getlogin getlogin_r setlogin \
pathconf sysconf fpathconf \
glob fnmatch regex \
confstr \
diff --git a/posix/unistd.h b/posix/unistd.h
index 89c8fd4db9..72ecd96023 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -541,6 +541,12 @@ extern int tcsetpgrp __P ((int __fd, __pid_t __pgrp_id));
/* Return the login name of the user. */
extern char *getlogin __P ((void));
+#ifdef __USE_REENTRANT
+/* Return at most NAME_LEN characters of the login name of the user in NAME.
+ If it cannot be determined or some other error occured, return the error
+ code. Otherwise return 0. */
+extern int getlogin_r __P ((char *__name, size_t __name_len));
+#endif
#ifdef __USE_BSD
/* Set the login name returned by `getlogin'. */
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 4f55804497..c2fefb4750 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -596,6 +596,15 @@ __p_rr(cp, msg, file)
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
fprintf(file, "\t%s\n", inet_ntop(AF_INET6, cp, t, sizeof t));
+ cp += dlen;
+ break;
+ }
+
+ case T_LOC: {
+ char t[255];
+
+ (void) fprintf(file, "\t%s\n", loc_ntoa(cp, t));
+ cp += dlen;
break;
}
@@ -831,3 +840,385 @@ __p_time(value)
}
return (nbuf);
}
+
+/*
+ * routines to convert between on-the-wire RR format and zone file format.
+ * Does not contain conversion to/from decimal degrees; divide or multiply
+ * by 60*60*1000 for that.
+ */
+
+static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
+ 1000000,10000000,100000000,1000000000};
+
+/* takes an XeY precision/size value, returns a string representation. */
+static const char *
+precsize_ntoa(prec)
+ u_int8_t prec;
+{
+ static char retbuf[sizeof("90000000.00")];
+ unsigned long val;
+ int mantissa, exponent;
+
+ mantissa = (int)((prec >> 4) & 0x0f) % 10;
+ exponent = (int)((prec >> 0) & 0x0f) % 10;
+
+ val = mantissa * poweroften[exponent];
+
+ (void) sprintf(retbuf, "%ld.%.2ld", val/100, val%100);
+ return (retbuf);
+}
+
+/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
+static u_int8_t
+precsize_aton(strptr)
+ char **strptr;
+{
+ unsigned int mval = 0, cmval = 0;
+ u_int8_t retval = 0;
+ register char *cp;
+ register int exponent;
+ register int mantissa;
+
+ cp = *strptr;
+
+ while (isdigit(*cp))
+ mval = mval * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /* centimeters */
+ cp++;
+ if (isdigit(*cp)) {
+ cmval = (*cp++ - '0') * 10;
+ if (isdigit(*cp)) {
+ cmval += (*cp++ - '0');
+ }
+ }
+ }
+ cmval = (mval * 100) + cmval;
+
+ for (exponent = 0; exponent < 9; exponent++)
+ if (cmval < poweroften[exponent+1])
+ break;
+
+ mantissa = cmval / poweroften[exponent];
+ if (mantissa > 9)
+ mantissa = 9;
+
+ retval = (mantissa << 4) | exponent;
+
+ *strptr = cp;
+
+ return (retval);
+}
+
+/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
+static u_int32_t
+latlon2ul(latlonstrptr,which)
+ char **latlonstrptr;
+ int *which;
+{
+ register char *cp;
+ u_int32_t retval;
+ int deg = 0, min = 0, secs = 0, secsfrac = 0;
+
+ cp = *latlonstrptr;
+
+ while (isdigit(*cp))
+ deg = deg * 10 + (*cp++ - '0');
+
+ while (isspace(*cp))
+ cp++;
+
+ if (!(isdigit(*cp)))
+ goto fndhemi;
+
+ while (isdigit(*cp))
+ min = min * 10 + (*cp++ - '0');
+
+ while (isspace(*cp))
+ cp++;
+
+ if (!(isdigit(*cp)))
+ goto fndhemi;
+
+ while (isdigit(*cp))
+ secs = secs * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /* decimal seconds */
+ cp++;
+ if (isdigit(*cp)) {
+ secsfrac = (*cp++ - '0') * 100;
+ if (isdigit(*cp)) {
+ secsfrac += (*cp++ - '0') * 10;
+ if (isdigit(*cp)) {
+ secsfrac += (*cp++ - '0');
+ }
+ }
+ }
+ }
+
+ while (!isspace(*cp)) /* if any trailing garbage */
+ cp++;
+
+ while (isspace(*cp))
+ cp++;
+
+ fndhemi:
+ switch (*cp) {
+ case 'N': case 'n':
+ case 'E': case 'e':
+ retval = ((unsigned)1<<31)
+ + (((((deg * 60) + min) * 60) + secs) * 1000)
+ + secsfrac;
+ break;
+ case 'S': case 's':
+ case 'W': case 'w':
+ retval = ((unsigned)1<<31)
+ - (((((deg * 60) + min) * 60) + secs) * 1000)
+ - secsfrac;
+ break;
+ default:
+ retval = 0; /* invalid value -- indicates error */
+ break;
+ }
+
+ switch (*cp) {
+ case 'N': case 'n':
+ case 'S': case 's':
+ *which = 1; /* latitude */
+ break;
+ case 'E': case 'e':
+ case 'W': case 'w':
+ *which = 2; /* longitude */
+ break;
+ default:
+ *which = 0; /* error */
+ break;
+ }
+
+ cp++; /* skip the hemisphere */
+
+ while (!isspace(*cp)) /* if any trailing garbage */
+ cp++;
+
+ while (isspace(*cp)) /* move to next field */
+ cp++;
+
+ *latlonstrptr = cp;
+
+ return (retval);
+}
+
+/* converts a zone file representation in a string to an RDATA on-the-wire
+ * representation. */
+int
+loc_aton(ascii, binary)
+ const char *ascii;
+ u_char *binary;
+{
+ const char *cp, *maxcp;
+ u_char *bcp;
+
+ u_int32_t latit = 0, longit = 0, alt = 0;
+ u_int32_t lltemp1 = 0, lltemp2 = 0;
+ int altmeters = 0, altfrac = 0, altsign = 1;
+ u_int8_t hp = 0x16; /* default = 1e6 cm = 10000.00m = 10km */
+ u_int8_t vp = 0x13; /* default = 1e3 cm = 10.00m */
+ u_int8_t siz = 0x12; /* default = 1e2 cm = 1.00m */
+ int which1 = 0, which2 = 0;
+
+ cp = ascii;
+ maxcp = cp + strlen(ascii);
+
+ lltemp1 = latlon2ul(&cp, &which1);
+
+ lltemp2 = latlon2ul(&cp, &which2);
+
+ switch (which1 + which2) {
+ case 3: /* 1 + 2, the only valid combination */
+ if ((which1 == 1) && (which2 == 2)) { /* normal case */
+ latit = lltemp1;
+ longit = lltemp2;
+ } else if ((which1 == 2) && (which2 == 1)) { /* reversed */
+ longit = lltemp1;
+ latit = lltemp2;
+ } else { /* some kind of brokenness */
+ return 0;
+ }
+ break;
+ default: /* we didn't get one of each */
+ return 0;
+ }
+
+ /* altitude */
+ if (*cp == '-') {
+ altsign = -1;
+ cp++;
+ }
+
+ if (*cp == '+')
+ cp++;
+
+ while (isdigit(*cp))
+ altmeters = altmeters * 10 + (*cp++ - '0');
+
+ if (*cp == '.') { /* decimal meters */
+ cp++;
+ if (isdigit(*cp)) {
+ altfrac = (*cp++ - '0') * 10;
+ if (isdigit(*cp)) {
+ altfrac += (*cp++ - '0');
+ }
+ }
+ }
+
+ alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
+
+ while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ cp++;
+
+ while (isspace(*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ siz = precsize_aton(&cp);
+
+ while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ cp++;
+
+ while (isspace(*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ hp = precsize_aton(&cp);
+
+ while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ cp++;
+
+ while (isspace(*cp) && (cp < maxcp))
+ cp++;
+
+ if (cp >= maxcp)
+ goto defaults;
+
+ vp = precsize_aton(&cp);
+
+ defaults:
+
+ bcp = binary;
+ *bcp++ = (u_int8_t) 0; /* version byte */
+ *bcp++ = siz;
+ *bcp++ = hp;
+ *bcp++ = vp;
+ PUTLONG(latit,bcp);
+ PUTLONG(longit,bcp);
+ PUTLONG(alt,bcp);
+
+ return (16); /* size of RR in octets */
+}
+
+/* takes an on-the-wire LOC RR and formats it in a human readable format. */
+char *
+loc_ntoa(binary, ascii)
+ const u_char *binary;
+ char *ascii;
+{
+ static char *error = "?";
+ register const u_char *cp = binary;
+
+ int latdeg, latmin, latsec, latsecfrac;
+ int longdeg, longmin, longsec, longsecfrac;
+ char northsouth, eastwest;
+ int altmeters, altfrac, altsign;
+
+ const int referencealt = 100000 * 100;
+
+ int32_t latval, longval, altval;
+ u_int32_t templ;
+ u_int8_t sizeval, hpval, vpval, versionval;
+
+ char *sizestr, *hpstr, *vpstr;
+
+ versionval = *cp++;
+
+ if (versionval) {
+ sprintf(ascii, "; error: unknown LOC RR version");
+ return (ascii);
+ }
+
+ sizeval = *cp++;
+
+ hpval = *cp++;
+ vpval = *cp++;
+
+ GETLONG(templ, cp);
+ latval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ longval = (templ - ((unsigned)1<<31));
+
+ GETLONG(templ, cp);
+ if (templ < referencealt) { /* below WGS 84 spheroid */
+ altval = referencealt - templ;
+ altsign = -1;
+ } else {
+ altval = templ - referencealt;
+ altsign = 1;
+ }
+
+ if (latval < 0) {
+ northsouth = 'S';
+ latval = -latval;
+ } else
+ northsouth = 'N';
+
+ latsecfrac = latval % 1000;
+ latval = latval / 1000;
+ latsec = latval % 60;
+ latval = latval / 60;
+ latmin = latval % 60;
+ latval = latval / 60;
+ latdeg = latval;
+
+ if (longval < 0) {
+ eastwest = 'W';
+ longval = -longval;
+ } else
+ eastwest = 'E';
+
+ longsecfrac = longval % 1000;
+ longval = longval / 1000;
+ longsec = longval % 60;
+ longval = longval / 60;
+ longmin = longval % 60;
+ longval = longval / 60;
+ longdeg = longval;
+
+ altfrac = altval % 100;
+ altmeters = (altval / 100) * altsign;
+
+ if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
+ sizestr = error;
+ if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL)
+ hpstr = error;
+ if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL)
+ vpstr = error;
+
+ sprintf(ascii,
+ "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
+ latdeg, latmin, latsec, latsecfrac, northsouth,
+ longdeg, longmin, longsec, longsecfrac, eastwest,
+ altmeters, altfrac, sizestr, hpstr, vpstr);
+
+ if (sizestr != error)
+ free(sizestr);
+ if (hpstr != error)
+ free(hpstr);
+ if (vpstr != error)
+ free(vpstr);
+
+ return (ascii);
+}
diff --git a/resolv/resolv.h b/resolv/resolv.h
index f4320ff1b3..a0afb2caf3 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -189,6 +189,8 @@ extern struct __res_state _res;
#define res_ownok __res_ownok
#define res_mailok __res_mailok
#define res_dnok __res_dnok
+#define loc_ntoa __loc_ntoa
+#define loc_aton __loc_aton
#define dn_skipname __dn_skipname
#define fp_query __fp_query
#define fp_nquery __fp_nquery
@@ -212,6 +214,8 @@ int __res_hnok __P((const char *));
int __res_ownok __P((const char *));
int __res_mailok __P((const char *));
int __res_dnok __P((const char *));
+int __loc_aton __P((const char *ascii, u_char *binary));
+char * __loc_ntoa __P((const u_char *binary, char *ascii));
int __dn_skipname __P((const u_char *, const u_char *));
void __fp_resstat __P((struct __res_state *, FILE *));
void __fp_query __P((const u_char *, FILE *));
diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S
new file mode 100644
index 0000000000..7a90c3e63a
--- /dev/null
+++ b/sysdeps/libm-i387/e_asinl.S
@@ -0,0 +1,21 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+/* asinl = atanl (x / sqrtl(1 - x^2)) */
+ENTRY(__ieee754_asinl)
+ fldt 4(%esp) /* x */
+ fst %st(1)
+ fmul %st(0) /* x^2 */
+ fld1
+ fsubp /* 1 - x^2 */
+ fsqrt /* sqrt (1 - x^2) */
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_atan2l.S b/sysdeps/libm-i387/e_atan2l.S
new file mode 100644
index 0000000000..748571e38e
--- /dev/null
+++ b/sysdeps/libm-i387/e_atan2l.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_atan2l)
+ fldt 4(%esp)
+ fldt 16(%esp)
+ fpatan
+ ret
diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S
new file mode 100644
index 0000000000..d14089828d
--- /dev/null
+++ b/sysdeps/libm-i387/e_expl.S
@@ -0,0 +1,40 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+/* e^x = 2^(x * log2l(e)) */
+ENTRY(__ieee754_expl)
+ fldt 4(%esp)
+/* I added the following ugly construct because expl(+-Inf) resulted
+ in NaN. The ugliness results from the bright minds at Intel.
+ -- drepper@cygnus.com. */
+ fxam /* Is NaN or +-Inf? */
+ fstsw %ax
+ sahf
+ jnc .LnoInfNaN /* No, jump. */
+ jp .LisInf /* Is +-Inf, jump. */
+.LnoInfNaN:
+ fldl2e
+ fmulp /* x * log2(e) */
+ fstl %st(1)
+ frndint /* int(x * log2(e)) */
+ fstl %st(2)
+ fsubrp /* fract(x * log2(e)) */
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ ret
+
+.LisInf:
+ andb $2, %ah /* Test sign. */
+ jz .LpInf /* If positive, jump. */
+ fldz /* Set result to 0. */
+.LpInf: ret
diff --git a/sysdeps/libm-i387/e_fmodl.S b/sysdeps/libm-i387/e_fmodl.S
new file mode 100644
index 0000000000..75ed17b9e5
--- /dev/null
+++ b/sysdeps/libm-i387/e_fmodl.S
@@ -0,0 +1,20 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_fmodl)
+ fldt 16(%esp)
+ fldt 4(%esp)
+1: fprem
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ ret
diff --git a/sysdeps/libm-i387/e_log10l.S b/sysdeps/libm-i387/e_log10l.S
new file mode 100644
index 0000000000..0a19256933
--- /dev/null
+++ b/sysdeps/libm-i387/e_log10l.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_log10l)
+ fldlg2
+ fldt 4(%esp)
+ fyl2x
+ ret
diff --git a/sysdeps/libm-i387/e_logl.S b/sysdeps/libm-i387/e_logl.S
new file mode 100644
index 0000000000..2575d6c6e8
--- /dev/null
+++ b/sysdeps/libm-i387/e_logl.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_logl)
+ fldln2
+ fldt 4(%esp)
+ fyl2x
+ ret
diff --git a/sysdeps/libm-i387/e_remainderl.S b/sysdeps/libm-i387/e_remainderl.S
new file mode 100644
index 0000000000..ce98515167
--- /dev/null
+++ b/sysdeps/libm-i387/e_remainderl.S
@@ -0,0 +1,19 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_remainderl)
+ fldt 16(%esp)
+ fldt 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ ret
diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S
new file mode 100644
index 0000000000..8d5cd3b429
--- /dev/null
+++ b/sysdeps/libm-i387/e_scalbl.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_scalbl)
+ fldt 16(%esp)
+ fldt 4(%esp)
+ fscale
+ ret
diff --git a/sysdeps/libm-i387/e_sqrtl.S b/sysdeps/libm-i387/e_sqrtl.S
new file mode 100644
index 0000000000..88e5f82a0c
--- /dev/null
+++ b/sysdeps/libm-i387/e_sqrtl.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_sqrtl)
+ fldt 4(%esp)
+ fsqrt
+ ret
diff --git a/sysdeps/libm-i387/s_atanl.S b/sysdeps/libm-i387/s_atanl.S
new file mode 100644
index 0000000000..867e60b1c2
--- /dev/null
+++ b/sysdeps/libm-i387/s_atanl.S
@@ -0,0 +1,17 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__atanl)
+ fldt 4(%esp)
+ fld1
+ fpatan
+ ret
+weak_alias (__atanl, atanl)
diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S
new file mode 100644
index 0000000000..e2c22428b2
--- /dev/null
+++ b/sysdeps/libm-i387/s_cosl.S
@@ -0,0 +1,29 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__cosl)
+ fldt 4(%esp)
+ fcos
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fcos
+ ret
+weak_alias (__cosl, cosl)
diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S
index f842d468b9..28a0a40308 100644
--- a/sysdeps/libm-i387/s_finitef.S
+++ b/sysdeps/libm-i387/s_finitef.S
@@ -9,9 +9,9 @@ RCSID("$NetBSD: s_finitef.S,v 1.3 1995/05/09 00:00:02 jtc Exp $")
ENTRY(__finitef)
movl 4(%esp),%eax
- andl $0x7ff00000, %eax
- cmpl $0x7ff00000, %eax
- setnel %al
+ andl $0x7f800000, %eax
+ cmpl $0x7f800000, %eax
+ setne %al
andl $0x000000ff, %eax
ret
weak_alias (__finitef, finitef)
diff --git a/sysdeps/libm-i387/s_ilogbl.S b/sysdeps/libm-i387/s_ilogbl.S
new file mode 100644
index 0000000000..11c81011c6
--- /dev/null
+++ b/sysdeps/libm-i387/s_ilogbl.S
@@ -0,0 +1,24 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ilogbl)
+ pushl %ebp
+ movl %esp,%ebp
+ subl $4,%esp
+
+ fldt 8(%ebp)
+ fxtract
+
+ fistpl -4(%ebp)
+ movl -4(%ebp),%eax
+
+ leave
+ ret
+weak_alias (__ilogbl, ilogbl)
diff --git a/sysdeps/libm-i387/s_log1pl.S b/sysdeps/libm-i387/s_log1pl.S
new file mode 100644
index 0000000000..4a9faf7ba4
--- /dev/null
+++ b/sysdeps/libm-i387/s_log1pl.S
@@ -0,0 +1,25 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+/*
+ * Since the fyl2xp1 instruction has such a limited range:
+ * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
+ * it's not worth trying to use it.
+ */
+
+ENTRY(__log1pl)
+ fldln2
+ fldt 4(%esp)
+ fld1
+ faddp
+ fyl2x
+ ret
+weak_alias (__log1pl, log1pl)
diff --git a/sysdeps/libm-i387/s_logbl.S b/sysdeps/libm-i387/s_logbl.S
new file mode 100644
index 0000000000..e72b1fb941
--- /dev/null
+++ b/sysdeps/libm-i387/s_logbl.S
@@ -0,0 +1,15 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__logbl)
+ fldt 4(%esp)
+ fxtract
+ ret
+weak_alias (__logbl, logbl)
diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S
new file mode 100644
index 0000000000..b5fdf820d3
--- /dev/null
+++ b/sysdeps/libm-i387/s_scalbnl.S
@@ -0,0 +1,16 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__scalbnl)
+ fildl 16(%esp)
+ fldt 4(%esp)
+ fscale
+ ret
+weak_alias (__scalbnl, scalbnl)
diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S
new file mode 100644
index 0000000000..03c9c874b9
--- /dev/null
+++ b/sysdeps/libm-i387/s_sinl.S
@@ -0,0 +1,29 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__sinl)
+ fldt 4(%esp)
+ fsin
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fsin
+ ret
+weak_alias (__sinl, sinl)
diff --git a/sysdeps/libm-i387/s_tanl.S b/sysdeps/libm-i387/s_tanl.S
new file mode 100644
index 0000000000..6b1532af9e
--- /dev/null
+++ b/sysdeps/libm-i387/s_tanl.S
@@ -0,0 +1,31 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__tanl)
+ fldt 4(%esp)
+ fptan
+ fnstsw %ax
+ andw $0x400,%ax
+ jnz 1f
+ fstp %st(0)
+ ret
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fstsw %ax
+ andw $0x400,%ax
+ jnz 2b
+ fstp %st(1)
+ fptan
+ fstp %st(0)
+ ret
+weak_alias (__tanl, tanl)
diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c
index d46afb5494..ea070bc9b2 100644
--- a/sysdeps/libm-ieee754/k_standard.c
+++ b/sysdeps/libm-ieee754/k_standard.c
@@ -5,7 +5,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -33,7 +33,7 @@ static const double zero = 0.0; /* used as const */
static double zero = 0.0; /* used as const */
#endif
-/*
+/*
* Standard conformance (non-IEEE) on exception cases.
* Mapping:
* 1 -- acos(|x|>1)
@@ -58,7 +58,7 @@ static double zero = 0.0; /* used as const */
* 20-- pow(0.0,0.0)
* 21-- pow(x,y) overflow
* 22-- pow(x,y) underflow
- * 23-- pow(0,negative)
+ * 23-- pow(0,negative)
* 24-- pow(neg,non-integral)
* 25-- sinh(finite) overflow
* 26-- sqrt(negative)
@@ -82,14 +82,14 @@ static double zero = 0.0; /* used as const */
#ifdef __STDC__
- double __kernel_standard(double x, double y, int type)
+ double __kernel_standard(double x, double y, int type)
#else
- double __kernel_standard(x,y,type)
+ double __kernel_standard(x,y,type)
double x,y; int type;
#endif
{
struct exception exc;
-#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
+#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
#define HUGE_VAL inf
double inf = 0.0;
@@ -104,9 +104,11 @@ static double zero = 0.0; /* used as const */
switch(type) {
case 1:
case 101:
+ case 201:
/* acos(|x|>1) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "acos" : "acosf";
+ exc.name = type < 100 ? "acos" : (type < 200
+ ? "acosf" : "acosl");;
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -119,9 +121,11 @@ static double zero = 0.0; /* used as const */
break;
case 2:
case 102:
+ case 202:
/* asin(|x|>1) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "asin" : "asinf";
+ exc.name = type < 100 ? "asin" : (type < 200
+ ? "asinf" : "asinl");
exc.retval = zero;
if(_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -134,11 +138,13 @@ static double zero = 0.0; /* used as const */
break;
case 3:
case 103:
+ case 203:
/* atan2(+-0,+-0) */
exc.arg1 = y;
exc.arg2 = x;
exc.type = DOMAIN;
- exc.name = type < 100 ? "atan2" : "atan2f";
+ exc.name = type < 100 ? "atan2" : (type < 200
+ ? "atan2f" : "atan2l");
exc.retval = zero;
if(_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -151,9 +157,11 @@ static double zero = 0.0; /* used as const */
break;
case 4:
case 104:
+ case 204:
/* hypot(finite,finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "hypot" : "hypotf";
+ exc.name = type < 100 ? "hypot" : (type < 200
+ ? "hypotf" : "hypotl");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -166,9 +174,11 @@ static double zero = 0.0; /* used as const */
break;
case 5:
case 105:
+ case 205:
/* cosh(finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "cosh" : "coshf";
+ exc.name = type < 100 ? "cosh" : (type < 200
+ ? "coshf" : "coshl");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -181,9 +191,11 @@ static double zero = 0.0; /* used as const */
break;
case 6:
case 106:
+ case 206:
/* exp(finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "exp" : "expf";
+ exc.name = type < 100 ? "exp" : (type < 200
+ ? "expf" : "expl");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -196,9 +208,11 @@ static double zero = 0.0; /* used as const */
break;
case 7:
case 107:
+ case 207:
/* exp(finite) underflow */
exc.type = UNDERFLOW;
- exc.name = type < 100 ? "exp" : "expf";
+ exc.name = type < 100 ? "exp" : (type < 200
+ ? "expf" : "expl");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -208,9 +222,10 @@ static double zero = 0.0; /* used as const */
break;
case 8:
case 108:
+ case 208:
/* y0(0) = -inf */
exc.type = DOMAIN; /* should be SING for IEEE */
- exc.name = type < 100 ? "y0" : "y0f";
+ exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -226,9 +241,10 @@ static double zero = 0.0; /* used as const */
break;
case 9:
case 109:
+ case 209:
/* y0(x<0) = NaN */
exc.type = DOMAIN;
- exc.name = type < 100 ? "y0" : "y0f";
+ exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -244,9 +260,10 @@ static double zero = 0.0; /* used as const */
break;
case 10:
case 110:
+ case 210:
/* y1(0) = -inf */
exc.type = DOMAIN; /* should be SING for IEEE */
- exc.name = type < 100 ? "y1" : "y1f";
+ exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -262,9 +279,10 @@ static double zero = 0.0; /* used as const */
break;
case 11:
case 111:
+ case 211:
/* y1(x<0) = NaN */
exc.type = DOMAIN;
- exc.name = type < 100 ? "y1" : "y1f";
+ exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -280,9 +298,10 @@ static double zero = 0.0; /* used as const */
break;
case 12:
case 112:
+ case 212:
/* yn(n,0) = -inf */
exc.type = DOMAIN; /* should be SING for IEEE */
- exc.name = type < 100 ? "yn" : "ynf";
+ exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -298,9 +317,10 @@ static double zero = 0.0; /* used as const */
break;
case 13:
case 113:
+ case 213:
/* yn(x<0) = NaN */
exc.type = DOMAIN;
- exc.name = type < 100 ? "yn" : "ynf";
+ exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -316,9 +336,11 @@ static double zero = 0.0; /* used as const */
break;
case 14:
case 114:
+ case 214:
/* lgamma(finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "lgamma" : "lgammaf";
+ exc.name = type < 100 ? "lgamma" : (type < 200
+ ? "lgammaf" : "lgammal");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -331,9 +353,11 @@ static double zero = 0.0; /* used as const */
break;
case 15:
case 115:
+ case 215:
/* lgamma(-integer) or lgamma(0) */
exc.type = SING;
- exc.name = type < 100 ? "lgamma" : "lgammaf";
+ exc.name = type < 100 ? "lgamma" : (type < 200
+ ? "lgammaf" : "lgammal");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -349,9 +373,10 @@ static double zero = 0.0; /* used as const */
break;
case 16:
case 116:
+ case 216:
/* log(0) */
exc.type = SING;
- exc.name = type < 100 ? "log" : "logf";
+ exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -367,9 +392,10 @@ static double zero = 0.0; /* used as const */
break;
case 17:
case 117:
+ case 217:
/* log(x<0) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "log" : "logf";
+ exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -385,9 +411,11 @@ static double zero = 0.0; /* used as const */
break;
case 18:
case 118:
+ case 218:
/* log10(0) */
exc.type = SING;
- exc.name = type < 100 ? "log10" : "log10f";
+ exc.name = type < 100 ? "log10" : (type < 200
+ ? "log10f" : "log10l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -403,9 +431,11 @@ static double zero = 0.0; /* used as const */
break;
case 19:
case 119:
+ case 219:
/* log10(x<0) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "log10" : "log10f";
+ exc.name = type < 100 ? "log10" : (type < 200
+ ? "log10f" : "log10l");
if (_LIB_VERSION == _SVID_)
exc.retval = -HUGE;
else
@@ -421,10 +451,11 @@ static double zero = 0.0; /* used as const */
break;
case 20:
case 120:
+ case 220:
/* pow(0.0,0.0) */
/* error only if _LIB_VERSION == _SVID_ */
exc.type = DOMAIN;
- exc.name = type < 100 ? "pow" : "powf";
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
exc.retval = zero;
if (_LIB_VERSION != _SVID_) exc.retval = 1.0;
else if (!matherr(&exc)) {
@@ -434,9 +465,10 @@ static double zero = 0.0; /* used as const */
break;
case 21:
case 121:
+ case 221:
/* pow(x,y) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "pow" : "powf";
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
if (_LIB_VERSION == _SVID_) {
exc.retval = HUGE;
y *= 0.5;
@@ -454,9 +486,10 @@ static double zero = 0.0; /* used as const */
break;
case 22:
case 122:
+ case 222:
/* pow(x,y) underflow */
exc.type = UNDERFLOW;
- exc.name = type < 100 ? "pow" : "powf";
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -466,10 +499,11 @@ static double zero = 0.0; /* used as const */
break;
case 23:
case 123:
+ case 223:
/* 0**neg */
exc.type = DOMAIN;
- exc.name = type < 100 ? "pow" : "powf";
- if (_LIB_VERSION == _SVID_)
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
+ if (_LIB_VERSION == _SVID_)
exc.retval = zero;
else
exc.retval = -HUGE_VAL;
@@ -484,14 +518,15 @@ static double zero = 0.0; /* used as const */
break;
case 24:
case 124:
+ case 224:
/* neg**non-integral */
exc.type = DOMAIN;
- exc.name = type < 100 ? "pow" : "powf";
- if (_LIB_VERSION == _SVID_)
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
+ if (_LIB_VERSION == _SVID_)
exc.retval = zero;
- else
+ else
exc.retval = zero/zero; /* X/Open allow NaN */
- if (_LIB_VERSION == _POSIX_)
+ if (_LIB_VERSION == _POSIX_)
errno = EDOM;
else if (!matherr(&exc)) {
if (_LIB_VERSION == _SVID_) {
@@ -502,9 +537,11 @@ static double zero = 0.0; /* used as const */
break;
case 25:
case 125:
+ case 225:
/* sinh(finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "sinh" : "sinhf";
+ exc.name = type < 100 ? "sinh" : (type < 200
+ ? "sinhf" : "sinhl");
if (_LIB_VERSION == _SVID_)
exc.retval = ( (x>zero) ? HUGE : -HUGE);
else
@@ -517,9 +554,11 @@ static double zero = 0.0; /* used as const */
break;
case 26:
case 126:
+ case 226:
/* sqrt(x<0) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "sqrt" : "sqrtf";
+ exc.name = type < 100 ? "sqrt" : (type < 200
+ ? "sqrtf" : "sqrtl");
if (_LIB_VERSION == _SVID_)
exc.retval = zero;
else
@@ -535,9 +574,11 @@ static double zero = 0.0; /* used as const */
break;
case 27:
case 127:
+ case 227:
/* fmod(x,0) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "fmod" : "fmodf";
+ exc.name = type < 100 ? "fmod" : (type < 200
+ ? "fmodf" : "fmodl");
if (_LIB_VERSION == _SVID_)
exc.retval = x;
else
@@ -553,9 +594,12 @@ static double zero = 0.0; /* used as const */
break;
case 28:
case 128:
+ case 228:
/* remainder(x,0) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "remainder" : "remainderf";
+ exc.name = type < 100 ? "remainder" : (type < 200
+ ? "remainderf"
+ : "remainderl");
exc.retval = zero/zero;
if (_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -568,9 +612,11 @@ static double zero = 0.0; /* used as const */
break;
case 29:
case 129:
+ case 229:
/* acosh(x<1) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "acosh" : "acoshf";
+ exc.name = type < 100 ? "acosh" : (type < 200
+ ? "acoshf" : "acoshl");
exc.retval = zero/zero;
if (_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -583,9 +629,11 @@ static double zero = 0.0; /* used as const */
break;
case 30:
case 130:
+ case 230:
/* atanh(|x|>1) */
exc.type = DOMAIN;
- exc.name = type < 100 ? "atanh" : "atanhf";
+ exc.name = type < 100 ? "atanh" : (type < 200
+ ? "atanhf" : "atanhl");
exc.retval = zero/zero;
if (_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -598,9 +646,11 @@ static double zero = 0.0; /* used as const */
break;
case 31:
case 131:
+ case 231:
/* atanh(|x|=1) */
exc.type = SING;
- exc.name = type < 100 ? "atanh" : "atanhf";
+ exc.name = type < 100 ? "atanh" : (type < 200
+ ? "atanhf" : "atanhl");
exc.retval = x/zero; /* sign(x)*inf */
if (_LIB_VERSION == _POSIX_)
errno = EDOM;
@@ -613,9 +663,11 @@ static double zero = 0.0; /* used as const */
break;
case 32:
case 132:
+ case 232:
/* scalb overflow; SVID also returns +-HUGE_VAL */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "scalb" : "scalbf";
+ exc.name = type < 100 ? "scalb" : (type < 200
+ ? "scalbf" : "scalbl");
exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -625,9 +677,11 @@ static double zero = 0.0; /* used as const */
break;
case 33:
case 133:
+ case 233:
/* scalb underflow */
exc.type = UNDERFLOW;
- exc.name = type < 100 ? "scalb" : "scalbf";
+ exc.name = type < 100 ? "scalb" : (type < 200
+ ? "scalbf" : "scalbl");
exc.retval = __copysign(zero,x);
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -637,9 +691,10 @@ static double zero = 0.0; /* used as const */
break;
case 34:
case 134:
+ case 234:
/* j0(|x|>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "j0" : "j0f";
+ exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -649,13 +704,14 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 35:
case 135:
+ case 235:
/* y0(x>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "y0" : "y0f";
+ exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -665,13 +721,14 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 36:
case 136:
+ case 236:
/* j1(|x|>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "j1" : "j1f";
+ exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -681,13 +738,14 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 37:
case 137:
+ case 237:
/* y1(x>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "y1" : "y1f";
+ exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -697,13 +755,14 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 38:
case 138:
+ case 238:
/* jn(|x|>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "jn" : "jnf";
+ exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -713,13 +772,14 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 39:
case 139:
+ case 239:
/* yn(x>X_TLOSS) */
exc.type = TLOSS;
- exc.name = type < 100 ? "yn" : "ynf";
+ exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
errno = ERANGE;
@@ -729,13 +789,15 @@ static double zero = 0.0; /* used as const */
(void) WRITE2(": TLOSS error\n", 14);
}
errno = ERANGE;
- }
+ }
break;
case 40:
case 140:
+ case 240:
/* gamma(finite) overflow */
exc.type = OVERFLOW;
- exc.name = type < 100 ? "gamma" : "gammaf";
+ exc.name = type < 100 ? "gamma" : (type < 200
+ ? "gammaf" : "gammal");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -748,9 +810,11 @@ static double zero = 0.0; /* used as const */
break;
case 41:
case 141:
+ case 241:
/* gamma(-integer) or gamma(0) */
exc.type = SING;
- exc.name = type < 100 ? "gamma" : "gammaf";
+ exc.name = type < 100 ? "gamma" : (type < 200
+ ? "gammaf" : "gammal");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -766,10 +830,11 @@ static double zero = 0.0; /* used as const */
break;
case 42:
case 142:
+ case 242:
/* pow(NaN,0.0) */
/* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
exc.type = DOMAIN;
- exc.name = type < 100 ? "pow" : "powf";
+ exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl");
exc.retval = x;
if (_LIB_VERSION == _IEEE_ ||
_LIB_VERSION == _POSIX_) exc.retval = 1.0;
@@ -778,5 +843,5 @@ static double zero = 0.0; /* used as const */
}
break;
}
- return exc.retval;
+ return exc.retval;
}
diff --git a/sysdeps/libm-ieee754/s_ilogbl.c b/sysdeps/libm-ieee754/s_ilogbl.c
new file mode 100644
index 0000000000..11372e0dc8
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_ilogbl.c
@@ -0,0 +1,56 @@
+/* s_ilogbl.c -- long double version of s_ilogb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* ilogbl(long double x)
+ * return the binary exponent of non-zero x
+ * ilogbl(0) = 0x80000001
+ * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ int __ilogbl(long double x)
+#else
+ int __ilogbl(x)
+ long double x;
+#endif
+{
+ int32_t es,hx,lx,ix;
+
+ GET_LDOUBLE_EXP(es,x);
+ es &= 0x7fff;
+ if(es==0) {
+ GET_LDOUBLE_WORDS(es,hx,lx,x);
+ if((hx|lx)==0)
+ return 0x80000001; /* ilogbl(0) = 0x80000001 */
+ else /* subnormal x */
+ if(hx==0) {
+ for (ix = -16415; lx>0; lx<<=1) ix -=1;
+ } else {
+ for (ix = -16383; hx>0; hx<<=1) ix -=1;
+ }
+ return ix;
+ }
+ else if (es<0x7fff) return es-0x3fff;
+ else return 0x7fffffff;
+}
+weak_alias (__ilogbl, ilogbl)
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index 6d435f00b2..b35fc1c41c 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -31,5 +31,6 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
}
weak_alias (__isinf, isinf)
#ifdef NO_LONG_DOUBLE
+strong_alias (__isinf, __isinfl)
weak_alias (__isinf, isinfl)
#endif
diff --git a/sysdeps/libm-ieee754/s_logbl.c b/sysdeps/libm-ieee754/s_logbl.c
new file mode 100644
index 0000000000..2cd9d105f8
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_logbl.c
@@ -0,0 +1,47 @@
+/* s_logbl.c -- long double version of s_logb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * long double logbl(x)
+ * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
+ * Use ilogb instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __logbl(long double x)
+#else
+ long double __logbl(x)
+ long double x;
+#endif
+{
+ int32_t es,lx,ix;
+ GET_LDOUBLE_WORDS(es,ix,lx,x);
+ es &= 0x7fff; /* exponent */
+ if((es|ix|lx)==0) return -1.0/fabs(x);
+ if(es==0x7fff) return x*x;
+ if(es==0) /* IEEE 754 logb */
+ return -16382.0;
+ else
+ return (long double) (es-0x3fff);
+}
+weak_alias (__logbl, logbl)
diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c
new file mode 100644
index 0000000000..433c936240
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_modfl.c
@@ -0,0 +1,88 @@
+/* s_modfl.c -- long double version of s_modf.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * modfl(long double x, long double *iptr)
+ * return fraction part of x, and return x's integral part in *iptr.
+ * Method:
+ * Bit twiddling.
+ *
+ * Exception:
+ * No exception.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0;
+#else
+static long double one = 1.0;
+#endif
+
+#ifdef __STDC__
+ long double __modfl(long double x, long double *iptr)
+#else
+ long double __modfl(x, iptr)
+ long double x,*iptr;
+#endif
+{
+ int32_t i0,i1,j0;
+ u_int32_t i,se;
+ GET_LDOUBLE_WORDS(se,i0,i1,x);
+ j0 = (se&0x7fff)-0x3fff; /* exponent of x */
+ if(j0<32) { /* integer part in high x */
+ if(j0<0) { /* |x|<1 */
+ SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */
+ return x;
+ } else {
+ i = (0xffffffff)>>j0;
+ if(((i0&i)|i1)==0) { /* x is integral */
+ u_int32_t high;
+ *iptr = x;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
+ return x;
+ } else {
+ INSERT_WORDS(*iptr,i0&(~i),0);
+ return x - *iptr;
+ }
+ }
+ } else if (j0>63) { /* no fraction part */
+ u_int32_t high;
+ *iptr = x*one;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
+ return x;
+ } else { /* fraction part in low x */
+ i = ((u_int32_t)(0xffffffff))>>(j0-20);
+ if((i1&i)==0) { /* x is integral */
+ u_int32_t high;
+ *iptr = x;
+ GET_HIGH_WORD(high,x);
+ INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
+ return x;
+ } else {
+ INSERT_WORDS(*iptr,i0,i1&(~i));
+ return x - *iptr;
+ }
+ }
+}
+weak_alias (__modfl, modfl)
diff --git a/sysdeps/libm-ieee754/w_acoshl.c b/sysdeps/libm-ieee754/w_acoshl.c
new file mode 100644
index 0000000000..a37d4c15d9
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_acoshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper acoshl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __acoshl(long double x) /* wrapper acosh */
+#else
+ long double __acoshl(x) /* wrapper acosh */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acoshl(x);
+#else
+ long double z;
+ z = __ieee754_acoshl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<1.0) {
+ return __kernel_standard(x,x,229); /* acoshl(x<1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acoshl, acoshl)
diff --git a/sysdeps/libm-ieee754/w_acosl.c b/sysdeps/libm-ieee754/w_acosl.c
new file mode 100644
index 0000000000..cd9cecf2f9
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_acosl.c
@@ -0,0 +1,48 @@
+/* w_acosl.c -- long double version of w_acos.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrap_acosl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __acosl(long double x) /* wrapper acos */
+#else
+ long double __acosl(x) /* wrapper acos */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_acosl(x);
+#else
+ long double z;
+ z = __ieee754_acosl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>1.0) {
+ return __kernel_standard(x,x,201); /* acosl(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__acosl, acosl)
diff --git a/sysdeps/libm-ieee754/w_asinl.c b/sysdeps/libm-ieee754/w_asinl.c
new file mode 100644
index 0000000000..0ac3038e95
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_asinl.c
@@ -0,0 +1,49 @@
+/* w_asinl.c -- long double version of w_asin.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper asinl(x)
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __asinl(long double x) /* wrapper asinl */
+#else
+ long double __asinl(x) /* wrapper asinl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_asinl(x);
+#else
+ long double z;
+ z = __ieee754_asinl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>1.0) {
+ return __kernel_standard(x,x,202); /* asinl(|x|>1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__asinl, asinl)
diff --git a/sysdeps/libm-ieee754/w_atan2l.c b/sysdeps/libm-ieee754/w_atan2l.c
new file mode 100644
index 0000000000..9e6e56bbed
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_atan2l.c
@@ -0,0 +1,48 @@
+/* w_atan2l.c -- long double version of w_atan2.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atan2l(y,x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __atan2l(long double y, long double x) /* wrapper atan2l */
+#else
+ long double __atan2l(y,x) /* wrapper atan2l */
+ long double y,x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atan2l(y,x);
+#else
+ long double z;
+ z = __ieee754_atan2l(y,x);
+ if(_LIB_VERSION == _IEEE_||__isnanl(x)||__isnanl(y)) return z;
+ if(x==0.0&&y==0.0) {
+ return __kernel_standard(y,x,203); /* atan2l(+-0,+-0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__atan2l, atan2l)
diff --git a/sysdeps/libm-ieee754/w_atanhl.c b/sysdeps/libm-ieee754/w_atanhl.c
new file mode 100644
index 0000000000..d675fc6fe7
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_atanhl.c
@@ -0,0 +1,52 @@
+/* w_atanhl.c -- long double version of w_atanh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper atanhl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __atanhl(long double x) /* wrapper atanhl */
+#else
+ long double __atanhl(x) /* wrapper atanhl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_atanhl(x);
+#else
+ long double z,y;
+ z = __ieee754_atanhl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ y = fabsl(x);
+ if(y>=1.0) {
+ if(y>1.0)
+ return __kernel_standard(x,x,230); /* atanhl(|x|>1) */
+ else
+ return __kernel_standard(x,x,231); /* atanhl(|x|==1) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__atanhl, atanhl)
diff --git a/sysdeps/libm-ieee754/w_cabsl.c b/sysdeps/libm-ieee754/w_cabsl.c
new file mode 100644
index 0000000000..e82130d46d
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_cabsl.c
@@ -0,0 +1,18 @@
+/*
+ * cabsl() wrapper for hypotl().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+long double
+__cabsl(z)
+ struct __cabsl_complex z;
+{
+ return __hypotl(z.x, z.y);
+}
+weak_alias (__cabsl, cabsl)
diff --git a/sysdeps/libm-ieee754/w_coshl.c b/sysdeps/libm-ieee754/w_coshl.c
new file mode 100644
index 0000000000..343d5724b9
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_coshl.c
@@ -0,0 +1,47 @@
+/* w_acoshl.c -- long double version of w_acosh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper coshl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __coshl(long double x) /* wrapper coshl */
+#else
+ long double __coshl(x) /* wrapper coshl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_coshl(x);
+#else
+ long double z;
+ z = __ieee754_coshl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>7.10475860073943863426e+02) {
+ return __kernel_standard(x,x,205); /* cosh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__coshl, coshl)
diff --git a/sysdeps/libm-ieee754/w_dreml.c b/sysdeps/libm-ieee754/w_dreml.c
new file mode 100644
index 0000000000..aa73eedc49
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_dreml.c
@@ -0,0 +1,18 @@
+/*
+ * dreml() wrapper for remainderl().
+ *
+ * Written by J.T. Conklin, <jtc@wimsey.com>
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ * Placed into the Public Domain, 1994.
+ */
+
+#include <math.h>
+
+long double
+__dreml(x, y)
+ long double x, y;
+{
+ return __remainderl(x, y);
+}
+weak_alias (__dreml, dreml)
diff --git a/sysdeps/libm-ieee754/w_expl.c b/sysdeps/libm-ieee754/w_expl.c
new file mode 100644
index 0000000000..b8152cea65
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_expl.c
@@ -0,0 +1,60 @@
+/* w_expl.c -- long double version of w_exp.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper expl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+o_threshold= 1.135652340629414394949193107797076489134e4,
+ /* 0x400C, 0xB17217F7, 0xD1CF79AC */
+u_threshold= -1.140019167866942050398521670162263001513e4;
+ /* 0x400C, 0xB220C447, 0x69C201E8 */
+
+#ifdef __STDC__
+ long double __expl(long double x) /* wrapper exp */
+#else
+ long double __expl(x) /* wrapper exp */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_expl(x);
+#else
+ long double z;
+ z = __ieee754_expl(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(__finitel(x)) {
+ if(x>o_threshold)
+ return __kernel_standard(x,x,206); /* exp overflow */
+ else if(x<u_threshold)
+ return __kernel_standard(x,x,207); /* exp underflow */
+ }
+ return z;
+#endif
+}
+weak_alias (__expl, expl)
diff --git a/sysdeps/libm-ieee754/w_fmodl.c b/sysdeps/libm-ieee754/w_fmodl.c
new file mode 100644
index 0000000000..71ed4a94a4
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_fmodl.c
@@ -0,0 +1,48 @@
+/* w_fmodl.c -- long double version of w_fmod.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper fmodl(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __fmodl(long double x, long double y)/* wrapper fmodl */
+#else
+ long double __fmodl(x,y) /* wrapper fmodl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_fmodl(x,y);
+#else
+ long double z;
+ z = __ieee754_fmodl(x,y);
+ if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
+ if(y==0.0) {
+ return __kernel_standard(x,y,227); /* fmod(x,0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__fmodl, fmodl)
diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c
new file mode 100644
index 0000000000..f72e2e7e44
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_gammal.c
@@ -0,0 +1,54 @@
+/* w_gammal.c -- long double version of w_gamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double gammal(double x)
+ * Return the logarithm of the Gamma function of x.
+ *
+ * Method: call gammal_r
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+extern int signgam;
+
+#ifdef __STDC__
+ long double __gammal(long double x)
+#else
+ long double __gammal(x)
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,&signgam);
+#else
+ long double y;
+ y = __ieee754_lgammal_r(x,&signgam);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,241); /* gamma pole */
+ else
+ return __kernel_standard(x,x,240); /* gamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__gammal, gammal)
diff --git a/sysdeps/libm-ieee754/w_gammal_r.c b/sysdeps/libm-ieee754/w_gammal_r.c
new file mode 100644
index 0000000000..ad6a43ae9b
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_gammal_r.c
@@ -0,0 +1,52 @@
+/* w_gammal_r.c -- long double version of w_gamma_r.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper long double gammal_r(long double x, int *signgamp)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __gammal_r(long double x, int *signgamp)
+ /* wrapper lgammal_r */
+#else
+ long double __gammal_r(x,signgamp) /* wrapper lgamma_r */
+ long double x; int *signgamp;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,signgamp);
+#else
+ long double y;
+ y = __ieee754_lgammal_r(x,signgamp);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,241); /* gamma pole */
+ else
+ return __kernel_standard(x,x,240); /* gamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__gammal_r, gammal_r)
diff --git a/sysdeps/libm-ieee754/w_hypotl.c b/sysdeps/libm-ieee754/w_hypotl.c
new file mode 100644
index 0000000000..9f92e950d6
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_hypotl.c
@@ -0,0 +1,48 @@
+/* w_hypotl.c -- long double version of w_hypot.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper hypotl(x,y)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __hypotl(longdouble x, long double y)/* wrapper hypotl */
+#else
+ long double __hypotl(x,y) /* wrapper hypotl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_hypotl(x,y);
+#else
+ long double z;
+ z = __ieee754_hypotl(x,y);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if((!__finitel(z))&&__finitel(x)&&__finitel(y))
+ return __kernel_standard(x,y,204); /* hypot overflow */
+ else
+ return z;
+#endif
+}
+weak_alias (__hypotl, hypotl)
diff --git a/sysdeps/libm-ieee754/w_j0l.c b/sysdeps/libm-ieee754/w_j0l.c
new file mode 100644
index 0000000000..7b4144c95e
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_j0l.c
@@ -0,0 +1,75 @@
+/* w_j0l.c -- long double version of w_j0.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper j0l(long double x), y0l(long double x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __j0l(long double x) /* wrapper j0l */
+#else
+ long double __j0l(x) /* wrapper j0 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j0l(x);
+#else
+ long double z = __ieee754_j0l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__j0l, j0l)
+
+#ifdef __STDC__
+ long double __y0l(long double x) /* wrapper y0l */
+#else
+ long double __y0l(x) /* wrapper y0 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y0l(x);
+#else
+ long double z;
+ z = __ieee754_y0l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,208);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,209);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__y0l, y0l)
diff --git a/sysdeps/libm-ieee754/w_j1l.c b/sysdeps/libm-ieee754/w_j1l.c
new file mode 100644
index 0000000000..223ab79cde
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_j1l.c
@@ -0,0 +1,76 @@
+/* w_j1l.c -- long double version of w_j1.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper of j1l,y1l
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __j1l(long double x) /* wrapper j1l */
+#else
+ long double __j1l(x) /* wrapper j1l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_j1l(x);
+#else
+ long double z;
+ z = __ieee754_j1l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__j1l, j1l)
+
+#ifdef __STDC__
+ long double __y1l(long double x) /* wrapper y1l */
+#else
+ long double __y1l(x) /* wrapper y1l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_y1l(x);
+#else
+ long double z;
+ z = __ieee754_y1l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard(x,x,210);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard(x,x,211);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__y1l, y1l)
diff --git a/sysdeps/libm-ieee754/w_jnl.c b/sysdeps/libm-ieee754/w_jnl.c
new file mode 100644
index 0000000000..0a243db30a
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_jnl.c
@@ -0,0 +1,98 @@
+/* w_jnl.c -- long double version of w_jn.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper jn(int n, double x), yn(int n, double x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ * For n=0, j0(x) is called,
+ * for n=1, j1(x) is called,
+ * for n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __jnl(int n, long double x) /* wrapper jnl */
+#else
+ long double __jnl(n,x) /* wrapper jnl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_jnl(n,x);
+#else
+ long double z;
+ z = __ieee754_jnl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(fabsl(x)>X_TLOSS) {
+ return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__jnl, jnl)
+
+#ifdef __STDC__
+ long double __ynl(int n, long double x) /* wrapper ynl */
+#else
+ long double __ynl(n,x) /* wrapper ynl */
+ long double x; int n;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_ynl(n,x);
+#else
+ long double z;
+ z = __ieee754_ynl(n,x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
+ if(x <= 0.0){
+ if(x==0.0)
+ /* d= -one/(x-x); */
+ return __kernel_standard((double)n,x,212);
+ else
+ /* d = zero/(x-x); */
+ return __kernel_standard((double)n,x,213);
+ }
+ if(x>X_TLOSS) {
+ return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__ynl, ynl)
diff --git a/sysdeps/libm-ieee754/w_lgammal.c b/sysdeps/libm-ieee754/w_lgammal.c
new file mode 100644
index 0000000000..3d2cdbbc30
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_lgammal.c
@@ -0,0 +1,54 @@
+/* w_lgammal.c -- long double version of w_lgamma.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* long double lgammal(long double x)
+ * Return the logarithm of the Gamma function of x.
+ *
+ * Method: call __ieee754_lgammal_r
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+extern int signgam;
+
+#ifdef __STDC__
+ long double __lgammal(long double x)
+#else
+ long double __lgammal(x)
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,&signgam);
+#else
+ long double y;
+ y = __ieee754_lgammal_r(x,&signgam);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,215); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,214); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammal, lgammal)
diff --git a/sysdeps/libm-ieee754/w_lgammal_r.c b/sysdeps/libm-ieee754/w_lgammal_r.c
new file mode 100644
index 0000000000..71f5c005d0
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_lgammal_r.c
@@ -0,0 +1,52 @@
+/* w_lgammal_r.c -- long double version of w_lgamma_r.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper long double lgammal_r(long double x, int *signgamp)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __lgammal_r(long double x, int *signgamp)
+ /* wrapper lgamma_r */
+#else
+ long double __lgammal_r(x,signgamp) /* wrapper lgamma_r */
+ long double x; int *signgamp;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_lgammal_r(x,signgamp);
+#else
+ long double y;
+ y = __ieee754_lgammal_r(x,signgamp);
+ if(_LIB_VERSION == _IEEE_) return y;
+ if(!__finitel(y)&&__finitel(x)) {
+ if(__floorl(x)==x&&x<=0.0)
+ return __kernel_standard(x,x,215); /* lgamma pole */
+ else
+ return __kernel_standard(x,x,214); /* lgamma overflow */
+ } else
+ return y;
+#endif
+}
+weak_alias (__lgammal_r, lgammal_r)
diff --git a/sysdeps/libm-ieee754/w_log10l.c b/sysdeps/libm-ieee754/w_log10l.c
new file mode 100644
index 0000000000..0d0861689d
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_log10l.c
@@ -0,0 +1,51 @@
+/* w_log10l.c -- long double version of w_log10.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper log10l(X)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __log10l(long double x) /* wrapper log10l */
+#else
+ long double __log10l(x) /* wrapper log10l */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_log10l(x);
+#else
+ long double z;
+ z = __ieee754_log10l(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<=0.0) {
+ if(x==0.0)
+ return __kernel_standard(x,x,218); /* log10(0) */
+ else
+ return __kernel_standard(x,x,219); /* log10(x<0) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__log10l, log10l)
diff --git a/sysdeps/libm-ieee754/w_logl.c b/sysdeps/libm-ieee754/w_logl.c
new file mode 100644
index 0000000000..bb979c26c3
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_logl.c
@@ -0,0 +1,48 @@
+/* w_logl.c -- long double version of w_log.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper logl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __logl(long double x) /* wrapper logl */
+#else
+ long double __logl(x) /* wrapper logl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_logl(x);
+#else
+ long double z;
+ z = __ieee754_logl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z;
+ if(x==0.0)
+ return __kernel_standard(x,x,216); /* log(0) */
+ else
+ return __kernel_standard(x,x,217); /* log(x<0) */
+#endif
+}
+weak_alias (__logl, logl)
diff --git a/sysdeps/libm-ieee754/w_powl.c b/sysdeps/libm-ieee754/w_powl.c
new file mode 100644
index 0000000000..019664e0f1
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_powl.c
@@ -0,0 +1,64 @@
+/* w_powl.c -- long double version of w_pow.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper powl(x,y) return x**y
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+
+#ifdef __STDC__
+ long double __powl(long double x, long double y)/* wrapper powl */
+#else
+ long double __powl(x,y) /* wrapper powl */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_powl(x,y);
+#else
+ long double z;
+ z=__ieee754_powl(x,y);
+ if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
+ if(__isnanl(x)) {
+ if(y==0.0)
+ return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
+ else
+ return z;
+ }
+ if(x==0.0){
+ if(y==0.0)
+ return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
+ if(__finite(y)&&y<0.0)
+ return __kernel_standard(x,y,223); /* pow(0.0,negative) */
+ return z;
+ }
+ if(!__finitel(z)) {
+ if(__finitel(x)&&__finitel(y)) {
+ if(__isnanl(z))
+ return __kernel_standard(x,y,224); /* pow neg**non-int */
+ else
+ return __kernel_standard(x,y,221); /* pow overflow */
+ }
+ }
+ if(z==0.0&&__finitel(x)&&__finitel(y))
+ return __kernel_standard(x,y,222); /* pow underflow */
+ return z;
+#endif
+}
+weak_alias (__powl, powl)
diff --git a/sysdeps/libm-ieee754/w_remainderl.c b/sysdeps/libm-ieee754/w_remainderl.c
new file mode 100644
index 0000000000..284140174d
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_remainderl.c
@@ -0,0 +1,48 @@
+/* w_remainderl.c -- long double version of w_remainder.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper remainderl(x,p)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __remainderl(long double x, long double y)
+ /* wrapper remainderl */
+#else
+ long double __remainderl(x,y) /* wrapper remainder */
+ long double x,y;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_remainderl(x,y);
+#else
+ long double z;
+ z = __ieee754_remainderl(x,y);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z;
+ if(y==0.0)
+ return __kernel_standard(x,y,228); /* remainder(x,0) */
+ else
+ return z;
+#endif
+}
+weak_alias (__remainderl, remainderl)
diff --git a/sysdeps/libm-ieee754/w_scalbl.c b/sysdeps/libm-ieee754/w_scalbl.c
new file mode 100644
index 0000000000..ff5117d24c
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_scalbl.c
@@ -0,0 +1,65 @@
+/* w_scalbl.c -- long double version of w_scalb.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper scalbl(long double x, long double fn) is provide for
+ * passing various standard test suite. One
+ * should use scalbnl() instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#include <errno.h>
+
+#ifdef __STDC__
+#ifdef _SCALB_INT
+ long double __scalbl(long double x, int fn) /* wrapper scalbl */
+#else
+ long double __scalbl(long double x, long double fn)/* wrapper scalbl */
+#endif
+#else
+ long double __scalbl(x,fn) /* wrapper scalbl */
+#ifdef _SCALB_INT
+ long double x; int fn;
+#else
+ long double x,fn;
+#endif
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_scalbl(x,fn);
+#else
+ long double z;
+ z = __ieee754_scalbl(x,fn);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
+ return __kernel_standard(x,(double)fn,232); /* scalb overflow */
+ }
+ if(z==0.0&&z!=x) {
+ return __kernel_standard(x,(double)fn,233); /* scalb underflow */
+ }
+#ifndef _SCALB_INT
+ if(!__finitel(fn)) errno = ERANGE;
+#endif
+ return z;
+#endif
+}
+weak_alias (__scalbl, scalbl)
diff --git a/sysdeps/libm-ieee754/w_sinhl.c b/sysdeps/libm-ieee754/w_sinhl.c
new file mode 100644
index 0000000000..3e93cc598d
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_sinhl.c
@@ -0,0 +1,47 @@
+/* w_sinhl.c -- long double version of w_sinh.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sinhl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __sinhl(long double x) /* wrapper sinhl */
+#else
+ long double __sinhl(x) /* wrapper sinhl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sinhl(x);
+#else
+ long double z;
+ z = __ieee754_sinhl(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(!__finitel(z)&&__finitel(x)) {
+ return __kernel_standard(x,x,225); /* sinh overflow */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sinhl, sinhl)
diff --git a/sysdeps/libm-ieee754/w_sqrtl.c b/sysdeps/libm-ieee754/w_sqrtl.c
new file mode 100644
index 0000000000..5873ce93ab
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_sqrtl.c
@@ -0,0 +1,47 @@
+/* w_sqrtl.c -- long double version of w_sqrt.c.
+ * Conversion to long double by Ulrich Drepper,
+ * Cygnus Support, drepper@cygnus.com.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * wrapper sqrtl(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+ long double __sqrtl(long double x) /* wrapper sqrtl */
+#else
+ long double __sqrtl(x) /* wrapper sqrtl */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_sqrtl(x);
+#else
+ long double z;
+ z = __ieee754_sqrtl(x);
+ if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
+ if(x<0.0) {
+ return __kernel_standard(x,x,226); /* sqrt(negative) */
+ } else
+ return z;
+#endif
+}
+weak_alias (__sqrtl, sqrtl)
diff --git a/sysdeps/mach/hurd/getlogin_r.c b/sysdeps/mach/hurd/getlogin_r.c
new file mode 100644
index 0000000000..16eca670ce
--- /dev/null
+++ b/sysdeps/mach/hurd/getlogin_r.c
@@ -0,0 +1,41 @@
+/* Reentrant function to return the current login name. Hurd version.
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <string.h>
+
+/* Return at most NAME_LEN characters of the login name of the user in NAME.
+ If it cannot be determined or some other error occured, return the error
+ code. Otherwise return 0. */
+int
+getlogin_r (name, name_len)
+ char *name;
+ size_t name_len;
+{
+ static char login[1024]; /* XXX */
+ error_t err;
+
+ if (err = __USEPORT (PROC, __proc_getlogin (port, login)))
+ return errno = err;
+
+ strncpy (name, login, name_len);
+ return 0;
+}
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index e225da2be2..30f058314d 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96 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
@@ -48,7 +48,7 @@ ttyname_r (fd, buf, buflen)
/* Test for the absolute minimal size. This makes life easier inside
the loop. */
- if (buflen < sizeof (dev) + 2)
+ if (buflen < (int) (sizeof (dev) + 2))
{
errno = EINVAL;
return -1;
@@ -73,8 +73,8 @@ ttyname_r (fd, buf, buflen)
{
char *cp;
- cp = stpncpy (&buf[sizeof (dev) + 1], d->d_name,
- MIN (d->d_namlen + 1, buflen));
+ cp = __stpncpy (&buf[sizeof (dev) + 1], d->d_name,
+ MIN ((int) (_D_EXACT_NAMLEN (d) + 1), buflen));
cp[0] = '\0';
if (stat (buf, &st) == 0 && st.st_dev == mydev)
diff --git a/sysdeps/stub/getlogin_r.c b/sysdeps/stub/getlogin_r.c
new file mode 100644
index 0000000000..bf29c7c982
--- /dev/null
+++ b/sysdeps/stub/getlogin_r.c
@@ -0,0 +1,35 @@
+/* Reentrant function to return the current login name. Stub version.
+Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return at most NAME_LEN characters of the login name of the user in NAME.
+ If it cannot be determined or some other error occured, return the error
+ code. Otherwise return 0. */
+int
+getlogin_r (name, name_len)
+ char *name;
+ size_t name_len;
+{
+ errno = ENOSYS;
+ return errno;
+}
+
+stub_warning (getlogin_r)
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 504a7aa4c0..00baf6875a 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996 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
@@ -17,7 +17,6 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
-#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
@@ -27,38 +26,29 @@ Cambridge, MA 02139, USA. */
#include <utmp.h>
-/* Defined in ttyname.c. */
-extern char *__ttyname;
-
/* Return the login name of the user, or NULL if it can't be determined.
The returned pointer, if not NULL, is good only until the next call. */
char *
DEFUN_VOID(getlogin)
{
- char save_tty_pathname[2 + 2 * NAME_MAX];
- char *save_ttyname;
- char *real_tty_path;
+ char tty_pathname[2 + 2 * NAME_MAX];
+ char *real_tty_path = tty_pathname;
char *result = NULL;
- FILE *f;
- static struct utmp ut;
-
- if (__ttyname == NULL)
- save_ttyname = NULL;
- else
- save_ttyname = strcpy (save_tty_pathname, __ttyname);
+ static struct utmp_data utmp_data;
+ struct utmp *ut;
{
- int err;
+ int err = 0;
int d = __open ("/dev/tty", 0);
if (d < 0)
return NULL;
- real_tty_path = ttyname (d);
- err = errno;
+ if (ttyname_r (d, real_tty_path, sizeof (tty_pathname)) < 0)
+ err = errno;
(void) close (d);
- if (real_tty_path == NULL)
+ if (errno != 0)
{
errno = err;
return NULL;
@@ -67,24 +57,18 @@ DEFUN_VOID(getlogin)
real_tty_path += 5; /* Remove "/dev/". */
- f = fopen ("/etc/utmp", "r");
- if (f != NULL)
+ setutent_r (&utmp_data);
+ if (getutline_r (real_tty_path, &ut, &utmp_data) < 0)
{
- while (fread ((PTR) &ut, sizeof(ut), 1, f) == 1)
- if (!strncmp (ut.ut_line, real_tty_path, sizeof (ut.ut_line)))
- {
- result = ut.ut_name;
- /* The name is not null-terminated if
- it is as long as sizeof (ut.ut_name). */
- result[sizeof (ut.ut_name)] = '\0';
- break;
- }
- (void) fclose (f);
+ if (errno == ESRCH)
+ /* The caller expects ENOENT if nothing is found. */
+ errno = ENOENT;
+ result = NULL;
}
+ else
+ result = ut->ut_line;
+
+ endutent_r (&utmp_data);
- if (save_ttyname != NULL)
- strcpy (__ttyname, save_ttyname);
- if (result == NULL)
- errno = ENOENT;
return result;
}
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
new file mode 100644
index 0000000000..15afdee63c
--- /dev/null
+++ b/sysdeps/unix/getlogin_r.c
@@ -0,0 +1,80 @@
+/* Reentrant function to return the current login name. Unix version.
+Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <limits.h>
+#include <fcntl.h>
+
+#include <utmp.h>
+
+/* Return at most NAME_LEN characters of the login name of the user in NAME.
+ If it cannot be determined or some other error occured, return the error
+ code. Otherwise return 0. */
+
+int
+getlogin_r (name, name_len)
+ char *name;
+ size_t name_len;
+{
+ char tty_pathname[2 + 2 * NAME_MAX];
+ char *real_tty_path = tty_pathname;
+ int result = 0;
+ struct utmp_data utmp_data;
+ struct utmp *ut;
+
+ {
+ int err;
+ int d = __open ("/dev/tty", 0);
+ if (d < 0)
+ return errno;
+
+ result = ttyname_r (d, real_tty_path, sizeof (tty_pathname));
+ err = errno;
+ (void) close (d);
+
+ if (result < 0)
+ {
+ errno = err;
+ return err;
+ }
+ }
+
+ real_tty_path += 5; /* Remove "/dev/". */
+
+ setutent_r (&utmp_data);
+ if (getutline_r (real_tty_path, &ut, &utmp_data) < 0)
+ {
+ if (errno == ESRCH)
+ /* The caller expects ENOENT if nothing is found. */
+ result = ENOENT;
+ else
+ result = errno;
+ }
+ else
+ {
+ strncpy (name, ut->ut_line, name_len);
+ result = 0;
+ }
+ endutent_r (&utmp_data);
+
+ return result;
+}