diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-08-09 02:46:09 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-08-09 02:46:09 +0000 |
commit | a5113b141cd85a98b4711607c430e6e01775bd9a (patch) | |
tree | 5e345c0560b177c68320fa8a467215352996bb35 | |
parent | 233963756b2ef272f8876afec2a2bb629b425e0c (diff) | |
download | glibc-a5113b141cd85a98b4711607c430e6e01775bd9a.zip glibc-a5113b141cd85a98b4711607c430e6e01775bd9a.tar.gz glibc-a5113b141cd85a98b4711607c430e6e01775bd9a.tar.bz2 |
Thu Aug 8 16:17:38 1996 Ulrich Drepper <drepper@cygnus.com>
* pwd/getpwent.c: Define BUFLEN from NSS_BUFLEN_PASSWD.
* pwd/getpwent_r.c: Likewise.
* pwd/getpwnam.c: Likewise.
* pwd/getpwnam_r.c: Likewise.
* pwd/getpwuid.c: Likewise.
* pwd/getpwuid_r.c: Likewise.
* grp/getgrent.c: Define BUFLEN from NSS_BUFLEN_GROUP.
* grp/getgrent_r.c: Likewise.
* grp/getgrgid.c: Likewise.
* grp/getgrgid_r.c: Likewise.
* grp/getgrnam.c: Likewise.
* pwd/fgetpwent_r.c: New file. Reentrant version of fgetpwent.
* pwd/fgetpwent.c: Rewrite to use fgetpwent_r.
* pwd/Makefile (routines): Add fgetpwent_r.
* pwd/pwd.h: Add prototypes for __fgetpwent_r and fgetpwent_r.
* grp/fgetgrent_r.c: New file. Reentrant version of fgetgrent.
* grp/fgetgrent.c: Rewrite to use fgetgrent_r.
* grp/Makefile (routines): Add fgetgrent_r.
* grp/grp.h: Add prototypes for __fgetgrent_r and fgetgrent_r.
Implement shadow password lookup functions. This is no complete
shadow password suite.
* shadow/Makefile: New file.
* shadow/fgetspent.c: New file.
* shadow/fgetspent_r.c: New file.
* shadow/getspent.c: New file.
* shadow/getspent_r.c: New file.
* shadow/getspnam.c: New file.
* shadow/getspnam_r.c: New file.
* shadow/putspent.c: New file.
* shadow/sgetspent.c: New file.
* shadow/sgetspent_r.c: New file.
* shadow/shadow.h: New file.
* shadow/spwd-lookup.c: New file.
* shadow/nss_files/files-spwd.c: New file.
Thu Aug 8 13:33:45 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/ftime.c: New file. Available system
call is only a stub.
Reported by Matthias Urlichs.
* Makeconfig [!default_cflags]: Change default value from `-g'
to `-g -O'.
* configure.in: Recognize i686.
* sysdeps/i386/i686/Implies: Default on i586 optimized code.
Thu Aug 8 12:40:20 1996 Matthias Urlichs <smurf@smurf.noris.de>
* Makeconfig [$(build-omitfp) == yes]: Add to CFLAGS-.so
value of CFLAGS-.o, not CFLAGS-o.
* sysdeps/unix/sysv/linux/init-first.c (init): Add volatile
pointer to ourself. Otherwise `gcc -O3' optimized init away.
sure that all tables in binary file are word-aligned.
40 files changed, 755 insertions, 444 deletions
@@ -1,3 +1,64 @@ +Thu Aug 8 16:17:38 1996 Ulrich Drepper <drepper@cygnus.com> + + * pwd/getpwent.c: Define BUFLEN from NSS_BUFLEN_PASSWD. + * pwd/getpwent_r.c: Likewise. + * pwd/getpwnam.c: Likewise. + * pwd/getpwnam_r.c: Likewise. + * pwd/getpwuid.c: Likewise. + * pwd/getpwuid_r.c: Likewise. + + * grp/getgrent.c: Define BUFLEN from NSS_BUFLEN_GROUP. + * grp/getgrent_r.c: Likewise. + * grp/getgrgid.c: Likewise. + * grp/getgrgid_r.c: Likewise. + * grp/getgrnam.c: Likewise. + + * pwd/fgetpwent_r.c: New file. Reentrant version of fgetpwent. + * pwd/fgetpwent.c: Rewrite to use fgetpwent_r. + * pwd/Makefile (routines): Add fgetpwent_r. + * pwd/pwd.h: Add prototypes for __fgetpwent_r and fgetpwent_r. + + * grp/fgetgrent_r.c: New file. Reentrant version of fgetgrent. + * grp/fgetgrent.c: Rewrite to use fgetgrent_r. + * grp/Makefile (routines): Add fgetgrent_r. + * grp/grp.h: Add prototypes for __fgetgrent_r and fgetgrent_r. + + Implement shadow password lookup functions. This is no complete + shadow password suite. + * shadow/Makefile: New file. + * shadow/fgetspent.c: New file. + * shadow/fgetspent_r.c: New file. + * shadow/getspent.c: New file. + * shadow/getspent_r.c: New file. + * shadow/getspnam.c: New file. + * shadow/getspnam_r.c: New file. + * shadow/putspent.c: New file. + * shadow/sgetspent.c: New file. + * shadow/sgetspent_r.c: New file. + * shadow/shadow.h: New file. + * shadow/spwd-lookup.c: New file. + * shadow/nss_files/files-spwd.c: New file. + +Thu Aug 8 13:33:45 1996 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/unix/sysv/linux/ftime.c: New file. Available system + call is only a stub. + Reported by Matthias Urlichs. + + * Makeconfig [!default_cflags]: Change default value from `-g' + to `-g -O'. + + * configure.in: Recognize i686. + * sysdeps/i386/i686/Implies: Default on i586 optimized code. + +Thu Aug 8 12:40:20 1996 Matthias Urlichs <smurf@smurf.noris.de> + + * Makeconfig [$(build-omitfp) == yes]: Add to CFLAGS-.so + value of CFLAGS-.o, not CFLAGS-o. + + * sysdeps/unix/sysv/linux/init-first.c (init): Add volatile + pointer to ourself. Otherwise `gcc -O3' optimized init away. + Thu Aug 8 01:41:43 1996 Ulrich Drepper <drepper@cygnus.com> * elf/Makefile: Undo change of Tue Aug 6 14:27:11 1996. @@ -479,7 +540,7 @@ Mon Jul 29 02:46:23 1996 Ulrich Drepper <drepper@cygnus.com> warning. * locale/programs/ld-ctype.c (ctype_output): Add code to make - sure that all tables in binary file are words aligned. + sure that all tables in binary file are word-aligned. * locale/programs/locfile.c (write_locale_data): Correct handling of LC_MESSAGES locale. Create directory if necessary. @@ -4,16 +4,13 @@ Library Maintenance How to Install the GNU C Library ================================ - Installation of the GNU C library is relatively simple. - - You need the latest version of GNU `make'. Modifying the GNU C -Library to work with other `make' programs would be so hard that we -recommend you port GNU `make' instead. *Really.* + Installation of the GNU C library is relatively simple, but usually +requires several GNU tools to be installed already. To configure the GNU C library for your system, run the shell script `configure' with `sh'. Use an argument which is the conventional GNU name for your system configuration--for example, `sparc-sun-sunos4.1', -for a Sun 4 running Sunos 4.1. *Note Installation: +for a Sun 4 running SunOS 4.1. *Note Installation: (gcc.info)Installation, for a full description of standard GNU configuration names. If you omit the configuration name, `configure' will try to guess one for you by inspecting the system it is running @@ -21,46 +18,6 @@ on. It may or may not be able to come up with a guess, and the its guess might be wrong. `configure' will tell you the canonical name of the chosen configuration before proceeding. - The GNU C Library currently supports configurations that match the -following patterns: - - alpha-dec-osf1 - i386-ANYTHING-bsd4.3 - i386-ANYTHING-gnu - i386-ANYTHING-isc2.2 - i386-ANYTHING-isc3.N - i386-ANYTHING-sco3.2 - i386-ANYTHING-sco3.2v4 - i386-ANYTHING-sysv - i386-ANYTHING-sysv4 - i386-force_cpu386-none - i386-sequent-bsd - i960-nindy960-none - m68k-hp-bsd4.3 - m68k-mvme135-none - m68k-mvme136-none - m68k-sony-newsos3 - m68k-sony-newsos4 - m68k-sun-sunos4.N - mips-dec-ultrix4.N - mips-sgi-irix4.N - sparc-sun-solaris2.N - sparc-sun-sunos4.N - - While no other configurations are supported, there are handy aliases -for these few. (These aliases work in other GNU software as well.) - - decstation - hp320-bsd4.3 hp300bsd - i386-sco - i386-sco3.2v4 - i386-sequent-dynix - i386-svr4 - news - sun3-sunos4.N sun3 - sun4-solaris2.N sun4-sunos5.N - sun4-sunos4.N sun4 - Here are some options that you should specify (if appropriate) when you run `configure': @@ -76,8 +33,15 @@ you run `configure': building the GNU C Library. On some systems, the library may not build properly if you do *not* use `gas'. +`--with-gnu-binutils' + This option implies both `--with-gnu-ld' and `--with-gnu-as'. On + systems where GNU tools are the system tools, there is no need to + specify this option. These include GNU, GNU/Linux, and free BSD + systems. + +`--without-fp' `--nfp' - Use this option if your computer lacks hardware floating point + Use this option if your computer lacks hardware floating-point support. `--prefix=DIRECTORY' @@ -89,6 +53,29 @@ you run `configure': subdirectories of `DIRECTORY'. (You can also set this in `configparms'; see below.) +`--enable-shared' +`--disable-shared' + Enable or disable building of an ELF shared library on systems that + support it. The default is to build the shared library on systems + using ELF when the GNU `binutils' are available. + +`--enable-profile' +`--disable-profile' + Enable or disable building of the profiled C library, `-lc_p'. The + default is to build the profiled library. You may wish to disable + it if you don't plan to do profiling, because it doubles the build + time of compiling just the unprofiled static library. + +`--enable-omitfp' + Enable building a highly-optimized but possibly undebuggable + static C library. This causes the normal static and shared (if + enabled) C libraries to be compiled with maximal optimization, + including the `-fomit-frame-pointer' switch that makes debugging + impossible on many machines, and without debugging information + (which makes the binaries substantially smaller). An additional + static library is compiled with no optimization and full debugging + information, and installed as `-lc_g'. + The simplest way to run `configure' is to do it in the directory that contains the library sources. This prepares to build the library in that very directory. @@ -141,57 +128,101 @@ work with object files for the target you configured for. in the GNU C compiler, so you may need to compile the library with GCC. (In fact, all of the existing complete ports require GCC.) - The current release of the C library contains some header files that -the compiler normally provides: `stddef.h', `stdarg.h', and several -files with names of the form `va-MACHINE.h'. The versions of these -files that came with older releases of GCC do not work properly with -the GNU C library. The `stddef.h' file in release 2.2 and later of GCC -is correct. If you have release 2.2 or later of GCC, use its version -of `stddef.h' instead of the C library's. To do this, put the line -`override stddef.h =' in `configparms'. The other files are corrected -in release 2.3 and later of GCC. `configure' will automatically detect -whether the installed `stdarg.h' and `va-MACHINE.h' files are -compatible with the C library, and use its own if not. - - There is a potential problem with the `size_t' type and versions of -GCC prior to release 2.4. ANSI C requires that `size_t' always be an -unsigned type. For compatibility with existing systems' header files, -GCC defines `size_t' in `stddef.h' to be whatever type the system's -`sys/types.h' defines it to be. Most Unix systems that define `size_t' -in `sys/types.h', define it to be a signed type. Some code in the -library depends on `size_t' being an unsigned type, and will not work -correctly if it is signed. - - The GNU C library code which expects `size_t' to be unsigned is -correct. The definition of `size_t' as a signed type is incorrect. -Versions 2.4 and later of GCC always define `size_t' as an unsigned -type, and GCC's `fixincludes' script massages the system's -`sys/types.h' so as not to conflict with this. - - In the meantime, we work around this problem by telling GCC -explicitly to use an unsigned type for `size_t' when compiling the GNU C -library. `configure' will automatically detect what type GCC uses for -`size_t' arrange to override it if necessary. - - To build the library, type `make lib'. This will produce a lot of -output, some of which looks like errors from `make' (but isn't). Look -for error messages from `make' containing `***'. Those indicate that -something is really wrong. + To build the library and related programs, type `make'. This will +produce a lot of output, some of which may look like errors from `make' +(but isn't). Look for error messages from `make' containing `***'. +Those indicate that something is really wrong. To build and run some test programs which exercise some of the -library facilities, type `make tests'. This will produce several files +library facilities, type `make check'. This will produce several files with names like `PROGRAM.out'. To format the `GNU C Library Reference Manual' for printing, type -`make dvi'. To format the Info version of the manual for on line -reading with `C-h i' in Emacs or with the `info' program, type -`make info'. +`make dvi'. To install the library and its header files, and the Info files of -the manual, type `make install', after setting the installation -directories in `configparms'. This will build things if necessary, +the manual, type `make install'. This will build things if necessary, before installing them. +Recommended Tools to Install the GNU C Library +---------------------------------------------- + + We recommend installing the following GNU tools before attempting to +build the GNU C library: + + * `make' 3.75 + + You need the latest version of GNU `make'. Modifying the GNU C + Library to work with other `make' programs would be so hard that we + recommend you port GNU `make' instead. *Really.* We recommend + version GNU `make' version 3.75 or later. + + * GCC 2.7.2 + + On most platforms, the GNU C library can only be compiled with the + GNU C compiler. We recommend GCC version 2.7.2 or later; earlier + versions may have problems. + + * `binutils' 2.6 + + Using the GNU `binutils' (assembler, linker, and related tools) is + preferable when possible, and they are required to build an ELF + shared C library. We recommend `binutils' version 2.6 or later; + earlier versions are known to have problems. + +Supported Configurations +------------------------ + + The GNU C Library currently supports configurations that match the +following patterns: + + alpha-dec-osf1 + alpha-ANYTHING-linux + alpha-ANYTHING-linuxecoff + iX86-ANYTHING-bsd4.3 + iX86-ANYTHING-gnu + iX86-ANYTHING-isc2.2 + iX86-ANYTHING-isc3.N + iX86-ANYTHING-linux + iX86-ANYTHING-sco3.2 + iX86-ANYTHING-sco3.2v4 + iX86-ANYTHING-sysv + iX86-ANYTHING-sysv4 + iX86-force_cpu386-none + iX86-sequent-bsd + i960-nindy960-none + m68k-hp-bsd4.3 + m68k-mvme135-none + m68k-mvme136-none + m68k-sony-newsos3 + m68k-sony-newsos4 + m68k-sun-sunos4.N + mips-dec-ultrix4.N + mips-sgi-irix4.N + sparc-sun-solaris2.N + sparc-sun-sunos4.N + + Each case of `iX86' can be `i386', `i486', `i586', or `i686'.. All +of those configurations produce a library that can run on any of these +processors. The library will be optimized for the specified processor, +but will not use instructions not available on all of them. + + While no other configurations are supported, there are handy aliases +for these few. (These aliases work in other GNU software as well.) + + decstation + hp320-bsd4.3 hp300bsd + i486-gnu + i586-linux + i386-sco + i386-sco3.2v4 + i386-sequent-dynix + i386-svr4 + news + sun3-sunos4.N sun3 + sun4-solaris2.N sun4-sunos5.N + sun4-sunos4.N sun4 + Reporting Bugs ============== @@ -246,8 +277,10 @@ But what they do is fairly straightforward, and only requires that you define a few variables in the right places. The library sources are divided into subdirectories, grouped by -topic. The `string' subdirectory has all the string-manipulation -functions, `stdio' has all the standard I/O functions, etc. +topic. + + The `string' subdirectory has all the string-manipulation functions, +`math' has all the mathematical functions, etc. Each subdirectory contains a simple makefile, called `Makefile', which defines a few `make' variables and then includes the global @@ -283,7 +316,9 @@ The basic variables that a subdirectory makefile defines are: data in a file called `TEST-PROGRAM.input'; it will be given to the test program on its standard input. If a test program wants to be run with arguments, put the arguments (all on a single line) - in a file called `TEST-PROGRAM.args'. + in a file called `TEST-PROGRAM.args'. Test programs should exit + with zero status when the test passes, and nonzero status when the + test indicates a bug in the library or error in building. `others' The names of "other" programs associated with this section of the @@ -362,18 +397,24 @@ So the final list is `unix/bsd/vax unix/bsd unix/inet unix posix'. `sysdeps' has two "special" subdirectories, called `generic' and `stub'. These two are always implicitly appended to the list of subdirectories (in that order), so you needn't put them in an `Implies' -file, and you should not create any subdirectories under them. -`generic' is for things that can be implemented in machine-independent -C, using only other machine-independent functions in the C library. -`stub' is for "stub" versions of functions which cannot be implemented -on a particular machine or operating system. The stub functions always -return an error, and set `errno' to `ENOSYS' (Function not -implemented). *Note Error Reporting::. +file, and you should not create any subdirectories under them intended +to be new specific categories. `generic' is for things that can be +implemented in machine-independent C, using only other +machine-independent functions in the C library. `stub' is for "stub" +versions of functions which cannot be implemented on a particular +machine or operating system. The stub functions always return an +error, and set `errno' to `ENOSYS' (Function not implemented). *Note +Error Reporting::. A source file is known to be system-dependent by its having a -version in `generic' or `stub'; every system-dependent function should -have either a generic or stub implementation (there is no point in -having both). +version in `generic' or `stub'; every generally-available function whose +implementation is system-dependent in should have either a generic or +stub implementation (there is no point in having both). 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 `generic' and `stub' +directories), only in the system-dependent `Makefile' in the specific +system's subdirectory. If you come across a file that is in one of the main source directories (`string', `stdio', etc.), and you want to write a machine- @@ -629,18 +670,106 @@ generated are `ioctls.h', `errnos.h', `sys/param.h', and `errlist.c' Contributors to the GNU C Library ================================= - The GNU C library was written almost entirely by Roland McGrath, who -now maintains it. Some parts of the library were contributed or worked -on by other people. + The GNU C library was written originally by Roland McGrath. Some +parts of the library were contributed or worked on by other people. * The `getopt' function and related code were written by Richard Stallman, David J. MacKenzie, and Roland McGrath. - * Most of the math functions are taken from 4.4 BSD; they have been - modified only slightly to work with the GNU C library. The - Internet-related code (most of the `inet' subdirectory) and several - other miscellaneous functions and header files have been included - with little or no modification. + * The merge sort function `qsort' was written by Michael J. Haertel. + + * The quick sort function used as a fallback by `qsort' was written + by Douglas C. Schmidt. + + * The memory allocation functions `malloc', `realloc' and `free' and + related code were written by Michael J. Haertel. + + * Fast implementations of many of the string functions (`memcpy', + `strlen', etc.) were written by Torbjorn Granlund. + + * The `tar.h' header file was written by David J. MacKenzie. + + * The port to the MIPS DECStation running Ultrix 4 + (`mips-dec-ultrix4') was contributed by Brendan Kehoe and Ian + Lance Taylor. + + * The DES encryption function `crypt' and related functions were + contributed by Michael Glad. + + * The `ftw' function was contributed by Ian Lance Taylor. + + * The startup code to support SunOS shared libraries was contributed + by Tom Quinn. + + * The `mktime' function was contributed by Paul Eggert. + + * The port to the Sequent Symmetry running Dynix version 3 + (`i386-sequent-bsd') was contributed by Jason Merrill. + + * The timezone support code is derived from the public-domain + timezone package by Arthur David Olson and his many contributors. + + * The port to the DEC Alpha running OSF/1 (`alpha-dec-osf1') was + contributed by Brendan Kehoe, using some code written by Roland + McGrath. + + * The port to SGI machines running Irix 4 (`mips-sgi-irix4') was + contributed by Tom Quinn. + + * The port of the Mach and Hurd code to the MIPS architecture + (`mips-ANYTHING-gnu') was contributed by Kazumoto Kojima. + + * The floating-point printing function used by `printf' and friends + and the floating-point reading function used by `scanf', `strtod' + and friends were written by Ulrich Drepper. The multi-precision + integer functions used in those functions are taken from GNU MP, + which was contributed by Torbjorn Granlund. + + * The internationalization support in the library, and the support + programs `locale' and `localedef', were written by Ulrich Drepper. + Ulrich Drepper adapted the support code for message catalogs + (`libintl.h', etc.) from the GNU `gettext' package, which he also + wrote. He also contributed the `catgets' support and the entire + suite of multi-byte and wide-character support functions + (`wctype.h', `wchar.h', etc.). + + * The implementations of the `nsswitch.conf' mechanism and the files + and DNS backends for it were designed and written by Ulrich + Drepper and Roland McGrath, based on a backend interface defined + by Peter Eriksson. + + * The port to Linux i386/ELF (`i386-ANYTHING-linux') was contributed + by Ulrich Drepper, based in large part on work done in Hongjiu + Lu's Linux version of the GNU C Library. + + * The port to Linux/m68k (`m68k-ANYTHING-linux') was contributed by + Andreas Schwab. + + * Richard Henderson contributed the ELF dynamic linking code and + other support for the Alpha processor. + + * David Mosberger-Tang contributed the port to Linux/Alpha + (`alpha-ANYTHING-linux'). + + * Stephen R. van den Berg contributed a highly-optimized `strstr' + function. + + * Ulrich Drepper contributed the `hsearch' and `drand48' families of + functions; reentrant `...`_r'' versions of the `random' family; + System V shared memory and IPC support code; and several + highly-optimized string functions for iX86 processors. + + * The math functions are taken from `fdlibm-5.1' by Sun + Microsystems, as modified by J.T. Conklin, Ian Lance Taylor, + Ulrich Drepper, Andreas Schwab, and Roland McGrath. + + * The `libio' library used to implement `stdio' functions on some + platforms was written by Per Bothner and modified by Ulrich + Drepper. + + * The Internet-related code (most of the `inet' subdirectory) and + several other miscellaneous functions and header files have been + included from 4.4 BSD with little or no modification. All code incorporated from 4.4 BSD is under the following copyright: @@ -694,70 +823,7 @@ on by other people. changes to fit into the GNU C library and to fit the ANSI C standard, but the functional code is Berkeley's. - * The merge sort function `qsort' was written by Michael J. Haertel. - - * The quick sort function used as a fallback by `qsort' was written - by Douglas C. Schmidt. - - * The memory allocation functions `malloc', `realloc' and `free' and - related code were written by Michael J. Haertel. - - * Fast implementations of many of the string functions (`memcpy', - `strlen', etc.) were written by Torbjorn Granlund. - - * Some of the support code for Mach is taken from Mach 3.0 by CMU, - and is under the following copyright terms: - - Mach Operating System - Copyright (C) 1991,1990,1989 Carnegie Mellon University - All Rights Reserved. - - Permission to use, copy, modify and distribute this software - and its documentation is hereby granted, provided that both - the copyright notice and this permission notice appear in all - copies of the software, derivative works or modified - versions, and any portions thereof, and that both notices - appear in supporting documentation. - - CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS - IS" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF - ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF - THIS SOFTWARE. - - Carnegie Mellon requests users of this software to return to - - Software Distribution Coordinator - School of Computer Science - Carnegie Mellon University - Pittsburgh PA 15213-3890 - - or `Software.Distribution@CS.CMU.EDU' any improvements or - extensions that they make and grant Carnegie Mellon the - rights to redistribute these changes. - - * The `tar.h' header file was written by David J. MacKenzie. - - * The port to the MIPS DECStation running Ultrix 4 - (`mips-dec-ultrix4') was contributed by Brendan Kehoe and Ian - Lance Taylor. - - * The DES encryption function `crypt' and related functions were - contributed by Michael Glad. - - * The `ftw' function was contributed by Ian Lance Taylor. - - * The code to support SunOS shared libraries was contributed by Tom - Quinn. - - * The `mktime' function was contributed by Noel Cragg. - - * The port to the Sequent Symmetry running Dynix version 3 - (`i386-sequent-bsd') was contributed by Jason Merrill. - - * The timezone support code is derived from the public-domain - timezone package by Arthur David Olson. - - * The Internet resolver code is taken directly from BIND 4.9.1, + * The Internet resolver code is taken directly from BIND 4.9.4, which is under both the Berkeley copyright above and also: Portions Copyright (C) 1993 by Digital Equipment Corporation. @@ -780,15 +846,6 @@ on by other people. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * The port to the DEC Alpha running OSF/1 (`alpha-dec-osf1') was - contributed by Brendan Kehoe, using some code written by Roland - McGrath. - - * The floating-point printing function used by `printf' and friends - was written by Roland McGrath and Torbjorn Granlund. The - multi-precision integer functions used in that function are taken - from GNU MP, which was contributed by Torbjorn Granlund. - * The code to support Sun RPC is taken verbatim from Sun's RPCSRC-4.0 distribution, and is covered by this copyright: @@ -824,9 +881,33 @@ on by other people. 2550 Garcia Avenue Mountain View, California 94043 - * The port to SGI machines running Irix 4 (`mips-sgi-irix4') was - contributed by Tom Quinn. + * Some of the support code for Mach is taken from Mach 3.0 by CMU, + and is under the following copyright terms: - * The port of the Mach and Hurd code to the MIPS architecture - (`mips-ANYTHING-gnu') was contribued by Kazumoto Kojima. + Mach Operating System + Copyright (C) 1991,1990,1989 Carnegie Mellon University + All Rights Reserved. + + Permission to use, copy, modify and distribute this software + and its documentation is hereby granted, provided that both + the copyright notice and this permission notice appear in all + copies of the software, derivative works or modified + versions, and any portions thereof, and that both notices + appear in supporting documentation. + + CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS + IS" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF + ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF + THIS SOFTWARE. + + Carnegie Mellon requests users of this software to return to + + Software Distribution Coordinator + School of Computer Science + Carnegie Mellon University + Pittsburgh PA 15213-3890 + + or `Software.Distribution@CS.CMU.EDU' any improvements or + extensions that they make and grant Carnegie Mellon the + rights to redistribute these changes. diff --git a/catgets/catgets.c b/catgets/catgets.c index ca0fdd6..eae962f 100644 --- a/catgets/catgets.c +++ b/catgets/catgets.c @@ -41,7 +41,7 @@ catopen (const char *cat_name, int flag) result->status = closed; - result->cat_name = strdup (cat_name); + result->cat_name = __strdup (cat_name); if (result->cat_name == NULL) { free (result); @@ -71,7 +71,7 @@ catopen (const char *cat_name, int flag) env_var = "C"; } - result->env_var = strdup (env_var); + result->env_var = __strdup (env_var); if (result->env_var == NULL) { free ((void *) result->cat_name); @@ -80,9 +80,9 @@ catopen (const char *cat_name, int flag) } if (getenv ("NLSPATH") != NULL) - result->nlspath = strdup (getenv ("NLSPATH")); + result->nlspath = __strdup (getenv ("NLSPATH")); else - result->nlspath = strdup (NLSPATH); + result->nlspath = __strdup (NLSPATH); if (result->nlspath == NULL) { diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c index 9a8c7e6..2a52877 100644 --- a/catgets/open_catalog.c +++ b/catgets/open_catalog.c @@ -79,12 +79,12 @@ __open_catalog (__nl_catd catalog, int with_path) case 'N': /* Use the catalog name. */ ENOUGH (strlen (catalog->cat_name)); - bufact = stpcpy (&buf[bufact], catalog->cat_name) - buf; + bufact = __stpcpy (&buf[bufact], catalog->cat_name) - buf; break; case 'L': /* Use the current locale category value. */ ENOUGH (strlen (catalog->env_var)); - bufact = stpcpy (&buf[bufact], catalog->env_var) - buf; + bufact = __stpcpy (&buf[bufact], catalog->env_var) - buf; break; case 'l': /* Use language element of locale category value. */ @@ -152,7 +152,7 @@ __open_catalog (__nl_catd catalog, int with_path) if (bufact != 0) { - fd = open (buf, O_RDONLY); + fd = __open (buf, O_RDONLY); if (fd >= 0) break; } @@ -161,7 +161,7 @@ __open_catalog (__nl_catd catalog, int with_path) } } - if (fd < 0 || fstat (fd, &st) < 0) + if (fd < 0 || __fstat (fd, &st) < 0) { catalog->status = nonexisting; return; @@ -181,8 +181,8 @@ __open_catalog (__nl_catd catalog, int with_path) #endif catalog->file_size = st.st_size; catalog->file_ptr = - (struct catalog_obj *) mmap (NULL, st.st_size, PROT_READ, - MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0); + (struct catalog_obj *) __mmap (NULL, st.st_size, PROT_READ, + MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0); if (catalog->file_ptr != (struct catalog_obj *) -1) /* Tell the world we managed to mmap the file. */ catalog->status = mmaped; @@ -201,8 +201,8 @@ __open_catalog (__nl_catd catalog, int with_path) /* Save read, handle partial reads. */ do { - size_t now = read (fd, (((char *) &catalog->file_ptr) - + (st.st_size - todo)), todo); + size_t now = __read (fd, (((char *) &catalog->file_ptr) + + (st.st_size - todo)), todo); if (now == 0) { free ((void *) catalog->file_ptr); @@ -216,7 +216,7 @@ __open_catalog (__nl_catd catalog, int with_path) } /* We don't need the file anymore. */ - close (fd); + __close (fd); /* Determine whether the file is a catalog file and if yes whether it is written using the correct byte order. Else we have to swap @@ -230,7 +230,7 @@ __open_catalog (__nl_catd catalog, int with_path) /* Illegal file. Free he resources and mark catalog as not usable. */ if (catalog->status == mmaped) - munmap ((void *) catalog->file_ptr, catalog->file_size); + __munmap ((void *) catalog->file_ptr, catalog->file_size); else free (catalog->file_ptr); catalog->status = nonexisting; @@ -2,7 +2,7 @@ # From configure.in CVSid # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.99 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -355,7 +355,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.99" exit 0 ;; -with-* | --with-*) @@ -682,6 +682,7 @@ done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi +ac_config_mkinstalldirs=$ac_aux_dir/mkinstalldirs ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. @@ -745,7 +746,7 @@ case "$machine" in a29k | am29000) base_machine=a29k machine=a29k ;; alpha*) base_machine=alpha machine=alpha/$machine ;; hppa*) base_machine=hppa machine=hppa/$machine ;; -i[345]86) base_machine=i386 machine=i386/$machine ;; +i[3456]86) base_machine=i386 machine=i386/$machine ;; m680?0) base_machine=m68k machine=m68k/$machine ;; m68k) base_machine=m68k machine=m68k/m68020 ;; m88???) base_machine=m88k machine=m88k/$machine ;; @@ -973,6 +974,10 @@ fi fi echo "$ac_t""$INSTALL" 1>&6 +# The purpose of this command is only to make sure the auxiliary path +# is set and that the symbol AC_REQUIRE_AC_PROG_MKINSTALLDIRS is set. + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' @@ -1134,13 +1139,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1138 "configure" +#line 1143 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1149,13 +1154,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1153 "configure" +#line 1158 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1297,7 +1302,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1301 "configure" +#line 1306 "configure" #include "confdefs.h" #define __need_size_t #define __need_wchar_t @@ -1313,7 +1318,7 @@ size_t size; wchar_t wchar; if (&size == NULL || &wchar == NULL) abort (); ; return 0; } EOF -if { (eval echo configure:1317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_friendly_stddef=yes else @@ -1420,7 +1425,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1424 "configure" +#line 1429 "configure" #include "confdefs.h" int main() { return 0; } @@ -1430,7 +1435,7 @@ asm (".section .init"); asm (".text"); ; return 0; } EOF -if { (eval echo configure:1434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libc_cv_have_initfini=yes else @@ -1458,7 +1463,7 @@ if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1462 "configure" +#line 1467 "configure" #include "confdefs.h" asm ("_glibc_foobar:"); int main() { return 0; } @@ -1466,7 +1471,7 @@ int t() { glibc_foobar (); ; return 0; } EOF -if { (eval echo configure:1470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* libc_cv_asm_underscores=yes else @@ -1558,7 +1563,7 @@ _start () {} EOF if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles -Wl,--no-whole-archive - -o conftest conftest.c'; { (eval echo configure:1562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + -o conftest conftest.c'; { (eval echo configure:1567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then libc_cv_ld_no_whole_archive=yes else libc_cv_ld_no_whole_archive=no @@ -1769,7 +1774,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.10" + echo "$CONFIG_STATUS generated by autoconf version 2.99" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; diff --git a/elf/Makefile b/elf/Makefile index a19a8b4..cf9eaa8 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -69,8 +69,6 @@ $(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so) $(reloc-link) $^ # Link together the dynamic linker into a single relocatable object. -# We use this to produce both the ABI-compliant and Linux-compatible -# dynamic linker shared objects below. $(objpfx)librtld.so: $(objpfx)dl-allobjs.so $(common-objpfx)libc_pic.a $(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)' diff --git a/elf/dl-open.c b/elf/dl-open.c index 021c4be..9dda31e 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -97,7 +97,7 @@ _dl_open (const char *file, int mode) else { if (_dl_global_scope_alloc < - _dl_global_scope_end - _dl_global_scope + 2) + (size_t) (_dl_global_scope_end - _dl_global_scope + 2)) { /* Must extend the list. */ struct link_map **new = realloc (_dl_global_scope, diff --git a/elf/dl-support.c b/elf/dl-support.c index 50ebfbf..03c9d9c 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -20,6 +20,8 @@ Cambridge, MA 02139, USA. */ #include <assert.h> #include <fcntl.h> #include <unistd.h> +#include <sys/mman.h> +#include <sys/stat.h> /* This file defines some things that for the dynamic linker are defined in rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */ @@ -46,3 +48,38 @@ _dl_sysdep_fatal (void) { assert (! "_dl_sysdep_fatal called"); } + +/* Read the whole contents of FILE into new mmap'd space with given + protections. *SIZEP gets the size of the file. */ + +void * +_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) +{ + void *result; + struct stat st; + int fd = __open (file, O_RDONLY); + if (fd < 0) + return NULL; + if (__fstat (fd, &st) < 0) + result = NULL; + else + { + /* Map a copy of the file contents. */ + result = __mmap (0, st.st_size, prot, +#ifdef MAP_COPY + MAP_COPY +#else + MAP_PRIVATE +#endif +#ifdef MAP_FILE + | MAP_FILE +#endif + , fd, 0); + if (result == (void *) -1) + result = NULL; + else + *sizep = st.st_size; + } + __close (fd); + return result; +} diff --git a/locale/C-ctype.c b/locale/C-ctype.c index ab7e68e..6daeb1d 100644 --- a/locale/C-ctype.c +++ b/locale/C-ctype.c @@ -42,7 +42,7 @@ const char _nl_C_LC_CTYPE_class[768] = /* 0xec */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" /* 0xf2 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" /* 0xf8 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" - /* 0xfe */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" + /* 0xfe */ "\002\000" "\000\000" "\002\000" "\002\000" "\002\000" "\002\000" /* 0x04 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\003\040" /* 0x0a */ "\002\040" "\002\040" "\002\040" "\002\040" "\002\000" "\002\000" /* 0x10 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" @@ -342,11 +342,13 @@ const struct locale_data _nl_C_LC_CTYPE = #endif { string: (const char *) _nl_C_LC_CTYPE_toupper }, { string: (const char *) _nl_C_LC_CTYPE_tolower }, - { string: NULL }, #if BYTE_ORDER == BIG_ENDIAN - { string: NULL }, + { string: NULL }, { string: NULL }, #endif { string: _nl_C_LC_CTYPE_class32 }, +#if BYTE_ORDER == LITTLE_ENDIAN + { string: NULL }, +#endif { string: (const char *) _nl_C_LC_CTYPE_names }, #if BYTE_ORDER == BIG_ENDIAN { string: NULL }, diff --git a/locale/categories.def b/locale/categories.def index 4caef24..7c47fd4 100644 --- a/locale/categories.def +++ b/locale/categories.def @@ -79,8 +79,9 @@ DEFINE_CATEGORY DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EB, "ctype-tolower-eb", std, string) DEFINE_ELEMENT (_NL_CTYPE_TOUPPER_EL, "ctype-toupper-el", std, string) DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EL, "ctype-tolower-el", std, string) + DEFINE_ELEMENT (_NL_CTYPE_CLASS32, "ctype-class32", std, string) DEFINE_ELEMENT (_NL_CTYPE_NAMES_EB, "ctype-names-eb", std, string) - DEFINE_ELEMENT (_NL_CTYPE_NAMES_EL, "ctype-names-eb", std, string) + DEFINE_ELEMENT (_NL_CTYPE_NAMES_EL, "ctype-names-el", std, string) DEFINE_ELEMENT (_NL_CTYPE_HASH_SIZE, "ctype-hash-size", std, word) DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word) DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string) diff --git a/locale/setlocale.c b/locale/setlocale.c index 8bf58da..4eeb5b3 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include <alloca.h> #include <argz.h> #include <errno.h> +#include <libc-lock.h> #include <locale.h> #include <stdlib.h> #include <string.h> @@ -93,7 +94,7 @@ extern void postload (void); /* Define an array indexed by category of postload functions to call after loading and installing that category's data. */ -void (*const _nl_category_postload[]) (void) = +static void (*const _nl_category_postload[]) (void) = { #define DEFINE_CATEGORY(category, category_name, items, postload, b, c, d) \ [category] = postload, @@ -114,6 +115,9 @@ static const char *_nl_current_names[] = }; +/* Lock for protecting global data. */ +__libc_lock_define_initialized (static, lock) + /* Use this when we come along an error. */ #define ERROR_RETURN \ @@ -238,8 +242,8 @@ setlocale (int category, const char *locale) return (char *) _nl_current_names[category]; /* We perhaps really have to load some data. So we determine the - path in which to look for the data now. But this environment - variable must only be used when the binary has no SUID or SGID + path in which to look for the data now. The environment variable + `LOCPATH' must only be used when the binary has no SUID or SGID bit set. */ locale_path = NULL; locale_path_len = 0; @@ -309,6 +313,9 @@ setlocale (int category, const char *locale) ERROR_RETURN; } + /* Protect global data. */ + __libc_lock_lock (lock); + /* Load the new data for each category. */ while (category-- > 0) /* Only actually load the data if anything will use it. */ @@ -319,25 +326,7 @@ setlocale (int category, const char *locale) &newnames[category]); if (newdata[category] == NULL) - { - /* Loading this part of the locale failed. Abort the - composite load. */ - int save_errno; - abort_composite: - save_errno = errno; - - while (++category < LC_ALL) - if (_nl_current[category] != NULL - && newdata[category] != _nl_C[category]) - _nl_free_locale (newdata[category]); - else - if (_nl_current[category] == NULL - && newnames[category] != _nl_C_name) - free (newnames[category]); - - errno = save_errno; - return NULL; - } + goto abort_composite; } else { @@ -351,17 +340,39 @@ setlocale (int category, const char *locale) composite = new_composite_name (LC_ALL, newnames); if (composite == NULL) { + /* Loading this part of the locale failed. Abort the + composite load. */ + int save_errno; + category = -1; - goto abort_composite; - } + abort_composite: + save_errno = errno; + + while (++category < LC_ALL) + if (_nl_current[category] != NULL + && newdata[category] != _nl_C[category]) + _nl_free_locale (newdata[category]); + else + if (_nl_current[category] == NULL + && newnames[category] != _nl_C_name) + free (newnames[category]); - /* Now we have loaded all the new data. Put it in place. */ - for (category = 0; category < LC_ALL; ++category) + errno = save_errno; + composite = NULL; + } + else { - setdata (category, newdata[category]); - setname (category, newnames[category]); + /* Now we have loaded all the new data. Put it in place. */ + for (category = 0; category < LC_ALL; ++category) + { + setdata (category, newdata[category]); + setname (category, newnames[category]); + } + setname (LC_ALL, composite); } - setname (LC_ALL, composite); + + /* Critical section left. */ + __libc_lock_unlock (lock); return composite; } @@ -370,6 +381,9 @@ setlocale (int category, const char *locale) const struct locale_data *newdata = NULL; char *newname = NULL; + /* Protect global data. */ + __libc_lock_lock (lock); + if (_nl_current[category] != NULL) { /* Only actually load the data if anything will use it. */ @@ -377,7 +391,7 @@ setlocale (int category, const char *locale) newdata = _nl_find_locale (locale_path, locale_path_len, category, (char **) &newname); if (newdata == NULL) - return NULL; + goto abort_single; } /* Create new composite name. */ @@ -392,14 +406,20 @@ setlocale (int category, const char *locale) _nl_free_locale (newdata); errno = save_errno; - return NULL; + abort_single: + newname = NULL; } + else + { + if (_nl_current[category] != NULL) + setdata (category, newdata); - if (_nl_current[category] != NULL) - setdata (category, newdata); + setname (category, newname); + setname (LC_ALL, composite); + } - setname (category, newname); - setname (LC_ALL, composite); + /* Critical section left. */ + __libc_lock_unlock (lock); return newname; } diff --git a/manual/maint.texi b/manual/maint.texi index 5bf473e..98467e4 100644 --- a/manual/maint.texi +++ b/manual/maint.texi @@ -223,8 +223,8 @@ following patterns: @smallexample alpha-dec-osf1 -alpha-gnu-linux -alpha-gnu-linuxecoff +alpha-@var{anything}-linux +alpha-@var{anything}-linuxecoff i@var{x}86-@var{anything}-bsd4.3 i@var{x}86-@var{anything}-gnu i@var{x}86-@var{anything}-isc2.2 diff --git a/manual/memory.texi b/manual/memory.texi index de543ec..343da0b 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -756,7 +756,7 @@ the padding needed to start each object on a suitable boundary. * Obstacks Data Alignment:: Controlling alignment of objects in obstacks. * Obstack Chunks:: How obstacks obtain and release chunks; efficiency considerations. -* Summary of Obstacks:: +* Summary of Obstacks:: @end menu @node Creating Obstacks @@ -1182,7 +1182,7 @@ When you check for space using @code{obstack_room} and there is not enough room for what you want to add, the fast growth functions are not safe. In this case, simply use the corresponding ordinary growth function instead. Very soon this will copy the object to a -new chunk; then there will be lots of room available again. +new chunk; then there will be lots of room available again. So, each time you use an ordinary growth function, check afterward for sufficient space using @code{obstack_room}. Once the object is copied @@ -1206,7 +1206,7 @@ add_string (struct obstack *obstack, const char *ptr, int len) obstack_1grow (obstack, *ptr++); len--; @} - else + else @{ if (room > len) room = len; @@ -1494,8 +1494,7 @@ int open2 (char *str1, char *str2, int flags, int mode) @{ char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1); - strcpy (name, str1); - strcat (name, str2); + stpcpy (stpcpy (name, str1), str2); return open (name, flags, mode); @} @end smallexample @@ -1512,8 +1511,7 @@ open2 (char *str1, char *str2, int flags, int mode) int desc; if (name == 0) fatal ("virtual memory exceeded"); - strcpy (name, str1); - strcat (name, str2); + stpcpy (stpcpy (name, str1), str2); desc = open (name, flags, mode); free (name); return desc; @@ -1558,8 +1556,7 @@ int open2 (char *str1, char *str2, int flags, int mode) @{ char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1); - strcpy (name, str1); - strcat (name, str2); + stpcpy (stpcpy (name, str1), str2); return open_or_report_error (name, flags, mode); @} @end smallexample @@ -1606,8 +1603,7 @@ variable size. Here is how @code{open2} would look then: int open2 (char *str1, char *str2, int flags, int mode) @{ char name[strlen (str1) + strlen (str2) + 1]; - strcpy (name, str1); - strcat (name, str2); + stpcpy (stpcpy (name, str1), str2); return open (name, flags, mode); @} @end smallexample @@ -1748,4 +1744,3 @@ Normally it ought to display the string for the user to read. The warnings come when memory becomes 75% full, when it becomes 85% full, and when it becomes 95% full. Above 95% you get another warning each time memory usage increases. - diff --git a/manual/string.texi b/manual/string.texi index c638912..8b7e9da 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -6,7 +6,7 @@ many programs. The GNU C library provides an extensive set of string utility functions, including functions for copying, concatenating, comparing, and searching strings. Many of these functions can also operate on arbitrary regions of storage; for example, the @code{memcpy} -function can be used to copy the contents of any kind of array. +function can be used to copy the contents of any kind of array. It's fairly common for beginning C programmers to ``reinvent the wheel'' by duplicating this functionality in their own code, but it pays to @@ -158,7 +158,7 @@ get the allocation size of the character array that holds a string using the @code{sizeof} operator: @smallexample -char string[32] = "hello, world"; +char string[32] = "hello, world"; sizeof (string) @result{} 32 strlen (string) @@ -411,7 +411,7 @@ return a nonzero value if the strings are @emph{not} equivalent rather than if they are. The sign of the value indicates the relative ordering of the first characters in the strings that are not equivalent: a negative value indicates that the first string is ``less'' than the -second, while a positive value indicates that the first string is +second, while a positive value indicates that the first string is ``greater''. The most common use of these functions is to check only for equality. @@ -623,10 +623,10 @@ overlap; see @ref{Copying and Concatenation}. The return value is the length of the entire transformed string. This value is not affected by the value of @var{size}, but if it is greater -than @var{size}, it means that the transformed string did not entirely -fit in the array @var{to}. In this case, only as much of the string as -actually fits was stored. To get the whole transformed string, call -@code{strxfrm} again with a bigger output array. +or equal than @var{size}, it means that the transformed string did not +entirely fit in the array @var{to}. In this case, only as much of the +string as actually fits was stored. To get the whole transformed +string, call @code{strxfrm} again with a bigger output array. The transformed string may be longer than the original string, and it may also be shorter. @@ -671,23 +671,32 @@ sort_strings_fast (char **array, int nstrings) for (i = 0; i < nstrings; i++) @{ size_t length = strlen (array[i]) * 2; + char *transformed; + size_t transformed_lenght; temp_array[i].input = array[i]; - /* @r{Transform @code{array[i]}.} - @r{First try a buffer probably big enough.} */ - while (1) + /* @r{First try a buffer perhaps big enough.} */ + transformed = (char *) xmalloc (length); + + /* @r{Transform @code{array[i]}.} */ + transformed_length = strxfrm (transformed, array[i], length); + + /* @r{If the buffer was not large enough, resize it} + @r{and try again.} */ + if (transformed_length >= length) @{ - char *transformed = (char *) xmalloc (length); - if (strxfrm (transformed, array[i], length) < length) - @{ - temp_array[i].transformed = transformed; - break; - @} - /* @r{Try again with a bigger buffer.} */ - free (transformed); - length *= 2; + /* @r{Allocate the needed space. +1 for terminating} + @r{@code{NUL} character.} */ + transformed = (char *) xrealloc (transformed, + transformed_length + 1); + + /* @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); @} + + temp_array[i].transformed = transformed; @} /* @r{Sort @code{temp_array} by comparing transformed strings.} */ @@ -741,7 +750,7 @@ strchr ("hello, world", 'l') @result{} "llo, world" strchr ("hello, world", '?') @result{} NULL -@end smallexample +@end smallexample The terminating null character is considered to be part of the string, so you can use this function get a pointer to the end of a string by @@ -857,8 +866,6 @@ strpbrk ("hello, world", " \t\n,.;!?") @node Finding Tokens in a String, , Search Functions, String and Array Utilities @section Finding Tokens in a String -@c !!! Document strsep, which is a better thing to use than strtok. - @cindex tokenizing strings @cindex breaking a string into tokens @cindex parsing tokens from a string @@ -945,3 +952,61 @@ token = strtok (NULL, delimiters); /* token => "and" */ token = strtok (NULL, delimiters); /* token => "punctuation" */ token = strtok (NULL, delimiters); /* token => NULL */ @end smallexample + +The GNU C library contains two more functions for tokenizing a string +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. + +This function was proposed for POSIX.1b and can be found on many systems +which support multi-threading. +@end deftypefun + +@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 was introduced in 4.3BSD and therefore is widely available. +@end deftypefun + +Here is how the above example looks like when @code{strsep} is used. + +@comment Yes, this example has been tested. +@smallexample +#include <string.h> +#include <stddef.h> + +@dots{} + +char string[] = "words separated by spaces -- and, punctuation!"; +const char delimiters[] = " .,;:!-"; +char *running; +char *token; + +@dots{} + +running = string; +token = strsep (&running, delimiters); /* token => "words" */ +token = strsep (&running, delimiters); /* token => "separated" */ +token = strsep (&running, delimiters); /* token => "by" */ +token = strsep (&running, delimiters); /* token => "spaces" */ +token = strsep (&running, delimiters); /* token => "and" */ +token = strsep (&running, delimiters); /* token => "punctuation" */ +token = strsep (&running, delimiters); /* token => NULL */ +@end smallexample diff --git a/misc/Makefile b/misc/Makefile index 01e2238..1631b21 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -28,7 +28,7 @@ headers := sys/uio.h iovec.h sys/ioctl.h ioctls.h ioctl-types.h \ ttyent.h syslog.h sys/syslog.h paths.h sys/reboot.h \ sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h\ sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \ - sys/select.h + sys/select.h ustat.h sys/ustat.h ustatbits.h routines := brk sbrk sstk ioctl \ readv writev \ @@ -54,7 +54,7 @@ routines := brk sbrk sstk ioctl \ mmap munmap mprotect msync madvise \ efgcvt efgcvt_r qefgcvt qefgcvt_r \ hsearch hsearch_r tsearch lsearch \ - err error + err error ustat aux := init-misc distribute := bsd-compat.c extra-objs := bsd-compat.o diff --git a/misc/sys/select.h b/misc/sys/select.h index dcb2012..729ce7a 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -39,6 +39,8 @@ __BEGIN_DECLS of `struct timeval'. */ struct timeval; +typedef __fd_mask fd_mask; + /* Representation of a set of file descriptors. */ #define fd_set __fd_set diff --git a/misc/sys/ustat.h b/misc/sys/ustat.h index 57086c9..fd51c59 100644 --- a/misc/sys/ustat.h +++ b/misc/sys/ustat.h @@ -20,15 +20,17 @@ Cambridge, MA 02139, USA. */ /* This interface is obsolete. Use <sys/statfs.h> instead. */ #ifndef _SYS_USTAT_H -#define _SYS_USTAT_H 1 + +#define _SYS_USTAT_H 1 +#include <features.h> #include <sys/types.h> #include <ustatbits.h> __BEGIN_DECLS -extern int __ustat __P ((dev_t, struct ustat *)); -extern int ustat __P ((dev_t, struct ustat *)); +extern int __ustat __P ((__dev_t __dev, struct ustat *__ubuf)); +extern int ustat __P ((__dev_t __dev, struct ustat *__ubuf)); __END_DECLS diff --git a/misc/syslog.c b/misc/syslog.c index bcac6c7..3a39c43 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -56,6 +56,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #include <varargs.h> #endif +static int LogType = SOCK_DGRAM; /* type of socket connection */ static int LogFile = -1; /* fd for log */ static int connected; /* have done connect */ static int LogStat = 0; /* status bits, set by openlog() */ @@ -163,8 +164,15 @@ vsyslog(pri, fmt, ap) /* Get connected, output the message to the local logger. */ if (!connected) openlog(LogTag, LogStat | LOG_NDELAY, 0); + + /* If we have a SOCK_STREAM connection, also send ASCII NUL as + a record terminator. */ + if (LogType == SOCK_STREAM) + ++bufsize; + if (__send(LogFile, buf, bufsize, 0) < 0) { + closelog (); /* attempt re-open next time */ /* * Output the message to the console; don't worry about blocking, * if console blocks everything will. Make sure the error reported @@ -194,23 +202,36 @@ openlog(ident, logstat, logfac) if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) LogFacility = logfac; - if (LogFile == -1) { - SyslogAddr.sa_family = AF_UNIX; - (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, - sizeof(SyslogAddr.sa_data)); - if (LogStat & LOG_NDELAY) { - if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) - return; - (void)fcntl(LogFile, F_SETFD, 1); + while (1) { + if (LogFile == -1) { + SyslogAddr.sa_family = AF_UNIX; + (void)strncpy(SyslogAddr.sa_data, _PATH_LOG, + sizeof(SyslogAddr.sa_data)); + if (LogStat & LOG_NDELAY) { + if ((LogFile = socket(AF_UNIX, LogType, 0)) + == -1) + return; + (void)fcntl(LogFile, F_SETFD, 1); + } } + if (LogFile != -1 && !connected) + if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) + == -1) + { + int saved_errno = errno; + (void)close(LogFile); + LogFile = -1; + if (LogType == SOCK_DGRAM + && saved_errno == EPROTOTYPE) + { + /* retry with next SOCK_STREAM: */ + LogType = SOCK_STREAM; + continue; + } + } else + connected = 1; + break; } - if (LogFile != -1 && !connected) - if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) == -1) - { - (void)close(LogFile); - LogFile = -1; - } else - connected = 1; } void diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 3490594..1349e0c 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -42,10 +42,6 @@ static service_library *nss_new_service (name_database *database, __libc_lock_define_initialized (static, lock) -/* Global variable. */ -struct __res_state _res; - - /* Nonzero if the sevices are already initialized. */ static int nss_initialized; diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 9c3c3e7..3124de0 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -115,8 +115,10 @@ extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr, /* Send N bytes of BUF to socket FD. Returns the number sent or -1. */ -extern int __send __P ((int __fd, __ptr_t __buf, size_t __n, int __flags)); -extern int send __P ((int __fd, __ptr_t __buf, size_t __n, int __flags)); +extern int __send __P ((int __fd, __const __ptr_t __buf, size_t __n, + int __flags)); +extern int send __P ((int __fd, __const __ptr_t __buf, size_t __n, + int __flags)); /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. */ @@ -124,8 +126,9 @@ extern int recv __P ((int __fd, __ptr_t __buf, size_t __n, int __flags)); /* Send N bytes of BUF on socket FD to peer at address ADDR (which is ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */ -extern int sendto __P ((int __fd, __ptr_t __buf, size_t __n, int __flags, - __CONST_SOCKADDR_ARG __addr, size_t __addr_len)); +extern int sendto __P ((int __fd, __const __ptr_t __buf, size_t __n, + int __flags, __CONST_SOCKADDR_ARG __addr, + size_t __addr_len)); /* Read N bytes into BUF through socket FD. If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of diff --git a/string/tester.c b/string/tester.c index 6be3d2d..e57b279 100644 --- a/string/tester.c +++ b/string/tester.c @@ -71,6 +71,19 @@ DEFUN(main, (argc, argv), int argc AND char **argv) (void) strcpy(one, ""); equal(one, "", 7); /* Boundary condition. */ + /* stpncpy. */ + it = "stpncpy"; + + memset(one, 'x', sizeof(one)); + check(stpncpy(one, "abc", 2) == one + 2, 1); + check(stpncpy(one, "abc", 3) == one + 3, 2); + check(stpncpy(one, "abc", 4) == one + 3, 3); + check(one[3] == '\0' && one[4] == 'x', 4); + check(stpncpy(one, "abcd", 5) == one + 4, 5); + check(one[4] == '\0' && one[5] == 'x', 6); + check(stpncpy(one, "abcd", 6) == one + 4, 7); + check(one[4] == '\0' && one[5] == '\0' && one[6] == 'x', 8); + /* strcat. */ it = "strcat"; (void) strcpy(one, "ijk"); diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 11f5541..efad599 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -75,9 +75,12 @@ extra-objs = $(rpcgen-objs) all: # Make this the default target; it will be defined in Rules. +# Sun's code is not too clean. +override +gccwarn := -w + include ../Makeconfig -ifeq (no,$(cross-compile)) +ifeq (no,$(cross-compiling)) # We can only build this library if we can run the rpcgen we build. extra-libs := librpcsvc extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. @@ -86,9 +89,6 @@ librpcsvc-inhibit-o = .so # Build no shared rpcsvc library. omit-deps = $(librpcsvc-routines) endif -# Sun's code is not too clean. -override +gccwarn := -w - include ../Rules $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a diff --git a/sunrpc/rpc_prot.c b/sunrpc/rpc_prot.c index 4b1319a..8da20c6 100644 --- a/sunrpc/rpc_prot.c +++ b/sunrpc/rpc_prot.c @@ -6,23 +6,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -50,8 +50,6 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; /* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */ -struct opaque_auth _null_auth; - /* * XDR an opaque authentication struct * (see auth.h) @@ -84,9 +82,9 @@ xdr_des_block(xdrs, blkp) /* * XDR the MSG_ACCEPTED part of a reply message union */ -bool_t +bool_t xdr_accepted_reply(xdrs, ar) - register XDR *xdrs; + register XDR *xdrs; register struct accepted_reply *ar; { @@ -111,7 +109,7 @@ xdr_accepted_reply(xdrs, ar) /* * XDR the MSG_DENIED part of a reply message union */ -bool_t +bool_t xdr_rejected_reply(xdrs, rr) register XDR *xdrs; register struct rejected_reply *rr; @@ -147,7 +145,7 @@ xdr_replymsg(xdrs, rmsg) register struct rpc_msg *rmsg; { if ( - xdr_u_long(xdrs, &(rmsg->rm_xid)) && + xdr_u_long(xdrs, &(rmsg->rm_xid)) && xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) && (rmsg->rm_direction == REPLY) ) return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat), @@ -219,7 +217,7 @@ accepted(acpt_stat, error) error->re_lb.s2 = (long)acpt_stat; } -static void +static void rejected(rjct_stat, error) register enum reject_stat rjct_stat; register struct rpc_err *error; diff --git a/sysdeps/alpha/_mcount.S b/sysdeps/alpha/_mcount.S index e813ebd..6c4af3f 100644 --- a/sysdeps/alpha/_mcount.S +++ b/sysdeps/alpha/_mcount.S @@ -28,20 +28,17 @@ compiler treats those calls as if they were instructions. In particular, it doesn't save any of the temporary registers (caller saved registers). It is therefore necessary to preserve all caller-saved registers as well - + Upon entering _mcount, register $at holds the return address and ra holds the return address of the function's caller (selfpc and frompc, respectively in gmon.c language...). */ #include <sysdep.h> -#undef ret /* discard `ret' as defined in sysdep.h */ - .set noat .set noreorder LEAF(_mcount, 0xb0) -weak_alias (_mcount, mcount) .prologue 0 subq sp, 0xb0, sp @@ -69,8 +66,6 @@ weak_alias (_mcount, mcount) stq t5, 0x70(sp) stq t6, 0x78(sp) - lda pv, __mcount - stq t7, 0x80(sp) stq t8, 0x88(sp) stq t9, 0x90(sp) @@ -78,7 +73,7 @@ weak_alias (_mcount, mcount) stq t11, 0xa0(sp) stq v0, 0xa8(sp) - jsr ra, (pv), __mcount + jsr ra, __mcount ldq a0, 0x00(sp) ldq a1, 0x08(sp) @@ -108,3 +103,5 @@ weak_alias (_mcount, mcount) ret zero,($at),1 END(_mcount) + +weak_alias (_mcount, mcount) diff --git a/sysdeps/alpha/bb_init_func.S b/sysdeps/alpha/bb_init_func.S index 49be0b2..dcd4eac 100644 --- a/sysdeps/alpha/bb_init_func.S +++ b/sysdeps/alpha/bb_init_func.S @@ -40,10 +40,10 @@ ENTRY(__bb_init_func) ldq t0, ZERO_WORD(a0) /* t0 <- blocks->zero_word */ beq t0, init /* not initialized yet -> */ ret - + END(__bb_init_func) -.ent init + .ent init init: .frame sp, 0x38, ra, 0 subq sp, 0x38, sp @@ -61,8 +61,8 @@ init: stq t0, ZERO_WORD(a0) /* blocks->zero_word = 1 */ stq t2, NEXT(a0) /* blocks->next = __bb_head */ stq a0, 0(t1) - bne t2, leave - beq t3, leave /* t3 == GMON_PROF_ON? yes -> */ + bne t2, $leave + beq t3, $leave /* t3 == GMON_PROF_ON? yes -> */ /* also need to initialize destructor: */ stq ra, 0x00(sp) @@ -81,8 +81,8 @@ init: ldq a4, 0x20(sp) ldq a5, 0x28(sp) -leave: ldq pv, 0x30(sp) +$leave: ldq pv, 0x30(sp) addq sp, 0x38, sp ret -.end init + .end init diff --git a/sysdeps/alpha/bsd-_setjmp.S b/sysdeps/alpha/bsd-_setjmp.S index da60442..a7bdbb5 100644 --- a/sysdeps/alpha/bsd-_setjmp.S +++ b/sysdeps/alpha/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. Alpha version. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */ #include <sysdep.h> ENTRY(_setjmp) - lda $27, __sigsetjmp /* Load address to jump to. */ + ldgp $29,0($27) + .prologue 1 bis $31, $31, $17 /* Pass a second argument of zero. */ - jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ + jmp $31, __sigsetjmp /* Call __sigsetjmp. */ END(_setjmp) diff --git a/sysdeps/alpha/bsd-setjmp.S b/sysdeps/alpha/bsd-setjmp.S index fc73815..c0ed691 100644 --- a/sysdeps/alpha/bsd-setjmp.S +++ b/sysdeps/alpha/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. Alpha version. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */ #include <sysdep.h> ENTRY(setjmp) - lda $27, __sigsetjmp /* Load address to jump to. */ + ldgp $29, 0($27) + .prologue 1 bis $31, 1, $17 /* Pass a second argument of one. */ - jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ + jmp $31, __sigsetjmp /* Call __sigsetjmp. */ END(setjmp) diff --git a/sysdeps/alpha/divrem.h b/sysdeps/alpha/divrem.h index 2951335..b5b66ae 100644 --- a/sysdeps/alpha/divrem.h +++ b/sysdeps/alpha/divrem.h @@ -115,10 +115,9 @@ FUNC_NAME: br AT, 1f 1: ldgp gp, 0(AT) - lda AT, _mcount mov retaddr, ra - jsr AT, (AT), _mcount + jsr AT, _mcount ldq ra, 0x00(sp) ldq pv, 0x08(sp) @@ -137,7 +136,7 @@ FUNC_NAME: stq tmp0,0x18(sp) bis zero,zero,quotient stq tmp1,0x20(sp) - beq divisor,divbyzero + beq divisor,$divbyzero stq sign,0x28(sp) GETSIGN(dividend,divisor,sign) #if SIGNED @@ -170,7 +169,7 @@ FUNC_NAME: ldq arg1,0x00(sp) SETSIGN(sign,result,tmp0) -done: ldq arg2,0x08(sp) +$done: ldq arg2,0x08(sp) ldq mask,0x10(sp) ldq tmp0,0x18(sp) ldq tmp1,0x20(sp) @@ -178,11 +177,11 @@ done: ldq arg2,0x08(sp) lda sp,FRAME_SIZE(sp) ret zero,(retaddr),0 -divbyzero: +$divbyzero: lda a0,GEN_INTDIV(zero) call_pal PAL_gentrap bis zero,zero,result /* if trap returns, return 0 */ ldq arg1,0x00(sp) - br done + br $done END(FUNC_NAME) diff --git a/sysdeps/alpha/ffs.S b/sysdeps/alpha/ffs.S index e4dd87c..b84a51d 100644 --- a/sysdeps/alpha/ffs.S +++ b/sysdeps/alpha/ffs.S @@ -34,7 +34,7 @@ ENTRY(ffs) negq a0, t0 # due to the srl instruction and a0, t0, t0 clr v0 - beq a0, done + beq a0, $done # now do binary search for first non-zero bit @@ -61,6 +61,6 @@ ENTRY(ffs) addq v0, 1, t3 cmoveq t2, t3, v0 -done: ret +$done: ret END(ffs) diff --git a/sysdeps/alpha/memchr.S b/sysdeps/alpha/memchr.S index 2d21247..a47ac96 100644 --- a/sysdeps/alpha/memchr.S +++ b/sysdeps/alpha/memchr.S @@ -42,7 +42,7 @@ For correctness consider that: ENTRY(memchr) .prologue 0 - beq a2, not_found + beq a2, $not_found ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) addq a0, a2, t4 and a1, 0xff, a1 # a1 = 00000000000000ch @@ -57,7 +57,7 @@ ENTRY(memchr) extql t0, a0, t6 or t1, a1, a1 # a1 = chchchchchchchch - beq t3, first_quad + beq t3, $first_quad extqh t5, a0, t5 mov a0, v0 @@ -68,15 +68,15 @@ ENTRY(memchr) # in t0. E.g.: # a2 = 6 # t0 = ????c6c5c4c3c2c1 -last_quad: +$last_quad: negq a2, t5 srl t2, t5, t5 # t5 = mask of a2 bits set xor a1, t0, t0 cmpbge zero, t0, t1 and t1, t5, t1 - beq t1, not_found + beq t1, $not_found -found_it: +$found_it: # now, determine which byte matched: negq t1, t2 and t1, t2, t1 @@ -93,20 +93,20 @@ found_it: addq v0, 1, t2 cmoveq t0, t2, v0 -done: ret +$done: ret # # Deal with the case where a2 > 8 bytes remain to be # searched. a0 may not be aligned. # -first_quad: +$first_quad: andnot a0, 0x7, v0 insqh t2, a0, t1 # t1 = 0000ffffffffffff (a0<0:2> ff bytes) xor t0, a1, t0 or t0, t1, t0 # t0 = ====ffffffffffff cmpbge zero, t0, t1 - bne t1, found_it + bne t1, $found_it /* at least one byte left to process */ @@ -119,41 +119,41 @@ first_quad: subq t4, 1, a2 andnot a2, 0x7, a2 cmpult v0, a2, t1 - beq t1, final + beq t1, $final /* at least two quads remain to be accessed */ subq a2, v0, t3 # t3 <- number of quads to be processed in loop and t3, 8, t3 # odd number of quads? - bne t3, odd_quad_count + bne t3, $odd_quad_count /* at least three quads remain to be accessed */ mov t0, t3 # move prefetched value into correct register .align 3 -unrolled_loop: +$unrolled_loop: ldq t0, 8(v0) # prefetch t0 xor a1, t3, t1 cmpbge zero, t1, t1 - bne t1, found_it + bne t1, $found_it addq v0, 8, v0 -odd_quad_count: +$odd_quad_count: xor a1, t0, t1 ldq t3, 8(v0) # prefetch t3 cmpbge zero, t1, t1 - bne t1, found_it + bne t1, $found_it addq v0, 8, v0 cmpult v0, a2, t5 - bne t5, unrolled_loop + bne t5, $unrolled_loop mov t3, t0 # move prefetched value into t0 -final: subq t4, v0, a2 # a2 <- number of bytes left to do - bne a2, last_quad +$final: subq t4, v0, a2 # a2 <- number of bytes left to do + bne a2, $last_quad -not_found: +$not_found: mov zero, v0 ret diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S index da71a32..59929a0 100644 --- a/sysdeps/alpha/setjmp.S +++ b/sysdeps/alpha/setjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,9 +25,8 @@ ENTRY (__sigsetjmp) ldgp $29, 0($27) .prologue 1 - lda $27, __sigsetjmp_aux /* Load address to jump to. */ bis $30, $30, $18 /* Pass SP as 3rd arg. */ bis $15, $15, $19 /* Pass FP as 4th arg. */ - jmp $31, ($27), __sigsetjmp_aux /* Call __sigsetjmp_aux. */ + jmp $31, __sigsetjmp_aux /* Call __sigsetjmp_aux. */ END(__sigsetjmp) diff --git a/sysdeps/alpha/strlen.S b/sysdeps/alpha/strlen.S index 15c78cd..9eab707 100644 --- a/sysdeps/alpha/strlen.S +++ b/sysdeps/alpha/strlen.S @@ -19,52 +19,50 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Finds length of a 0-terminated string. Optimized for the Alpha -architecture: + architecture: - memory accessed as aligned quadwords only - - uses bcmpge to compare 8 bytes in parallel - - does binary search to find 0 byte in last - quadword (HAKMEM needed 12 instructions to - do this instead of the 9 instructions that - binary search needs). */ + - uses cmpbge to compare 8 bytes in parallel + - does binary search to find 0 byte in last quadword (HAKMEM + needed 12 instructions to do this instead of the 8 instructions + that the binary search needs). +*/ #include <sysdep.h> - .set noreorder - .set noat + .set noreorder + .set noat ENTRY(strlen) - ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) - lda t1, -1(zero) - insqh t1, a0, t1 - andnot a0, 7, v0 - or t1, t0, t0 - cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 - bne t1, found - -loop: ldq t0, 8(v0) - addq v0, 8, v0 # addr += 8 - nop # helps dual issue last two insns - cmpbge zero, t0, t1 - beq t1, loop - -found: blbs t1, done # make aligned case fast - negq t1, t2 - and t1, t2, t1 - - and t1, 0x0f, t0 - addq v0, 4, t2 - cmoveq t0, t2, v0 - - and t1, 0x33, t0 - addq v0, 2, t2 - cmoveq t0, t2, v0 - - and t1, 0x55, t0 - addq v0, 1, t2 - cmoveq t0, t2, v0 - -done: subq v0, a0, v0 - ret - - END(strlen) + ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) + lda t1, -1(zero) + insqh t1, a0, t1 + andnot a0, 7, v0 + or t1, t0, t0 + nop # dual issue the next two on ev5 + cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 + bne t1, $found + +$loop: ldq t0, 8(v0) + addq v0, 8, v0 # addr += 8 + cmpbge zero, t0, t1 + beq t1, $loop + +$found: negq t1, t2 # clear all but least set bit + and t1, t2, t1 + + and t1, 0xf0, t2 # binary search for that set bit + and t1, 0xcc, t3 + and t1, 0xaa, t4 + cmovne t2, 4, t2 + cmovne t3, 2, t3 + cmovne t4, 1, t4 + addq t2, t3, t2 + addq v0, t4, v0 + addq v0, t2, v0 + nop # dual issue next two on ev4 and ev5 + + subq v0, a0, v0 + ret + + END(strlen) diff --git a/sysdeps/generic/stpncpy.c b/sysdeps/generic/stpncpy.c index 427ed4b..c821e95 100644 --- a/sysdeps/generic/stpncpy.c +++ b/sysdeps/generic/stpncpy.c @@ -57,8 +57,6 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n) goto last_chars; } n -= dest - s; - if (n == 0) - return dest - 1; goto zero_fill; } @@ -70,16 +68,16 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n) for (;;) { c = *src++; + --n; *dest++ = c; if (c == '\0') break; - if (--n == 0) + if (n == 0) return dest; } - --n; zero_fill: - while (--n > 0) + while (n-- > 0) dest[n] = '\0'; return dest - 1; diff --git a/sysdeps/generic/ustatbits.h b/sysdeps/generic/ustatbits.h index 57bebdc..aa5d493 100644 --- a/sysdeps/generic/ustatbits.h +++ b/sysdeps/generic/ustatbits.h @@ -1,5 +1,5 @@ /* Generic declaration of ustat structure. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,10 +17,14 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +__BEGIN_DECLS + struct ustat { - daddr_t f_tfree; /* total free */ - ino_t f_tinode; /* total inodes free */ + __daddr_t f_tfree; /* total free */ + __ino_t f_tinode; /* total inodes free */ char f_fname[6]; /* filesystem name */ char f_fpack[6]; /* filesystem pack name */ }; + +__END_DECLS diff --git a/sysdeps/i386/fpu_control.h b/sysdeps/i386/fpu_control.h index d72f474..706dea3 100644 --- a/sysdeps/i386/fpu_control.h +++ b/sysdeps/i386/fpu_control.h @@ -19,7 +19,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _FPU_CONTROL_H -#define _FPU_CONTROL_H +#define _FPU_CONTROL_H 1 /* Here is the dirty part. Settup up your 387 through the control word * (cw) register. @@ -80,10 +80,10 @@ Boston, MA 02111-1307, USA. */ /* The fdlibm code requires strict IEEE double precision arithmetic, and no interrupts for exceptions, rounding to nearest. */ -#define _FPU_DEFAULT 0x127f +#define _FPU_DEFAULT 0x137f /* IEEE: same as above, but exceptions */ -#define _FPU_IEEE 0x127f +#define _FPU_IEEE 0x137f /* Type of the control word. */ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 85bab92..5f6b6b0 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -1,5 +1,5 @@ ifeq ($(subdir), misc) -sysdep_routines += sysctl +sysdep_routines += sysctl clone sysdep_headers += sys/mount.h sys/sysinfo.h sys/acct.h sys/sysctl.h \ sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \ diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S index 26bf97f..ad5f021 100644 --- a/sysdeps/unix/sysv/linux/alpha/brk.S +++ b/sysdeps/unix/sysv/linux/alpha/brk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@zen.org). The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,16 @@ break value (instead of the new, requested one). */ #include <sysdep.h> #include <errnos.h> +#ifdef PIC +.section .bss + .align 3 + .globl __curbrk +__curbrk: .skip 8 + .type __curbrk,@object + .size __curbrk,8 +#else .comm __curbrk, 8 +#endif .text LEAF(__brk, 0) diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c index cee5f48..56331cb 100644 --- a/sysdeps/unix/sysv/linux/alpha/ioperm.c +++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger. @@ -92,6 +92,7 @@ static struct platform { {"EB66", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ {"EB66P", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ {"Jensen", IOSYS_JENSEN, JENSEN_MEM}, + {"Mikasa", IOSYS_APECS, APECS_DENSE_MEM}, {"Mustang", IOSYS_APECS, APECS_DENSE_MEM}, {"Noname", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ }; diff --git a/sysdeps/unix/sysv/linux/gnu/types.h b/sysdeps/unix/sysv/linux/gnu/types.h index 0bc072b..89b815d 100644 --- a/sysdeps/unix/sysv/linux/gnu/types.h +++ b/sysdeps/unix/sysv/linux/gnu/types.h @@ -65,4 +65,8 @@ typedef long int __swblk_t; /* Type of a swap block maybe? */ typedef __kernel_fd_set __fd_set; typedef __kernel_clock_t __clock_t; +/* Linus doesn't want __kernel_fd_mask in <linux/posix_types.h> since + XPG4 seems to require `unsigned long'. */ +typedef unsigned long __fd_mask; + #endif /* gnu/types.h */ diff --git a/time/localtime.c b/time/localtime.c index 3800d8b..2a78030 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -40,13 +40,13 @@ __localtime_r (timer, tp) /* This lock is defined in tzset.c and locks all the data defined there and in tzfile.c; the internal functions do no locking themselves. This lock is only taken here and in `tzset'. */ + __libc_lock_define (extern, __tzset_lock) extern int __tzset_run, __use_tzfile; extern int __tz_compute __P ((time_t timer, struct tm *tp)); extern int __tzfile_compute __P ((time_t timer, long int *leap_correct, int *leap_hit)); long int leap_correction; int leap_extra_secs; - __libc_lock_define (extern, __tzset_lock); if (timer == NULL) { |