1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
Ulrich Drepper
1996-08-09 02:46:09 +00:00
parent 233963756b
commit a5113b141c
40 changed files with 752 additions and 441 deletions

View File

@ -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> Thu Aug 8 01:41:43 1996 Ulrich Drepper <drepper@cygnus.com>
* elf/Makefile: Undo change of Tue Aug 6 14:27:11 1996. * 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. warning.
* locale/programs/ld-ctype.c (ctype_output): Add code to make * 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 * locale/programs/locfile.c (write_locale_data): Correct handling
of LC_MESSAGES locale. Create directory if necessary. of LC_MESSAGES locale. Create directory if necessary.

455
INSTALL
View File

@ -4,16 +4,13 @@ Library Maintenance
How to Install the GNU C Library How to Install the GNU C Library
================================ ================================
Installation of the GNU C library is relatively simple. Installation of the GNU C library is relatively simple, but usually
requires several GNU tools to be installed already.
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.*
To configure the GNU C library for your system, run the shell script To configure the GNU C library for your system, run the shell script
`configure' with `sh'. Use an argument which is the conventional GNU `configure' with `sh'. Use an argument which is the conventional GNU
name for your system configuration--for example, `sparc-sun-sunos4.1', 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 (gcc.info)Installation, for a full description of standard GNU
configuration names. If you omit the configuration name, `configure' configuration names. If you omit the configuration name, `configure'
will try to guess one for you by inspecting the system it is running 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 guess might be wrong. `configure' will tell you the canonical name of
the chosen configuration before proceeding. 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 Here are some options that you should specify (if appropriate) when
you run `configure': you run `configure':
@ -76,8 +33,15 @@ you run `configure':
building the GNU C Library. On some systems, the library may not building the GNU C Library. On some systems, the library may not
build properly if you do *not* use `gas'. 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' `--nfp'
Use this option if your computer lacks hardware floating point Use this option if your computer lacks hardware floating-point
support. support.
`--prefix=DIRECTORY' `--prefix=DIRECTORY'
@ -89,6 +53,29 @@ you run `configure':
subdirectories of `DIRECTORY'. (You can also set this in subdirectories of `DIRECTORY'. (You can also set this in
`configparms'; see below.) `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 The simplest way to run `configure' is to do it in the directory
that contains the library sources. This prepares to build the library that contains the library sources. This prepares to build the library
in that very directory. 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 the GNU C compiler, so you may need to compile the library with GCC.
(In fact, all of the existing complete ports require GCC.) (In fact, all of the existing complete ports require GCC.)
The current release of the C library contains some header files that To build the library and related programs, type `make'. This will
the compiler normally provides: `stddef.h', `stdarg.h', and several produce a lot of output, some of which may look like errors from `make'
files with names of the form `va-MACHINE.h'. The versions of these (but isn't). Look for error messages from `make' containing `***'.
files that came with older releases of GCC do not work properly with Those indicate that something is really wrong.
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 and run some test programs which exercise some of the 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'. with names like `PROGRAM.out'.
To format the `GNU C Library Reference Manual' for printing, type To format the `GNU C Library Reference Manual' for printing, type
`make dvi'. To format the Info version of the manual for on line `make dvi'.
reading with `C-h i' in Emacs or with the `info' program, type
`make info'.
To install the library and its header files, and the Info files of To install the library and its header files, and the Info files of
the manual, type `make install', after setting the installation the manual, type `make install'. This will build things if necessary,
directories in `configparms'. This will build things if necessary,
before installing them. 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 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. define a few variables in the right places.
The library sources are divided into subdirectories, grouped by The library sources are divided into subdirectories, grouped by
topic. The `string' subdirectory has all the string-manipulation topic.
functions, `stdio' has all the standard I/O functions, etc.
The `string' subdirectory has all the string-manipulation functions,
`math' has all the mathematical functions, etc.
Each subdirectory contains a simple makefile, called `Makefile', Each subdirectory contains a simple makefile, called `Makefile',
which defines a few `make' variables and then includes the global 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 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 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) 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' `others'
The names of "other" programs associated with this section of the 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 `sysdeps' has two "special" subdirectories, called `generic' and
`stub'. These two are always implicitly appended to the list of `stub'. These two are always implicitly appended to the list of
subdirectories (in that order), so you needn't put them in an `Implies' subdirectories (in that order), so you needn't put them in an `Implies'
file, and you should not create any subdirectories under them. file, and you should not create any subdirectories under them intended
`generic' is for things that can be implemented in machine-independent to be new specific categories. `generic' is for things that can be
C, using only other machine-independent functions in the C library. implemented in machine-independent C, using only other
`stub' is for "stub" versions of functions which cannot be implemented machine-independent functions in the C library. `stub' is for "stub"
on a particular machine or operating system. The stub functions always versions of functions which cannot be implemented on a particular
return an error, and set `errno' to `ENOSYS' (Function not machine or operating system. The stub functions always return an
implemented). *Note Error Reporting::. 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 A source file is known to be system-dependent by its having a
version in `generic' or `stub'; every system-dependent function should version in `generic' or `stub'; every generally-available function whose
have either a generic or stub implementation (there is no point in implementation is system-dependent in should have either a generic or
having both). 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 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- 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 Contributors to the GNU C Library
================================= =================================
The GNU C library was written almost entirely by Roland McGrath, who The GNU C library was written originally by Roland McGrath. Some
now maintains it. Some parts of the library were contributed or worked parts of the library were contributed or worked on by other people.
on by other people.
* The `getopt' function and related code were written by Richard * The `getopt' function and related code were written by Richard
Stallman, David J. MacKenzie, and Roland McGrath. Stallman, David J. MacKenzie, and Roland McGrath.
* Most of the math functions are taken from 4.4 BSD; they have been * The merge sort function `qsort' was written by Michael J. Haertel.
modified only slightly to work with the GNU C library. The
Internet-related code (most of the `inet' subdirectory) and several * The quick sort function used as a fallback by `qsort' was written
other miscellaneous functions and header files have been included by Douglas C. Schmidt.
with little or no modification.
* 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 All code incorporated from 4.4 BSD is under the following
copyright: copyright:
@ -694,70 +823,7 @@ on by other people.
changes to fit into the GNU C library and to fit the ANSI C changes to fit into the GNU C library and to fit the ANSI C
standard, but the functional code is Berkeley's. standard, but the functional code is Berkeley's.
* The merge sort function `qsort' was written by Michael J. Haertel. * The Internet resolver code is taken directly from BIND 4.9.4,
* 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,
which is under both the Berkeley copyright above and also: which is under both the Berkeley copyright above and also:
Portions Copyright (C) 1993 by Digital Equipment Corporation. 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 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 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 * The code to support Sun RPC is taken verbatim from Sun's
RPCSRC-4.0 distribution, and is covered by this copyright: RPCSRC-4.0 distribution, and is covered by this copyright:
@ -824,9 +881,33 @@ on by other people.
2550 Garcia Avenue 2550 Garcia Avenue
Mountain View, California 94043 Mountain View, California 94043
* The port to SGI machines running Irix 4 (`mips-sgi-irix4') was * Some of the support code for Mach is taken from Mach 3.0 by CMU,
contributed by Tom Quinn. and is under the following copyright terms:
* The port of the Mach and Hurd code to the MIPS architecture Mach Operating System
(`mips-ANYTHING-gnu') was contribued by Kazumoto Kojima. 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.

View File

@ -41,7 +41,7 @@ catopen (const char *cat_name, int flag)
result->status = closed; result->status = closed;
result->cat_name = strdup (cat_name); result->cat_name = __strdup (cat_name);
if (result->cat_name == NULL) if (result->cat_name == NULL)
{ {
free (result); free (result);
@ -71,7 +71,7 @@ catopen (const char *cat_name, int flag)
env_var = "C"; env_var = "C";
} }
result->env_var = strdup (env_var); result->env_var = __strdup (env_var);
if (result->env_var == NULL) if (result->env_var == NULL)
{ {
free ((void *) result->cat_name); free ((void *) result->cat_name);
@ -80,9 +80,9 @@ catopen (const char *cat_name, int flag)
} }
if (getenv ("NLSPATH") != NULL) if (getenv ("NLSPATH") != NULL)
result->nlspath = strdup (getenv ("NLSPATH")); result->nlspath = __strdup (getenv ("NLSPATH"));
else else
result->nlspath = strdup (NLSPATH); result->nlspath = __strdup (NLSPATH);
if (result->nlspath == NULL) if (result->nlspath == NULL)
{ {

View File

@ -79,12 +79,12 @@ __open_catalog (__nl_catd catalog, int with_path)
case 'N': case 'N':
/* Use the catalog name. */ /* Use the catalog name. */
ENOUGH (strlen (catalog->cat_name)); ENOUGH (strlen (catalog->cat_name));
bufact = stpcpy (&buf[bufact], catalog->cat_name) - buf; bufact = __stpcpy (&buf[bufact], catalog->cat_name) - buf;
break; break;
case 'L': case 'L':
/* Use the current locale category value. */ /* Use the current locale category value. */
ENOUGH (strlen (catalog->env_var)); ENOUGH (strlen (catalog->env_var));
bufact = stpcpy (&buf[bufact], catalog->env_var) - buf; bufact = __stpcpy (&buf[bufact], catalog->env_var) - buf;
break; break;
case 'l': case 'l':
/* Use language element of locale category value. */ /* Use language element of locale category value. */
@ -152,7 +152,7 @@ __open_catalog (__nl_catd catalog, int with_path)
if (bufact != 0) if (bufact != 0)
{ {
fd = open (buf, O_RDONLY); fd = __open (buf, O_RDONLY);
if (fd >= 0) if (fd >= 0)
break; 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; catalog->status = nonexisting;
return; return;
@ -181,7 +181,7 @@ __open_catalog (__nl_catd catalog, int with_path)
#endif #endif
catalog->file_size = st.st_size; catalog->file_size = st.st_size;
catalog->file_ptr = catalog->file_ptr =
(struct catalog_obj *) mmap (NULL, st.st_size, PROT_READ, (struct catalog_obj *) __mmap (NULL, st.st_size, PROT_READ,
MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0); MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0);
if (catalog->file_ptr != (struct catalog_obj *) -1) if (catalog->file_ptr != (struct catalog_obj *) -1)
/* Tell the world we managed to mmap the file. */ /* Tell the world we managed to mmap the file. */
@ -201,7 +201,7 @@ __open_catalog (__nl_catd catalog, int with_path)
/* Save read, handle partial reads. */ /* Save read, handle partial reads. */
do do
{ {
size_t now = read (fd, (((char *) &catalog->file_ptr) size_t now = __read (fd, (((char *) &catalog->file_ptr)
+ (st.st_size - todo)), todo); + (st.st_size - todo)), todo);
if (now == 0) if (now == 0)
{ {
@ -216,7 +216,7 @@ __open_catalog (__nl_catd catalog, int with_path)
} }
/* We don't need the file anymore. */ /* We don't need the file anymore. */
close (fd); __close (fd);
/* Determine whether the file is a catalog file and if yes whether /* 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 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 /* Illegal file. Free he resources and mark catalog as not
usable. */ usable. */
if (catalog->status == mmaped) if (catalog->status == mmaped)
munmap ((void *) catalog->file_ptr, catalog->file_size); __munmap ((void *) catalog->file_ptr, catalog->file_size);
else else
free (catalog->file_ptr); free (catalog->file_ptr);
catalog->status = nonexisting; catalog->status = nonexisting;

35
configure vendored
View File

@ -2,7 +2,7 @@
# From configure.in CVSid # From configure.in CVSid
# Guess values for system-dependent variables and create Makefiles. # 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. # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
# #
# This configure script is free software; the Free Software Foundation # This configure script is free software; the Free Software Foundation
@ -355,7 +355,7 @@ EOF
verbose=yes ;; verbose=yes ;;
-version | --version | --versio | --versi | --vers) -version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.10" echo "configure generated by autoconf version 2.99"
exit 0 ;; exit 0 ;;
-with-* | --with-*) -with-* | --with-*)
@ -682,6 +682,7 @@ done
if test -z "$ac_aux_dir"; then 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; } { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
fi fi
ac_config_mkinstalldirs=$ac_aux_dir/mkinstalldirs
ac_config_guess=$ac_aux_dir/config.guess ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub ac_config_sub=$ac_aux_dir/config.sub
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. 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 ;; a29k | am29000) base_machine=a29k machine=a29k ;;
alpha*) base_machine=alpha machine=alpha/$machine ;; alpha*) base_machine=alpha machine=alpha/$machine ;;
hppa*) base_machine=hppa machine=hppa/$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 ;; m680?0) base_machine=m68k machine=m68k/$machine ;;
m68k) base_machine=m68k machine=m68k/m68020 ;; m68k) base_machine=m68k machine=m68k/m68020 ;;
m88???) base_machine=m88k machine=m88k/$machine ;; m88???) base_machine=m88k machine=m88k/$machine ;;
@ -973,6 +974,10 @@ fi
fi fi
echo "$ac_t""$INSTALL" 1>&6 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}. # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution. # It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' 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, # On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. # not just through cpp.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1138 "configure" #line 1143 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 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` ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then if test -z "$ac_err"; then
: :
@ -1149,13 +1154,13 @@ else
rm -rf conftest* rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp" CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1153 "configure" #line 1158 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <assert.h> #include <assert.h>
Syntax Error Syntax Error
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 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` ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then 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 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1301 "configure" #line 1306 "configure"
#include "confdefs.h" #include "confdefs.h"
#define __need_size_t #define __need_size_t
#define __need_wchar_t #define __need_wchar_t
@ -1313,7 +1318,7 @@ size_t size; wchar_t wchar;
if (&size == NULL || &wchar == NULL) abort (); if (&size == NULL || &wchar == NULL) abort ();
; return 0; } ; return 0; }
EOF 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* rm -rf conftest*
libc_cv_friendly_stddef=yes libc_cv_friendly_stddef=yes
else else
@ -1420,7 +1425,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1424 "configure" #line 1429 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { return 0; } int main() { return 0; }
@ -1430,7 +1435,7 @@ asm (".section .init");
asm (".text"); asm (".text");
; return 0; } ; return 0; }
EOF 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* rm -rf conftest*
libc_cv_have_initfini=yes libc_cv_have_initfini=yes
else else
@ -1458,7 +1463,7 @@ if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1462 "configure" #line 1467 "configure"
#include "confdefs.h" #include "confdefs.h"
asm ("_glibc_foobar:"); asm ("_glibc_foobar:");
int main() { return 0; } int main() { return 0; }
@ -1466,7 +1471,7 @@ int t() {
glibc_foobar (); glibc_foobar ();
; return 0; } ; return 0; }
EOF 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* rm -rf conftest*
libc_cv_asm_underscores=yes libc_cv_asm_underscores=yes
else else
@ -1558,7 +1563,7 @@ _start () {}
EOF EOF
if { ac_try='${CC-cc} $CFLAGS if { ac_try='${CC-cc} $CFLAGS
-nostdlib -nostartfiles -Wl,--no-whole-archive -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 libc_cv_ld_no_whole_archive=yes
else else
libc_cv_ld_no_whole_archive=no 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" 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 ;; exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v) -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 ;; exit 0 ;;
-help | --help | --hel | --he | --h) -help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;; echo "\$ac_cs_usage"; exit 0 ;;

View File

@ -69,8 +69,6 @@ $(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so)
$(reloc-link) $^ $(reloc-link) $^
# Link together the dynamic linker into a single relocatable object. # 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 $(objpfx)librtld.so: $(objpfx)dl-allobjs.so $(common-objpfx)libc_pic.a
$(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)' $(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'

View File

@ -97,7 +97,7 @@ _dl_open (const char *file, int mode)
else else
{ {
if (_dl_global_scope_alloc < 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. */ /* Must extend the list. */
struct link_map **new = realloc (_dl_global_scope, struct link_map **new = realloc (_dl_global_scope,

View File

@ -20,6 +20,8 @@ Cambridge, MA 02139, USA. */
#include <assert.h> #include <assert.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.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 /* 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. */ 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"); 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;
}

View File

@ -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" /* 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" /* 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" /* 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" /* 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" /* 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" /* 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 #endif
{ string: (const char *) _nl_C_LC_CTYPE_toupper }, { string: (const char *) _nl_C_LC_CTYPE_toupper },
{ string: (const char *) _nl_C_LC_CTYPE_tolower }, { string: (const char *) _nl_C_LC_CTYPE_tolower },
{ string: NULL },
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
{ string: NULL }, { string: NULL }, { string: NULL },
#endif #endif
{ string: _nl_C_LC_CTYPE_class32 }, { string: _nl_C_LC_CTYPE_class32 },
#if BYTE_ORDER == LITTLE_ENDIAN
{ string: NULL },
#endif
{ string: (const char *) _nl_C_LC_CTYPE_names }, { string: (const char *) _nl_C_LC_CTYPE_names },
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
{ string: NULL }, { string: NULL },

View File

@ -79,8 +79,9 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EB, "ctype-tolower-eb", std, string) 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_TOUPPER_EL, "ctype-toupper-el", std, string)
DEFINE_ELEMENT (_NL_CTYPE_TOLOWER_EL, "ctype-tolower-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_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_SIZE, "ctype-hash-size", std, word)
DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word) DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word)
DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string) DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string)

View File

@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */
#include <alloca.h> #include <alloca.h>
#include <argz.h> #include <argz.h>
#include <errno.h> #include <errno.h>
#include <libc-lock.h>
#include <locale.h> #include <locale.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -93,7 +94,7 @@ extern void postload (void);
/* Define an array indexed by category of postload functions to call after /* Define an array indexed by category of postload functions to call after
loading and installing that category's data. */ 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) \ #define DEFINE_CATEGORY(category, category_name, items, postload, b, c, d) \
[category] = postload, [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. */ /* Use this when we come along an error. */
#define ERROR_RETURN \ #define ERROR_RETURN \
@ -238,8 +242,8 @@ setlocale (int category, const char *locale)
return (char *) _nl_current_names[category]; return (char *) _nl_current_names[category];
/* We perhaps really have to load some data. So we determine the /* We perhaps really have to load some data. So we determine the
path in which to look for the data now. But this environment path in which to look for the data now. The environment variable
variable must only be used when the binary has no SUID or SGID `LOCPATH' must only be used when the binary has no SUID or SGID
bit set. */ bit set. */
locale_path = NULL; locale_path = NULL;
locale_path_len = 0; locale_path_len = 0;
@ -309,6 +313,9 @@ setlocale (int category, const char *locale)
ERROR_RETURN; ERROR_RETURN;
} }
/* Protect global data. */
__libc_lock_lock (lock);
/* Load the new data for each category. */ /* Load the new data for each category. */
while (category-- > 0) while (category-- > 0)
/* Only actually load the data if anything will use it. */ /* Only actually load the data if anything will use it. */
@ -319,25 +326,7 @@ setlocale (int category, const char *locale)
&newnames[category]); &newnames[category]);
if (newdata[category] == NULL) if (newdata[category] == NULL)
{ goto abort_composite;
/* 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;
}
} }
else else
{ {
@ -351,10 +340,28 @@ setlocale (int category, const char *locale)
composite = new_composite_name (LC_ALL, newnames); composite = new_composite_name (LC_ALL, newnames);
if (composite == NULL) if (composite == NULL)
{ {
category = -1; /* Loading this part of the locale failed. Abort the
goto abort_composite; composite load. */
} int save_errno;
category = -1;
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;
composite = NULL;
}
else
{
/* Now we have loaded all the new data. Put it in place. */ /* Now we have loaded all the new data. Put it in place. */
for (category = 0; category < LC_ALL; ++category) for (category = 0; category < LC_ALL; ++category)
{ {
@ -362,6 +369,10 @@ setlocale (int category, const char *locale)
setname (category, newnames[category]); setname (category, newnames[category]);
} }
setname (LC_ALL, composite); setname (LC_ALL, composite);
}
/* Critical section left. */
__libc_lock_unlock (lock);
return composite; return composite;
} }
@ -370,6 +381,9 @@ setlocale (int category, const char *locale)
const struct locale_data *newdata = NULL; const struct locale_data *newdata = NULL;
char *newname = NULL; char *newname = NULL;
/* Protect global data. */
__libc_lock_lock (lock);
if (_nl_current[category] != NULL) if (_nl_current[category] != NULL)
{ {
/* Only actually load the data if anything will use it. */ /* 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, newdata = _nl_find_locale (locale_path, locale_path_len, category,
(char **) &newname); (char **) &newname);
if (newdata == NULL) if (newdata == NULL)
return NULL; goto abort_single;
} }
/* Create new composite name. */ /* Create new composite name. */
@ -392,14 +406,20 @@ setlocale (int category, const char *locale)
_nl_free_locale (newdata); _nl_free_locale (newdata);
errno = save_errno; errno = save_errno;
return NULL; abort_single:
newname = NULL;
} }
else
{
if (_nl_current[category] != NULL) if (_nl_current[category] != NULL)
setdata (category, newdata); setdata (category, newdata);
setname (category, newname); setname (category, newname);
setname (LC_ALL, composite); setname (LC_ALL, composite);
}
/* Critical section left. */
__libc_lock_unlock (lock);
return newname; return newname;
} }

