diff options
-rw-r--r-- | ChangeLog | 40 | ||||
-rw-r--r-- | Makeconfig | 4 | ||||
-rw-r--r-- | elf/dl-load.c | 3 | ||||
-rw-r--r-- | malloc/mtrace.c | 2 | ||||
-rw-r--r-- | math/math.h | 10 | ||||
-rw-r--r-- | posix/regex.c | 6 | ||||
-rw-r--r-- | rt/Makefile | 4 | ||||
-rw-r--r-- | rt/aio_misc.c | 26 | ||||
-rw-r--r-- | rt/aio_suspend.c | 53 | ||||
-rw-r--r-- | rt/lio_listio.c | 10 | ||||
-rw-r--r-- | rt/lio_listio64.c | 10 | ||||
-rw-r--r-- | rt/tst-aio.c | 142 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_pow.c | 2 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_expm1.c | 1 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_signgam.c | 3 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gamma.c | 4 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gammaf.c | 4 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_gammal.c | 4 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_lgamma.c | 10 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_lgammaf.c | 10 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_lgammal.c | 10 | ||||
-rw-r--r-- | test-skeleton.c | 51 | ||||
-rw-r--r-- | wcsmbs/wcstod_l.c | 5 | ||||
-rw-r--r-- | wcsmbs/wcstof_l.c | 5 | ||||
-rw-r--r-- | wcsmbs/wcstold_l.c | 5 |
25 files changed, 349 insertions, 75 deletions
@@ -1,5 +1,45 @@ +1998-04-11 09:33 Ulrich Drepper <drepper@cygnus.com> + + * Makeconfig (rtobjdir): New variable. + (rpath-link): Add rtobjdir and thread directory, if available. + + * test-skeleton.c: Add support to remove temporary files. + Always define test_dir. Improve message about expected signal. + + * rt/Makefile (tests): Add tst-aio. + Add rules for tst-aio to be linked with librt and thread library. + * rt/aio_misc.c: Correct fundamental bugs. + * rt/aio_suspend.c: Correct bug in test for available request. + Initialize conditional variable. + * rt/lio_listio.c: Initialize conditional variable. + * rt/lio_listio64.c: Likewise. + * rt/tst-aio.c: New file. + + * sysdeps/libm-ieee754/s_signgam.c: Undo last change. + * sysdeps/libm-ieee754/w_gamma.c: Likewise. Adopt for ISO C 9x. + * sysdeps/libm-ieee754/w_gammaf.c: Likewise. + * sysdeps/libm-ieee754/w_gammal.c: Likewise. + * sysdeps/libm-ieee754/w_lgamma.c: Likewise. + * sysdeps/libm-ieee754/w_lgammaf.c: Likewise. + * sysdeps/libm-ieee754/w_lgammal.c: Likewise. + +1998-04-11 14:49 Mark Kettenis <kettenis@landau.phys.uva.nl> + + * posix/regex.c [_LIBC] (__re_syntax_options): Initialize to 0. + 1998-04-10 Ulrich Drepper <drepper@cygnus.com> + * elf/dl-load.c (open_path): Use correct name for test whether + directory in load path exists. + + * sysdeps/libm-ieee754/s_expm1.c: Remove variable one. + * sysdeps/libm-ieee754/e_pow.c: Fix typo. + Patches by Tom Rini <trini@kernel.crashing.org>. + + * wcsmbs/wcstof_l.c: Declare ____wcstoull_l_internal. + * wcsmbs/wcstod_l.c: Likewise. + * wcsmbs/wcstold_l.c: Likewise. + * include/byteswap.h: New file. * malloc/mtrace.c (mtrace): Use smaller output buffer to reduce @@ -413,12 +413,13 @@ else default-rpath = $(libdir) endif # This is how to find at build-time things that will be installed there. -rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir) +rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir):$(rtobjdir) mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math) elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) nisobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nis) dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2) +rtobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)rt) else link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a endif @@ -750,6 +751,7 @@ ifneq (,$(findstring linuxthreads,$(add-ons))) shared-thread-library = $(common-objpfx)linuxthreads/libpthread.so static-thread-library = $(common-objpfx)linuxthreads/libpthread.a have-thread-library = yes +rpath-link := $(rpath-link):$(common-objpfx)linuxthreads endif endif # Makeconfig not yet included diff --git a/elf/dl-load.c b/elf/dl-load.c index c3337e4..6433b32 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -919,7 +919,8 @@ open_path (const char *name, size_t namelen, int preloaded, test whether there is any directory at all. */ struct stat st; - buf[this_dir->dirnamelen + capstr[cnt].len] = '\0'; + buf[this_dir->dirnamelen + + MAX (capstr[cnt].len - 1, 0)] = '\0'; if (__xstat (_STAT_VER, buf, &st) != 0 || ! S_ISDIR (st.st_mode)) diff --git a/malloc/mtrace.c b/malloc/mtrace.c index 0c8e411..a7f0a90 100644 --- a/malloc/mtrace.c +++ b/malloc/mtrace.c @@ -244,7 +244,7 @@ mtrace () if (mallstream != NULL) { /* Be sure it doesn't malloc its buffer! */ - setvbuf (mallstream, malloc_trace_buffer, TRACE_BUFFER_SIZE); + setbuffer (mallstream, malloc_trace_buffer, TRACE_BUFFER_SIZE); fprintf (mallstream, "= Start\n"); tr_old_free_hook = __free_hook; __free_hook = tr_freehook; diff --git a/math/math.h b/math/math.h index 274647e..fe7f46f 100644 --- a/math/math.h +++ b/math/math.h @@ -200,8 +200,14 @@ enum #ifdef __USE_MISC /* Support for various different standard error handling behaviors. */ - -typedef enum { _IEEE_ = -1, _SVID_, _XOPEN_, _POSIX_ } _LIB_VERSION_TYPE; +typedef enum +{ + _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */ + _SVID_, /* According to System V, release 4. */ + _XOPEN_, /* Nowadays also Unix98. */ + _POSIX_, + _ISOC_ /* Actually this is ISO C 9X. */ +} _LIB_VERSION_TYPE; /* This variable can be changed at run-time to any of the values above to affect floating point error handling behavior (it may also be necessary diff --git a/posix/regex.c b/posix/regex.c index aeaf198..d29a4bf 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -966,13 +966,13 @@ printchar (c) /* Set by `re_set_syntax' to the current regexp syntax to recognize. Can also be assigned to arbitrarily: each pattern buffer stores its own syntax, so it can be changed between regex compilations. */ -/* This has no initializer because initialized variables in Emacs - become read-only after dumping. */ #ifdef _LIBC -reg_syntax_t __re_syntax_options; +reg_syntax_t __re_syntax_options = 0; weak_alias (__re_syntax_options, re_syntax_options) # define re_syntax_options __re_syntax_options #else +/* This has no initializer because initialized variables in Emacs + become read-only after dumping. */ reg_syntax_t re_syntax_options; #endif diff --git a/rt/Makefile b/rt/Makefile index ef6e930..748050a 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -30,6 +30,8 @@ librt-routines := aio_cancel aio_error aio_fsync aio_misc aio_read \ librt-map := librt.map +tests := tst-aio + # Make sure that everything is distributed independent of configuration. distribute := aio_misc.h $(librt-routines:=.c) $(librt-map) @@ -48,3 +50,5 @@ include ../Rules # This ensures they will load libc.so for needed symbols if loaded by # a statically-linked program that hasn't already loaded it. $(objpfx)librt.so: $(common-objpfx)libc.so $(shared-thread-library) + +$(objpfx)tst-aio: $(objpfx)librt.so $(shared-thread-library) diff --git a/rt/aio_misc.c b/rt/aio_misc.c index 91c5544..030bef9 100644 --- a/rt/aio_misc.c +++ b/rt/aio_misc.c @@ -1,5 +1,5 @@ /* Handle general operations. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -27,7 +27,6 @@ #include "aio_misc.h" - /* Pool of request list entries. */ static struct requestlist **pool; @@ -273,7 +272,7 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation) /* The current file descriptor is worked on. It makes no sense to start another thread since this new thread would fight with the running thread for the resources. But we also cannot - say that the thread processing this desriptor shall imeediately + say that the thread processing this desriptor shall immediately after finishing the current job process this request if there are other threads in the running queue which have a higher priority. */ @@ -392,14 +391,18 @@ handle_fildes_io (void *arg) pthread_t self = pthread_self (); struct sched_param param; struct requestlist *runp = (struct requestlist *) arg; - aiocb_union *aiocbp = runp->aiocbp; + aiocb_union *aiocbp; int policy; - int fildes = runp->aiocbp->aiocb.aio_fildes; + int fildes; pthread_getschedparam (self, &policy, ¶m); do { + /* Update our variables. */ + aiocbp = runp->aiocbp; + fildes = aiocbp->aiocb.aio_fildes; + /* Change the priority to the requested value (if necessary). */ if (aiocbp->aiocb.__abs_prio != param.sched_priority || aiocbp->aiocb.__policy != policy) @@ -467,8 +470,8 @@ handle_fildes_io (void *arg) /* Now dequeue the current request. */ if (runp->next_prio == NULL) { - /* No outstanding request for this descriptor. Process the - runlist if necessary. */ + /* No outstanding request for this descriptor. Remove this + descriptor from the list. */ if (runp->next_fd != NULL) runp->next_fd->last_fd = runp->last_fd; if (runp->last_fd != NULL) @@ -488,15 +491,12 @@ handle_fildes_io (void *arg) /* Free the old element. */ __aio_free_request (runp); - runp = freelist; + runp = runlist; if (runp != NULL) { /* We must not run requests which are not marked `running'. */ if (runp->running == yes) - { - freelist = runp->next_run; - runp->running = allocated; - } + runlist = runp->next_run; else { struct requestlist *old; @@ -516,6 +516,8 @@ handle_fildes_io (void *arg) /* If no request to work on we will stop the thread. */ if (runp == NULL) --nthreads; + else + runp->running = allocated; /* Release the mutex. */ pthread_mutex_unlock (&__aio_requests_mutex); diff --git a/rt/aio_suspend.c b/rt/aio_suspend.c index 6123b7b..ca16342 100644 --- a/rt/aio_suspend.c +++ b/rt/aio_suspend.c @@ -1,5 +1,5 @@ /* Suspend until termination of a requests. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -40,40 +40,42 @@ aio_suspend (list, nent, timeout) int nent; const struct timespec *timeout; { - pthread_cond_t cond; struct waitlist waitlist[nent]; struct requestlist *requestlist[nent]; + pthread_cond_t cond; int cnt; int result = 0; + int dummy; + int none = 1; /* Request the mutex. */ pthread_mutex_lock (&__aio_requests_mutex); - /* First look whether there is already a terminated request. */ + /* There is not yet a finished request. Signal the request that + we are working for it. */ for (cnt = 0; cnt < nent; ++cnt) - if (list[cnt] != NULL && list[cnt]->__error_code != EINPROGRESS) - break; + if (list[cnt] != NULL && list[cnt]->__error_code == EINPROGRESS) + { + requestlist[cnt] = __aio_find_req ((aiocb_union *) list[cnt]); + + if (requestlist[cnt] != NULL) + { + waitlist[cnt].cond = &cond; + waitlist[cnt].next = requestlist[cnt]->waiting; + waitlist[cnt].counterp = &dummy; + waitlist[cnt].sigevp = NULL; + requestlist[cnt]->waiting = &waitlist[cnt]; + none = 0; + } + } - if (cnt == nent) + /* If there is a not finished request wait for it. */ + if (!none) { int oldstate; - /* There is not yet a finished request. Signal the request that - we are working for it. */ - for (cnt = 0; cnt < nent; ++cnt) - if (list[cnt] != NULL && list[cnt]->__error_code == EINPROGRESS) - { - requestlist[cnt] = __aio_find_req ((aiocb_union *) list[cnt]); - - if (requestlist[cnt] != NULL) - { - waitlist[cnt].cond = &cond; - waitlist[cnt].next = requestlist[cnt]->waiting; - waitlist[cnt].counterp = NULL; - waitlist[cnt].sigevp = NULL; - requestlist[cnt]->waiting = &waitlist[cnt]; - } - } + /* Initialize the conditional variable. */ + pthread_cond_init (&cond, NULL); /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancelation points we must be careful. We added entries to the waiting lists @@ -87,7 +89,7 @@ aio_suspend (list, nent, timeout) timeout); /* Now remove the entry in the waiting list for all requests - which didn't terminate */ + which didn't terminate. */ for (cnt = 0; cnt < nent; ++cnt) if (list[cnt] != NULL && list[cnt]->__error_code == EINPROGRESS && requestlist[cnt] != NULL) @@ -107,6 +109,11 @@ aio_suspend (list, nent, timeout) /* Now it's time to restore the cancelation state. */ pthread_setcancelstate (oldstate, NULL); + /* Release the conditional variable. */ + if (pthread_cond_destroy (&cond) != 0) + /* This must never happen. */ + abort (); + if (result != 0) { /* An error occurred. Possibly it's EINTR. We have to translate diff --git a/rt/lio_listio.c b/rt/lio_listio.c index b389c6a..07c8d3e 100644 --- a/rt/lio_listio.c +++ b/rt/lio_listio.c @@ -1,5 +1,5 @@ /* Enqueue and list of read or write requests. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -86,6 +86,9 @@ lio_listio (mode, list, nent, sig) struct waitlist waitlist[nent]; int oldstate; + /* Initialize the conditional variable. */ + pthread_cond_init (&cond, NULL); + total = 0; for (cnt = 0; cnt < nent; ++cnt) if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP @@ -110,6 +113,11 @@ lio_listio (mode, list, nent, sig) /* Now it's time to restore the cancelation state. */ pthread_setcancelstate (oldstate, NULL); + + /* Release the conditional variable. */ + if (pthread_cond_destroy (&cond) != 0) + /* This must never happen. */ + abort (); } else { diff --git a/rt/lio_listio64.c b/rt/lio_listio64.c index 19f56ad..69b78b7 100644 --- a/rt/lio_listio64.c +++ b/rt/lio_listio64.c @@ -1,5 +1,5 @@ /* Enqueue and list of read or write requests, 64bit offset version. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -86,6 +86,9 @@ lio_listio64 (mode, list, nent, sig) struct waitlist waitlist[nent]; int oldstate; + /* Initialize the conditional variable. */ + pthread_cond_init (&cond, NULL); + total = 0; for (cnt = 0; cnt < nent; ++cnt) if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP @@ -109,6 +112,11 @@ lio_listio64 (mode, list, nent, sig) /* Now it's time to restore the cancelation state. */ pthread_setcancelstate (oldstate, NULL); + + /* Release the conditional variable. */ + if (pthread_cond_destroy (&cond) != 0) + /* This must never happen. */ + abort (); } else { diff --git a/rt/tst-aio.c b/rt/tst-aio.c new file mode 100644 index 0000000..e319dea --- /dev/null +++ b/rt/tst-aio.c @@ -0,0 +1,142 @@ +/* Tests for AIO in librt. + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + 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 <aio.h> +#include <errno.h> +#include <error.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/stat.h> + + +/* prototype for our test function. */ +extern int do_test (int argc, char *argv[]); + + +/* We might need a bit longer timeout. */ +#define TIMEOUT 20 /* sec */ + +/* This defines the `main' function and some more. */ +#include <test-skeleton.c> + + +int +test_file (const void *buf, size_t size, int fd, const char *msg) +{ + struct stat st; + char tmp[size]; + + errno = 0; + if (fstat (fd, &st) < 0) + { + error (0, errno, "%s: failed stat", msg); + return 1; + } + + if (st.st_size != size) + { + error (0, errno, "%s: wrong size: %lu, should be %lu", + msg, (unsigned long int) st.st_size, (unsigned long int) size); + return 1; + } + + if (pread (fd, tmp, size, 0) != size) + { + error (0, errno, "%s: failed stat", msg); + return 1; + } + + if (memcmp (buf, tmp, size) != 0) + { + error (0, errno, "%s: failed comparison", msg); + return 1; + } + + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "%s: failed truncate", msg); + return 1; + } + + return 0; +} + + +int +do_test (int argc, char *argv[]) +{ + char *name; + char name_len; + struct aiocb cbs[10]; + struct aiocb *cbp[10]; + char buf[1000]; + size_t cnt; + int fd; + int result = 0; + int go_on; + + name_len = strlen (test_dir); + name = malloc (name_len + sizeof ("/aioXXXXXX")); + mempcpy (mempcpy (name, test_dir, name_len), + "/aioXXXXXX", sizeof ("/aioXXXXXX")); + add_temp_file (name); + + /* Open our test file. */ + fd = mkstemp (name); + if (fd == -1) + error (EXIT_FAILURE, errno, "cannot open test file `%s'", name); + + /* Preparation. */ + for (cnt = 0; cnt < 10; ++cnt) + { + cbs[cnt].aio_fildes = fd; + cbs[cnt].aio_reqprio = 0; + cbs[cnt].aio_buf = memset (&buf[cnt * 100], '0' + cnt, 100); + cbs[cnt].aio_nbytes = 100; + cbs[cnt].aio_offset = cnt * 100; + cbs[cnt].aio_sigevent.sigev_notify = SIGEV_NONE; + + cbp[cnt] = &cbs[cnt]; + } + + /* First a simple test. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + /* Wait 'til the results are there. */ + do + { + aio_suspend ((const struct aiocb *const *) cbp, 10, NULL); + go_on = 0; + for (cnt = 0; cnt < 10; ++cnt) + if (cbp[cnt] != NULL && aio_error (cbp[cnt]) == EINPROGRESS) + go_on = 1; + else + { + if (cbp[cnt] != NULL) + printf ("request %d finished\n", cnt); + cbp[cnt] = NULL; + } + } + while (go_on); + /* Test this. */ + result |= test_file (buf, sizeof (buf), fd, "aio_write"); + + return result; +} diff --git a/sysdeps/libm-ieee754/e_pow.c b/sysdeps/libm-ieee754/e_pow.c index 02b16c5..1e1496f 100644 --- a/sysdeps/libm-ieee754/e_pow.c +++ b/sysdeps/libm-ieee754/e_pow.c @@ -266,7 +266,7 @@ C[] = { r2 = C[8]+s2*C[9]; s24=s22*s22; r3 = C[6]+s2*C[7]; s26=s24*s22; r = r3*s22 + r2*s24 + r1*s26; -#endfi +#endif r += s_l*(s_h+s); s2 = s_h*s_h; t_h = 3.0+s2+r; diff --git a/sysdeps/libm-ieee754/s_expm1.c b/sysdeps/libm-ieee754/s_expm1.c index ed1aba5..df6b1e4 100644 --- a/sysdeps/libm-ieee754/s_expm1.c +++ b/sysdeps/libm-ieee754/s_expm1.c @@ -120,7 +120,6 @@ static const double #else static double #endif -one = 1.0, huge = 1.0e+300, tiny = 1.0e-300, o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ diff --git a/sysdeps/libm-ieee754/s_signgam.c b/sysdeps/libm-ieee754/s_signgam.c index 2ab5924..021b0ff 100644 --- a/sysdeps/libm-ieee754/s_signgam.c +++ b/sysdeps/libm-ieee754/s_signgam.c @@ -1,4 +1,3 @@ #include "math.h" #include "math_private.h" -int __signgam = 0; -weak_alias (__signgam, signgam) +int signgam; diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c index 7629503..02a3d47 100644 --- a/sysdeps/libm-ieee754/w_gamma.c +++ b/sysdeps/libm-ieee754/w_gamma.c @@ -22,8 +22,6 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $"; #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ double __gamma(double x) #else @@ -34,7 +32,7 @@ extern int __signgam; double y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgamma_r(x,&__signgam); + y = __ieee754_lgamma_r(x,&signgam); else { #endif diff --git a/sysdeps/libm-ieee754/w_gammaf.c b/sysdeps/libm-ieee754/w_gammaf.c index fc28a97..7d78a52 100644 --- a/sysdeps/libm-ieee754/w_gammaf.c +++ b/sysdeps/libm-ieee754/w_gammaf.c @@ -20,8 +20,6 @@ static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $"; #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ float __gammaf(float x) #else @@ -32,7 +30,7 @@ extern int __signgam; float y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgammaf_r(x,&__signgam); + y = __ieee754_lgammaf_r(x,&signgam); else { #endif diff --git a/sysdeps/libm-ieee754/w_gammal.c b/sysdeps/libm-ieee754/w_gammal.c index 88c681b..1b4ae2c 100644 --- a/sysdeps/libm-ieee754/w_gammal.c +++ b/sysdeps/libm-ieee754/w_gammal.c @@ -25,8 +25,6 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ long double __gammal(long double x) #else @@ -37,7 +35,7 @@ extern int __signgam; long double y; #ifndef _IEEE_LIBM if (_LIB_VERSION == _SVID_) - y = __ieee754_lgammal_r(x,&__signgam); + y = __ieee754_lgammal_r(x,&signgam); else { #endif diff --git a/sysdeps/libm-ieee754/w_lgamma.c b/sysdeps/libm-ieee754/w_lgamma.c index fbb933f..bbb53f5 100644 --- a/sysdeps/libm-ieee754/w_lgamma.c +++ b/sysdeps/libm-ieee754/w_lgamma.c @@ -23,8 +23,6 @@ static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $"; #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ double __lgamma(double x) #else @@ -33,10 +31,14 @@ extern int __signgam; #endif { #ifdef _IEEE_LIBM - return __ieee754_lgamma_r(x,&__signgam); + return __ieee754_lgamma_r(x,&signgam); #else double y; - y = __ieee754_lgamma_r(x,&__signgam); + int local_signgam; + y = __ieee754_lgamma_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_signgam; if(_LIB_VERSION == _IEEE_) return y; if(!__finite(y)&&__finite(x)) { if(__floor(x)==x&&x<=0.0) diff --git a/sysdeps/libm-ieee754/w_lgammaf.c b/sysdeps/libm-ieee754/w_lgammaf.c index e056602..369dee6 100644 --- a/sysdeps/libm-ieee754/w_lgammaf.c +++ b/sysdeps/libm-ieee754/w_lgammaf.c @@ -20,8 +20,6 @@ static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $" #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ float __lgammaf(float x) #else @@ -30,10 +28,14 @@ extern int __signgam; #endif { #ifdef _IEEE_LIBM - return __ieee754_lgammaf_r(x,&__signgam); + return __ieee754_lgammaf_r(x,&signgam); #else float y; - y = __ieee754_lgammaf_r(x,&__signgam); + int local_signgam; + y = __ieee754_lgammaf_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_signgam; if(_LIB_VERSION == _IEEE_) return y; if(!__finitef(y)&&__finitef(x)) { if(__floorf(x)==x&&x<=(float)0.0) diff --git a/sysdeps/libm-ieee754/w_lgammal.c b/sysdeps/libm-ieee754/w_lgammal.c index aab8417..9db2ce2 100644 --- a/sysdeps/libm-ieee754/w_lgammal.c +++ b/sysdeps/libm-ieee754/w_lgammal.c @@ -27,8 +27,6 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -extern int __signgam; - #ifdef __STDC__ long double __lgammal(long double x) #else @@ -37,10 +35,14 @@ extern int __signgam; #endif { #ifdef _IEEE_LIBM - return __ieee754_lgammal_r(x,&__signgam); + return __ieee754_lgammal_r(x,&signgam); #else long double y; - y = __ieee754_lgammal_r(x,&__signgam); + int local_signgam; + y = __ieee754_lgammal_r(x,&local_signgam); + if (_LIB_VERSION != _ISOC_) + /* ISO C 9x does not define the global variable. */ + signgam = local_signgam; if(_LIB_VERSION == _IEEE_) return y; if(!__finitel(y)&&__finitel(x)) { if(__floorl(x)==x&&x<=0.0) diff --git a/test-skeleton.c b/test-skeleton.c index 5bb5c44..39c6073 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -18,6 +18,7 @@ Boston, MA 02111-1307, USA. */ #include <getopt.h> +#include <search.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -52,6 +53,39 @@ static int pid; /* Directory to place temporary files in. */ static const char *test_dir; +/* List of temporary files. */ +struct name_list +{ + struct qelem q; + const char *name; +} *name_list; + +/* Add temporary files in list. */ +void +add_temp_file (const char *name) +{ + struct name_list *newp = (struct name_list *) calloc (sizeof (*newp), 1); + if (newp != NULL) + { + newp->name = name; + if (name_list == NULL) + name_list = (struct name_list *) &newp->q; + else + insque (newp, name_list); + } +} + +/* Delete all temporary files. */ +void +delete_temp_files (void) +{ + while (name_list != NULL) + { + remove (name_list->name); + name_list = (struct name_list *) name_list->q.q_forw; + } +} + /* Timeout handler. We kill the child and exit with an error. */ void timeout_handler (int sig __attribute__ ((unused))) @@ -114,11 +148,20 @@ main (int argc, char *argv[]) exit (1); } } + else + { + test_dir = getenv ("TMPDIR"); + if (test_dir == NULL || test_dir[0] == '\0') + test_dir = "/tmp"; + } /* If we are not expected to fork run the function immediately. */ if (direct) return TEST_FUNCTION; + /* make sure temporary files are deleted. */ + atexit (delete_temp_files); + /* Set up the test environment: - prevent core dumps - set up the timer @@ -166,8 +209,12 @@ main (int argc, char *argv[]) #endif if (WTERMSIG (status) != EXPECTED_SIGNAL) { - fprintf (stderr, "Incorrect signal from child: got `%s', need `%s'\n", - strsignal (WTERMSIG (status)), strsignal (EXPECTED_SIGNAL)); + if (EXPECTED_SIGNAL != 0) + fprintf (stderr, "Incorrect signal from child: got `%s', need `%s'\n", + strsignal (WTERMSIG (status)), strsignal (EXPECTED_SIGNAL)); + else + fprintf (stderr, "Incorrect signal from child: got `%s'\n", + strsignal (WTERMSIG (status))); exit (1); } diff --git a/wcsmbs/wcstod_l.c b/wcsmbs/wcstod_l.c index 1cd5694..84d2e99 100644 --- a/wcsmbs/wcstod_l.c +++ b/wcsmbs/wcstod_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,5 +26,8 @@ extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int, __locale_t); +extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, + wchar_t **, int, int, + __locale_t); #include <wcstod.c> diff --git a/wcsmbs/wcstof_l.c b/wcsmbs/wcstof_l.c index 193fc86..347f27f 100644 --- a/wcsmbs/wcstof_l.c +++ b/wcsmbs/wcstof_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,5 +26,8 @@ extern float ____wcstof_l_internal (const wchar_t *, wchar_t **, int, __locale_t); +extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, + wchar_t **, int, int, + __locale_t); #include <wcstof.c> diff --git a/wcsmbs/wcstold_l.c b/wcsmbs/wcstold_l.c index 596c7ce..f92ec78 100644 --- a/wcsmbs/wcstold_l.c +++ b/wcsmbs/wcstold_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,5 +26,8 @@ extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **, int, __locale_t); +extern unsigned long long int ____wcstoull_l_internal (const wchar_t *, + wchar_t **, int, int, + __locale_t); #include <wcstold.c> |