diff options
-rw-r--r-- | ChangeLog | 90 | ||||
-rw-r--r-- | FAQ | 26 | ||||
-rw-r--r-- | Make-dist | 8 | ||||
-rw-r--r-- | SNAP | 16 | ||||
-rw-r--r-- | bits/errno.h | 23 | ||||
-rw-r--r-- | include/features.h | 13 | ||||
-rw-r--r-- | libio/stdfiles.c | 2 | ||||
-rw-r--r-- | libio/strops.c | 3 | ||||
-rw-r--r-- | manual/creature.texi | 7 | ||||
-rw-r--r-- | manual/filesys.texi | 6 | ||||
-rw-r--r-- | manual/maint.texi | 10 | ||||
-rw-r--r-- | manual/socket.texi | 48 | ||||
-rw-r--r-- | manual/string.texi | 210 | ||||
-rw-r--r-- | math/libm-test.c | 1 | ||||
-rw-r--r-- | po/Makefile | 2 | ||||
-rw-r--r-- | posix/glob.c | 63 | ||||
-rw-r--r-- | resolv/nss_dns/dns-host.c | 15 | ||||
-rw-r--r-- | stdlib/a64l.c | 4 | ||||
-rw-r--r-- | stdlib/l64a.c | 13 | ||||
-rw-r--r-- | sysdeps/generic/bits/errno.h | 23 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_cbrt.c | 6 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_cbrtf.c | 6 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/s_cbrtl.c | 6 | ||||
-rw-r--r-- | sysdeps/unix/bsd/sun/sethostid.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/inet/syscalls.list | 16 | ||||
-rw-r--r-- | sysdeps/unix/sysv/irix4/reboot.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/irix4/swapon.c | 2 | ||||
-rw-r--r-- | time/tzfile.c | 2 | ||||
-rw-r--r-- | time/tzset.c | 2 |
29 files changed, 450 insertions, 177 deletions
diff --git a/ChangeLog b/ChangeLog index 82a31444a5..37552bb0e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,94 @@ +1997-10-29 21:20 Ulrich Drepper <drepper@cygnus.com> + + * libio/strops.c (_IO_str_seekoff): If mode is zero and the read/write + pointers are tied set mode according to current stream mode. + + * include/features.h [_GNU_SOURCE] (_POSIX_C_SOURCE): Define to + 199506L. + Define _XOPEN_SOURCE to 500 if _POSIX_C_SOURCE is defined. + * manual/creature.texi: Describe this. + + * manual/socket.texi: Describe connect, accept, send, sendmsg, sendto, + recv, recvfrom, and recvmsg as cancelation points. + * sysdeps/unix/inet/syscalls.list: Add __libc_* names for these + functions. + +1997-10-17 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * Make-dist (try-sysdeps): Don't look for stub files anymore. + + * manual/maint.texi (Porting): Remove another reference to stub + directory. + + * sysdeps/unix/bsd/sun/sethostid.c: Include stub version from + generic subdir. + * sysdeps/unix/sysv/irix4/reboot.c: Likewise. + * sysdeps/unix/sysv/irix4/swapon.c: Likewise + +1997-10-29 03:54 Ulrich Drepper <drepper@cygnus.com> + + * resolv/nss_dns/dns-host.c: Change variable pointed to by h_errnop + in all error cases (PR 244). + +1997-10-29 00:56 Ulrich Drepper <drepper@cygnus.com> + + * posix/glob.c: Fix handling of expressions like "*/" (PR 325). + Optimize by using mempcpy. + +1997-10-17 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * po/Makefile ($(mo-installed)): Don't fail during installation if + files don't exist (might happen if msgfmt doesn't exist) (PR 328). + Suggested by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>. + +1997-10-24 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * sysdeps/generic/bits/errno.h (ENOMSG): Define it. + Pointed out by Klaus Espenlaub + <kespenla@hydra.informatik.uni-ulm.de> (PR libc/259). + +1997-10-28 17:40 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/libm-ieee754/s_cbrt.c: Testing the returned exponent for + zero isn't enough to determine illegal arguments. + * sysdeps/libm-ieee754/s_cbrtf.c: Likewise. + * sysdeps/libm-ieee754/s_cbrtl.c: Likewise. + +1997-10-28 17:14 Ulrich Drepper <drepper@cygnus.com> + + * manual/filesys.texi (S_ISVTX): Describe that it is available with + _BSD_SOURCE only. + Reported by Jochen Hein <jochen.hein@delphi.central.de>. + +1997-10-28 04:26 Ulrich Drepper <drepper@cygnus.com> + + * time/tzfile.c (__tzfile_compute): Use negated value of offset for + timezone variable. + * time/tzset.c (tz_compute): Likewise. + Reported by Erik Troan <ewt@redhat.com>. + +1997-10-28 02:51 Ulrich Drepper <drepper@cygnus.com> + + * manual/filesys.texi: Correct prototype in readdir_r description. + Reported by Jim Meyering <meyering@eng.ascend.com>. + +1997-10-27 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * math/libm-test.c (cbrt_test): Add test for cbrt(0.970299). + +1997-10-26 19:39 Zack Weinberg <zack@rabi.phys.columbia.edu> + + * stdlib/l64a.c: Produce a useful result for n < 0. + * stdlib/a64l.c: Use unsigned type for working variable. + * manual/string.texi (general): Grammar, typo, overfull fixes. + (strlen): Insert warning about sizeof(char *). + (a64l, l64a): Make documentation agree with implementation. + 1997-10-26 18:12 Ulrich Drepper <drepper@cygnus.com> * libio/genops.c: Partial undo of last patch. * libio/stdfiles.c: Likewise. - * libio/iofdopen.c: Use _IO_FILE_complete, not _IO_file_plus. + * libio/iofdopen.c: Use _IO_FILE_complete, not _IO_FILE_plus. * libio/iopopen.c: Likewise. * libio/iovdprintf.c: Likewise. * libio/libio.h: Remove duplicated `;'. @@ -21,7 +107,7 @@ * posix/unistd.h: Add explanation of _POSIX_* constants. - * posix/unists.h: Add prototypes for __pread, __pread64, __pwrite + * posix/unistd.h: Add prototypes for __pread, __pread64, __pwrite and __pwrite64. * sysdeps/generic/pread.c: Define as __pread and make pread weak alias. * sysdeps/generic/pread64.c: Likewise. diff --git a/FAQ b/FAQ index c37ae5b7ed..b1e4da343f 100644 --- a/FAQ +++ b/FAQ @@ -97,6 +97,9 @@ please let me know. [Q27] ``Programs like `logname', `top', `uptime' `users', `w' and `who', show incorrect information about the (number of) users on my system. Why?'' + +[Q28] ``After upgrading to a glibc 2.1 with symbol versioning I get + errors about undefined symbols. What went wrong?'' ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ [Q1] ``What systems does the GNU C Library run on?'' @@ -734,12 +737,31 @@ symlink that you have in place before you install glibc. However, ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ +[Q28] ``After upgrading to a glibc 2.1 with symbol versioning I get + errors about undefined symbols. What went wrong?'' + +[A28] {AJ} In a versioned libc a lot of symbols are now local that +have been global symbols in previous versions. When defining a extern +variable both in a user program and extern in the libc the links +resolves this to only one reference - the one in the library. The +problem is caused by either wrong program code or tools. In no case +the global variables from libc should be used by any program. Since +these reference are now local, you might see a message like: + +"msgfmt: error in loading shared libraries: : undefined symbol: _nl_domain_bindings" + +The only way to fix this is to recompile your program. Sorry, that's +the price you might have to pay once for quite a number of advantages +with symbol versioning. + + +~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Answers were given by: {UD} Ulrich Drepper, <drepper@cygnus.com> {DMT} David Mosberger-Tang, <davidm@AZStarNet.com> -{RM} Roland McGrath, <roland@gnu.ai.mit.edu> -{HJL} H.J. Lu, <hjl@gnu.ai.mit.edu> +{RM} Roland McGrath, <roland@gnu.org> +{HJL} H.J. Lu, <hjl@gnu.org> {AJ} Andreas Jaeger, <aj@arthur.rhein-neckar.de> {EY} Eric Youngdale, <eric@andante.jic.com> {PB} Phil Blundell, <Philip.Blundell@pobox.com> diff --git a/Make-dist b/Make-dist index 02f7fe4302..df06fba3c1 100644 --- a/Make-dist +++ b/Make-dist @@ -88,15 +88,13 @@ sources += $(addsuffix .c,$(elided-routines) \ +maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \ $(filter %.c %.S %.s %.h %.sub,$(distribute)) foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2) -# Find all the files that have a stub or generic version. -try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic \ - $(..)sysdeps/libm-ieee754,\ +# Find all the files that have a generic version. +try-sysdeps := $(foreach dir,$(..)sysdeps/generic $(..)sysdeps/libm-ieee754,\ $(addprefix $(dir)/,$(+maybe-sysdeps))) foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2) +sysdeps := $(wildcard $(try-sysdeps)) -foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2) +foo:=$(shell echo 'generic +sysdeps=$(+sysdeps)'>&2) +sysdep-names := $(sort $(patsubst $(..)sysdeps/generic/%,%,\ - $(patsubst $(..)sysdeps/stub/%,%,\ $(patsubst $(..)sysdeps/libm-ieee754/%,%,\ $(+sysdeps))))) foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2) diff --git a/SNAP b/SNAP index c1fc905f43..d13b9f7191 100644 --- a/SNAP +++ b/SNAP @@ -99,7 +99,7 @@ diff will be relative to the source tree after applying all previous daily diffs. The daily diffs are for people who have relatively low bandwidth ftp or uucp connections. -The files will be available via anonymous ftp from alpha.gnu.ai.mit.edu, in +The files will be available via anonymous ftp from alpha.gnu.org, in directory /gnu/libc and on linux.kernel.org in /pub/software/libs/glibc. The directories should look something like: @@ -110,9 +110,9 @@ directories should look something like: . . -Please note that the snapshots on alpha.gnu.ai.mit.edu and on +Please note that the snapshots on alpha.gnu.org and on linux.kernel.org are not always in sync. Patches to some files might -appear a day a diff earlier or later on alpha than on kernel. +appear a day a diff earlier or later on alpha than on kernel. Use always alpha or always kernel but don't mix them. There are sometimes additionally test releases of the add-ons available in @@ -155,13 +155,13 @@ GETTING HELP, GLIBC DISCUSSIONS, etc ------------------------------------ People who want to help with glibc and who test out snapshots regularly should -get on the libc-alpha@gnu.ai.mit.edu mailing list by sending an email to -libc-alpha-request@gnu.ai.mit.edu. This list is meant (as the name suggests) +get on the libc-alpha@gnu.org mailing list by sending an email to +libc-alpha-request@gnu.org. This list is meant (as the name suggests) for the discussion of test releases and also reports for them. People who are on this list are welcome to post questions of general interest. People who are not only willing to test the snapshots but instead really want -to help developing glibc should contact libc-hacker-request@gnu.ai.mit.edu to +to help developing glibc should contact libc-hacker-request@gnu.org to be put on the developers mailing list. This list is really only meant for developers. No questions about installation problems or other simple topics are wanted nor will they be answered. @@ -174,7 +174,7 @@ you are talking about and it will just cause confusion. BUG REPORTS ----------- -Send bug reports directly to Ulrich Drepper <drepper@gnu.ai.mit.edu>. Please +Send bug reports directly to Ulrich Drepper <drepper@gnu.org>. Please do *not* use the glibcbug script for reporting bugs in the snapshots. glibcbug should only be used for problems with the official released versions. We don't like bug reports in the bug database because otherwise the impression @@ -202,7 +202,7 @@ FORMAT FOR PATCHES ------------------ If you have a fix for a bug, or an enhancement to submit, send your patch to -Ulrich Drepper <drepper@gnu.ai.mit.edu>. Here are some simple guidelines for +Ulrich Drepper <drepper@gnu.org>. Here are some simple guidelines for submitting patches: o Use "unified diffs" for patches. A typical command for generating diff --git a/bits/errno.h b/bits/errno.h index e197c3603d..cb61da7836 100644 --- a/bits/errno.h +++ b/bits/errno.h @@ -18,23 +18,24 @@ /* This file defines the `errno' constants. */ -#if !defined(__Emath_defined) && (defined(_ERRNO_H) || defined(__need_Emath)) +#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath) #undef __need_Emath #define __Emath_defined 1 -#define EDOM 1 -#define ERANGE 2 +# define EDOM 1 +# define ERANGE 2 #endif #ifdef _ERRNO_H -#define ENOSYS 3 -#define EINVAL 4 -#define ESPIPE 5 -#define EBADF 6 -#define ENOMEM 7 -#define EACCES 8 -#define ENFILE 9 -#define EMFILE 10 +# define ENOSYS 3 +# define EINVAL 4 +# define ESPIPE 5 +# define EBADF 6 +# define ENOMEM 7 +# define EACCES 8 +# define ENFILE 9 +# define EMFILE 10 +# define ENOMSG 11 #endif #define __set_errno(val) errno = (val) diff --git a/include/features.h b/include/features.h index e8c97f800e..b6118a1cf6 100644 --- a/include/features.h +++ b/include/features.h @@ -121,7 +121,7 @@ # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 199309L +# define _POSIX_C_SOURCE 199506L # undef _XOPEN_SOURCE # define _XOPEN_SOURCE 500 # undef _XOPEN_SOURCE_EXTENDED @@ -159,7 +159,7 @@ # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) != 500 # define _POSIX_C_SOURCE 2 # else -# define _POSIX_C_SOURCE 199309L +# define _POSIX_C_SOURCE 199506L # endif #endif @@ -171,8 +171,13 @@ # define __USE_POSIX2 1 #endif -#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L -# define __USE_POSIX199309 1 +#ifdef _POSIX_C_SOURCE +# if _POSIX_C_SOURCE >= 199309L +# define __USE_POSIX199309 1 +# endif +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 500 +# endif #endif #ifdef _XOPEN_SOURCE diff --git a/libio/stdfiles.c b/libio/stdfiles.c index 56861666af..7eb828350c 100644 --- a/libio/stdfiles.c +++ b/libio/stdfiles.c @@ -39,7 +39,7 @@ = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},}; \ default_symbol_version (INAME, NAME, GLIBC_2.1) #else -#define DEF_STDFILE(INAME, FD, CHAIN, FLAGS) \ +#define DEF_STDFILE(INAME, NAME, FD, CHAIN, FLAGS) \ struct _IO_FILE_complete INAME \ = {{FILEBUF_LITERAL(CHAIN, FLAGS, FD), &_IO_file_jumps},}; \ default_symbol_version (INAME, NAME, GLIBC_2.1) diff --git a/libio/strops.c b/libio/strops.c index c596315b60..01f8d6eeb7 100644 --- a/libio/strops.c +++ b/libio/strops.c @@ -215,6 +215,9 @@ _IO_str_seekoff (fp, offset, dir, mode) _IO_ssize_t cur_size = _IO_str_count (fp); _IO_fpos64_t new_pos = EOF; + if (mode == 0 && (fp->_flags & _IO_TIED_PUT_GET)) + mode = (fp->_flags & _IO_CURRENTLY_PUTTING ? _IOS_OUTPUT : _IOS_INPUT); + /* Move the get pointer, if requested. */ if (mode & _IOS_INPUT) { diff --git a/manual/creature.texi b/manual/creature.texi index 38a11c0093..03f79ede96 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -36,6 +36,11 @@ available. If you define this macro with a value of @code{2}, then both the functionality from the POSIX.1 standard and the functionality from the POSIX.2 standard (IEEE Standard 1003.2) are made available. This is in addition to the @w{ISO C} facilities. + +The Single Unix Specification specify that setting this macro to the +value @code{199506L} selects all the values specified by the POSIX +standards plus those of the Single Unix Specification, i.e., is the +same as if @code{_XOPEN_SOURCE} is set to @code{500} (see below). @end defvr @comment (none) @@ -88,7 +93,7 @@ available which are necessary for the X/Open Unix brand. If the macro @code{_XOPEN_SOURCE} has the value @math{500} this includes all functionality described so far plus some new definitions from the -Single Unix specification, @w{version 2}. +Single Unix Specification, @w{version 2}. @end defvr @comment (NONE) diff --git a/manual/filesys.texi b/manual/filesys.texi index 4cf4f99c07..c33bad892e 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -340,7 +340,7 @@ value. Use @code{readdir_r} when this is critical. @comment dirent.h @comment GNU -@deftypefun int readdir_r (DIR *@var{dirstream}, struct *@var{entry}, struct **@var{result}) +@deftypefun int readdir_r (DIR *@var{dirstream}, struct dirent *@var{entry}, struct dirent **@var{result}) This function is the reentrant version of @code{readdir}. Like @code{readdir} it returns the next entry from the directory. But to prevent conflicts for simultaneously running threads the result is not @@ -1783,6 +1783,10 @@ waste of the server's memory to cache them a second time. In this use the sticky bit also says that the filesystem may fail to record the file's modification time onto disk reliably (the idea being that no-one cares for a swap file). + +This bit is only available on BSD systems (and those derived from +them). Therefore one has to use the @code{_BSD_SOURCE} feature select +macro to get the definition (@pxref{Feature Test Macros}). @end table The actual bit values of the symbols are listed in the table above diff --git a/manual/maint.texi b/manual/maint.texi index 7698549bf3..6d4185b52c 100644 --- a/manual/maint.texi +++ b/manual/maint.texi @@ -538,11 +538,11 @@ include the file @code{<stub-tag.h>} into your file. This causes the function to be listed in the installed @code{<gnu/stubs.h>}, and makes GNU ld warn when the function is used. -Some rare functions are only useful on specific systems and aren't -defined at all on others; these do not appear anywhere in the -system-independent source code or makefiles (including the -@file{generic} and @file{stub} directories), only in the -system-dependent @file{Makefile} in the specific system's subdirectory. +Some rare functions are only useful on specific systems and +aren't defined at all on others; these do not appear anywhere +in the system-independent source code or makefiles (including the +@file{generic}), only in the system-dependent @file{Makefile} in the +specific system's subdirectory. If you come across a file that is in one of the main source directories (@file{string}, @file{stdio}, etc.), and you want to write a machine- or diff --git a/manual/socket.texi b/manual/socket.texi index 76d7863728..45b9bbb892 100644 --- a/manual/socket.texi +++ b/manual/socket.texi @@ -1769,6 +1769,12 @@ completely established, will fail with @code{EALREADY}. The socket @var{socket} is non-blocking and already has a pending connection in progress (see @code{EINPROGRESS} above). @end table + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @node Listening @@ -1897,6 +1903,12 @@ The descriptor @var{socket} does not support this operation. @var{socket} has nonblocking mode set, and there are no pending connections immediately available. @end table + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun The @code{accept} function is not allowed for sockets using @@ -2023,6 +2035,12 @@ case, @code{send} generates a @code{SIGPIPE} signal first; if that signal is ignored or blocked, or if its handler returns, then @code{send} fails with @code{EPIPE}. @end table + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @node Receiving Data @@ -2067,6 +2085,12 @@ The operation was interrupted by a signal before any data was read. @item ENOTCONN You never connected this socket. @end table + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @node Socket Data Options @@ -2366,6 +2390,12 @@ system on your machine usually does not know this. It is also possible for one call to @code{sendto} to report an error due to a problem related to a previous call. + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @node Receiving Datagrams @@ -2398,6 +2428,12 @@ if you are not interested in this information. The @var{flags} are interpreted the same way as for @code{recv} (@pxref{Socket Data Options}). The return value and error conditions are also the same as for @code{recv}. + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun You can use plain @code{recv} (@pxref{Receiving Data}) instead of @@ -2420,11 +2456,23 @@ you don't want to specify @var{flags} (@pxref{I/O Primitives}). @comment sys/socket.h @comment BSD @deftypefun int sendmsg (int @var{socket}, const struct msghdr *@var{message}, int @var{flags}) + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @comment sys/socket.h @comment BSD @deftypefun int recvmsg (int @var{socket}, struct msghdr *@var{message}, int @var{flags}) + +This function is defined as a cancelation point in multi-threaded +programs. So one has to be prepared for this and make sure that +possibly allocated resources (like memory, files descriptors, +semaphores or whatever) are freed even if the thread is cancel. +@c @xref{pthread_cleanup_push}, for a method how to do this. @end deftypefun @end ignore diff --git a/manual/string.texi b/manual/string.texi index 3d60fa4d2e..f33303b356 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -82,7 +82,7 @@ string. The amount of memory allocated for the character array may extend past the null character that normally marks the end of the string. In this -document, the term @dfn{allocation size} is always used to refer to the +document, the term @dfn{allocated size} is always used to refer to the total amount of memory allocated for the string, while the term @dfn{length} refers to the number of characters up to (but not including) the terminating null character. @@ -155,8 +155,8 @@ strlen ("hello, world") @end smallexample When applied to a character array, the @code{strlen} function returns -the length of the string stored there, not its allocation size. You can -get the allocation size of the character array that holds a string using +the length of the string stored there, not its allocated size. You can +get the allocated size of the character array that holds a string using the @code{sizeof} operator: @smallexample @@ -166,6 +166,22 @@ sizeof (string) strlen (string) @result{} 12 @end smallexample + +But beware, this will not work unless @var{string} is the character +array itself, not a pointer to it. For example: + +@smallexample +char string[32] = "hello, world"; +char *ptr = string; +sizeof (string) + @result{} 32 +sizeof (ptr) + @result{} 4 /* @r{(on a machine with 4 byte pointers)} */ +@end smallexample + +This is an easy mistake to make when you are working with functions that +take string arguments; those arguments are always pointers, not arrays. + @end deftypefun @comment string.h @@ -397,7 +413,7 @@ is implemented to be useful in contexts where this behaviour of the @emph{first} written null character. This function is not part of ISO or POSIX but was found useful while -developing GNU C Library itself. +developing the GNU C Library itself. Its behaviour is undefined if the strings overlap. @end deftypefun @@ -406,12 +422,11 @@ Its behaviour is undefined if the strings overlap. @comment GNU @deftypefn {Macro} {char *} strdupa (const char *@var{s}) This function is similar to @code{strdup} but allocates the new string -using @code{alloca} instead of @code{malloc} -@pxref{Variable Size Automatic}. This means of course the returned -string has the same limitations as any block of memory allocated using -@code{alloca}. +using @code{alloca} instead of @code{malloc} (@pxref{Variable Size +Automatic}). This means of course the returned string has the same +limitations as any block of memory allocated using @code{alloca}. -For obvious reasons @code{strdupa} is implemented only as a macro. I.e., +For obvious reasons @code{strdupa} is implemented only as a macro; you cannot get the address of this function. Despite this limitation it is a useful function. The following code shows a situation where using @code{malloc} would be a lot more expensive. @@ -434,8 +449,7 @@ allocates the new string using @code{alloca} @pxref{Variable Size Automatic}. The same advantages and limitations of @code{strdupa} are valid for @code{strndupa}, too. -This function is implemented only as a macro which means one cannot -get the address of it. +This function is implemented only as a macro, just like @code{strdupa}. @code{strndupa} is only available if GNU CC is used. @end deftypefn @@ -613,10 +627,10 @@ is an initial substring of @var{s2}, then @var{s1} is considered to be @comment BSD @deftypefun int strcasecmp (const char *@var{s1}, const char *@var{s2}) This function is like @code{strcmp}, except that differences in case are -ignored. How uppercase and lowercase character are related is +ignored. How uppercase and lowercase characters are related is determined by the currently selected locale. In the standard @code{"C"} locale the characters @"A and @"a do not match but in a locale which -regards this characters as parts of the alphabet they do match. +regards these characters as parts of the alphabet they do match. @code{strcasecmp} is derived from BSD. @end deftypefun @@ -625,8 +639,8 @@ regards this characters as parts of the alphabet they do match. @comment BSD @deftypefun int strncasecmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) This function is like @code{strncmp}, except that differences in case -are ignored. Like for @code{strcasecmp} it is locale dependent how -uppercase and lowercase character are related. +are ignored. Like @code{strcasecmp}, it is locale dependent how +uppercase and lowercase characters are related. @code{strncasecmp} is a GNU extension. @end deftypefun @@ -671,7 +685,7 @@ function. In fact, if @var{s1} and @var{s2} contain no digits, Basically, we compare strings normally (character by character), until we find a digit in each string - then we enter a special comparison -mode, where each sequence of digit is taken as a whole. If we reach the +mode, where each sequence of digits is taken as a whole. If we reach the end of these two parts without noticing a difference, we return to the standard comparison mode. There are two types of numeric parts: "integral" and "fractional" (those begin with a '0'). The types @@ -693,7 +707,7 @@ than the other one; else the comparison behaves normally. @smallexample strverscmp ("no digit", "no digit") - @result{} 0 /* @r{same behaviour as strverscmp.} */ + @result{} 0 /* @r{same behaviour as strcmp.} */ strverscmp ("item#99", "item#100") @result{} <0 /* @r{same prefix, but 99 < 100.} */ strverscmp ("alpha1", "alpha001") @@ -873,7 +887,8 @@ sort_strings_fast (char **array, int nstrings) /* @r{The return value is not interesting because we know} @r{how long the transformed string is.} */ - (void) strxfrm (transformed, array[i], transformed_length + 1); + (void) strxfrm (transformed, array[i], + transformed_length + 1); @} temp_array[i].transformed = transformed; @@ -1096,12 +1111,11 @@ a null pointer. @end deftypefun @strong{Warning:} Since @code{strtok} alters the string it is parsing, -you always copy the string to a temporary buffer before parsing it with -@code{strtok}. If you allow @code{strtok} to modify a string that came -from another part of your program, you are asking for trouble; that -string may be part of a data structure that could be used for other -purposes during the parsing, when alteration by @code{strtok} makes the -data structure temporarily inaccurate. +you should always copy the string to a temporary buffer before parsing +it with @code{strtok}. If you allow @code{strtok} to modify a string +that came from another part of your program, you are asking for trouble; +that string might be used for other purposes after @code{strtok} has +modified it, and it would not have the expected value. The string that you are operating on might even be a constant. Then when @code{strtok} tries to modify it, your program will get a fatal @@ -1146,14 +1160,13 @@ which overcome the limitation of non-reentrancy. @comment string.h @comment POSIX @deftypefun {char *} strtok_r (char *@var{newstring}, const char *@var{delimiters}, char **@var{save_ptr}) -Just like @code{strtok} this function splits the string into several -tokens which can be accessed be successive calls to @code{strtok_r}. -The difference is that the information about the next token is not set -up in some internal state information. Instead the caller has to -provide another argument @var{save_ptr} which is a pointer to a string -pointer. Calling @code{strtok_r} with a null pointer for -@var{newstring} and leaving @var{save_ptr} between the calls unchanged -does the job without limiting reentrancy. +Just like @code{strtok}, this function splits the string into several +tokens which can be accessed by successive calls to @code{strtok_r}. +The difference is that the information about the next token is stored in +the space pointed to by the third argument, @var{save_ptr}, which is a +pointer to a string pointer. Calling @code{strtok_r} with a null +pointer for @var{newstring} and leaving @var{save_ptr} between the calls +unchanged does the job without hindering reentrancy. This function is defined in POSIX-1 and can be found on many systems which support multi-threading. @@ -1162,12 +1175,12 @@ which support multi-threading. @comment string.h @comment BSD @deftypefun {char *} strsep (char **@var{string_ptr}, const char *@var{delimiter}) -A second reentrant approach is to avoid the additional first argument. -The initialization of the moving pointer has to be done by the user. -Successive calls of @code{strsep} move the pointer along the tokens -separated by @var{delimiter}, returning the address of the next token -and updating @var{string_ptr} to point to the beginning of the next -token. +This function is just @code{strtok_r} with the @var{newstring} argument +replaced by the @var{save_ptr} argument. The initialization of the +moving pointer has to be done by the user. Successive calls to +@code{strsep} move the pointer along the tokens separated by +@var{delimiter}, returning the address of the next token and updating +@var{string_ptr} to point to the beginning of the next token. This function was introduced in 4.3BSD and therefore is widely available. @end deftypefun @@ -1204,47 +1217,30 @@ token = strsep (&running, delimiters); /* token => NULL */ To store or transfer binary data in environments which only support text one has to encode the binary data by mapping the input bytes to characters in the range allowed for storing or transfering. SVID -systems (and nowadays XPG compliant systems) have such a function in the -C library. +systems (and nowadays XPG compliant systems) provide minimal support for +this task. @comment stdlib.h @comment XPG @deftypefun {char *} l64a (long int @var{n}) -This function encodes an input value with 32 bits using characters from -the basic character set. Groups of 6 bits are encoded using the -following table: - -@multitable {xxxxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} -@item @tab 0 @tab 1 @tab 2 @tab 3 @tab 4 @tab 5 @tab 6 @tab 7 -@item 0 @tab @code{.} @tab @code{/} @tab @code{0} @tab @code{1} - @tab @code{2} @tab @code{3} @tab @code{4} @tab @code{5} -@item 8 @tab @code{6} @tab @code{7} @tab @code{8} @tab @code{9} - @tab @code{A} @tab @code{B} @tab @code{C} @tab @code{D} -@item 16 @tab @code{E} @tab @code{F} @tab @code{G} @tab @code{H} - @tab @code{I} @tab @code{J} @tab @code{K} @tab @code{L} -@item 24 @tab @code{M} @tab @code{N} @tab @code{O} @tab @code{P} - @tab @code{Q} @tab @code{R} @tab @code{S} @tab @code{T} -@item 32 @tab @code{U} @tab @code{V} @tab @code{W} @tab @code{X} - @tab @code{Y} @tab @code{Z} @tab @code{a} @tab @code{b} -@item 40 @tab @code{c} @tab @code{d} @tab @code{e} @tab @code{f} - @tab @code{g} @tab @code{h} @tab @code{i} @tab @code{j} -@item 48 @tab @code{k} @tab @code{l} @tab @code{m} @tab @code{n} - @tab @code{o} @tab @code{p} @tab @code{q} @tab @code{r} -@item 56 @tab @code{s} @tab @code{t} @tab @code{u} @tab @code{v} - @tab @code{w} @tab @code{x} @tab @code{y} @tab @code{z} -@end multitable - -The function returns a pointer to a static buffer which contains the -string representing of the encoding of @var{n}. To encoded a series of -bytes the use should append the new string to the destination buffer. -@emph{Warning:} Since a static buffer is used this function should not +This function encodes a 32-bit input value using characters from the +basic character set. It returns a pointer to a 6 character buffer which +contains an encoded version of @var{n}. To encode a series of bytes the +user must copy the returned string to a destination buffer. It returns +the empty string if @var{n} is zero, which is somewhat bizarre but +mandated by the standard.@* +@strong{Warning:} Since a static buffer is used this function should not be used in multi-threaded programs. There is no thread-safe alternative -to this function in the C library. -@end deftypefun +to this function in the C library.@* +@strong{Compatibility Note:} The XPG standard states that the return +value of @code{l64a} is undefined if @var{n} is negative. In the GNU +implementation, @code{l64a} treats its argument as unsigned, so it will +return a sensible encoding for any nonzero @var{n}; however, portable +programs should not rely on this. -Alone the @code{l64a} function is not usable. To encode arbitrary -sequences of bytes one needs some more code and this could look like -this: +To encode a large buffer @code{l64a} must be called in a loop, once for +each 32-bit word of the buffer. For example, one could do something +like this: @smallexample char * @@ -1256,8 +1252,10 @@ encode (const void *buf, size_t len) char *cp = out; /* @r{Encode the length.} */ - memcpy (cp, l64a (len), 6); - cp += 6; + /* @r{Using `htonl' is necessary so that the data can be} + @r{decoded even on machines with different byte order.} */ + + cp = mempcpy (cp, l64a (htonl (len)), 6); while (len > 3) @{ @@ -1266,10 +1264,12 @@ encode (const void *buf, size_t len) n = (n << 8) | *in++; n = (n << 8) | *in++; len -= 4; - /* @r{Using `htonl' is necessary so that the data can be} - @r{decoded even on machines with different byte order.} */ - memcpy (cp, l64a (htonl (n)), 6); - cp += 6; + if (n) + cp = mempcpy (cp, l64a (htonl (n)), 6); + else + /* @r{`l64a' returns the empty string for n==0, so we } + @r{must generate its encoding (}"......"@r{) by hand.} */ + cp = stpcpy (cp, "......"); @} if (len > 0) @{ @@ -1289,9 +1289,9 @@ encode (const void *buf, size_t len) @end smallexample It is strange that the library does not provide the complete -functionality needed but so be it. There are some other encoding -methods which are much more widely used (UU encoding, Base64 encoding). -Generally, it is better to use one of these encodings. +functionality needed but so be it. + +@end deftypefun To decode data produced with @code{l64a} the following function should be used. @@ -1300,19 +1300,43 @@ used. @comment XPG @deftypefun {long int} a64l (const char *@var{string}) The parameter @var{string} should contain a string which was produced by -a call to @code{l64a}. The function processes the next 6 characters and -decodes the characters it finds according to the table above. -Characters not in the conversion table are simply ignored. This is -useful for breaking the information in lines in which case the end of -line characters are simply ignored. - -The decoded number is returned at the end as a @code{long int} value. -Consecutive calls to this function are possible but the caller must make -sure the buffer pointer is update after each call to @code{a64l} since -this function does not modify the buffer pointer. Every call consumes 6 -characters. +a call to @code{l64a}. The function processes at least 6 characters of +this string, and decodes the characters it finds according to the table +below. It stops decoding when it finds a character not in the table, +rather like @code{atoi}; if you have a buffer which has been broken into +lines, you must be careful to skip over the end-of-line characters. + +The decoded number is returned as a @code{long int} value. @end deftypefun +The @code{l64a} and @code{a64l} functions use a base 64 encoding, in +which each character of an encoded string represents six bits of an +input word. These symbols are used for the base 64 digits: + +@multitable {xxxxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} {xxx} +@item @tab 0 @tab 1 @tab 2 @tab 3 @tab 4 @tab 5 @tab 6 @tab 7 +@item 0 @tab @code{.} @tab @code{/} @tab @code{0} @tab @code{1} + @tab @code{2} @tab @code{3} @tab @code{4} @tab @code{5} +@item 8 @tab @code{6} @tab @code{7} @tab @code{8} @tab @code{9} + @tab @code{A} @tab @code{B} @tab @code{C} @tab @code{D} +@item 16 @tab @code{E} @tab @code{F} @tab @code{G} @tab @code{H} + @tab @code{I} @tab @code{J} @tab @code{K} @tab @code{L} +@item 24 @tab @code{M} @tab @code{N} @tab @code{O} @tab @code{P} + @tab @code{Q} @tab @code{R} @tab @code{S} @tab @code{T} +@item 32 @tab @code{U} @tab @code{V} @tab @code{W} @tab @code{X} + @tab @code{Y} @tab @code{Z} @tab @code{a} @tab @code{b} +@item 40 @tab @code{c} @tab @code{d} @tab @code{e} @tab @code{f} + @tab @code{g} @tab @code{h} @tab @code{i} @tab @code{j} +@item 48 @tab @code{k} @tab @code{l} @tab @code{m} @tab @code{n} + @tab @code{o} @tab @code{p} @tab @code{q} @tab @code{r} +@item 56 @tab @code{s} @tab @code{t} @tab @code{u} @tab @code{v} + @tab @code{w} @tab @code{x} @tab @code{y} @tab @code{z} +@end multitable + +This encoding scheme is not standard. There are some other encoding +methods which are much more widely used (UU encoding, MIME encoding). +Generally, it is better to use one of these encodings. + @node Argz and Envz Vectors @section Argz and Envz Vectors diff --git a/math/libm-test.c b/math/libm-test.c index c24b5f0f83..56f111d88c 100644 --- a/math/libm-test.c +++ b/math/libm-test.c @@ -1004,6 +1004,7 @@ cbrt_test (void) check_eps ("cbrt (8) == 2", FUNC(cbrt) (8), 2, CHOOSE (5e-17L, 0, 0)); check_eps ("cbrt (-27) == -3", FUNC(cbrt) (-27.0), -3.0, CHOOSE (3e-16L, 5e-16, 0)); + check ("cbrt (0.970299) == 0.99", FUNC(cbrt) (0.970299), 0.99); } diff --git a/po/Makefile b/po/Makefile index 20221cb727..10098049cf 100644 --- a/po/Makefile +++ b/po/Makefile @@ -61,7 +61,7 @@ include ../Rules $(MSGFMT) -o $@ $< # Install the message object files as libc.po in the language directory. -$(mo-installed): %.mo; $(do-install) +$(mo-installed): %.mo; $(do-install) || exit 0 .PHONY: linguas linguas.mo linguas: $(ALL_LINGUAS:=.po) diff --git a/posix/glob.c b/posix/glob.c index f0cb6d377b..6a601ee15e 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -16,7 +16,7 @@ Boston, MA 02111-1307, USA. */ /* AIX requires this to be the first thing in the file. */ -#if defined (_AIX) && !defined (__GNUC__) +#if defined _AIX && !defined __GNUC__ #pragma alloca #endif @@ -169,6 +169,11 @@ extern void bcopy (); # define strcoll strcmp #endif +#if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1 +# define HAVE_MEMPCPY 1 +# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len) +#endif + #ifndef __GNU_LIBRARY__ # ifdef __GNUC__ @@ -417,8 +422,12 @@ glob (pattern, flags, errfunc, pglob) int result; /* Construct the new glob expression. */ +#ifdef HAVE_MEMPCPY + mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len); +#else memcpy (alt_start, p, next - p); memcpy (&alt_start[next - p], rest, rest_len); +#endif result = glob (onealt, ((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) @@ -479,8 +488,12 @@ glob (pattern, flags, errfunc, pglob) { dirlen = filename - pattern; dirname = (char *) __alloca (dirlen + 1); +#ifdef HAVE_MEMPCPY + *((char *) mempcpy (dirname, pattern, dirlen)) = '\0'; +#else memcpy (dirname, pattern, dirlen); dirname[dirlen] = '\0'; +#endif ++filename; } @@ -568,8 +581,13 @@ glob (pattern, flags, errfunc, pglob) char *newp; size_t home_len = strlen (home_dir); newp = (char *) __alloca (home_len + dirlen); +# ifdef HAVE_MEMPCPY + mempcpy (mempcpy (newp, home_dir, home_len), + &dirname[1], dirlen); +# else memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], &dirname[1], dirlen); +# endif dirname = newp; } } @@ -585,8 +603,13 @@ glob (pattern, flags, errfunc, pglob) else { user_name = (char *) __alloca (end_name - dirname); +# ifdef HAVE_MEMPCPY + *((char *) mempcpy (user_name, dirname + 1, end_name - dirname)) + = '\0'; +# else memcpy (user_name, dirname + 1, end_name - dirname); user_name[end_name - dirname - 1] = '\0'; +# endif } /* Look up specific user's home directory. */ @@ -614,9 +637,14 @@ glob (pattern, flags, errfunc, pglob) size_t home_len = strlen (home_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); newp = (char *) __alloca (home_len + rest_len + 1); +# ifdef HAVE_MEMPCPY + *((char *) mempcpy (mempcpy (newp, home_dir, home_len), + end_name, rest_len)) = '\0'; +# else memcpy (newp, home_dir, home_len); memcpy (&newp[home_len], end_name, rest_len); newp[home_len + rest_len] = '\0'; +# endif dirname = newp; } } @@ -838,9 +866,17 @@ prefix_array (dirname, array, n) return 1; } +#ifdef HAVE_MEMPCPY + { + char *endp = (char *) mempcpy (new, dirname, dirlen); + *endp++ = '/'; + mempcpy (endp, array[i], eltlen); + } +#else memcpy (new, dirname, dirlen); new[dirlen] = '/'; memcpy (&new[dirlen + 1], array[i], eltlen); +#endif free ((__ptr_t) array[i]); array[i] = new; } @@ -922,6 +958,18 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) (flags & GLOB_ERR)) return GLOB_ABORTED; } + else if (pattern[0] == '\0') + { + /* This is a special case for matching directories like in + "*a/". */ + names = (struct globlink *) __alloca (sizeof (struct globlink)); + names->name = (char *) malloc (1); + if (names->name == NULL) + goto memory_error; + names->name[0] = '\0'; + names->next = NULL; + nfound = 1; + } else while (1) { @@ -941,8 +989,13 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) names->name = (char *) malloc (len + 1); if (names->name == NULL) goto memory_error; +#ifdef HAVE_MEMPCPY + *((char *) mempcpy ((__ptr_t) names->name, pattern, len)) + = '\0'; +#else memcpy ((__ptr_t) names->name, pattern, len); names->name[len] = '\0'; +#endif names->next = NULL; nfound = 1; break; @@ -992,8 +1045,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) = (char *) malloc (len + 1); if (new->name == NULL) goto memory_error; +#ifdef HAVE_MEMPCPY + *((char *) mempcpy ((__ptr_t) new->name, name, len)) = '\0'; +#else memcpy ((__ptr_t) new->name, name, len); new->name[len] = '\0'; +#endif new->next = names; names = new; ++nfound; @@ -1014,8 +1071,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) names->name = (char *) malloc (len + 1); if (names->name == NULL) goto memory_error; +#ifdef HAVE_MEMPCPY + *((char *) mempcpy (names->name, pattern, len)) = '\0'; +#else memcpy (names->name, pattern, len); names->name[len] = '\0'; +#endif } if (nfound != 0) diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index f7721840b7..ee3f7e8d79 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -158,7 +158,10 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result, n = res_search (name, C_IN, type, host_buffer.buf, sizeof (host_buffer.buf)); if (n < 0) - return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND; + { + *h_errnop = h_errno; + return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND; + } return getanswer_r (&host_buffer, n, name, type, result, buffer, buflen, h_errnop); @@ -251,12 +254,18 @@ _nss_dns_gethostbyaddr_r (const char *addr, int len, int af, n = res_query (qbuf, C_IN, T_PTR, (u_char *)host_buffer.buf, sizeof host_buffer); if (n < 0) - return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND; + { + *h_errnop = h_errno; + return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND; + } status = getanswer_r (&host_buffer, n, qbuf, T_PTR, result, buffer, buflen, h_errnop); if (status != NSS_STATUS_SUCCESS) - return status; + { + *h_errnop = h_errno; + return status; + } #ifdef SUNSECURITY This is not implemented because it is not possible to use the current diff --git a/stdlib/a64l.c b/stdlib/a64l.c index 9d462c77f3..d1dd3a9b6b 100644 --- a/stdlib/a64l.c +++ b/stdlib/a64l.c @@ -24,7 +24,7 @@ a64l (string) const char *string; { size_t cnt; - long int result = 0l; + unsigned long int result = 0l; for (cnt = 0; cnt < 6; ++cnt) { @@ -50,5 +50,5 @@ a64l (string) } } - return result; + return (long int) result; } diff --git a/stdlib/l64a.c b/stdlib/l64a.c index ba7a910c96..9fbde5d139 100644 --- a/stdlib/l64a.c +++ b/stdlib/l64a.c @@ -36,21 +36,20 @@ char * l64a (n) long int n; { + unsigned long int m = (unsigned long int) n; static char result[7]; int cnt; - if (n <= 0l) - /* The value for N == 0 is defined to be the empty string. When a - negative value is given the result is undefined. We will - return the empty string. */ + if (m == 0l) + /* The value for N == 0 is defined to be the empty string. */ return (char *) ""; result[6] = '\0'; - for (cnt = 5; n > 0; --cnt) + for (cnt = 5; m > 0; --cnt) { - result[cnt] = conv_table[n & 0x3f]; - n >>= 6; + result[cnt] = conv_table[m & 0x3f]; + m >>= 6; } return &result[cnt + 1]; diff --git a/sysdeps/generic/bits/errno.h b/sysdeps/generic/bits/errno.h index e197c3603d..cb61da7836 100644 --- a/sysdeps/generic/bits/errno.h +++ b/sysdeps/generic/bits/errno.h @@ -18,23 +18,24 @@ /* This file defines the `errno' constants. */ -#if !defined(__Emath_defined) && (defined(_ERRNO_H) || defined(__need_Emath)) +#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath) #undef __need_Emath #define __Emath_defined 1 -#define EDOM 1 -#define ERANGE 2 +# define EDOM 1 +# define ERANGE 2 #endif #ifdef _ERRNO_H -#define ENOSYS 3 -#define EINVAL 4 -#define ESPIPE 5 -#define EBADF 6 -#define ENOMEM 7 -#define EACCES 8 -#define ENFILE 9 -#define EMFILE 10 +# define ENOSYS 3 +# define EINVAL 4 +# define ESPIPE 5 +# define EBADF 6 +# define ENOMEM 7 +# define EACCES 8 +# define ENFILE 9 +# define EMFILE 10 +# define ENOMSG 11 #endif #define __set_errno(val) errno = (val) diff --git a/sysdeps/libm-ieee754/s_cbrt.c b/sysdeps/libm-ieee754/s_cbrt.c index a5033ff468..753049d375 100644 --- a/sysdeps/libm-ieee754/s_cbrt.c +++ b/sysdeps/libm-ieee754/s_cbrt.c @@ -46,8 +46,10 @@ __cbrt (double x) xm = __frexp (fabs (x), &xe); /* If X is not finite or is null return it (with raising exceptions - if necessary. */ - if (xe == 0) + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) return x + x; u = (0.354895765043919860 diff --git a/sysdeps/libm-ieee754/s_cbrtf.c b/sysdeps/libm-ieee754/s_cbrtf.c index f9f687c011..fa0fef9987 100644 --- a/sysdeps/libm-ieee754/s_cbrtf.c +++ b/sysdeps/libm-ieee754/s_cbrtf.c @@ -46,8 +46,10 @@ __cbrtf (float x) xm = __frexpf (fabsf (x), &xe); /* If X is not finite or is null return it (with raising exceptions - if necessary. */ - if (xe == 0) + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) return x + x; u = (0.492659620528969547 + (0.697570460207922770 diff --git a/sysdeps/libm-ieee754/s_cbrtl.c b/sysdeps/libm-ieee754/s_cbrtl.c index b3a53a39e1..1d021b7c3c 100644 --- a/sysdeps/libm-ieee754/s_cbrtl.c +++ b/sysdeps/libm-ieee754/s_cbrtl.c @@ -48,8 +48,10 @@ __cbrtl (long double x) xm = __frexpl (fabs (x), &xe); /* If X is not finite or is null return it (with raising exceptions - if necessary. */ - if (xe == 0) + if necessary. + Note: *Our* version of `frexp' sets XE to zero if the argument is + Inf or NaN. This is not portable but faster. */ + if (xe == 0 && fpclassify (x) <= FP_ZERO) return x + x; u = (0.338058687610520237 diff --git a/sysdeps/unix/bsd/sun/sethostid.c b/sysdeps/unix/bsd/sun/sethostid.c index a8951fa7d5..aeb2940f42 100644 --- a/sysdeps/unix/bsd/sun/sethostid.c +++ b/sysdeps/unix/bsd/sun/sethostid.c @@ -1 +1 @@ -#include <sysdeps/stub/sethostid.c> +#include <sysdeps/generic/sethostid.c> diff --git a/sysdeps/unix/inet/syscalls.list b/sysdeps/unix/inet/syscalls.list index 976cc1892c..772d2390b5 100644 --- a/sysdeps/unix/inet/syscalls.list +++ b/sysdeps/unix/inet/syscalls.list @@ -1,20 +1,20 @@ # File name Caller Syscall name # args Strong name Weak names -accept - accept 3 accept +accept - accept 3 __libc_accept accept bind - bind 3 bind -connect - connect 3 __connect connect +connect - connect 3 __libc_connect __connect connect gethostid - gethostid 0 gethostid gethostname - gethostname 2 __gethostname gethostname getpeername - getpeername 3 getpeername getsockname - getsockname 3 getsockname getsockopt - getsockopt 5 getsockopt listen - listen 2 listen -recv - recv 4 recv -recvfrom - recvfrom 6 recvfrom -recvmsg - recvmsg 3 recvmsg -send - send 4 __send send -sendmsg - sendmsg 3 sendmsg -sendto - sendto 6 sendto +recv - recv 4 __libc_recv recv +recvfrom - recvfrom 6 __libc_recvfrom recvfrom +recvmsg - recvmsg 3 __libc_recvmsg recvmsg +send - send 4 __libc_send __send send +sendmsg - sendmsg 3 __libc_sendmsg sendmsg +sendto - sendto 6 __libc_sendto sendto sethostid - sethostid 1 sethostid sethostname - sethostname 2 sethostname setsockopt - setsockopt 5 setsockopt diff --git a/sysdeps/unix/sysv/irix4/reboot.c b/sysdeps/unix/sysv/irix4/reboot.c index d7a3659d2b..4d90e6fc56 100644 --- a/sysdeps/unix/sysv/irix4/reboot.c +++ b/sysdeps/unix/sysv/irix4/reboot.c @@ -1 +1 @@ -#include <sysdeps/stub/reboot.c> +#include <sysdeps/generic/reboot.c> diff --git a/sysdeps/unix/sysv/irix4/swapon.c b/sysdeps/unix/sysv/irix4/swapon.c index 86a638fdc5..54885a883e 100644 --- a/sysdeps/unix/sysv/irix4/swapon.c +++ b/sysdeps/unix/sysv/irix4/swapon.c @@ -1 +1 @@ -#include <sysdeps/stub/swapon.c> +#include <sysdeps/generic/swapon.c> diff --git a/time/tzfile.c b/time/tzfile.c index 4b891b469c..e3cb299fe1 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -421,7 +421,7 @@ __tzfile_compute (time_t timer, int use_localtime, { struct ttinfo *info = find_transition (timer); __daylight = info->isdst; - __timezone = info->offset; + __timezone = -info->offset; for (i = 0; i < num_types && i < sizeof (__tzname) / sizeof (__tzname[0]); ++i) diff --git a/time/tzset.c b/time/tzset.c index dcee9dd66c..385e7f7633 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -548,7 +548,7 @@ tz_compute (timer, tm) return 0; __daylight = timer >= tz_rules[0].change && timer < tz_rules[1].change; - __timezone = tz_rules[__daylight ? 1 : 0].offset; + __timezone = -tz_rules[__daylight ? 1 : 0].offset; __tzname[0] = (char *) tz_rules[0].name; __tzname[1] = (char *) tz_rules[1].name; |