View File

@ -223,8 +223,8 @@ following patterns:
@smallexample @smallexample
alpha-dec-osf1 alpha-dec-osf1
alpha-gnu-linux alpha-@var{anything}-linux
alpha-gnu-linuxecoff alpha-@var{anything}-linuxecoff
i@var{x}86-@var{anything}-bsd4.3 i@var{x}86-@var{anything}-bsd4.3
i@var{x}86-@var{anything}-gnu i@var{x}86-@var{anything}-gnu
i@var{x}86-@var{anything}-isc2.2 i@var{x}86-@var{anything}-isc2.2

View File

@ -1494,8 +1494,7 @@ int
open2 (char *str1, char *str2, int flags, int mode) open2 (char *str1, char *str2, int flags, int mode)
@{ @{
char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1); char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1);
strcpy (name, str1); stpcpy (stpcpy (name, str1), str2);
strcat (name, str2);
return open (name, flags, mode); return open (name, flags, mode);
@} @}
@end smallexample @end smallexample
@ -1512,8 +1511,7 @@ open2 (char *str1, char *str2, int flags, int mode)
int desc; int desc;
if (name == 0) if (name == 0)
fatal ("virtual memory exceeded"); fatal ("virtual memory exceeded");
strcpy (name, str1); stpcpy (stpcpy (name, str1), str2);
strcat (name, str2);
desc = open (name, flags, mode); desc = open (name, flags, mode);
free (name); free (name);
return desc; return desc;
@ -1558,8 +1556,7 @@ int
open2 (char *str1, char *str2, int flags, int mode) open2 (char *str1, char *str2, int flags, int mode)
@{ @{
char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1); char *name = (char *) alloca (strlen (str1) + strlen (str2) + 1);
strcpy (name, str1); stpcpy (stpcpy (name, str1), str2);
strcat (name, str2);
return open_or_report_error (name, flags, mode); return open_or_report_error (name, flags, mode);
@} @}
@end smallexample @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) int open2 (char *str1, char *str2, int flags, int mode)
@{ @{
char name[strlen (str1) + strlen (str2) + 1]; char name[strlen (str1) + strlen (str2) + 1];
strcpy (name, str1); stpcpy (stpcpy (name, str1), str2);
strcat (name, str2);
return open (name, flags, mode); return open (name, flags, mode);
@} @}
@end smallexample @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% 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 full, and when it becomes 95% full. Above 95% you get another warning
each time memory usage increases. each time memory usage increases.

