diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-10-12 12:00:26 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-10-12 12:00:26 +0000 |
commit | 3ee87ca7d4c813087eeee8b9fd04b7836244a54a (patch) | |
tree | 30d5d50dce77cb2e80d0bead19ee23e7d0a38617 | |
parent | 7dbf6a6cd568437c4b2fa14bcf5a1914cc267527 (diff) | |
download | glibc-3ee87ca7d4c813087eeee8b9fd04b7836244a54a.tar glibc-3ee87ca7d4c813087eeee8b9fd04b7836244a54a.tar.gz glibc-3ee87ca7d4c813087eeee8b9fd04b7836244a54a.tar.bz2 glibc-3ee87ca7d4c813087eeee8b9fd04b7836244a54a.zip |
Updated to fedora-glibc-20041012T1128cvs/fedora-glibc-2_3_3-67
58 files changed, 565 insertions, 205 deletions
@@ -1,3 +1,93 @@ +2004-10-11 Ulrich Drepper <drepper@redhat.com> + + * timezone/asia: Update from tzdata2004e. + * timezone/southamerica: Likewise. + * timezone/private.h: Update from tzcode2004e. + * timezone/zdump.c: Likewise. + + * stdio-common/vfscanf.c: Add support for reading localized + digits. Patch mainly by Hamed Malek <hamed@bamdad.org>. + + * resolv/res_init.c (res_thread_freeres): Reset _res.options. + [BZ #434] + + * resolv/res_send.c (send_dg): Use nonblocking sockets. Add + appropriate poll/select calls and restart operation if necessary. + Also handle EINTR. + + * elf/tst-dlopenrpath.c (do_test): Enable code which was disabled + for debugging. + + * elf/dl-sym.c (do_sym): Avoid using global variable. + + * elf/dl-addr.c (_dl_addr): Really use match everywhere. + +2004-10-09 Andreas Schwab <schwab@suse.de> + + * sysdeps/m68k/memcopy.h (WORD_COPY_BWD): Remove use of cast as + lvalue. + + * sysdeps/m68k/fpu/bits/mathinline.h: Remove __THROW from inline + definitions. + +2004-10-07 Andreas Schwab <schwab@suse.de> + + * misc/sys/uio.h: Change __vector to __iovec to avoid clash with + altivec. + +2004-10-06 Alan Modra <amodra@bigpond.net.au> + + * gmon/Makefile (CFLAGS-mcount.c): Move before inclusion of "Rules". + * sysdeps/powerpc/powerpc64/Makefile (CFLAGS-mcount.c): Add + -msoft-float. + * sysdeps/powerpc/powerpc64/sysdep.h (SAVE_ARG, REST_ARG): New macros. + (CALL_MCOUNT): Replace with a gas macro implementation. + (EALIGN): Delete PROF version. + * sysdeps/powerpc/powerpc64/__longjmp-common.S: Invoke CALL_MCOUNT. + * sysdeps/powerpc/powerpc64/bsd-_setjmp.S: Likewise. + * sysdeps/powerpc/powerpc64/bsd-setjmp.S: Likewise. + * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise. + * sysdeps/powerpc/powerpc64/memcpy.S: Likewise. + * sysdeps/powerpc/powerpc64/memset.S: Likewise. + * sysdeps/powerpc/powerpc64/stpcpy.S: Likewise. + * sysdeps/powerpc/powerpc64/strchr.S: Likewise. + * sysdeps/powerpc/powerpc64/strcmp.S: Likewise. + * sysdeps/powerpc/powerpc64/strcpy.S: Likewise. + * sysdeps/powerpc/powerpc64/strlen.S: Likewise. + * sysdeps/powerpc/powerpc64/strncmp.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_llround.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise. + * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise. + + * sysdeps/powerpc/powerpc64/setjmp-common.S: Add extra entry point + past _mcount call. + * sysdeps/powerpc/powerpc64/bsd-_setjmp.S: Use it. + * sysdeps/powerpc/powerpc64/bsd-setjmp.S: Likewise. + +2004-10-06 Ulrich Drepper <drepper@redhat.com> + + * resolv/res_mkquery.c (res_nmkquery): Reject randombits value if + low 16 bits are zero. + +2004-10-06 Jakub Jelinek <jakub@redhat.com> + + * posix/tst-getaddrinfo2.c: Include stdlib.h and string.h. + (do_test): Use %p instead of 0x%08X to print a pointer. + + * malloc/malloc.c: Include stdio-common/_itoa.h. + 2004-10-05 Ulrich Drepper <drepper@redhat.com> * elf/rtld.c (dl_main): Use _dl_debug_printf instead of _dl_printf @@ -1,6 +1,6 @@ Open jobs for finishing GNU libc: --------------------------------- -Status: September 2002 +Status: October 2004 If you have time and talent to take over any of the jobs below please contact <bug-glibc@gnu.org>. @@ -53,7 +53,7 @@ contact <bug-glibc@gnu.org>. [11] Write access function for netmasks, bootparams, and automount - databases for nss_files and nss_db module. + databases for nss_files, nss_nis, and nss_nisplus modules. The functions should be embedded in the nss scheme. This is not hard and not all services must be supported at once. @@ -76,7 +76,7 @@ contact <bug-glibc@gnu.org>. [18] Based on the sprof program we need tools to analyze the output. The result should be a link map which specifies in which order the .o files are placed in the shared object. This should help to improve - code locality and result in a smaller foorprint (in code and data + code locality and result in a smaller footprint (in code and data memory) since less pages are only used in small parts. @@ -93,29 +93,6 @@ contact <bug-glibc@gnu.org>. available. -[21] The nscd program and the stubs in the libc should be changed so - that each program uses only one socket connect. Take a look at - http://people.redhat.com/drepper/nscd.html - - An alternative approach is to use an mmap()ed file. The idea is - the following: - - the nscd creates the hash tables and the information it stores - in it in a mmap()ed region. This means no pointers must be - used, only offsets. - OR - if POSIX shared memory is available use a named shared memory - region to put the data in - - each program using NSS functionality tries to open the file - with the data. - - by checking some timestamp (which the nscd renews frequently) - the programs can test whether the file is still valid - - if the file is valid look through the nscd and locate the - appropriate hash table for the database and lookup the data. - If it is included we are set. - - if the data is not yet in the database we contact the nscd using - the currently implemented methods. - - [23] The `strptime' function needs to be completed. This includes among other things that it must get teached about timezones. The solution envisioned is to extract the timezones from the ADO timezone @@ -127,18 +104,4 @@ contact <bug-glibc@gnu.org>. Australia/Canberra or if the current locale is en_AU. -[25] Sun's nscd version implements a feature where the nscd keeps N entries - for each database current. I.e., if an entries lifespan is over and - it is one of the N entries to be kept the nscd updates the information - instead of removing the entry. - - How to decide about which N entries to keep has to be examined. - Factors should be number of uses (of course), influenced by aging. - Just imagine a computer used by several people. The IDs of the current - user should be preferred even if the last user spent more time. - - -[27] We need a second test suite with tests which cannot run during a normal - `make check' run. This test suite can require root priviledges and - can test things like DNS (i.e., require network access), - user-interaction, networking in general, and probably many other things. +[27] ...deleted... diff --git a/elf/dl-addr.c b/elf/dl-addr.c index ae97398bad..c373eb3b17 100644 --- a/elf/dl-addr.c +++ b/elf/dl-addr.c @@ -28,7 +28,7 @@ _dl_addr (const void *address, Dl_info *info, struct link_map **mapp, const ElfW(Sym) **symbolp) { const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address); - struct link_map *l, *match; + struct link_map *match; const ElfW(Sym) *symtab, *matchsym, *symtabend; const char *strtab; ElfW(Word) strtabsize; @@ -38,7 +38,7 @@ _dl_addr (const void *address, Dl_info *info, /* Find the highest-addressed object that ADDRESS is not below. */ match = NULL; - for (l = GL(dl_loaded); l; l = l->l_next) + for (struct link_map *l = GL(dl_loaded); l; l = l->l_next) if (addr >= l->l_map_start && addr < l->l_map_end) { /* We know ADDRESS lies within L if in any shared object. @@ -67,8 +67,8 @@ _dl_addr (const void *address, Dl_info *info, info->dli_fbase = (void *) match->l_map_start; /* If this is the main program the information is incomplete. */ - if (__builtin_expect (l->l_name[0], 'a') == '\0' - && l->l_type == lt_executable) + if (__builtin_expect (match->l_name[0], 'a') == '\0' + && match->l_type == lt_executable) info->dli_fname = _dl_argv[0]; symtab = (const void *) D_PTR (match, l_info[DT_SYMTAB]); diff --git a/elf/dl-sym.c b/elf/dl-sym.c index c7c737804e..a94610263d 100644 --- a/elf/dl-sym.c +++ b/elf/dl-sym.c @@ -90,9 +90,9 @@ do_sym (void *handle, const char *name, void *who, { if (__builtin_expect (match == GL(dl_loaded), 0)) { - if (! GL(dl_loaded) - || caller < GL(dl_loaded)->l_map_start - || caller >= GL(dl_loaded)->l_map_end) + if (match == NULL + || caller < match->l_map_start + || caller >= match->l_map_end) GLRO(dl_signal_error) (0, NULL, NULL, N_("\ RTLD_NEXT used in code not dynamically loaded")); } diff --git a/elf/tst-dlopenrpath.c b/elf/tst-dlopenrpath.c index 964f103b8c..bd4d888f34 100644 --- a/elf/tst-dlopenrpath.c +++ b/elf/tst-dlopenrpath.c @@ -62,10 +62,8 @@ do_test (void) result = foo (); out: -#if 0 unlink (PFX "test-subdir/in-subdir.so"); rmdir (testsubdir); -#endif return result; } diff --git a/fedora/branch.mk b/fedora/branch.mk index 086ea6912b..abdfc0ce41 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -1,5 +1,5 @@ # This file is updated automatically by Makefile. glibc-branch := fedora glibc-base := HEAD -fedora-sync-date := 2004-10-06 09:00 UTC -fedora-sync-tag := fedora-glibc-20041006T0900 +fedora-sync-date := 2004-10-12 11:28 UTC +fedora-sync-tag := fedora-glibc-20041012T1128 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index b93411f1d7..766d7c5518 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 66 +%define glibcrelease 67 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define prelinkarches noarch %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64 @@ -1239,6 +1239,13 @@ rm -f *.filelist* %endif %changelog +* Tue Oct 12 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-67 +- update from CVS + - use non-blocking sockets in resolver (#135234) + - reset pd->res options on thread exit, so that threads + reusing cached stacks get resolver state properly initialized + (BZ #434) + * Wed Oct 6 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-66 - update from CVS - avoid using perl in the spec file, buildrequire sed >= 3.95 diff --git a/gmon/Makefile b/gmon/Makefile index 060ede1f8f..80a79456f7 100644 --- a/gmon/Makefile +++ b/gmon/Makefile @@ -29,11 +29,11 @@ elide-routines.os = bb_init_func bb_exit_func tests := tst-sprofil -include ../Rules - # The mcount code won't work without a frame pointer. CFLAGS-mcount.c := -fno-omit-frame-pointer +include ../Rules + # We cannot compile mcount.c with -pg because that would # create recursive calls. Just copy the normal static object. # On systems where `profil' is not a system call, the same diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 065136e8d7..5f362c62b7 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,8 @@ +2004-10-11 Ulrich Drepper <drepper@redhat.com> + + * locales/fa_IR: Add to_inpunct map. + Patch by Hamed Malek <hamed@bamdad.org>. + 2004-10-04 Ulrich Drepper <drepper@redhat.com> * locales/gu_IN: Update various incorrect and missing information. diff --git a/localedata/locales/fa_IR b/localedata/locales/fa_IR index 128c5d8cdc..8f65b1edd8 100644 --- a/localedata/locales/fa_IR +++ b/localedata/locales/fa_IR @@ -10,8 +10,8 @@ escape_char / % Fax: +98 21 6019568 % Language: fa % Territory: IR -% Revision: 2.3 -% Date: 2004-03-16 +% Revision: 2.4 +% Date: 2004-09-04 % Users: general % Repertoiremap: % Charset: UTF-8 @@ -50,6 +50,20 @@ copy "i18n" outdigit <U06F0>..<U06F9> +map to_inpunct; / + (<U0030>,<U06F0>); / + (<U0031>,<U06F1>); / + (<U0032>,<U06F2>); / + (<U0033>,<U06F3>); / + (<U0034>,<U06F4>); / + (<U0035>,<U06F5>); / + (<U0036>,<U06F6>); / + (<U0037>,<U06F7>); / + (<U0038>,<U06F8>); / + (<U0039>,<U06F9>); / + (<U002E>,<U066B>); / + (<U002C>,<U066C>) + map to_outpunct; / (<U002E>,<U066B>); / (<U002C>,<U066C>) diff --git a/malloc/malloc.c b/malloc/malloc.c index a41171490a..ad6009a198 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -257,6 +257,10 @@ #include <malloc-machine.h> +#ifdef _LIBC +#include <stdio-common/_itoa.h> +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/misc/sys/uio.h b/misc/sys/uio.h index 53add9f2e2..1b203f71c2 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -30,24 +30,24 @@ __BEGIN_DECLS /* Read data from file descriptor FD, and put the result in the - buffers described by VECTOR, which is a vector of COUNT `struct iovec's. + buffers described by IOVEC, which is a vector of COUNT `struct iovec's. The buffers are filled in the order specified. Operates just like `read' (see <unistd.h>) except that data are - put in VECTOR instead of a contiguous buffer. + put in IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ -extern ssize_t readv (int __fd, __const struct iovec *__vector, int __count); +extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count); -/* Write data pointed by the buffers described by VECTOR, which +/* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT `struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like `write' (see <unistd.h>) except that the data - are taken from VECTOR instead of a contiguous buffer. + are taken from IOVEC instead of a contiguous buffer. This function is a cancellation point and therefore not marked with __THROW. */ -extern ssize_t writev (int __fd, __const struct iovec *__vector, int __count); +extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count); __END_DECLS diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 5d488cd1a5..e842302cb8 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -4,9 +4,17 @@ of pthread-functions.h and pthreaddef.h. * sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise. + * sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h (pthread_cond_t): + Change __data.__nwaiters from int to unsigned int. + + * tst-clock2.c (do_test): Don't fail if _POSIX_THREAD_CPUTIME == 0 and + sysconf (_SC_THREAD_CPUTIME) returns negative value. + + * allocatestack.c (__find_thread_by_id): Move attribute_hidden + before return type. + * sysdeps/s390/jmpbuf-unwind.h: Include bits/wordsize.h. - (JMPBUF_CFA_UNWINDS_ADJ): Subtract 96 resp. 160 bytes from - CFA. + (JMPBUF_CFA_UNWINDS_ADJ): Subtract 96 resp. 160 bytes from CFA. 2004-10-06 Ulrich Drepper <drepper@redhat.com> diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 242da0a5a1..d4f3188f53 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -772,8 +772,8 @@ __reclaim_stacks (void) #if HP_TIMING_AVAIL /* Find a thread given the thread ID. */ -struct pthread * attribute_hidden +struct pthread * __find_thread_by_id (pid_t tid) { struct pthread *result = NULL; diff --git a/nptl/pt-allocrtsig.c b/nptl/pt-allocrtsig.c index 9481e15f25..347bf139ad 100644 --- a/nptl/pt-allocrtsig.c +++ b/nptl/pt-allocrtsig.c @@ -28,7 +28,7 @@ extern int __libc_allocate_rtsig_private (int high); /* We reserve __SIGRTMIN for use as the cancellation signal and - __SIGRTMIN+1 to andle setuid et.al. These signals are used + __SIGRTMIN+1 to handle setuid et.al. These signals are used internally. */ int __libc_current_sigrtmin (void) diff --git a/nptl/pthread_attr_getstackaddr.c b/nptl/pthread_attr_getstackaddr.c index e6e25880ab..7656600dd5 100644 --- a/nptl/pthread_attr_getstackaddr.c +++ b/nptl/pthread_attr_getstackaddr.c @@ -33,7 +33,7 @@ __pthread_attr_getstackaddr (attr, stackaddr) iattr = (struct pthread_attr *) attr; /* Some code assumes this function to work even if no stack address - has been set. Let them figure it our for themselves what the + has been set. Let them figure it out for themselves what the value means. Simply store the result. */ *stackaddr = iattr->stackaddr; diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h index 03c2ef8106..92fb08c951 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h @@ -100,7 +100,7 @@ typedef union __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; void *__mutex; - int __nwaiters; + unsigned int __nwaiters; unsigned int __broadcast_seq; } __data; char __size[__SIZEOF_PTHREAD_COND_T]; diff --git a/nptl/tst-clock2.c b/nptl/tst-clock2.c index fd216b2ba1..bca40956e2 100644 --- a/nptl/tst-clock2.c +++ b/nptl/tst-clock2.c @@ -58,6 +58,14 @@ do_test (void) #if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 # define N 10 +# if _POSIX_THREAD_CPUTIME == 0 + if (sysconf (_SC_THREAD_CPUTIME) < 0) + { + puts ("_POSIX_THREAD_CPUTIME option not available"); + return 0; + } +# endif + if (pthread_barrier_init (&b2, NULL, 2) != 0 || pthread_barrier_init (&bN, NULL, N + 1) != 0) { diff --git a/posix/tst-getaddrinfo2.c b/posix/tst-getaddrinfo2.c index b0bce5925c..13edca0a34 100644 --- a/posix/tst-getaddrinfo2.c +++ b/posix/tst-getaddrinfo2.c @@ -2,6 +2,8 @@ #include <errno.h> #include <netdb.h> #include <unistd.h> +#include <stdlib.h> +#include <string.h> #include <sys/socket.h> static int @@ -47,7 +49,7 @@ do_test (void) if (err) { printf ("FAIL getaddrinfo IPv4 socktype 0,513: " - "fam %d alen %d addr 0x%08X addr/fam %d " + "fam %d alen %d addr %p addr/fam %d " "addr/port %d H[%d]\n", pai->ai_family, pai->ai_addrlen, psin, psin ? psin->sin_family : 0, diff --git a/resolv/res_init.c b/resolv/res_init.c index 4087597a87..731c784e17 100644 --- a/resolv/res_init.c +++ b/resolv/res_init.c @@ -597,6 +597,9 @@ res_thread_freeres (void) free (_res._u._ext.nsaddrs[ns]); _res._u._ext.nsaddrs[ns] = NULL; } + + /* Make sure we do a full re-initialization the next time. */ + _res.options = 0; } text_set_element (__libc_thread_subfreeres, res_thread_freeres); text_set_element (__libc_subfreeres, res_thread_freeres); diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c index 5b705b0e8b..9825ae0fa3 100644 --- a/resolv/res_mkquery.c +++ b/resolv/res_mkquery.c @@ -141,7 +141,7 @@ res_nmkquery(res_state statp, randombits = (tv.tv_sec << 8) ^ tv.tv_usec; #endif } - while (randombits == 0); + while ((randombits & 0xffff) == 0); statp->id = (statp->id + randombits) & 0xffff; #endif hp->opcode = op; diff --git a/resolv/res_send.c b/resolv/res_send.c index 2366f59cd2..44d8cb0fee 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -88,6 +88,7 @@ static const char rcsid[] = "$BINDId: res_send.c,v 8.38 2000/03/30 20:16:51 vixi #include <sys/ioctl.h> #include <errno.h> +#include <fcntl.h> #include <netdb.h> #include <resolv.h> #include <signal.h> @@ -965,12 +966,73 @@ send_dg(res_state statp, return (0); } #endif /* !CANNOT_CONNECT_DGRAM */ + /* Make socket non-blocking. */ + int fl = __fcntl (EXT(statp).nssocks[ns], F_GETFL); + if (fl != -1) + __fcntl (EXT(statp).nssocks[ns], F_SETFL, + fl | O_NONBLOCK); Dprint(statp->options & RES_DEBUG, (stdout, ";; new DG socket\n")) } s = EXT(statp).nssocks[ns]; + /* + * Compute time for the total operation. + */ + seconds = (statp->retrans << ns); + if (ns > 0) + seconds /= statp->nscount; + if (seconds <= 0) + seconds = 1; + evNowTime(&now); + evConsTime(&timeout, seconds, 0); + evAddTime(&finish, &now, &timeout); + int need_recompute = 0; + resend: +#ifdef _LIBC + /* Convert struct timespec in milliseconds. */ + ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000; + + pfd[0].fd = s; + pfd[0].events = POLLOUT; + n = __poll (pfd, 1, 0); + if (__builtin_expect (n == 0, 0)) { + n = __poll (pfd, 1, ptimeout); + need_recompute = 1; + } +#else + FD_ZERO(&dsmask); + FD_SET(s, &dsmask); + struct timeval zerotime = { 0, 0 }; + n = pselect(s + 1, NULL, &dsmask, NULL, &zerotime, NULL); + if (n == 0) { + n = pselect(s + 1, NULL, &dsmask, NULL, &timeout, NULL); + need_recompute = 1; + } +#endif + if (n == 0) { + Dprint(statp->options & RES_DEBUG, (stdout, + ";; timeout sending\n")); + *gotsomewhere = 1; + return (0); + } + if (n < 0) { + if (errno == EINTR) { + recompute_resend: + evNowTime(&now); + if (evCmpTime(finish, now) > 0) { + evSubTime(&timeout, &finish, &now); + goto resend; + } + } + Perror(statp, stderr, "select", errno); + res_nclose(statp); + return (0); + } + __set_errno (0); #ifndef CANNOT_CONNECT_DGRAM if (send(s, (char*)buf, buflen, 0) != buflen) { + if (errno == EINTR || errno == EAGAIN) + goto recompute_resend; Perror(statp, stderr, "send", errno); res_nclose(statp); return (0); @@ -984,6 +1046,8 @@ send_dg(res_state statp, if (sendto(s, (char*)buf, buflen, 0, (struct sockaddr *)nsap, sizeof *nsap) != buflen) { + if (errno == EINTR || errno == EAGAIN) + goto recompute_resend; Aerror(statp, stderr, "sendto", errno, (struct sockaddr *) nsap); res_nclose(statp); @@ -991,46 +1055,38 @@ send_dg(res_state statp, } #endif /* !CANNOT_CONNECT_DGRAM */ - /* - * Wait for reply. - */ - seconds = (statp->retrans << ns); - if (ns > 0) - seconds /= statp->nscount; - if (seconds <= 0) - seconds = 1; - evNowTime(&now); - evConsTime(&timeout, seconds, 0); - evAddTime(&finish, &now, &timeout); wait: + if (need_recompute) { + evNowTime(&now); + if (evCmpTime(finish, now) <= 0) { + err_return: + Perror(statp, stderr, "select", errno); + res_nclose(statp); + return (0); + } + evSubTime(&timeout, &finish, &now); + } #ifdef _LIBC /* Convert struct timespec in milliseconds. */ ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000; - pfd[0].fd = s; pfd[0].events = POLLIN; n = __poll (pfd, 1, ptimeout); #else - FD_ZERO(&dsmask); - FD_SET(s, &dsmask); n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL); #endif if (n == 0) { - Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n")); + Dprint(statp->options & RES_DEBUG, (stdout, + ";; timeout receiving\n")); *gotsomewhere = 1; return (0); } if (n < 0) { if (errno == EINTR) { - evNowTime(&now); - if (evCmpTime(finish, now) > 0) { - evSubTime(&timeout, &finish, &now); - goto wait; - } + need_recompute = 1; + goto wait; } - Perror(statp, stderr, "select", errno); - res_nclose(statp); - return (0); + goto err_return; } __set_errno (0); #ifdef _LIBC @@ -1056,6 +1112,10 @@ send_dg(res_state statp, resplen = recvfrom(s, (char*)ans, anssiz,0, (struct sockaddr *)&from, &fromlen); if (resplen <= 0) { + if (errno == EINTR || errno == EAGAIN) { + need_recompute = 1; + goto wait; + } Perror(statp, stderr, "recvfrom", errno); res_nclose(statp); return (0); diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 63e7bd8815..c641d2d371 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1163,9 +1163,15 @@ _IO_vfscanf (s, format, argptr, errp) int level; #ifdef COMPILE_WSCANF const wchar_t *wcdigits[10]; + const wchar_t *wcdigits_extended[10]; #else const char *mbdigits[10]; + const char *mbdigits_extended[10]; #endif + /* "to_inpunct" is a map from ASCII digits to their + equivalent in locale. This is defined for locales + which use an extra digits set. */ + wctrans_t map = __wctrans ("to_inpunct"); int n; from_level = 0; @@ -1176,6 +1182,66 @@ _IO_vfscanf (s, format, argptr, errp) to_level = (uint32_t) curctype->values[_NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN)].word - 1; #endif + /* Get the alternative digit forms if there are any. */ + if (__builtin_expect (map != NULL, 0)) + { + /* Adding new level for extra digits set in locale file. */ + ++to_level; + + for (n = 0; n < 10; ++n) + { +#ifdef COMPILE_WSCANF + wcdigits[n] = (const wchar_t *) + _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n); + + wchar_t *wc_extended = (wchar_t *) + alloca ((to_level + 2) * sizeof (wchar_t)); + __wmemcpy (wc_extended, wcdigits[n], to_level); + wc_extended[to_level] = __towctrans (L'0' + n, map); + wc_extended[to_level + 1] = '\0'; + wcdigits_extended[n] = wc_extended; +#else + mbdigits[n] + = curctype->values[_NL_CTYPE_INDIGITS0_MB + n].string; + + /* Get the equivalent wide char in map. */ + wint_t extra_wcdigit = __towctrans (L'0' + n, map); + + /* Convert it to multibyte representation. */ + mbstate_t state; + memset (&state, '\0', sizeof (state)); + + char extra_mbdigit[MB_LEN_MAX]; + size_t mblen + = __wcrtomb (extra_mbdigit, extra_wcdigit, &state); + + if (mblen == (size_t) -1) + { + /* Ignore this new level. */ + map = NULL; + break; + } + + /* Calculate the length of mbdigits[n]. */ + const char *last_char = mbdigits[n]; + for (level = 0; level < to_level; ++level) + last_char = strchr (last_char, '\0') + 1; + + size_t mbdigits_len = last_char - mbdigits[n]; + + /* Allocate memory for extended multibyte digit. */ + char *mb_extended; + mb_extended = (char *) alloca (mbdigits_len + mblen + 1); + + /* And get the mbdigits + extra_digit string. */ + *(char *) __mempcpy (__mempcpy (mb_extended, mbdigits[n], + mbdigits_len), + extra_mbdigit, mblen) = '\0'; + mbdigits_extended[n] = mb_extended; +#endif + } + } + /* Read the number into workspace. */ while (c != EOF && width != 0) { @@ -1185,8 +1251,11 @@ _IO_vfscanf (s, format, argptr, errp) { /* Get the string for the digits with value N. */ #ifdef COMPILE_WSCANF - wcdigits[n] = (const wchar_t *) - _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n); + if (__builtin_expect (map != NULL, 0)) + wcdigits[n] = wcdigits_extended[n]; + else + wcdigits[n] = (const wchar_t *) + _NL_CURRENT (LC_CTYPE, _NL_CTYPE_INDIGITS0_WC + n); wcdigits[n] += from_level; if (c == (wint_t) *wcdigits[n]) @@ -1201,8 +1270,11 @@ _IO_vfscanf (s, format, argptr, errp) const char *cmpp; int avail = width > 0 ? width : INT_MAX; - mbdigits[n] - = curctype->values[_NL_CTYPE_INDIGITS0_MB + n].string; + if (__builtin_expect (map != NULL, 0)) + mbdigits[n] = mbdigits_extended[n]; + else + mbdigits[n] + = curctype->values[_NL_CTYPE_INDIGITS0_MB + n].string; for (level = 0; level < from_level; level++) mbdigits[n] = strchr (mbdigits[n], '\0') + 1; diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h index 1e43e43047..acbac47aac 100644 --- a/sysdeps/m68k/fpu/bits/mathinline.h +++ b/sysdeps/m68k/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Definitions of inline math functions implemented by the m68881/2. - Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003 + Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -110,7 +110,7 @@ #if defined __USE_MISC || defined __USE_ISOC99 # define __inline_mathop(func, op) \ __inline_mathop1(double, func, op) \ - __inline_mathop1(float, __CONCAT(func,f), op) \ + __inline_mathop1(float, __CONCAT(func,f), op) \ __inline_mathop1(long double, __CONCAT(func,l), op) #else # define __inline_mathop(func, op) \ @@ -118,7 +118,7 @@ #endif #define __inline_mathop1(float_type,func, op) \ - __m81_defun (float_type, func, (float_type __mathop_x)) __THROW \ + __m81_defun (float_type, func, (float_type __mathop_x)) \ { \ float_type __result; \ __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\ @@ -175,7 +175,7 @@ __inline_mathop(trunc, intrz) for the function names. */ #define __inline_functions(float_type, s) \ -__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) __THROW \ +__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -191,7 +191,7 @@ __m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) __THROW \ return __result; \ } \ \ -__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) __THROW \ +__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -217,7 +217,7 @@ __inline_functions(long double,l) #ifdef __USE_MISC # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) __THROW \ +__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ @@ -227,7 +227,7 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) __THROW \ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \ } \ \ -__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) __THROW \ +__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \ { \ /* There is no branch-condition for infinity, so we must extract and \ examine the condition codes manually. */ \ @@ -238,7 +238,7 @@ __m81_defun (int, __CONCAT(__finite,s), (float_type __value)) __THROW \ } \ \ __m81_defun (float_type, __CONCAT(__scalbn,s), \ - (float_type __x, int __n)) __THROW \ + (float_type __x, int __n)) \ { \ float_type __result; \ __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \ @@ -255,7 +255,7 @@ __inline_functions(long double,l) #if defined __USE_MISC || defined __USE_XOPEN # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) __THROW \ +__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \ { \ char __result; \ __asm("ftst%.x %1\n" \ @@ -275,7 +275,7 @@ __inline_functions(long double,l) #ifdef __USE_ISOC99 # define __inline_functions(float_type, s) \ -__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) __THROW \ +__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \ { \ /* There is no branch-condition for the sign bit, so we must extract \ and examine the condition codes manually. */ \ @@ -285,13 +285,13 @@ __m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) __THROW \ return (__fpsr >> 27) & 1; \ } \ \ -__m81_defun (float_type, __CONCAT(__scalbln,s), \ - (float_type __x, long int __n)) __THROW \ + __m81_defun (float_type, __CONCAT(__scalbln,s), \ + (float_type __x, long int __n)) \ { \ return __CONCAT(__scalbn,s) (__x, __n); \ } \ \ -__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) __THROW \ +__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -305,7 +305,7 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) __THROW \ return __result; \ } \ \ -__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) __THROW \ +__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) \ { \ long int __result; \ __asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \ @@ -314,7 +314,7 @@ __m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) __THROW \ \ __m81_inline float_type \ __m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y, \ - float_type __z) __THROW \ + float_type __z) \ { \ return (__x * __y) + __z; \ } @@ -331,7 +331,7 @@ __inline_functions (long double,l) # define __inline_functions(float_type, s) \ __m81_inline void \ __m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \ - float_type *__cosx) __THROW \ + float_type *__cosx) \ { \ __asm ("fsincos%.x %2,%1:%0" \ : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \ @@ -351,14 +351,14 @@ __inline_functions (long double,l) /* Note that there must be no whitespace before the argument passed for NAME, to make token pasting work correctly with -traditional. */ # define __inline_forward_c(rettype, name, args1, args2) \ -extern __inline rettype __attribute__((__const__)) \ -name args1 __THROW \ -{ \ - return __CONCAT(__,name) args2; \ +extern __inline rettype __attribute__((__const__)) \ + name args1 \ +{ \ + return __CONCAT(__,name) args2; \ } # define __inline_forward(rettype, name, args1, args2) \ -extern __inline rettype name args1 __THROW \ +extern __inline rettype name args1 \ { \ return __CONCAT(__,name) args2; \ } diff --git a/sysdeps/m68k/memcopy.h b/sysdeps/m68k/memcopy.h index cdc268ad51..0951eeaf7a 100644 --- a/sysdeps/m68k/memcopy.h +++ b/sysdeps/m68k/memcopy.h @@ -1,5 +1,5 @@ /* memcopy.h -- definitions for memory copy functions. Motorola 68020 version. - Copyright (C) 1991, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1997, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -68,29 +68,33 @@ do \ { \ size_t __nblocks = (nbytes) / 32 + 1; \ + op_t *__dst_ep = (op_t *) (dst_ep); \ + op_t *__src_ep = (op_t *) (src_ep); \ switch ((nbytes) / sizeof (op_t) % 8) \ do \ { \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 7: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 6: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 5: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 4: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 3: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 2: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 1: \ - *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ + *--__dst_ep = *--__src_ep; \ case 0: \ __nblocks--; \ } \ while (__nblocks != 0); \ (nbytes_left) = (nbytes) % sizeof (op_t); \ + (dst_ep) = (unsigned long) __dst_ep; \ + (src_ep) = (unsigned long) __src_ep; \ } while (0) #endif diff --git a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile index 758b856854..3ced6568df 100644 --- a/sysdeps/powerpc/powerpc64/Makefile +++ b/sysdeps/powerpc/powerpc64/Makefile @@ -22,3 +22,10 @@ ifeq ($(subdir),elf) # help gcc inline asm code from dl-machine.h +cflags += -finline-limit=2000 endif + +ifeq ($(subdir),gmon) +# The assembly functions assume that fp arg regs are not trashed. +# Compiling with -msoft-float ensures that fp regs are not used +# for moving memory around. +CFLAGS-mcount.c += -msoft-float +endif diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S index b11a0fd7b5..9d0195dd14 100644 --- a/sysdeps/powerpc/powerpc64/__longjmp-common.S +++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S @@ -42,6 +42,7 @@ .machine "altivec" ENTRY (BP_SYM (__longjmp)) + CALL_MCOUNT 2 CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE) #ifndef __NO_VMX__ ld r5,.LC__dl_hwcap@toc(r2) diff --git a/sysdeps/powerpc/powerpc64/bsd-_setjmp.S b/sysdeps/powerpc/powerpc64/bsd-_setjmp.S index 13f4056706..82b79a8098 100644 --- a/sysdeps/powerpc/powerpc64/bsd-_setjmp.S +++ b/sysdeps/powerpc/powerpc64/bsd-_setjmp.S @@ -25,8 +25,9 @@ #if defined NOT_IN_libc /* Build a non-versioned object for rtld-*. */ ENTRY (BP_SYM (_setjmp)) + CALL_MCOUNT 1 li r4,0 /* Set second argument to 0. */ - b JUMPTARGET(BP_SYM (__sigsetjmp)) + b JUMPTARGET (__sigsetjmp_ent) END (BP_SYM (_setjmp)) libc_hidden_def (_setjmp) @@ -36,8 +37,9 @@ libc_hidden_def (_setjmp) symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.3); ENTRY (BP_SYM (__novmx_setjmp)) + CALL_MCOUNT 1 li r4,0 /* Set second argument to 0. */ - b JUMPTARGET(BP_SYM (__novmx__sigsetjmp)) + b JUMPTARGET (__novmx__sigsetjmp_ent) END (BP_SYM (__novmx_setjmp)) libc_hidden_def (__novmx_setjmp) # endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_3_4) */ @@ -50,13 +52,15 @@ ENTRY (BP_SYM (__GI__setjmp)) #if defined SHARED && !defined IS_IN_rtld std r2,40(r1) /* Save the callers TOC in the save area. */ #endif + CALL_MCOUNT 1 li r4,0 /* Set second argument to 0. */ - b JUMPTARGET(BP_SYM (__vmx__sigsetjmp)) + b JUMPTARGET (__vmx__sigsetjmp_ent) END (BP_SYM (__GI__setjmp)) ENTRY (BP_SYM (__vmx_setjmp)) + CALL_MCOUNT 1 li r4,0 /* Set second argument to 0. */ - b JUMPTARGET(BP_SYM (__vmx__sigsetjmp)) + b JUMPTARGET (__vmx__sigsetjmp_ent) END (BP_SYM (__vmx_setjmp)) libc_hidden_def (__vmx_setjmp) #endif /* !NOT_IN_libc */ diff --git a/sysdeps/powerpc/powerpc64/bsd-setjmp.S b/sysdeps/powerpc/powerpc64/bsd-setjmp.S index 73b9a4d34e..543e83faa3 100644 --- a/sysdeps/powerpc/powerpc64/bsd-setjmp.S +++ b/sysdeps/powerpc/powerpc64/bsd-setjmp.S @@ -25,8 +25,9 @@ ENTRY (__novmxsetjmp) + CALL_MCOUNT 1 li r4,1 /* Set second argument to 1. */ - b JUMPTARGET (__novmx__sigsetjmp) + b JUMPTARGET (__novmx__sigsetjmp_ent) END (__novmxsetjmp) strong_alias (__novmxsetjmp, __novmx__setjmp) symbol_version (__novmxsetjmp, setjmp, GLIBC_2.3) @@ -35,8 +36,9 @@ symbol_version (__novmxsetjmp, setjmp, GLIBC_2.3) ENTRY (__vmxsetjmp) + CALL_MCOUNT 1 li r4,1 /* Set second argument to 1. */ - b JUMPTARGET (__vmx__sigsetjmp) + b JUMPTARGET (__vmx__sigsetjmp_ent) END (__vmxsetjmp) strong_alias (__vmxsetjmp, __vmx__setjmp) strong_alias (__vmx__sigsetjmp, __setjmp) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S index 127f302666..a1bfaa70c2 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S @@ -27,6 +27,7 @@ .section ".text" ENTRY (__ceil) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S index 34f61423cc..42eb274389 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S @@ -27,6 +27,7 @@ .section ".text" ENTRY (__ceilf) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S index 40fd83d3d1..a43ed12cf0 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S @@ -23,6 +23,7 @@ #include <sysdep.h> ENTRY(__copysign) + CALL_MCOUNT 0 /* double [f1] copysign (double [f1] x, double [f2] y); copysign(x,y) returns a value with the magnitude of x and with the sign bit of y. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S index 57fd63cd66..80cbdc5709 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_floor.S @@ -25,6 +25,7 @@ .section ".text" ENTRY (__floor) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S index cde92b9174..20cbb15ebd 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S @@ -25,6 +25,7 @@ .section ".text" ENTRY (__floorf) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S index bc976a7edb..610b561f25 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S @@ -21,6 +21,7 @@ /* long long int[r3] __llrint (double x[fp1]) */ ENTRY (__llrint) + CALL_MCOUNT 0 fctid fp13,fp1 stfd fp13,-16(r1) nop /* Insure the following load is in a different dispatch group */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S index aef84de831..b7b2a8fc63 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S @@ -21,6 +21,7 @@ /* long long int[r3] __llrintf (float x[fp1]) */ ENTRY (__llrintf) + CALL_MCOUNT 0 fctid fp13,fp1 stfd fp13,-16(r1) nop /* Insure the following load is in a different dispatch group */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S index 320ef0f6d8..a3dcd4c33d 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.S @@ -37,6 +37,7 @@ to the integer value. */ ENTRY (__llround) + CALL_MCOUNT 0 lfd fp12,.LC0@toc(2) lfd fp10,.LC1@toc(2) fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S index ff923056b1..b5ca43bf20 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S @@ -37,6 +37,7 @@ to the integer value. */ ENTRY (__llroundf) + CALL_MCOUNT 0 lfd fp12,.LC0@toc(2) lfd fp10,.LC1@toc(2) fcmpu cr6,fp1,fp12 /* if (x < 0.0) */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S index f7db7ff80a..79e807269d 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_rint.S @@ -28,6 +28,7 @@ .section ".text" ENTRY (__rint) + CALL_MCOUNT 0 lfd fp13,.LC0@toc(2) fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S index de6d654796..eb34dd5e77 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S @@ -25,6 +25,7 @@ .section ".text" ENTRY (__rintf) + CALL_MCOUNT 0 lfd fp13,.LC0@toc(2) fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S index 1c2e5299e5..c0b6d46fea 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_round.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_round.S @@ -39,6 +39,7 @@ to the integer value. */ ENTRY (__round) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S index fd8eb0aea3..23ee4c052b 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S @@ -39,6 +39,7 @@ to the integer value. */ ENTRY (__roundf ) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S index dc345ab424..3ddd298525 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S @@ -34,6 +34,7 @@ subtracting +-2**52. */ ENTRY (__trunc) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S index 727647f6de..b38b722a6f 100644 --- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S @@ -34,6 +34,7 @@ subtracting +-2**23. */ ENTRY (__truncf) + CALL_MCOUNT 0 mffs fp11 /* Save current FPU rounding mode. */ lfd fp13,.LC0@toc(2) fabs fp0,fp1 diff --git a/sysdeps/powerpc/powerpc64/memcpy.S b/sysdeps/powerpc/powerpc64/memcpy.S index 251e1fed80..9df5bb42b6 100644 --- a/sysdeps/powerpc/powerpc64/memcpy.S +++ b/sysdeps/powerpc/powerpc64/memcpy.S @@ -37,6 +37,8 @@ Each case has a optimized unrolled loop. */ EALIGN (BP_SYM (memcpy), 5, 0) + CALL_MCOUNT 3 + cmpldi cr1,5,31 neg 0,3 std 3,-16(1) diff --git a/sysdeps/powerpc/powerpc64/memset.S b/sysdeps/powerpc/powerpc64/memset.S index f3a299d5c8..1abc59bb17 100644 --- a/sysdeps/powerpc/powerpc64/memset.S +++ b/sysdeps/powerpc/powerpc64/memset.S @@ -41,6 +41,7 @@ to 0, to take advantage of the dcbz instruction. */ EALIGN (BP_SYM (memset), 5, 0) + CALL_MCOUNT 3 #define rTMP r0 #define rRTN r3 /* Initial value of 1st argument. */ @@ -274,6 +275,7 @@ libc_hidden_builtin_def (memset) /* Copied from bzero.S to prevent the linker from inserting a stub between bzero and memset. */ ENTRY (BP_SYM (__bzero)) + CALL_MCOUNT 3 #if __BOUNDED_POINTERS__ mr r6,r4 li r5,0 diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S index ab57170875..f82d5a21f5 100644 --- a/sysdeps/powerpc/powerpc64/setjmp-common.S +++ b/sysdeps/powerpc/powerpc64/setjmp-common.S @@ -41,6 +41,10 @@ .machine "altivec" ENTRY (BP_SYM (__sigsetjmp)) + CALL_MCOUNT 2 + .globl JUMPTARGET(GLUE(__sigsetjmp,_ent)) + .hidden JUMPTARGET(GLUE(__sigsetjmp,_ent)) +JUMPTARGET(GLUE(__sigsetjmp,_ent)): CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE) std r1,(JB_GPR1*8)(3) mflr r0 diff --git a/sysdeps/powerpc/powerpc64/stpcpy.S b/sysdeps/powerpc/powerpc64/stpcpy.S index deac0ea229..cc7a6ab66a 100644 --- a/sysdeps/powerpc/powerpc64/stpcpy.S +++ b/sysdeps/powerpc/powerpc64/stpcpy.S @@ -26,6 +26,7 @@ /* char * [r3] stpcpy (char *dest [r3], const char *src [r4]) */ EALIGN (BP_SYM (__stpcpy), 4, 0) + CALL_MCOUNT 2 #define rTMP r0 #define rRTN r3 diff --git a/sysdeps/powerpc/powerpc64/strchr.S b/sysdeps/powerpc/powerpc64/strchr.S index e3222f354d..93ea61e49c 100644 --- a/sysdeps/powerpc/powerpc64/strchr.S +++ b/sysdeps/powerpc/powerpc64/strchr.S @@ -26,6 +26,7 @@ /* char * [r3] strchr (const char *s [r3] , int c [r4] ) */ ENTRY (BP_SYM (strchr)) + CALL_MCOUNT 2 #define rTMP1 r0 #define rRTN r3 /* outgoing result */ diff --git a/sysdeps/powerpc/powerpc64/strcmp.S b/sysdeps/powerpc/powerpc64/strcmp.S index 7e2dae07f7..4d7eb21bf7 100644 --- a/sysdeps/powerpc/powerpc64/strcmp.S +++ b/sysdeps/powerpc/powerpc64/strcmp.S @@ -26,6 +26,7 @@ /* int [r3] strcmp (const char *s1 [r3], const char *s2 [r4]) */ EALIGN (BP_SYM(strcmp), 4, 0) + CALL_MCOUNT 2 #define rTMP r0 #define rRTN r3 diff --git a/sysdeps/powerpc/powerpc64/strcpy.S b/sysdeps/powerpc/powerpc64/strcpy.S index 4d12b82e5e..e9e9fc78cd 100644 --- a/sysdeps/powerpc/powerpc64/strcpy.S +++ b/sysdeps/powerpc/powerpc64/strcpy.S @@ -26,6 +26,7 @@ /* char * [r3] strcpy (char *dest [r3], const char *src [r4]) */ EALIGN (BP_SYM (strcpy), 4, 0) + CALL_MCOUNT 2 #define rTMP r0 #define rRTN r3 /* incoming DEST arg preserved as result */ diff --git a/sysdeps/powerpc/powerpc64/strlen.S b/sysdeps/powerpc/powerpc64/strlen.S index 760be5884a..4c1385aead 100644 --- a/sysdeps/powerpc/powerpc64/strlen.S +++ b/sysdeps/powerpc/powerpc64/strlen.S @@ -79,6 +79,7 @@ /* int [r3] strlen (char *s [r3]) */ ENTRY (BP_SYM (strlen)) + CALL_MCOUNT 1 #define rTMP1 r0 #define rRTN r3 /* incoming STR arg, outgoing result */ diff --git a/sysdeps/powerpc/powerpc64/strncmp.S b/sysdeps/powerpc/powerpc64/strncmp.S index bdcfab99e3..04bdc2f606 100644 --- a/sysdeps/powerpc/powerpc64/strncmp.S +++ b/sysdeps/powerpc/powerpc64/strncmp.S @@ -26,6 +26,7 @@ /* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ EALIGN (BP_SYM(strncmp), 4, 0) + CALL_MCOUNT 3 #define rTMP r0 #define rRTN r3 diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index 4420a6dfac..fead0b578a 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -23,37 +23,36 @@ #ifdef __ASSEMBLER__ +/* Support macros for CALL_MCOUNT. */ + .macro SAVE_ARG NARG + .if \NARG + SAVE_ARG \NARG-1 + std 2+\NARG,-72+8*(\NARG)(1) + .endif + .endm + + .macro REST_ARG NARG + .if \NARG + REST_ARG \NARG-1 + ld 2+\NARG,40+8*(\NARG)(1) + .endif + .endm + /* If compiled for profiling, call `_mcount' at the start of each function. see ppc-mcount.S for more details. */ + .macro CALL_MCOUNT NARG #ifdef PROF -/* The mcount code relies on a the return address being on the stack - to locate our caller and so it can restore it; so store one just - for its benefit. */ -#ifdef SYSV_ELF_PROFILING -#define CALL_MCOUNT \ - .pushsection; \ - .section ".data"; \ - .align ALIGNARG(2); \ -__mcount: \ - .long 0; \ - .previous; \ - .section ".toc","aw"; \ -.LC__mcount:; \ - .tc __mcount[TC],__mcount; \ - .previous; \ - mflr r0; \ - std r0,16(r1); \ - ld r0,.LC__mcount@toc(r2); \ - bl JUMPTARGET(_mcount); -#else /* SYSV_ELF_PROFILING */ -#define CALL_MCOUNT \ - mflr r0; \ - std r0,16(r1); \ - bl JUMPTARGET(_mcount); -#endif /* SYSV_ELF_PROFILING */ -#else /* PROF */ -#define CALL_MCOUNT /* Do nothing. */ -#endif /* PROF */ + mflr r0 + SAVE_ARG \NARG + std r0,16(r1) + stdu r1,-112(r1) + bl JUMPTARGET (_mcount) + ld r0,128(r1) + REST_ARG \NARG + addi r1,r1,112 + mtlr r0 +#endif + .endm #ifdef USE_PPC64_OVERLAPPING_OPD # define OPD_ENT(name) .quad BODY_LABEL (name), .TOC.@tocbase @@ -106,24 +105,11 @@ BODY_LABEL(name): /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes past a 2^alignt boundary. */ -#ifdef PROF -#define EALIGN(name, alignt, words) \ - ENTRY_2(name) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ -BODY_LABEL(name): \ - CALL_MCOUNT \ - b 0f; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ -0: -#else /* PROF */ #define EALIGN(name, alignt, words) \ ENTRY_2(name) \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ BODY_LABEL(name): -#endif /* Local labels stripped out by the linker. */ #undef L diff --git a/timezone/asia b/timezone/asia index 4417134dac..3c2c1a1868 100644 --- a/timezone/asia +++ b/timezone/asia @@ -1,4 +1,4 @@ -# @(#)asia 7.75 +# @(#)asia 7.77 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to @@ -761,6 +761,26 @@ Zone Asia/Jerusalem 2:20:56 - LMT 1880 # direction is expected until the latter part of 2004 which is a long # time off in terms of Israeli politics. +# (2004-09-20): +# The latest rumour, however, is that in 2005, when the clock changes to +# Daylight Saving Time (date as yet unknown), the move will be a two-hour leap +# forward (from UTC+0200 to UTC+0400) and then, in the fall, the clock will +# move back only an hour to UTC+0300 thus effectively moving Israel's timezone +# from UTC+0200 to UTC+0300. However, no actual draft has been put before the +# Knesset (Israel's Parliament) though the intention is to do so this +# month [2004-09]. + +# (2004-09-26): +# Even though the draft law for the above did pass the Ministerial Committee +# for Legislative Matters three months ago, it was voted down in today's +# Cabinet meeting. The current suggestion is to keep the current timezone at +# UTC+0200 but have an extended period of Daylight Saving Time (UTC+0300) from +# the beginning of Passover holiday in the spring to after the Tabernacle +# holiday in the fall (i.e. the dates of which are governed by the Hebrew +# calendar but this means at least 184 days of DST). However, this is only a +# suggestion that was raised in today's cabinet meeting and has not yet been +# drafted. + ############################################################################### diff --git a/timezone/private.h b/timezone/private.h index c8f4548683..57663052f0 100644 --- a/timezone/private.h +++ b/timezone/private.h @@ -21,7 +21,7 @@ #ifndef lint #ifndef NOID -static char privatehid[] = "@(#)private.h 7.53"; +static char privatehid[] = "@(#)private.h 7.54"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -190,11 +190,22 @@ extern int unlink P((const char * filename)); ** But some newer errno.h implementations define it as a macro. ** Fix the former without affecting the latter. */ + #ifndef errno extern int errno; #endif /* !defined errno */ /* +** Some time.h implementations don't declare asctime_r. +** Others might define it as a macro. +** Fix the former without affecting the latter. +*/ + +#ifndef asctime_r +extern char * asctime_r(); +#endif + +/* ** Private function declarations. */ char * icalloc P((int nelem, int elsize)); diff --git a/timezone/southamerica b/timezone/southamerica index 13bd5270e8..912491049b 100644 --- a/timezone/southamerica +++ b/timezone/southamerica @@ -1,4 +1,4 @@ -# @(#)southamerica 7.52 +# @(#)southamerica 7.54 # This data is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to @@ -186,6 +186,20 @@ Rule Arg 2000 only - Mar Sun>=1 0:00 0 - # contains a contradiction. I would give more credence to the Saturday/Sunday # date than the "three days earlier" phrase, and conclude that Tierra del # Fuego set its clocks back at 2004-05-30 00:00. +# +# From Steffen Thorsen (2004-10-05): +# The previous law 7210 which changed the province of Mendoza's time zone +# back in May have been modified slightly in a new law 7277, which set the +# new end date to 2004-09-26 (original date was 2004-10-17). +# http://www.gobernac.mendoza.gov.ar/boletin/pdf/20040924-27244-normas.pdf +# +# From Mariano Absatz (2004-10-05): +# San Juan changed from UTC-03:00 to UTC-04:00 at midnight between +# Sunday, May 30th and Monday, May 31st. It changed back to UTC-03:00 +# at midnight between Saturday, July 24th and Sunday, July 25th.... +# http://www.sanjuan.gov.ar/prensa/archivo/000329.html +# http://www.sanjuan.gov.ar/prensa/archivo/000426.html +# http://www.sanjuan.gov.ar/prensa/archivo/000441.html # Unless otherwise specified, data are from Shanks through 1992, from # the IATA otherwise. As noted below, Shanks says that @@ -261,8 +275,8 @@ Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31 -4:00 - WART 1991 May 7 -3:00 Arg AR%sT 1999 Oct 3 -4:00 Arg AR%sT 2000 Mar 3 - -3:00 - ART 2004 Jun 1 - -4:00 - WART 2004 Oct 17 + -3:00 - ART 2004 May 31 + -4:00 - WART 2004 Jul 25 -3:00 - ART # # Jujuy (JY) @@ -306,7 +320,7 @@ Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31 -3:00 Arg AR%sT 1999 Oct 3 -4:00 Arg AR%sT 2000 Mar 3 -3:00 - ART 2004 May 23 - -4:00 - WART 2004 Oct 17 + -4:00 - WART 2004 Sep 26 -3:00 - ART # # Chubut (CH) @@ -420,6 +434,11 @@ Zone America/La_Paz -4:32:36 - LMT 1890 # the Government decided to postpone DST, instead of changing the Constitution # (maybe, for the next elections, it will be possible to change the clock)... +# From Rodrigo Severo (2004-10-04): +# It's just the biannual change made necessary by the much hyped, supposedly +# modern Brazilian eletronic voting machines which, apparently, can't deal +# with a time change between the first and the second rounds of the elections. + # From Paul Eggert (2002-10-10): # The official decrees referenced below are mostly taken from # <a href="http://pcdsh01.on.br/DecHV.html"> @@ -556,11 +575,15 @@ Rule Brazil 2001 max - Feb Sun>=15 0:00 0 - Rule Brazil 2002 only - Nov 3 0:00 1:00 S # Decree 4,844 (2003-09-24; corrected 2003-09-26) repeals DST in BA, MT, TO. # <a href="http://www.presidencia.gov.br/CCIVIL/decreto/2003/D4844.htm"></a> -Rule Brazil 2003 max - Oct Sun>=15 0:00 1:00 S +Rule Brazil 2003 only - Oct 19 0:00 1:00 S +# Decree 5,223 (2004-10-01) reestablishes DST in MT. +# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2004-2006/2004/Decreto/D5223.htm"></a> +Rule Brazil 2004 only - Nov 2 0:00 1:00 S # The latest ruleset listed above says that the following states observe DST: -# DF, ES, GO, MG, MS, PR, RJ, RS, SC, SP. +# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP. # -# For dates after mid-2004, the above rules with TO="max" are guesses +Rule Brazil 2005 max - Oct Sun>=15 0:00 1:00 S +# For dates after mid-2005, the above rules with TO="max" are guesses # and are quite possibly wrong, but are more likely than no DST at all. @@ -648,7 +671,8 @@ Zone America/Campo_Grande -3:38:28 - LMT 1914 # Mato Grosso (MT) Zone America/Cuiaba -3:44:20 - LMT 1914 -4:00 Brazil AM%sT 2003 Sep 24 - -4:00 - AMT + -4:00 - AMT 2004 Oct 4 + -4:00 Brazil AM%sT # # west Para (PA), Rondonia (RO) # West Para includes Altamira, Oribidos, Prainha, Oriximina, and Santarem. @@ -1029,6 +1053,11 @@ Rule Uruguay 1990 1992 - Mar Sun>=1 0:00 0 - Rule Uruguay 1990 1991 - Oct Sun>=21 0:00 1:00 S Rule Uruguay 1992 only - Oct 18 0:00 1:00 S Rule Uruguay 1993 only - Feb 28 0:00 0 - +# From Eduardo Cota (2004-09-20): +# The uruguayan government has decreed a change in the local time.... +# http://www.presidencia.gub.uy/decretos/2004091502.htm +Rule Uruguay 2004 only - Sep Sun>=15 0:00 1:00 S +Rule Uruguay 2005 only - Mar Sun>=8 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Montevideo -3:44:44 - LMT 1898 Jun 28 -3:44:44 - MMT 1920 May 1 # Montevideo MT diff --git a/timezone/zdump.c b/timezone/zdump.c index 9faeaf21b2..20bb916822 100644 --- a/timezone/zdump.c +++ b/timezone/zdump.c @@ -1,4 +1,4 @@ -static char elsieid[] = "@(#)zdump.c 7.31"; +static char elsieid[] = "@(#)zdump.c 7.40"; /* ** This code has been made independent of the rest of the time @@ -64,16 +64,15 @@ static char elsieid[] = "@(#)zdump.c 7.31"; #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) #endif /* !defined isleap */ -#if HAVE_GETTEXT - 0 +#if HAVE_GETTEXT #include "locale.h" /* for setlocale */ #include "libintl.h" -#endif /* HAVE_GETTEXT - 0 */ +#endif /* HAVE_GETTEXT */ #ifndef GNUC_or_lint #ifdef lint #define GNUC_or_lint -#endif /* defined lint */ -#ifndef lint +#else /* !defined lint */ #ifdef __GNUC__ #define GNUC_or_lint #endif /* defined __GNUC__ */ @@ -83,8 +82,7 @@ static char elsieid[] = "@(#)zdump.c 7.31"; #ifndef INITIALIZE #ifdef GNUC_or_lint #define INITIALIZE(x) ((x) = 0) -#endif /* defined GNUC_or_lint */ -#ifndef GNUC_or_lint +#else /* !defined GNUC_or_lint */ #define INITIALIZE(x) #endif /* !defined GNUC_or_lint */ #endif /* !defined INITIALIZE */ @@ -96,11 +94,11 @@ static char elsieid[] = "@(#)zdump.c 7.31"; */ #ifndef _ -#if HAVE_GETTEXT - 0 +#if HAVE_GETTEXT #define _(msgid) gettext(msgid) -#else /* !(HAVE_GETTEXT - 0) */ +#else /* !HAVE_GETTEXT */ #define _(msgid) msgid -#endif /* !(HAVE_GETTEXT - 0) */ +#endif /* !HAVE_GETTEXT */ #endif /* !defined _ */ #ifndef TZ_DOMAIN @@ -110,8 +108,7 @@ static char elsieid[] = "@(#)zdump.c 7.31"; #ifndef P #ifdef __STDC__ #define P(x) x -#endif /* defined __STDC__ */ -#ifndef __STDC__ +#else /* !defined __STDC__ */ #define P(x) () #endif /* !defined __STDC__ */ #endif /* !defined P */ @@ -129,6 +126,7 @@ static time_t hunt P((char * name, time_t lot, time_t hit)); static size_t longest; static char * progname; static void show P((char * zone, time_t t, int v)); +static void dumptime P((const struct tm * tmp)); int main(argc, argv) @@ -150,14 +148,13 @@ char * argv[]; struct tm newtm; INITIALIZE(cuttime); -#if HAVE_GETTEXT - 0 - (void) setlocale(LC_CTYPE, ""); +#if HAVE_GETTEXT (void) setlocale(LC_MESSAGES, ""); #ifdef TZ_DOMAINDIR (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR); -#endif /* defined(TEXTDOMAINDIR) */ +#endif /* defined TEXTDOMAINDIR */ (void) textdomain(TZ_DOMAIN); -#endif /* HAVE_GETTEXT - 0 */ +#endif /* HAVE_GETTEXT */ progname = argv[0]; for (i = 1; i < argc; ++i) if (strcmp(argv[i], "--version") == 0) { @@ -324,7 +321,7 @@ struct tm * oldp; return -delta(oldp, newp); result = 0; for (tmy = oldp->tm_year; tmy < newp->tm_year; ++tmy) - result += DAYSPERNYEAR + isleap(tmy + TM_YEAR_BASE); + result += DAYSPERNYEAR + isleap(tmy + (long) TM_YEAR_BASE); result += newp->tm_yday - oldp->tm_yday; result *= HOURSPERDAY; result += newp->tm_hour - oldp->tm_hour; @@ -344,10 +341,12 @@ int v; struct tm * tmp; (void) printf("%-*s ", (int) longest, zone); - if (v) - (void) printf("%.24s UTC = ", asctime(gmtime(&t))); + if (v) { + dumptime(gmtime(&t)); + (void) printf(" UTC = "); + } tmp = localtime(&t); - (void) printf("%.24s", asctime(tmp)); + dumptime(tmp); if (*abbr(tmp) != '\0') (void) printf(" %s", abbr(tmp)); if (v) { @@ -371,3 +370,37 @@ struct tm * tmp; result = tzname[tmp->tm_isdst]; return (result == NULL) ? &nada : result; } + +static void +dumptime(timeptr) +register const struct tm * timeptr; +{ + static const char wday_name[][3] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char mon_name[][3] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + register const char * wn; + register const char * mn; + + /* + ** The packaged versions of localtime and gmtime never put out-of-range + ** values in tm_wday or tm_mon, but since this code might be compiled + ** with other (perhaps experimental) versions, paranoia is in order. + */ + if (timeptr->tm_wday < 0 || timeptr->tm_wday >= + (int) (sizeof wday_name / sizeof wday_name[0])) + wn = "???"; + else wn = wday_name[timeptr->tm_wday]; + if (timeptr->tm_mon < 0 || timeptr->tm_mon >= + (int) (sizeof mon_name / sizeof mon_name[0])) + mn = "???"; + else mn = mon_name[timeptr->tm_mon]; + (void) printf("%.3s %.3s%3d %.2d:%.2d:%.2d %ld", + wn, mn, + timeptr->tm_mday, timeptr->tm_hour, + timeptr->tm_min, timeptr->tm_sec, + timeptr->tm_year + (long) TM_YEAR_BASE); +} |