View File

@ -623,10 +623,10 @@ overlap; see @ref{Copying and Concatenation}.
The return value is the length of the entire transformed string. This 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 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 or equal than @var{size}, it means that the transformed string did not
fit in the array @var{to}. In this case, only as much of the string as entirely fit in the array @var{to}. In this case, only as much of the
actually fits was stored. To get the whole transformed string, call string as actually fits was stored. To get the whole transformed
@code{strxfrm} again with a bigger output array. string, call @code{strxfrm} again with a bigger output array.
The transformed string may be longer than the original string, and it The transformed string may be longer than the original string, and it
may also be shorter. may also be shorter.
@ -671,23 +671,32 @@ sort_strings_fast (char **array, int nstrings)
for (i = 0; i < nstrings; i++) for (i = 0; i < nstrings; i++)
@{ @{
size_t length = strlen (array[i]) * 2; size_t length = strlen (array[i]) * 2;
char *transformed;
size_t transformed_lenght;
temp_array[i].input = array[i]; temp_array[i].input = array[i];
/* @r{Transform @code{array[i]}.} /* @r{First try a buffer perhaps big enough.} */
@r{First try a buffer probably big enough.} */ transformed = (char *) xmalloc (length);
while (1)
@{ /* @r{Transform @code{array[i]}.} */
char *transformed = (char *) xmalloc (length); transformed_length = strxfrm (transformed, array[i], length);
if (strxfrm (transformed, array[i], length) < length)
/* @r{If the buffer was not large enough, resize it}
@r{and try again.} */
if (transformed_length >= length)
@{ @{
/* @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; temp_array[i].transformed = transformed;
break;
@}
/* @r{Try again with a bigger buffer.} */
free (transformed);
length *= 2;
@}
@} @}
/* @r{Sort @code{temp_array} by comparing transformed strings.} */ /* @r{Sort @code{temp_array} by comparing transformed strings.} */
@ -857,8 +866,6 @@ strpbrk ("hello, world", " \t\n,.;!?")
@node Finding Tokens in a String, , Search Functions, String and Array Utilities @node Finding Tokens in a String, , Search Functions, String and Array Utilities
@section Finding Tokens in a String @section Finding Tokens in a String
@c !!! Document strsep, which is a better thing to use than strtok.
@cindex tokenizing strings @cindex tokenizing strings
@cindex breaking a string into tokens @cindex breaking a string into tokens
@cindex parsing tokens from a string @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 => "punctuation" */
token = strtok (NULL, delimiters); /* token => NULL */ token = strtok (NULL, delimiters); /* token => NULL */
@end smallexample @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

View File

@ -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 \ 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/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/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 \ routines := brk sbrk sstk ioctl \
readv writev \ readv writev \
@ -54,7 +54,7 @@ routines := brk sbrk sstk ioctl \
mmap munmap mprotect msync madvise \ mmap munmap mprotect msync madvise \
efgcvt efgcvt_r qefgcvt qefgcvt_r \ efgcvt efgcvt_r qefgcvt qefgcvt_r \
hsearch hsearch_r tsearch lsearch \ hsearch hsearch_r tsearch lsearch \
err error err error ustat
aux := init-misc aux := init-misc
distribute := bsd-compat.c distribute := bsd-compat.c
extra-objs := bsd-compat.o extra-objs := bsd-compat.o

View File

@ -39,6 +39,8 @@ __BEGIN_DECLS
of `struct timeval'. */ of `struct timeval'. */
struct timeval; struct timeval;
typedef __fd_mask fd_mask;
/* Representation of a set of file descriptors. */ /* Representation of a set of file descriptors. */
#define fd_set __fd_set #define fd_set __fd_set

View File

@ -20,15 +20,17 @@ Cambridge, MA 02139, USA. */
/* This interface is obsolete. Use <sys/statfs.h> instead. */ /* This interface is obsolete. Use <sys/statfs.h> instead. */
#ifndef _SYS_USTAT_H #ifndef _SYS_USTAT_H
#define _SYS_USTAT_H 1 #define _SYS_USTAT_H 1
#include <features.h>
#include <sys/types.h> #include <sys/types.h>
#include <ustatbits.h> #include <ustatbits.h>
__BEGIN_DECLS __BEGIN_DECLS
extern int __ustat __P ((dev_t, struct ustat *)); extern int __ustat __P ((__dev_t __dev, struct ustat *__ubuf));
extern int ustat __P ((dev_t, struct ustat *)); extern int ustat __P ((__dev_t __dev, struct ustat *__ubuf));
__END_DECLS __END_DECLS

View File

@ -56,6 +56,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#include <varargs.h> #include <varargs.h>
#endif #endif
static int LogType = SOCK_DGRAM; /* type of socket connection */
static int LogFile = -1; /* fd for log */ static int LogFile = -1; /* fd for log */
static int connected; /* have done connect */ static int connected; /* have done connect */
static int LogStat = 0; /* status bits, set by openlog() */ 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. */ /* Get connected, output the message to the local logger. */
if (!connected) if (!connected)
openlog(LogTag, LogStat | LOG_NDELAY, 0); 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) if (__send(LogFile, buf, bufsize, 0) < 0)
{ {
closelog (); /* attempt re-open next time */
/* /*
* Output the message to the console; don't worry about blocking, * Output the message to the console; don't worry about blocking,
* if console blocks everything will. Make sure the error reported * 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) if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
LogFacility = logfac; LogFacility = logfac;
while (1) {
if (LogFile == -1) { if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX; SyslogAddr.sa_family = AF_UNIX;
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG, (void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data)); sizeof(SyslogAddr.sa_data));
if (LogStat & LOG_NDELAY) { if (LogStat & LOG_NDELAY) {
if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) if ((LogFile = socket(AF_UNIX, LogType, 0))
== -1)
return; return;
(void)fcntl(LogFile, F_SETFD, 1); (void)fcntl(LogFile, F_SETFD, 1);
} }
} }
if (LogFile != -1 && !connected) if (LogFile != -1 && !connected)
if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) == -1) if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))
== -1)
{ {
int saved_errno = errno;
(void)close(LogFile); (void)close(LogFile);
LogFile = -1; LogFile = -1;
if (LogType == SOCK_DGRAM
&& saved_errno == EPROTOTYPE)
{
/* retry with next SOCK_STREAM: */
LogType = SOCK_STREAM;
continue;
}
} else } else
connected = 1; connected = 1;
break;
}
} }
void void

View File

@ -42,10 +42,6 @@ static service_library *nss_new_service (name_database *database,
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (static, lock)
/* Global variable. */
struct __res_state _res;
/* Nonzero if the sevices are already initialized. */ /* Nonzero if the sevices are already initialized. */
static int nss_initialized; static int nss_initialized;

View File

@ -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. */ /* 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, __const __ptr_t __buf, size_t __n,
extern int send __P ((int __fd, __ptr_t __buf, size_t __n, int __flags)); 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. /* Read N bytes into BUF from socket FD.
Returns the number read or -1 for errors. */ 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 /* 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. */ 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, extern int sendto __P ((int __fd, __const __ptr_t __buf, size_t __n,
__CONST_SOCKADDR_ARG __addr, size_t __addr_len)); int __flags, __CONST_SOCKADDR_ARG __addr,
size_t __addr_len));
/* Read N bytes into BUF through socket FD. /* Read N bytes into BUF through socket FD.
If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of

View File

@ -71,6 +71,19 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
(void) strcpy(one, ""); (void) strcpy(one, "");
equal(one, "", 7); /* Boundary condition. */ 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. */ /* strcat. */
it = "strcat"; it = "strcat";
(void) strcpy(one, "ijk"); (void) strcpy(one, "ijk");

View File

@ -75,9 +75,12 @@ extra-objs = $(rpcgen-objs)
all: # Make this the default target; it will be defined in Rules. all: # Make this the default target; it will be defined in Rules.
# Sun's code is not too clean.
override +gccwarn := -w
include ../Makeconfig include ../Makeconfig
ifeq (no,$(cross-compile)) ifeq (no,$(cross-compiling))
# We can only build this library if we can run the rpcgen we build. # We can only build this library if we can run the rpcgen we build.
extra-libs := librpcsvc extra-libs := librpcsvc
extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. 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) omit-deps = $(librpcsvc-routines)
endif endif
# Sun's code is not too clean.
override +gccwarn := -w
include ../Rules include ../Rules
$(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) $(common-objpfx)libc.a

View File

@ -50,8 +50,6 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */ /* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
struct opaque_auth _null_auth;
/* /*
* XDR an opaque authentication struct * XDR an opaque authentication struct
* (see auth.h) * (see auth.h)

View File

@ -35,13 +35,10 @@ respectively in gmon.c language...). */
#include <sysdep.h> #include <sysdep.h>
#undef ret /* discard `ret' as defined in sysdep.h */
.set noat .set noat
.set noreorder .set noreorder
LEAF(_mcount, 0xb0) LEAF(_mcount, 0xb0)
weak_alias (_mcount, mcount)
.prologue 0 .prologue 0
subq sp, 0xb0, sp subq sp, 0xb0, sp
@ -69,8 +66,6 @@ weak_alias (_mcount, mcount)
stq t5, 0x70(sp) stq t5, 0x70(sp)
stq t6, 0x78(sp) stq t6, 0x78(sp)
lda pv, __mcount
stq t7, 0x80(sp) stq t7, 0x80(sp)
stq t8, 0x88(sp) stq t8, 0x88(sp)
stq t9, 0x90(sp) stq t9, 0x90(sp)
@ -78,7 +73,7 @@ weak_alias (_mcount, mcount)
stq t11, 0xa0(sp) stq t11, 0xa0(sp)
stq v0, 0xa8(sp) stq v0, 0xa8(sp)
jsr ra, (pv), __mcount jsr ra, __mcount
ldq a0, 0x00(sp) ldq a0, 0x00(sp)
ldq a1, 0x08(sp) ldq a1, 0x08(sp)
@ -108,3 +103,5 @@ weak_alias (_mcount, mcount)
ret zero,($at),1 ret zero,($at),1
END(_mcount) END(_mcount)
weak_alias (_mcount, mcount)

View File

@ -61,8 +61,8 @@ init:
stq t0, ZERO_WORD(a0) /* blocks->zero_word = 1 */ stq t0, ZERO_WORD(a0) /* blocks->zero_word = 1 */
stq t2, NEXT(a0) /* blocks->next = __bb_head */ stq t2, NEXT(a0) /* blocks->next = __bb_head */
stq a0, 0(t1) stq a0, 0(t1)
bne t2, leave bne t2, $leave
beq t3, leave /* t3 == GMON_PROF_ON? yes -> */ beq t3, $leave /* t3 == GMON_PROF_ON? yes -> */
/* also need to initialize destructor: */ /* also need to initialize destructor: */
stq ra, 0x00(sp) stq ra, 0x00(sp)
@ -81,7 +81,7 @@ init:
ldq a4, 0x20(sp) ldq a4, 0x20(sp)
ldq a5, 0x28(sp) ldq a5, 0x28(sp)
leave: ldq pv, 0x30(sp) $leave: ldq pv, 0x30(sp)
addq sp, 0x38, sp addq sp, 0x38, sp
ret ret

View File

@ -1,5 +1,5 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. Alpha version. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h> #include <sysdep.h>
ENTRY(_setjmp) 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. */ bis $31, $31, $17 /* Pass a second argument of zero. */
jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ jmp $31, __sigsetjmp /* Call __sigsetjmp. */
END(_setjmp) END(_setjmp)

View File

@ -1,5 +1,5 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. Alpha version. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h> #include <sysdep.h>
ENTRY(setjmp) 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. */ bis $31, 1, $17 /* Pass a second argument of one. */
jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ jmp $31, __sigsetjmp /* Call __sigsetjmp. */
END(setjmp) END(setjmp)

View File

@ -115,10 +115,9 @@ FUNC_NAME:
br AT, 1f br AT, 1f
1: ldgp gp, 0(AT) 1: ldgp gp, 0(AT)
lda AT, _mcount
mov retaddr, ra mov retaddr, ra
jsr AT, (AT), _mcount jsr AT, _mcount
ldq ra, 0x00(sp) ldq ra, 0x00(sp)
ldq pv, 0x08(sp) ldq pv, 0x08(sp)
@ -137,7 +136,7 @@ FUNC_NAME:
stq tmp0,0x18(sp) stq tmp0,0x18(sp)
bis zero,zero,quotient bis zero,zero,quotient
stq tmp1,0x20(sp) stq tmp1,0x20(sp)
beq divisor,divbyzero beq divisor,$divbyzero
stq sign,0x28(sp) stq sign,0x28(sp)
GETSIGN(dividend,divisor,sign) GETSIGN(dividend,divisor,sign)
#if SIGNED #if SIGNED
@ -170,7 +169,7 @@ FUNC_NAME:
ldq arg1,0x00(sp) ldq arg1,0x00(sp)
SETSIGN(sign,result,tmp0) SETSIGN(sign,result,tmp0)
done: ldq arg2,0x08(sp) $done: ldq arg2,0x08(sp)
ldq mask,0x10(sp) ldq mask,0x10(sp)
ldq tmp0,0x18(sp) ldq tmp0,0x18(sp)
ldq tmp1,0x20(sp) ldq tmp1,0x20(sp)
@ -178,11 +177,11 @@ done: ldq arg2,0x08(sp)
lda sp,FRAME_SIZE(sp) lda sp,FRAME_SIZE(sp)
ret zero,(retaddr),0 ret zero,(retaddr),0
divbyzero: $divbyzero:
lda a0,GEN_INTDIV(zero) lda a0,GEN_INTDIV(zero)
call_pal PAL_gentrap call_pal PAL_gentrap
bis zero,zero,result /* if trap returns, return 0 */ bis zero,zero,result /* if trap returns, return 0 */
ldq arg1,0x00(sp) ldq arg1,0x00(sp)
br done br $done
END(FUNC_NAME) END(FUNC_NAME)

View File

@ -34,7 +34,7 @@ ENTRY(ffs)
negq a0, t0 # due to the srl instruction negq a0, t0 # due to the srl instruction
and a0, t0, t0 and a0, t0, t0
clr v0 clr v0
beq a0, done beq a0, $done
# now do binary search for first non-zero bit # now do binary search for first non-zero bit
@ -61,6 +61,6 @@ ENTRY(ffs)
addq v0, 1, t3 addq v0, 1, t3
cmoveq t2, t3, v0 cmoveq t2, t3, v0
done: ret $done: ret
END(ffs) END(ffs)

View File

@ -42,7 +42,7 @@ For correctness consider that:
ENTRY(memchr) ENTRY(memchr)
.prologue 0 .prologue 0
beq a2, not_found beq a2, $not_found
ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned)
addq a0, a2, t4 addq a0, a2, t4
and a1, 0xff, a1 # a1 = 00000000000000ch and a1, 0xff, a1 # a1 = 00000000000000ch
@ -57,7 +57,7 @@ ENTRY(memchr)
extql t0, a0, t6 extql t0, a0, t6
or t1, a1, a1 # a1 = chchchchchchchch or t1, a1, a1 # a1 = chchchchchchchch
beq t3, first_quad beq t3, $first_quad
extqh t5, a0, t5 extqh t5, a0, t5
mov a0, v0 mov a0, v0
@ -68,15 +68,15 @@ ENTRY(memchr)
# in t0. E.g.: # in t0. E.g.:
# a2 = 6 # a2 = 6
# t0 = ????c6c5c4c3c2c1 # t0 = ????c6c5c4c3c2c1
last_quad: $last_quad:
negq a2, t5 negq a2, t5
srl t2, t5, t5 # t5 = mask of a2 bits set srl t2, t5, t5 # t5 = mask of a2 bits set
xor a1, t0, t0 xor a1, t0, t0
cmpbge zero, t0, t1 cmpbge zero, t0, t1
and t1, t5, t1 and t1, t5, t1
beq t1, not_found beq t1, $not_found
found_it: $found_it:
# now, determine which byte matched: # now, determine which byte matched:
negq t1, t2 negq t1, t2
and t1, t2, t1 and t1, t2, t1
@ -93,20 +93,20 @@ found_it:
addq v0, 1, t2 addq v0, 1, t2
cmoveq t0, t2, v0 cmoveq t0, t2, v0
done: ret $done: ret
# #
# Deal with the case where a2 > 8 bytes remain to be # Deal with the case where a2 > 8 bytes remain to be
# searched. a0 may not be aligned. # searched. a0 may not be aligned.
# #
first_quad: $first_quad:
andnot a0, 0x7, v0 andnot a0, 0x7, v0
insqh t2, a0, t1 # t1 = 0000ffffffffffff (a0<0:2> ff bytes) insqh t2, a0, t1 # t1 = 0000ffffffffffff (a0<0:2> ff bytes)
xor t0, a1, t0 xor t0, a1, t0
or t0, t1, t0 # t0 = ====ffffffffffff or t0, t1, t0 # t0 = ====ffffffffffff
cmpbge zero, t0, t1 cmpbge zero, t0, t1
bne t1, found_it bne t1, $found_it
/* at least one byte left to process */ /* at least one byte left to process */
@ -119,41 +119,41 @@ first_quad:
subq t4, 1, a2 subq t4, 1, a2
andnot a2, 0x7, a2 andnot a2, 0x7, a2
cmpult v0, a2, t1 cmpult v0, a2, t1
beq t1, final beq t1, $final
/* at least two quads remain to be accessed */ /* at least two quads remain to be accessed */
subq a2, v0, t3 # t3 <- number of quads to be processed in loop subq a2, v0, t3 # t3 <- number of quads to be processed in loop
and t3, 8, t3 # odd number of quads? 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 */ /* at least three quads remain to be accessed */
mov t0, t3 # move prefetched value into correct register mov t0, t3 # move prefetched value into correct register
.align 3 .align 3
unrolled_loop: $unrolled_loop:
ldq t0, 8(v0) # prefetch t0 ldq t0, 8(v0) # prefetch t0
xor a1, t3, t1 xor a1, t3, t1
cmpbge zero, t1, t1 cmpbge zero, t1, t1
bne t1, found_it bne t1, $found_it
addq v0, 8, v0 addq v0, 8, v0
odd_quad_count: $odd_quad_count:
xor a1, t0, t1 xor a1, t0, t1
ldq t3, 8(v0) # prefetch t3 ldq t3, 8(v0) # prefetch t3
cmpbge zero, t1, t1 cmpbge zero, t1, t1
bne t1, found_it bne t1, $found_it
addq v0, 8, v0 addq v0, 8, v0
cmpult v0, a2, t5 cmpult v0, a2, t5
bne t5, unrolled_loop bne t5, $unrolled_loop
mov t3, t0 # move prefetched value into t0 mov t3, t0 # move prefetched value into t0
final: subq t4, v0, a2 # a2 <- number of bytes left to do $final: subq t4, v0, a2 # a2 <- number of bytes left to do
bne a2, last_quad bne a2, $last_quad
not_found: $not_found:
mov zero, v0 mov zero, v0
ret ret

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -25,9 +25,8 @@ ENTRY (__sigsetjmp)
ldgp $29, 0($27) ldgp $29, 0($27)
.prologue 1 .prologue 1
lda $27, __sigsetjmp_aux /* Load address to jump to. */
bis $30, $30, $18 /* Pass SP as 3rd arg. */ bis $30, $30, $18 /* Pass SP as 3rd arg. */
bis $15, $15, $19 /* Pass FP as 4th 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) END(__sigsetjmp)

View File

@ -22,11 +22,11 @@ Cambridge, MA 02139, USA. */
architecture: architecture:
- memory accessed as aligned quadwords only - memory accessed as aligned quadwords only
- uses bcmpge to compare 8 bytes in parallel - uses cmpbge to compare 8 bytes in parallel
- does binary search to find 0 byte in last - does binary search to find 0 byte in last quadword (HAKMEM
quadword (HAKMEM needed 12 instructions to needed 12 instructions to do this instead of the 8 instructions
do this instead of the 9 instructions that that the binary search needs).
binary search needs). */ */
#include <sysdep.h> #include <sysdep.h>
@ -39,32 +39,30 @@ ENTRY(strlen)
insqh t1, a0, t1 insqh t1, a0, t1
andnot a0, 7, v0 andnot a0, 7, v0
or t1, t0, t0 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 cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0
bne t1, found bne t1, $found
loop: ldq t0, 8(v0) $loop: ldq t0, 8(v0)
addq v0, 8, v0 # addr += 8 addq v0, 8, v0 # addr += 8
nop # helps dual issue last two insns
cmpbge zero, t0, t1 cmpbge zero, t0, t1
beq t1, loop beq t1, $loop
found: blbs t1, done # make aligned case fast $found: negq t1, t2 # clear all but least set bit
negq t1, t2
and t1, t2, t1 and t1, t2, t1
and t1, 0x0f, t0 and t1, 0xf0, t2 # binary search for that set bit
addq v0, 4, t2 and t1, 0xcc, t3
cmoveq t0, t2, v0 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
and t1, 0x33, t0 subq v0, a0, v0
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 ret
END(strlen) END(strlen)

View File

@ -57,8 +57,6 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n)
goto last_chars; goto last_chars;
} }
n -= dest - s; n -= dest - s;
if (n == 0)
return dest - 1;
goto zero_fill; goto zero_fill;
} }
@ -70,16 +68,16 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n)
for (;;) for (;;)
{ {
c = *src++; c = *src++;
--n;
*dest++ = c; *dest++ = c;
if (c == '\0') if (c == '\0')
break; break;
if (--n == 0) if (n == 0)
return dest; return dest;
} }
--n;
zero_fill: zero_fill:
while (--n > 0) while (n-- > 0)
dest[n] = '\0'; dest[n] = '\0';
return dest - 1; return dest - 1;

View File

@ -1,5 +1,5 @@
/* Generic declaration of ustat structure. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
__BEGIN_DECLS
struct ustat struct ustat
{ {
daddr_t f_tfree; /* total free */ __daddr_t f_tfree; /* total free */
ino_t f_tinode; /* total inodes free */ __ino_t f_tinode; /* total inodes free */
char f_fname[6]; /* filesystem name */ char f_fname[6]; /* filesystem name */
char f_fpack[6]; /* filesystem pack name */ char f_fpack[6]; /* filesystem pack name */
}; };
__END_DECLS

View File

@ -19,7 +19,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _FPU_CONTROL_H #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 /* Here is the dirty part. Settup up your 387 through the control word
* (cw) register. * (cw) register.
@ -80,10 +80,10 @@ Boston, MA 02111-1307, USA. */
/* The fdlibm code requires strict IEEE double precision arithmetic, /* The fdlibm code requires strict IEEE double precision arithmetic,
and no interrupts for exceptions, rounding to nearest. */ and no interrupts for exceptions, rounding to nearest. */
#define _FPU_DEFAULT 0x127f #define _FPU_DEFAULT 0x137f
/* IEEE: same as above, but exceptions */ /* IEEE: same as above, but exceptions */
#define _FPU_IEEE 0x127f #define _FPU_IEEE 0x137f
/* Type of the control word. */ /* Type of the control word. */
typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));

View File

@ -1,5 +1,5 @@
ifeq ($(subdir), misc) ifeq ($(subdir), misc)
sysdep_routines += sysctl sysdep_routines += sysctl clone
sysdep_headers += sys/mount.h sys/sysinfo.h sys/acct.h sys/sysctl.h \ 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 \ sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \

View File

@ -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). Contributed by Brendan Kehoe (brendan@zen.org).
The GNU C Library is free software; you can redistribute it and/or 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 <sysdep.h>
#include <errnos.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 .comm __curbrk, 8
#endif
.text .text
LEAF(__brk, 0) LEAF(__brk, 0)

View File

@ -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. This file is part of the GNU C Library.
Contributed by David Mosberger. Contributed by David Mosberger.
@ -92,6 +92,7 @@ static struct platform {
{"EB66", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ {"EB66", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */
{"EB66P", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ {"EB66P", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */
{"Jensen", IOSYS_JENSEN, JENSEN_MEM}, {"Jensen", IOSYS_JENSEN, JENSEN_MEM},
{"Mikasa", IOSYS_APECS, APECS_DENSE_MEM},
{"Mustang", IOSYS_APECS, APECS_DENSE_MEM}, {"Mustang", IOSYS_APECS, APECS_DENSE_MEM},
{"Noname", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */ {"Noname", IOSYS_APECS, APECS_DENSE_MEM}, /* LCA same as APECS */
}; };

View File

@ -65,4 +65,8 @@ typedef long int __swblk_t; /* Type of a swap block maybe? */
typedef __kernel_fd_set __fd_set; typedef __kernel_fd_set __fd_set;
typedef __kernel_clock_t __clock_t; 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 */ #endif /* gnu/types.h */

View File

@ -40,13 +40,13 @@ __localtime_r (timer, tp)
/* This lock is defined in tzset.c and locks all the data defined there /* 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. and in tzfile.c; the internal functions do no locking themselves.
This lock is only taken here and in `tzset'. */ This lock is only taken here and in `tzset'. */
__libc_lock_define (extern, __tzset_lock)
extern int __tzset_run, __use_tzfile; extern int __tzset_run, __use_tzfile;
extern int __tz_compute __P ((time_t timer, struct tm *tp)); extern int __tz_compute __P ((time_t timer, struct tm *tp));
extern int __tzfile_compute __P ((time_t timer, extern int __tzfile_compute __P ((time_t timer,
long int *leap_correct, int *leap_hit)); long int *leap_correct, int *leap_hit));
long int leap_correction; long int leap_correction;
int leap_extra_secs; int leap_extra_secs;
__libc_lock_define (extern, __tzset_lock);
if (timer == NULL) if (timer == NULL)
{ {