mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
initial import
This commit is contained in:
commit
28f540f45b
10
.cvsignore
Normal file
10
.cvsignore
Normal file
@ -0,0 +1,10 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
||||
|
||||
configparms
|
||||
|
||||
sun4 i386 i386-gnuelf hp300-netbsd hp300
|
||||
|
||||
ieeetest hppa-sysdeps regex
|
12
=__ify
Executable file
12
=__ify
Executable file
@ -0,0 +1,12 @@
|
||||
for func in $*; do
|
||||
for file in `find sysdeps -name "${func}.c"`;
|
||||
do
|
||||
script=/tmp/foo$$;
|
||||
( echo "%s/${func}/__&/g";
|
||||
echo x )>$script ;
|
||||
ex $file <$script ;
|
||||
newfile=`echo $file | sed "s/${func}/__&/"`;
|
||||
mv $file $newfile;
|
||||
echo $newfile;
|
||||
done
|
||||
done
|
832
INSTALL
Normal file
832
INSTALL
Normal file
@ -0,0 +1,832 @@
|
||||
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.*
|
||||
|
||||
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:
|
||||
(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
|
||||
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':
|
||||
|
||||
`--with-gnu-ld'
|
||||
Use this option if you plan to use GNU `ld' to link programs with
|
||||
the GNU C Library. (We strongly recommend that you do.) This
|
||||
option enables use of features that exist only in GNU `ld'; so if
|
||||
you configure for GNU `ld' you must use GNU `ld' *every time* you
|
||||
link with the GNU C Library, and when building it.
|
||||
|
||||
`--with-gnu-as'
|
||||
Use this option if you plan to use the GNU assembler, `gas', when
|
||||
building the GNU C Library. On some systems, the library may not
|
||||
build properly if you do *not* use `gas'.
|
||||
|
||||
`--nfp'
|
||||
Use this option if your computer lacks hardware floating point
|
||||
support.
|
||||
|
||||
`--prefix=DIRECTORY'
|
||||
Install machine-independent data files in subdirectories of
|
||||
`DIRECTORY'. (You can also set this in `configparms'; see below.)
|
||||
|
||||
`--exec-prefix=DIRECTORY'
|
||||
Install the library and other machine-dependent files in
|
||||
subdirectories of `DIRECTORY'. (You can also set this in
|
||||
`configparms'; see below.)
|
||||
|
||||
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.
|
||||
|
||||
You can prepare to build the library in some other directory by going
|
||||
to that other directory to run `configure'. In order to run configure,
|
||||
you will have to specify a directory for it, like this:
|
||||
|
||||
mkdir sun4
|
||||
cd sun4
|
||||
../configure sparc-sun-sunos4.1
|
||||
|
||||
`configure' looks for the sources in whatever directory you specified
|
||||
for finding `configure' itself. It does not matter where in the file
|
||||
system the source and build directories are--as long as you specify the
|
||||
source directory when you run `configure', you will get the proper
|
||||
results.
|
||||
|
||||
This feature lets you keep sources and binaries in different
|
||||
directories, and that makes it easy to build the library for several
|
||||
different machines from the same set of sources. Simply create a build
|
||||
directory for each target machine, and run `configure' in that
|
||||
directory specifying the target machine's configuration name.
|
||||
|
||||
The library has a number of special-purpose configuration parameters.
|
||||
These are defined in the file `Makeconfig'; see the comments in that
|
||||
file for the details.
|
||||
|
||||
But don't edit the file `Makeconfig' yourself--instead, create a
|
||||
file `configparms' in the directory where you are building the library,
|
||||
and define in that file the parameters you want to specify.
|
||||
`configparms' should *not* be an edited copy of `Makeconfig'; specify
|
||||
only the parameters that you want to override. To see how to set these
|
||||
parameters, find the section of `Makeconfig' that says "These are the
|
||||
configuration variables." Then for each parameter that you want to
|
||||
change, copy the definition from `Makeconfig' to your new `configparms'
|
||||
file, and change the value as appropriate for your system.
|
||||
|
||||
It is easy to configure the GNU C library for cross-compilation by
|
||||
setting a few variables in `configparms'. Set `CC' to the
|
||||
cross-compiler for the target you configured the library for; it is
|
||||
important to use this same `CC' value when running `configure', like
|
||||
this: `CC=TARGET-gcc configure TARGET'. Set `BUILD_CC' to the compiler
|
||||
to use for for programs run on the build system as part of compiling
|
||||
the library. You may need to set `AR' and `RANLIB' to cross-compiling
|
||||
versions of `ar' and `ranlib' if the native tools are not configured to
|
||||
work with object files for the target you configured for.
|
||||
|
||||
Some of the machine-dependent code for some machines uses extensions
|
||||
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 and run some test programs which exercise some of the
|
||||
library facilities, type `make tests'. 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'.
|
||||
|
||||
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,
|
||||
before installing them.
|
||||
|
||||
Reporting Bugs
|
||||
==============
|
||||
|
||||
There are probably bugs in the GNU C library. There are certainly
|
||||
errors and omissions in this manual. If you report them, they will get
|
||||
fixed. If you don't, no one will ever know about them and they will
|
||||
remain unfixed for all eternity, if not longer.
|
||||
|
||||
To report a bug, first you must find it. Hopefully, this will be the
|
||||
hard part. Once you've found a bug, make sure it's really a bug. A
|
||||
good way to do this is to see if the GNU C library behaves the same way
|
||||
some other C library does. If so, probably you are wrong and the
|
||||
libraries are right (but not necessarily). If not, one of the libraries
|
||||
is probably wrong.
|
||||
|
||||
Once you're sure you've found a bug, try to narrow it down to the
|
||||
smallest test case that reproduces the problem. In the case of a C
|
||||
library, you really only need to narrow it down to one library function
|
||||
call, if possible. This should not be too difficult.
|
||||
|
||||
The final step when you have a simple test case is to report the bug.
|
||||
When reporting a bug, send your test case, the results you got, the
|
||||
results you expected, what you think the problem might be (if you've
|
||||
thought of anything), your system type, and the version of the GNU C
|
||||
library which you are using. Also include the files `config.status'
|
||||
and `config.make' which are created by running `configure'; they will
|
||||
be in whatever directory was current when you ran `configure'.
|
||||
|
||||
If you think you have found some way in which the GNU C library does
|
||||
not conform to the ANSI and POSIX standards (*note Standards and
|
||||
Portability::.), that is definitely a bug. Report it!
|
||||
|
||||
Send bug reports to the Internet address `bug-glibc@prep.ai.mit.edu'
|
||||
or the UUCP path `mit-eddie!prep.ai.mit.edu!bug-glibc'. If you have
|
||||
other problems with installation or use, please report those as well.
|
||||
|
||||
If you are not sure how a function should behave, and this manual
|
||||
doesn't tell you, that's a bug in the manual. Report that too! If the
|
||||
function's behavior disagrees with the manual, then either the library
|
||||
or the manual has a bug, so report the disagreement. If you find any
|
||||
errors or omissions in this manual, please report them to the Internet
|
||||
address `bug-glibc-manual@prep.ai.mit.edu' or the UUCP path
|
||||
`mit-eddie!prep.ai.mit.edu!bug-glibc-manual'.
|
||||
|
||||
Adding New Functions
|
||||
====================
|
||||
|
||||
The process of building the library is driven by the makefiles, which
|
||||
make heavy use of special features of GNU `make'. The makefiles are
|
||||
very complex, and you probably don't want to try to understand them.
|
||||
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.
|
||||
|
||||
Each subdirectory contains a simple makefile, called `Makefile',
|
||||
which defines a few `make' variables and then includes the global
|
||||
makefile `Rules' with a line like:
|
||||
|
||||
include ../Rules
|
||||
|
||||
The basic variables that a subdirectory makefile defines are:
|
||||
|
||||
`subdir'
|
||||
The name of the subdirectory, for example `stdio'. This variable
|
||||
*must* be defined.
|
||||
|
||||
`headers'
|
||||
The names of the header files in this section of the library, such
|
||||
as `stdio.h'.
|
||||
|
||||
`routines'
|
||||
`aux'
|
||||
The names of the modules (source files) in this section of the
|
||||
library. These should be simple names, such as `strlen' (rather
|
||||
than complete file names, such as `strlen.c'). Use `routines' for
|
||||
modules that define functions in the library, and `aux' for
|
||||
auxiliary modules containing things like data definitions. But the
|
||||
values of `routines' and `aux' are just concatenated, so there
|
||||
really is no practical difference.
|
||||
|
||||
`tests'
|
||||
The names of test programs for this section of the library. These
|
||||
should be simple names, such as `tester' (rather than complete file
|
||||
names, such as `tester.c'). `make tests' will build and run all
|
||||
the test programs. If a test program needs input, put the test
|
||||
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'.
|
||||
|
||||
`others'
|
||||
The names of "other" programs associated with this section of the
|
||||
library. These are programs which are not tests per se, but are
|
||||
other small programs included with the library. They are built by
|
||||
`make others'.
|
||||
|
||||
`install-lib'
|
||||
`install-data'
|
||||
`install'
|
||||
Files to be installed by `make install'. Files listed in
|
||||
`install-lib' are installed in the directory specified by `libdir'
|
||||
in `configparms' or `Makeconfig' (*note Installation::.). Files
|
||||
listed in `install-data' are installed in the directory specified
|
||||
by `datadir' in `configparms' or `Makeconfig'. Files listed in
|
||||
`install' are installed in the directory specified by `bindir' in
|
||||
`configparms' or `Makeconfig'.
|
||||
|
||||
`distribute'
|
||||
Other files from this subdirectory which should be put into a
|
||||
distribution tar file. You need not list here the makefile itself
|
||||
or the source and header files listed in the other standard
|
||||
variables. Only define `distribute' if there are files used in an
|
||||
unusual way that should go into the distribution.
|
||||
|
||||
`generated'
|
||||
Files which are generated by `Makefile' in this subdirectory.
|
||||
These files will be removed by `make clean', and they will never
|
||||
go into a distribution.
|
||||
|
||||
`extra-objs'
|
||||
Extra object files which are built by `Makefile' in this
|
||||
subdirectory. This should be a list of file names like `foo.o';
|
||||
the files will actually be found in whatever directory object
|
||||
files are being built in. These files will be removed by
|
||||
`make clean'. This variable is used for secondary object files
|
||||
needed to build `others' or `tests'.
|
||||
|
||||
Porting the GNU C Library
|
||||
=========================
|
||||
|
||||
The GNU C library is written to be easily portable to a variety of
|
||||
machines and operating systems. Machine- and operating system-dependent
|
||||
functions are well separated to make it easy to add implementations for
|
||||
new machines or operating systems. This section describes the layout of
|
||||
the library source tree and explains the mechanisms used to select
|
||||
machine-dependent code to use.
|
||||
|
||||
All the machine-dependent and operating system-dependent files in the
|
||||
library are in the subdirectory `sysdeps' under the top-level library
|
||||
source directory. This directory contains a hierarchy of
|
||||
subdirectories (*note Hierarchy Conventions::.).
|
||||
|
||||
Each subdirectory of `sysdeps' contains source files for a
|
||||
particular machine or operating system, or for a class of machine or
|
||||
operating system (for example, systems by a particular vendor, or all
|
||||
machines that use IEEE 754 floating-point format). A configuration
|
||||
specifies an ordered list of these subdirectories. Each subdirectory
|
||||
implicitly appends its parent directory to the list. For example,
|
||||
specifying the list `unix/bsd/vax' is equivalent to specifying the list
|
||||
`unix/bsd/vax unix/bsd unix'. A subdirectory can also specify that it
|
||||
implies other subdirectories which are not directly above it in the
|
||||
directory hierarchy. If the file `Implies' exists in a subdirectory,
|
||||
it lists other subdirectories of `sysdeps' which are appended to the
|
||||
list, appearing after the subdirectory containing the `Implies' file.
|
||||
Lines in an `Implies' file that begin with a `#' character are ignored
|
||||
as comments. For example, `unix/bsd/Implies' contains:
|
||||
# BSD has Internet-related things.
|
||||
unix/inet
|
||||
|
||||
and `unix/Implies' contains:
|
||||
posix
|
||||
|
||||
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::.
|
||||
|
||||
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).
|
||||
|
||||
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-
|
||||
or operating system-dependent version of it, move the file into
|
||||
`sysdeps/generic' and write your new implementation in the appropriate
|
||||
system-specific subdirectory. Note that if a file is to be
|
||||
system-dependent, it *must not* appear in one of the main source
|
||||
directories.
|
||||
|
||||
There are a few special files that may exist in each subdirectory of
|
||||
`sysdeps':
|
||||
|
||||
`Makefile'
|
||||
A makefile for this machine or operating system, or class of
|
||||
machine or operating system. This file is included by the library
|
||||
makefile `Makerules', which is used by the top-level makefile and
|
||||
the subdirectory makefiles. It can change the variables set in the
|
||||
including makefile or add new rules. It can use GNU `make'
|
||||
conditional directives based on the variable `subdir' (see above)
|
||||
to select different sets of variables and rules for different
|
||||
sections of the library. It can also set the `make' variable
|
||||
`sysdep-routines', to specify extra modules to be included in the
|
||||
library. You should use `sysdep-routines' rather than adding
|
||||
modules to `routines' because the latter is used in determining
|
||||
what to distribute for each subdirectory of the main source tree.
|
||||
|
||||
Each makefile in a subdirectory in the ordered list of
|
||||
subdirectories to be searched is included in order. Since several
|
||||
system-dependent makefiles may be included, each should append to
|
||||
`sysdep-routines' rather than simply setting it:
|
||||
|
||||
sysdep-routines := $(sysdep-routines) foo bar
|
||||
|
||||
`Subdirs'
|
||||
This file contains the names of new whole subdirectories under the
|
||||
top-level library source tree that should be included for this
|
||||
system. These subdirectories are treated just like the
|
||||
system-independent subdirectories in the library source tree, such
|
||||
as `stdio' and `math'.
|
||||
|
||||
Use this when there are completely new sets of functions and header
|
||||
files that should go into the library for the system this
|
||||
subdirectory of `sysdeps' implements. For example,
|
||||
`sysdeps/unix/inet/Subdirs' contains `inet'; the `inet' directory
|
||||
contains various network-oriented operations which only make sense
|
||||
to put in the library on systems that support the Internet.
|
||||
|
||||
`Dist'
|
||||
This file contains the names of files (relative to the
|
||||
subdirectory of `sysdeps' in which it appears) which should be
|
||||
included in the distribution. List any new files used by rules in
|
||||
the `Makefile' in the same directory, or header files used by the
|
||||
source files in that directory. You don't need to list files that
|
||||
are implementations (either C or assembly source) of routines
|
||||
whose names are given in the machine-independent makefiles in the
|
||||
main source tree.
|
||||
|
||||
`configure'
|
||||
This file is a shell script fragment to be run at configuration
|
||||
time. The top-level `configure' script uses the shell `.' command
|
||||
to read the `configure' file in each system-dependent directory
|
||||
chosen, in order. The `configure' files are often generated from
|
||||
`configure.in' files using Autoconf.
|
||||
|
||||
A system-dependent `configure' script will usually add things to
|
||||
the shell variables `DEFS' and `config_vars'; see the top-level
|
||||
`configure' script for details. The script can check for
|
||||
`--with-PACKAGE' options that were passed to the top-level
|
||||
`configure'. For an option `--with-PACKAGE=VALUE' `configure'
|
||||
sets the shell variable `with_PACKAGE' (with any dashes in PACKAGE
|
||||
converted to underscores) to VALUE; if the option is just
|
||||
`--with-PACKAGE' (no argument), then it sets `with_PACKAGE' to
|
||||
`yes'.
|
||||
|
||||
`configure.in'
|
||||
This file is an Autoconf input fragment to be processed into the
|
||||
file `configure' in this subdirectory. *Note Introduction:
|
||||
(autoconf.info)Introduction, for a description of Autoconf. You
|
||||
should write either `configure' or `configure.in', but not both.
|
||||
The first line of `configure.in' should invoke the `m4' macro
|
||||
`GLIBC_PROVIDES'. This macro does several `AC_PROVIDE' calls for
|
||||
Autoconf macros which are used by the top-level `configure'
|
||||
script; without this, those macros might be invoked again
|
||||
unnecessarily by Autoconf.
|
||||
|
||||
That is the general system for how system-dependencies are isolated.
|
||||
|
||||
Layout of the `sysdeps' Directory Hierarchy
|
||||
-------------------------------------------
|
||||
|
||||
A GNU configuration name has three parts: the CPU type, the
|
||||
manufacturer's name, and the operating system. `configure' uses these
|
||||
to pick the list of system-dependent directories to look for. If the
|
||||
`--nfp' option is *not* passed to `configure', the directory
|
||||
`MACHINE/fpu' is also used. The operating system often has a "base
|
||||
operating system"; for example, if the operating system is `sunos4.1',
|
||||
the base operating system is `unix/bsd'. The algorithm used to pick
|
||||
the list of directories is simple: `configure' makes a list of the base
|
||||
operating system, manufacturer, CPU type, and operating system, in that
|
||||
order. It then concatenates all these together with slashes in
|
||||
between, to produce a directory name; for example, the configuration
|
||||
`sparc-sun-sunos4.1' results in `unix/bsd/sun/sparc/sunos4.1'.
|
||||
`configure' then tries removing each element of the list in turn, so
|
||||
`unix/bsd/sparc' and `sun/sparc' are also tried, among others. Since
|
||||
the precise version number of the operating system is often not
|
||||
important, and it would be very inconvenient, for example, to have
|
||||
identical `sunos4.1.1' and `sunos4.1.2' directories, `configure' tries
|
||||
successively less specific operating system names by removing trailing
|
||||
suffixes starting with a period.
|
||||
|
||||
As an example, here is the complete list of directories that would be
|
||||
tried for the configuration `sparc-sun-sunos4.1' (without the `--nfp'
|
||||
option):
|
||||
|
||||
sparc/fpu
|
||||
unix/bsd/sun/sunos4.1/sparc
|
||||
unix/bsd/sun/sunos4.1
|
||||
unix/bsd/sun/sunos4/sparc
|
||||
unix/bsd/sun/sunos4
|
||||
unix/bsd/sun/sunos/sparc
|
||||
unix/bsd/sun/sunos
|
||||
unix/bsd/sun/sparc
|
||||
unix/bsd/sun
|
||||
unix/bsd/sunos4.1/sparc
|
||||
unix/bsd/sunos4.1
|
||||
unix/bsd/sunos4/sparc
|
||||
unix/bsd/sunos4
|
||||
unix/bsd/sunos/sparc
|
||||
unix/bsd/sunos
|
||||
unix/bsd/sparc
|
||||
unix/bsd
|
||||
unix/sun/sunos4.1/sparc
|
||||
unix/sun/sunos4.1
|
||||
unix/sun/sunos4/sparc
|
||||
unix/sun/sunos4
|
||||
unix/sun/sunos/sparc
|
||||
unix/sun/sunos
|
||||
unix/sun/sparc
|
||||
unix/sun
|
||||
unix/sunos4.1/sparc
|
||||
unix/sunos4.1
|
||||
unix/sunos4/sparc
|
||||
unix/sunos4
|
||||
unix/sunos/sparc
|
||||
unix/sunos
|
||||
unix/sparc
|
||||
unix
|
||||
sun/sunos4.1/sparc
|
||||
sun/sunos4.1
|
||||
sun/sunos4/sparc
|
||||
sun/sunos4
|
||||
sun/sunos/sparc
|
||||
sun/sunos
|
||||
sun/sparc
|
||||
sun
|
||||
sunos4.1/sparc
|
||||
sunos4.1
|
||||
sunos4/sparc
|
||||
sunos4
|
||||
sunos/sparc
|
||||
sunos
|
||||
sparc
|
||||
|
||||
Different machine architectures are conventionally subdirectories at
|
||||
the top level of the `sysdeps' directory tree. For example,
|
||||
`sysdeps/sparc' and `sysdeps/m68k'. These contain files specific to
|
||||
those machine architectures, but not specific to any particular
|
||||
operating system. There might be subdirectories for specializations of
|
||||
those architectures, such as `sysdeps/m68k/68020'. Code which is
|
||||
specific to the floating-point coprocessor used with a particular
|
||||
machine should go in `sysdeps/MACHINE/fpu'.
|
||||
|
||||
There are a few directories at the top level of the `sysdeps'
|
||||
hierarchy that are not for particular machine architectures.
|
||||
|
||||
`generic'
|
||||
`stub'
|
||||
As described above (*note Porting::.), these are the two
|
||||
subdirectories that every configuration implicitly uses after all
|
||||
others.
|
||||
|
||||
`ieee754'
|
||||
This directory is for code using the IEEE 754 floating-point
|
||||
format, where the C type `float' is IEEE 754 single-precision
|
||||
format, and `double' is IEEE 754 double-precision format. Usually
|
||||
this directory is referred to in the `Implies' file in a machine
|
||||
architecture-specific directory, such as `m68k/Implies'.
|
||||
|
||||
`posix'
|
||||
This directory contains implementations of things in the library in
|
||||
terms of POSIX.1 functions. This includes some of the POSIX.1
|
||||
functions themselves. Of course, POSIX.1 cannot be completely
|
||||
implemented in terms of itself, so a configuration using just
|
||||
`posix' cannot be complete.
|
||||
|
||||
`unix'
|
||||
This is the directory for Unix-like things. *Note Porting to
|
||||
Unix::. `unix' implies `posix'. There are some special-purpose
|
||||
subdirectories of `unix':
|
||||
|
||||
`unix/common'
|
||||
This directory is for things common to both BSD and System V
|
||||
release 4. Both `unix/bsd' and `unix/sysv/sysv4' imply
|
||||
`unix/common'.
|
||||
|
||||
`unix/inet'
|
||||
This directory is for `socket' and related functions on Unix
|
||||
systems. The `inet' top-level subdirectory is enabled by
|
||||
`unix/inet/Subdirs'. `unix/common' implies `unix/inet'.
|
||||
|
||||
`mach'
|
||||
This is the directory for things based on the Mach microkernel
|
||||
from CMU (including the GNU operating system). Other basic
|
||||
operating systems (VMS, for example) would have their own
|
||||
directories at the top level of the `sysdeps' hierarchy, parallel
|
||||
to `unix' and `mach'.
|
||||
|
||||
Porting the GNU C Library to Unix Systems
|
||||
-----------------------------------------
|
||||
|
||||
Most Unix systems are fundamentally very similar. There are
|
||||
variations between different machines, and variations in what
|
||||
facilities are provided by the kernel. But the interface to the
|
||||
operating system facilities is, for the most part, pretty uniform and
|
||||
simple.
|
||||
|
||||
The code for Unix systems is in the directory `unix', at the top
|
||||
level of the `sysdeps' hierarchy. This directory contains
|
||||
subdirectories (and subdirectory trees) for various Unix variants.
|
||||
|
||||
The functions which are system calls in most Unix systems are
|
||||
implemented in assembly code in files in `sysdeps/unix'. These files
|
||||
are named with a suffix of `.S'; for example, `__open.S'. Files ending
|
||||
in `.S' are run through the C preprocessor before being fed to the
|
||||
assembler.
|
||||
|
||||
These files all use a set of macros that should be defined in
|
||||
`sysdep.h'. The `sysdep.h' file in `sysdeps/unix' partially defines
|
||||
them; a `sysdep.h' file in another directory must finish defining them
|
||||
for the particular machine and operating system variant. See
|
||||
`sysdeps/unix/sysdep.h' and the machine-specific `sysdep.h'
|
||||
implementations to see what these macros are and what they should do.
|
||||
|
||||
The system-specific makefile for the `unix' directory (that is, the
|
||||
file `sysdeps/unix/Makefile') gives rules to generate several files
|
||||
from the Unix system you are building the library on (which is assumed
|
||||
to be the target system you are building the library *for*). All the
|
||||
generated files are put in the directory where the object files are
|
||||
kept; they should not affect the source tree itself. The files
|
||||
generated are `ioctls.h', `errnos.h', `sys/param.h', and `errlist.c'
|
||||
(for the `stdio' section of the library).
|
||||
|
||||
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 `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.
|
||||
|
||||
All code incorporated from 4.4 BSD is under the following
|
||||
copyright:
|
||||
|
||||
Copyright (C) 1991 Regents of the University of California.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
3. All advertising materials mentioning features or use of
|
||||
this software must display the following acknowledgement:
|
||||
This product includes software developed by the
|
||||
University of California, Berkeley and its
|
||||
contributors.
|
||||
|
||||
4. Neither the name of the University nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGE.
|
||||
|
||||
* The random number generation functions `random', `srandom',
|
||||
`setstate' and `initstate', which are also the basis for the
|
||||
`rand' and `srand' functions, were written by Earl T. Cohen for
|
||||
the University of California at Berkeley and are copyrighted by the
|
||||
Regents of the University of California. They have undergone minor
|
||||
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,
|
||||
which is under both the Berkeley copyright above and also:
|
||||
|
||||
Portions Copyright (C) 1993 by Digital Equipment Corporation.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
for any purpose with or without fee is hereby granted,
|
||||
provided that the above copyright notice and this permission
|
||||
notice appear in all copies, and that the name of Digital
|
||||
Equipment Corporation not be used in advertising or publicity
|
||||
pertaining to distribution of the document or software
|
||||
without specific, written prior permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP.
|
||||
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE
|
||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
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:
|
||||
|
||||
Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
|
||||
Sun RPC is a product of Sun Microsystems, Inc. and is
|
||||
provided for unrestricted use provided that this legend is
|
||||
included on all tape media and as a part of the software
|
||||
program in whole or part. Users 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
|
||||
|
||||
* 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 contribued by Kazumoto Kojima.
|
||||
|
223
Make-dist
Normal file
223
Make-dist
Normal file
@ -0,0 +1,223 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
dist:
|
||||
|
||||
ifdef subdir
|
||||
.. := ../
|
||||
else
|
||||
.. :=
|
||||
endif
|
||||
|
||||
include $(..)Makeconfig
|
||||
|
||||
foo:=$(shell echo 'distribute=$(distribute)'>&2)
|
||||
foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
|
||||
|
||||
ifndef sysdep_dirs
|
||||
# Find all sysdep directories.
|
||||
export sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name RCS -print)
|
||||
else
|
||||
# Defined by the parent.
|
||||
sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
|
||||
endif
|
||||
|
||||
sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
|
||||
ifdef sysdep-Subdir-files
|
||||
subdirs := $(sort $(subdirs) \
|
||||
$(shell sed -e 's/\#.*$$//' $(sysdep-Subdir-files)))
|
||||
endif
|
||||
|
||||
|
||||
# Makefiles can define `source_dirs' to list nonstandard directories
|
||||
# where source files might be found.
|
||||
|
||||
ifdef subdir
|
||||
all-headers = $(headers)
|
||||
else
|
||||
+distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
|
||||
inhibit_interface_rules=t inhibit_mach_syscalls=t \
|
||||
subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
|
||||
foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
|
||||
all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
|
||||
# Ignore subdir headers without top-level indirections.
|
||||
all-headers := $(sort $(headers) $(wildcard $(all-headers)))
|
||||
+subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
|
||||
+subdir-headers := $(filter-out $(headers),$(all-headers))
|
||||
endif
|
||||
foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
|
||||
|
||||
# Find all sysdep sources and headers.
|
||||
+maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
|
||||
$(filter %.c %.S %.s %.h %.sub,$(distribute))
|
||||
foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
|
||||
# Find all the files that have a stub or generic version.
|
||||
try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic,\
|
||||
$(addprefix $(dir)/,$(+maybe-sysdeps)))
|
||||
foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
|
||||
+sysdeps := $(wildcard $(try-sysdeps))
|
||||
foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2)
|
||||
+sysdep-names := $(sort $(notdir $(+sysdeps)))
|
||||
foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
|
||||
|
||||
# Now find all the sysdep versions of those files.
|
||||
+sysdeps := $(wildcard $(foreach dir,$(sysdep_dirs) $(source_dirs),\
|
||||
$(addprefix $(dir)/, \
|
||||
$(+sysdep-names) \
|
||||
$(+sysdep-names:.c=.s) \
|
||||
$(+sysdep-names:.c=.S) \
|
||||
)))
|
||||
|
||||
|
||||
# Source and header files to go in the distribution tar file.
|
||||
|
||||
.S.s := $(wildcard $(sources:.c=.S) $(sources:.c=.s))
|
||||
sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
|
||||
|
||||
+out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
|
||||
$(addsuffix .c,$(sysdep_routines)) \
|
||||
$(+subdir-nodist)
|
||||
#foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
|
||||
+tsrcs := $(filter-out $(+out) $(addprefix %/,$(+out)), \
|
||||
$(sources) $(all-headers) $(distribute)) \
|
||||
$(+sysdeps)
|
||||
foo:=$(shell echo made +tsrcs >&2)
|
||||
foo:=$(shell echo generated='$(generated)' >&2)
|
||||
generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
|
||||
foo:=$(shell echo now generated='$(generated)' >&2)
|
||||
+tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
|
||||
foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
|
||||
foo:=$(shell echo foobie, dammit! >&2)
|
||||
|
||||
ifndef tardir
|
||||
rel+vers := $(shell sed -n -e 's/^.*libc_release.*\"\([^"]*\)";$$/\1/p' \
|
||||
-e 's/^.*libc_version.*\"\([^"]*\)";$$/\1/p' \
|
||||
< $(..)version.c)
|
||||
release := $(word 1,$(rel+vers))
|
||||
version := $(word 2,$(rel+vers))
|
||||
export tardir := glibc-$(version)
|
||||
endif
|
||||
|
||||
$(..)glibc-$(version):
|
||||
ln -s . $@
|
||||
|
||||
+tsrcs := $(+tsrcs) \
|
||||
TAGS
|
||||
.PHONY: TAGS
|
||||
TAGS: $(..)MakeTAGS
|
||||
$(MAKE) -f $< $@ -o subdir_TAGS
|
||||
|
||||
ifdef subdir
|
||||
|
||||
foo:=$(shell echo subdir foo >&2)
|
||||
|
||||
+tsrcs := Makefile $(+tsrcs) \
|
||||
$(addsuffix .c,$(others) $(tests)) \
|
||||
$(wildcard $(addsuffix .input,$(tests)) \
|
||||
$(addsuffix .args,$(tests)))
|
||||
+tardeps := $(strip $(+tsrcs))
|
||||
+tsrcs := $(addprefix $(tardir)/$(subdir)/,$(+tardeps))
|
||||
|
||||
verbose = v
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(..)$(tardir) $(+tardeps)
|
||||
@cd ..; if test -f dist.tar; then c=u; else c=c; fi; \
|
||||
$(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ..."; \
|
||||
tar $${c}h$(verbose)f dist.tar $(+tsrcs)
|
||||
|
||||
else # Parent makefile.
|
||||
|
||||
# Find what other things sysdep directories want to distribute.
|
||||
|
||||
foo:=$(shell echo parent foobie>&2)
|
||||
+sysdep-distfiles := $(wildcard $(addsuffix /Dist,$(sysdep_dirs)))
|
||||
foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
|
||||
+sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
|
||||
$(addprefix $(dir $(file)), \
|
||||
$(shell sed -e 's/\#.*$$//' $(file)))) \
|
||||
$(+sysdep-distfiles) \
|
||||
$(sysdep-Subdir-files)
|
||||
foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
|
||||
|
||||
subdirs := $(filter-out crypt,$(subdirs))
|
||||
|
||||
+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies \
|
||||
configure configure.in,\
|
||||
$(addsuffix /$(file),$(sysdep_dirs)))) \
|
||||
$(+sysdep-dist)
|
||||
|
||||
+tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
|
||||
|
||||
define autoconf-it
|
||||
autoconf $(ACFLAGS) $< > $@.new
|
||||
mv -f $@.new $@
|
||||
test -d CVS && cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
|
||||
endef
|
||||
|
||||
configure: configure.in; $(autoconf-it)
|
||||
%/configure: %/configure.in; $(autoconf-it)
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(tardir).tar.gz $(tardir)-crypt.tar.gz
|
||||
|
||||
$(tardir)-crypt.tar.gz: crypt/crypt.tar.gz
|
||||
ln $< $@
|
||||
crypt/%: FORCE
|
||||
$(MAKE) -C $(@D) $(@F)
|
||||
FORCE:
|
||||
|
||||
subdir_dist: dist.tar
|
||||
dist.tar: $(tardir) $(+tsrcs)
|
||||
tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
|
||||
|
||||
$(tardir).tar: dist.tar subdir_dist
|
||||
tar xfv $< -C /tmp | doschk
|
||||
tar covf $@ -C /tmp $(tardir)
|
||||
-rm -fr /tmp/$(tardir) &
|
||||
|
||||
%.Z: %
|
||||
compress -c $< > $@
|
||||
|
||||
%.gz: %
|
||||
gzip -9 -v -c $< > $@
|
||||
|
||||
foo:=$(shell echo subdirs=$(subdirs) >&2)
|
||||
dist-subdirs := $(addprefix dist-,$(subdirs)) # dist-manual
|
||||
.PHONY: subdir_dist $(dist-subdirs)
|
||||
subdir_dist: $(dist-subdirs)
|
||||
$(dist-subdirs):
|
||||
$(MAKE) -C $(patsubst dist-%,%,$@) dist
|
||||
|
||||
# This is here instead of in Makefile so it can use $(release) and $(version).
|
||||
README: README.template version.c
|
||||
-rm -f $@
|
||||
sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
|
||||
# Make it unwritable so I won't change it by mistake.
|
||||
chmod 444 $@
|
||||
|
||||
|
||||
endif # Subdirectory vs. parent makefile
|
||||
|
||||
# Get these things out of the environment because they take up lots of space.
|
||||
unexport distribute generated
|
||||
|
||||
# Fnord.
|
||||
export inhibit_mach_syscalls=t
|
||||
export no_deps=t
|
||||
export inhibit_interface_rules=t
|
107
MakeTAGS
Normal file
107
MakeTAGS
Normal file
@ -0,0 +1,107 @@
|
||||
# Make the TAGS files.
|
||||
|
||||
# Copyright (C) 1992, 1994 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
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
# Make this the default goal.
|
||||
TAGS:
|
||||
|
||||
ifdef subdir
|
||||
.. := ../
|
||||
endif
|
||||
|
||||
include $(..)Makeconfig
|
||||
|
||||
ifndef tags_sources
|
||||
ifeq ($(subdir),ctype)
|
||||
# In most cases, we want the C source files to come before
|
||||
# the header files so tags for optimizing #define's in the
|
||||
# headers won't be put in the tags files, but for ctype,
|
||||
# the functions are just backup for the #define's in the header.
|
||||
tags_sources = $(all-headers) $(all-sources)
|
||||
else # Not ctype.
|
||||
tags_sources = $(all-sources) $(all-headers)
|
||||
endif # ctype
|
||||
endif # No tags_sources
|
||||
|
||||
sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
|
||||
|
||||
ifndef sysdep_dirs
|
||||
# Find all sysdep directories.
|
||||
sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name RCS -print)
|
||||
endif
|
||||
|
||||
# Find all sysdep dirs there are, but putting the ones
|
||||
# we are configured to use first and preserving their order.
|
||||
all-dirs := $(objdir) \
|
||||
$(sysdep-dirs) \
|
||||
$(source_dirs) \
|
||||
$(filter-out $(sysdep-dirs),$(sysdep_dirs))
|
||||
|
||||
# Find all the subdirs there are, but putting the ones
|
||||
# we are configured to use first and preserving their order.
|
||||
ifndef subdir
|
||||
subdirs := $(subdirs) \
|
||||
$(filter-out $(subdirs),\
|
||||
$(shell sed -e 's/\#.*$$//' \
|
||||
$(wildcard $(addsuffix /Subdirs,\
|
||||
$(all-dirs)))\
|
||||
/dev/null))
|
||||
all-dist = $(foreach Dist,$(wildcard $(all-dirs:%=%/Dist)),\
|
||||
$(addprefix $(Dist:%/Dist=%)/,\
|
||||
$(filter %.c %.h %.S %.s,\
|
||||
$(shell cat $(Dist)))))
|
||||
tags_sources = $(all-sources) $(all-headers) $(all-dist)
|
||||
endif
|
||||
|
||||
# All different versions of $(sources), preserving the configured sysdep
|
||||
# directory order.
|
||||
all-sources = $(wildcard $(foreach file,$(sources),\
|
||||
$(file) \
|
||||
$(foreach dir,$(all-dirs),\
|
||||
$(dir)/$(file) \
|
||||
$(dir)/$(file:.c=.S) \
|
||||
$(dir)/$(file:.c=.s))))
|
||||
|
||||
all-headers = $(wildcard $(foreach file,$(headers),\
|
||||
$(file) \
|
||||
$(foreach dir,$(all-dirs),$(dir)/$(file))))
|
||||
|
||||
tags_sources := $(strip $(tags_sources))
|
||||
|
||||
TAGS: $(tags_sources)
|
||||
ifdef subdir
|
||||
ifdef tags_sources
|
||||
$(ETAGS) -o $@ $^
|
||||
else
|
||||
# No sources. Create a dummy file.
|
||||
touch $@
|
||||
endif # tags_sources
|
||||
else # parent
|
||||
TAGS: subdir_TAGS
|
||||
# Note that this uses the -i switch, and thus requires v19 etags.
|
||||
$(ETAGS) -o $@ \
|
||||
$(subdirs:%=-i %/TAGS) \
|
||||
$(filter-out subdir_TAGS,$^)
|
||||
|
||||
.PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
|
||||
subdir_TAGS: $(subdirs:%=%/TAGS)
|
||||
$(subdirs:%=%/TAGS):
|
||||
$(MAKE) -C $(@D) no_deps=t $(@F)
|
||||
|
||||
endif # subdir
|
358
Makeconfig
Normal file
358
Makeconfig
Normal file
@ -0,0 +1,358 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Makefile configuration options for the GNU C library.
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
ifneq "$(origin +included-Makeconfig)" "file"
|
||||
|
||||
+included-Makeconfig := yes
|
||||
|
||||
ifdef subdir
|
||||
.. := ../
|
||||
endif
|
||||
|
||||
# If config.make exists, the source directory was configured,
|
||||
# so don't try to be clever and find another directory to build in.
|
||||
ifneq (,$(wildcard $(..)config.make))
|
||||
ARCH =
|
||||
machine =
|
||||
else # Not configured.
|
||||
ifndef ARCH
|
||||
ifdef machine
|
||||
ARCH = $(machine)
|
||||
endif # machine
|
||||
endif # ARCH
|
||||
endif # config.make
|
||||
|
||||
# Directory for object files and libc.a. If this is not defined, the
|
||||
# object files live in the subdirectories where their sources live, and
|
||||
# libc.a lives in the parent directory (this probably doesn't work any
|
||||
# more).
|
||||
ifdef ARCH
|
||||
ifeq ($(filter /%,$(ARCH)),)
|
||||
objdir := $(..)$(ARCH)
|
||||
else
|
||||
objdir = $(ARCH)
|
||||
endif
|
||||
endif
|
||||
|
||||
# $(common-objdir) is the place to put objects and
|
||||
# such that are not specific to a single subdir.
|
||||
ifdef objdir
|
||||
objpfx = $(objdir)/
|
||||
common-objpfx = $(objpfx)
|
||||
common-objdir = $(objdir)
|
||||
else
|
||||
objpfx :=
|
||||
ifdef ..
|
||||
common-objpfx = $(..)
|
||||
common-objdir = ..
|
||||
else
|
||||
# This is a kludge. make wizards might grok.
|
||||
common-objpfx = sysdeps/../
|
||||
common-objdir = .
|
||||
endif
|
||||
endif
|
||||
|
||||
libc.a = $(common-objpfx)libc.a
|
||||
|
||||
|
||||
# Get the values defined by options to `configure'.
|
||||
include $(common-objpfx)config.make
|
||||
|
||||
# Force the user to configure before making.
|
||||
$(common-objpfx)config.make:
|
||||
@echo The GNU C library has not been configured. >&2
|
||||
@echo Run \`configure\' to configure it before building. >&2
|
||||
@exit 1
|
||||
|
||||
# Get the user's configuration parameters.
|
||||
ifneq ($(wildcard $(..)configparms),)
|
||||
include $(..)configparms
|
||||
endif
|
||||
ifneq ($(objpfx),)
|
||||
ifneq ($(wildcard $(objpfx)configparms),)
|
||||
include $(objpfx)configparms
|
||||
endif
|
||||
endif
|
||||
|
||||
sysdep_dir := $(..)sysdeps
|
||||
export sysdep_dir := $(sysdep_dir)
|
||||
|
||||
####
|
||||
#### These are the configuration variables. You can define values for
|
||||
#### the variables below in the file `configparms'.
|
||||
#### Do NOT edit this file.
|
||||
####
|
||||
|
||||
|
||||
# Common prefix for machine-independent installation directories.
|
||||
ifndef prefix
|
||||
prefix = /usr/local
|
||||
endif
|
||||
|
||||
# Common prefix for machine-dependent installation directories.
|
||||
ifndef exec_prefix
|
||||
exec_prefix = $(prefix)
|
||||
endif
|
||||
|
||||
# Where to install the library and object files.
|
||||
ifndef libdir
|
||||
libdir = $(exec_prefix)/lib
|
||||
endif
|
||||
|
||||
# Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
|
||||
# the prefix is spliced between `lib' and the name, so the linker switch
|
||||
# `-l$(libprefix)NAME' finds the library; for other files the prefix is
|
||||
# just prepended to the whole file name.
|
||||
ifndef libprefix
|
||||
libprefix =
|
||||
endif
|
||||
|
||||
# Where to install the header files.
|
||||
ifndef includedir
|
||||
includedir = $(exec_prefix)/include
|
||||
endif
|
||||
|
||||
# Define if the library should install its own <stddef.h>.
|
||||
# Do this unless you are using version 2.2 or later of GCC.
|
||||
ifndef stddef.h
|
||||
stddef.h = stddef.h
|
||||
endif
|
||||
|
||||
# Where to install machine-independent data files.
|
||||
# These are the timezone database, and eventually the locale database.
|
||||
ifndef datadir
|
||||
datadir = $(prefix)/share
|
||||
endif
|
||||
|
||||
# Where to install the timezone data files (which are machine-independent).
|
||||
ifndef zonedir
|
||||
zonedir = $(datadir)/zoneinfo
|
||||
endif
|
||||
|
||||
# Where to install programs.
|
||||
ifndef bindir
|
||||
bindir = $(exec_prefix)/bin
|
||||
endif
|
||||
|
||||
# Where to install administrative programs.
|
||||
ifndef sbindir
|
||||
sbindir = $(exec_prefix)/sbin
|
||||
endif
|
||||
|
||||
# Where to install the Info files.
|
||||
ifndef infodir
|
||||
infodir = $(prefix)/info
|
||||
endif
|
||||
|
||||
# Where to install default configuration files. These include the local
|
||||
# timezone specification and network data base files.
|
||||
ifndef sysconfdir
|
||||
sysconfdir = $(prefix)/etc
|
||||
endif
|
||||
|
||||
# What timezone should be the installed default (e.g., US/Eastern).
|
||||
# Run `make -C time echo-zonenames' to see a list of available zone names.
|
||||
# The local timezone can be changed with `zic -l TIMEZONE' at any time.
|
||||
ifndef localtime
|
||||
localtime = Factory
|
||||
endif
|
||||
|
||||
# Where to install the "localtime" timezone file; this is the file whose
|
||||
# contents $(localtime) specifies. If this is a relative pathname, it is
|
||||
# relative to $(zonedir). It is a good idea to put this somewhere
|
||||
# other than there, so the zoneinfo directory contains only universal data,
|
||||
# localizing the configuration data elsewhere.
|
||||
ifndef localtime-file
|
||||
localtime-file = $(sysconfdir)/localtime
|
||||
endif
|
||||
|
||||
# What timezone's DST rules should be used when a POSIX-style TZ
|
||||
# environment variable doesn't specify any rules. For 1003.1 compliance
|
||||
# this timezone must use rules that are as U.S. federal law defines DST.
|
||||
# Run `make -C time echo-zonenames' to see a list of available zone names.
|
||||
# This setting can be changed with `zic -p TIMEZONE' at any time.
|
||||
# If you want POSIX.1 compatibility, use `America/New_York'.
|
||||
ifndef posixrules
|
||||
posixrules = America/New_York
|
||||
endif
|
||||
|
||||
# Where to install the "posixrules" timezone file; this is file
|
||||
# whose contents $(posixrules) specifies. If this is a relative
|
||||
# pathname, it is relative to $(zonedir).
|
||||
ifndef posixrules-file
|
||||
posixrules-file = posixrules
|
||||
endif
|
||||
|
||||
|
||||
# Directory where your system's native header files live.
|
||||
# This is used on Unix systems to generate some GNU libc header files.
|
||||
ifndef sysincludedir
|
||||
sysincludedir = /usr/include
|
||||
endif
|
||||
|
||||
|
||||
# Commands to install files.
|
||||
ifndef INSTALL_DATA
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
endif
|
||||
ifndef INSTALL_PROGRAM
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
endif
|
||||
ifndef INSTALL
|
||||
INSTALL = install
|
||||
endif
|
||||
|
||||
|
||||
# The name of the C compiler.
|
||||
# If you've got GCC, and it works, use it.
|
||||
ifeq ($(origin CC),default)
|
||||
CC := gcc
|
||||
endif
|
||||
|
||||
# The name of the C compiler to use for compilations of programs to run on
|
||||
# the host that is building the library. If you set CC to a
|
||||
# cross-compiler, you must set this to the normal compiler.
|
||||
ifndef BUILD_CC
|
||||
BUILD_CC = $(CC)
|
||||
endif
|
||||
|
||||
# Default flags to pass the C compiler.
|
||||
ifndef default_cflags
|
||||
default_cflags := -g
|
||||
endif
|
||||
|
||||
# Flags to pass the C compiler when assembling preprocessed assembly code
|
||||
# (`.S' files). On some systems the assembler doesn't understand the `#' line
|
||||
# directives the preprocessor produces. If you have troubling compiling
|
||||
# assembly code, try using -P here to suppress these directives.
|
||||
ifndef asm-CPPFLAGS
|
||||
asm-CPPFLAGS =
|
||||
endif
|
||||
|
||||
# Command for linking programs with the C library.
|
||||
ifndef +link
|
||||
+link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
|
||||
$(common-objpfx)start.o $(^:lib=$(libc.a)) $(gnulib) $(libc.a)
|
||||
endif
|
||||
ifndef gnulib
|
||||
gnulib := -lgcc
|
||||
endif
|
||||
|
||||
ifndef LD
|
||||
LD := ld -X
|
||||
endif
|
||||
|
||||
ifndef RANLIB
|
||||
RANLIB = ranlib
|
||||
endif
|
||||
|
||||
# Extra flags to pass to GCC.
|
||||
+gccwarn := -Wall -Wwrite-strings -Wno-parentheses
|
||||
|
||||
# This is the program that generates makefile
|
||||
# dependencies from C source files.
|
||||
ifndef +mkdep
|
||||
+mkdep = $(CC) -M
|
||||
endif
|
||||
|
||||
# The program that makes Emacs-style TAGS files.
|
||||
ETAGS := etags -T
|
||||
|
||||
# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
|
||||
# perhaps others) to preprocess assembly code in some cases.
|
||||
M4 = m4
|
||||
|
||||
####
|
||||
#### End of configuration variables.
|
||||
####
|
||||
|
||||
# This tells some versions of GNU make before 3.63 not to export all variables.
|
||||
.NOEXPORT:
|
||||
|
||||
# We want to echo the commands we're running without
|
||||
# umpteem zillion filenames along with it (we use `...' instead)
|
||||
# but we don't want this echoing done when the user has said
|
||||
# he doesn't want to see commands echoed by using -s.
|
||||
ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
|
||||
+cmdecho := echo >/dev/null
|
||||
else # not -s
|
||||
+cmdecho := echo
|
||||
endif # -s
|
||||
|
||||
# These are the flags given to the compiler to tell
|
||||
# it what sort of optimization and/or debugging output to do.
|
||||
ifndef +cflags
|
||||
# If `CFLAGS' was defined, use that.
|
||||
ifdef CFLAGS
|
||||
+cflags := $(filter-out -I%,$(CFLAGS))
|
||||
endif # CFLAGS
|
||||
endif # +cflags
|
||||
|
||||
# If none of the above worked, default to "-g".
|
||||
ifeq "$(strip $(+cflags))" ""
|
||||
+cflags := $(default_cflags)
|
||||
endif # $(+cflags) == ""
|
||||
|
||||
# If using gcc, add flags that only it will grok.
|
||||
ifneq "$(findstring gcc,$(CC))" ""
|
||||
+cflags := $(+cflags) $(+gccwarn)
|
||||
+gcc-nowarn := -w
|
||||
else
|
||||
+gcc-nowarn :=
|
||||
endif # gcc
|
||||
|
||||
# Don't duplicate options if we inherited variables from the parent.
|
||||
+cflags := $(sort $(+cflags))
|
||||
|
||||
|
||||
# These are flags given to the C compiler to tell it to look for include
|
||||
# files (including ones given in angle brackets) in the current directory
|
||||
# and in the parent library source directory.
|
||||
# `+sysdep-includes' will be defined by Makerules.
|
||||
+includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
|
||||
$(includes) $(+sysdep-includes) $(last-includes)
|
||||
|
||||
|
||||
# These are the variables that the implicit compilation rules use.
|
||||
CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
|
||||
$(sysdep-CPPFLAGS)
|
||||
override CFLAGS = $(+cflags) $(sysdep-CFLAGS)
|
||||
|
||||
|
||||
# This is the macro that the implicit linking rules use.
|
||||
ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
|
||||
LDFLAGS := -g
|
||||
endif
|
||||
|
||||
+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
|
||||
|
||||
ifneq ($(BUILD_CC),$(CC))
|
||||
cross-compiling := yes
|
||||
else
|
||||
cross-compiling := no
|
||||
endif
|
||||
|
||||
|
||||
endif # Makeconfig not yet included
|
233
Makefile
Normal file
233
Makefile
Normal file
@ -0,0 +1,233 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Master Makefile for the GNU C library
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
|
||||
# This is the default target; it makes everything except the tests.
|
||||
.PHONY: all
|
||||
all: lib others
|
||||
|
||||
define autoconf-it
|
||||
autoconf $(ACFLAGS) $< > $@.new
|
||||
mv -f $@.new $@
|
||||
test -d CVS && cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
|
||||
endef
|
||||
|
||||
configure: configure.in; $(autoconf-it)
|
||||
%/configure: %/configure.in; $(autoconf-it)
|
||||
|
||||
include Makeconfig
|
||||
|
||||
ifndef avoid-generated
|
||||
include $(objpfx)sysd-dirs
|
||||
define \n
|
||||
|
||||
|
||||
endef
|
||||
sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
|
||||
endif
|
||||
|
||||
# These are the subdirectories containing the library source.
|
||||
+ansi_dirs := assert ctype locale math setjmp \
|
||||
signal stdio stdlib malloc string time
|
||||
+posix_dirs := dirent grp pwd posix io termios
|
||||
+other_dirs := resource socket misc gnulib $(wildcard crypt) manual csu
|
||||
subdirs := $(strip $(+ansi_dirs) $(+posix_dirs) $(+other_dirs) \
|
||||
$(sysdep-subdirs))
|
||||
export subdirs := $(subdirs) # Benign, useless in GNU make before 3.63.
|
||||
|
||||
# The mach and hurd subdirectories have many generated header files which
|
||||
# the much of rest of the library depends on, so it is best to build them
|
||||
# first (and mach before hurd, at that). The before-compile additions in
|
||||
# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
|
||||
# not to exist when making in other directories, but it will be slower that
|
||||
# way with more somewhat expensive `make' invocations.
|
||||
subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
|
||||
$(filter-out mach hurd,$(subdirs))
|
||||
|
||||
# All initialization source files.
|
||||
+subdir_inits := $(wildcard $(foreach dir,$(subdirs),$(dir)/init-$(dir).c))
|
||||
# All subdirectories containing initialization source files.
|
||||
+init_subdirs := $(patsubst %/,%,$(dir $(+subdir_inits)))
|
||||
|
||||
|
||||
# These are the targets that are made by making them in each subdirectory.
|
||||
+subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
|
||||
subdir_clean subdir_distclean subdir_realclean \
|
||||
tests subdir_lint.out \
|
||||
subdir_echo-headers subdir_echo-distinfo \
|
||||
subdir_install $(addprefix install-, \
|
||||
no-libc.a bin lib \
|
||||
data headers others)
|
||||
|
||||
headers := features.h errno.h sys/errno.h errnos.h limits.h $(stddef.h)
|
||||
aux = sysdep $(libc-init) version
|
||||
|
||||
echo-headers: subdir_echo-headers
|
||||
|
||||
# What to install.
|
||||
install-others = $(includedir)/stubs.h
|
||||
|
||||
ifeq (yes,$(gnu-ld))
|
||||
libc-init = set-init
|
||||
else
|
||||
libc-init = munch-init
|
||||
$(objpfx)munch-init.c: munch.awk munch-tmpl.c $(+subdir_inits)
|
||||
awk -f $< subdirs='$(+init_subdirs)' $(word 2,$^) > $@-t
|
||||
mv -f $@-t $@
|
||||
generated := $(generated) munch-init.c
|
||||
endif
|
||||
|
||||
|
||||
include Makerules
|
||||
|
||||
# Install from subdirectories too.
|
||||
install: subdir_install
|
||||
|
||||
lib-noranlib $(libc.a)(__.SYMDEF): subdir_lib
|
||||
|
||||
|
||||
$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make
|
||||
(echo define sysdep-subdirs; \
|
||||
for dir in $(sysdirs); do \
|
||||
if [ -r $(sysdep_dir)/$$dir/Subdirs ]; then \
|
||||
sed 's/#.*$$//' $(sysdep_dir)/$$dir/Subdirs; \
|
||||
else true; \
|
||||
fi; \
|
||||
done; \
|
||||
echo endef) > $@-tmp
|
||||
mv -f $@-tmp $@
|
||||
|
||||
# Makerules creates a file `stub-$(subdir)' for each subdirectory, which
|
||||
# contains `#define __stub_FUNCTION' for each function which is a stub.
|
||||
# Here we paste all of these together into <stubs.h>.
|
||||
|
||||
subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)stub-$(dir))
|
||||
|
||||
# Since stubs.h is never needed when building the library, we simplify the
|
||||
# hairy installation process by producing it in place only as the last part
|
||||
# of the top-level `make install'. It depends on subdir_install, which
|
||||
# iterates over all the subdirs; subdir_install in each subdir depends on
|
||||
# the subdir's stubs file. Having more direct dependencies would result in
|
||||
# extra iterations over the list for subdirs and many recursive makes.
|
||||
$(includedir)/stubs.h: subdir_install
|
||||
@rm -f $(objpfx)stubs.h
|
||||
(echo '/* This file is automatically generated.';\
|
||||
echo ' It defines a symbol `__stub_FUNCTION'\'' for each function';\
|
||||
echo ' in the C library which is a stub, meaning it will fail';\
|
||||
echo ' every time called, usually setting errno to ENOSYS. */';\
|
||||
sort $(subdir-stubs)) > $(objpfx)stubs.h
|
||||
$(INSTALL_DATA) $(objpfx)stubs.h $@
|
||||
rm -f $(objpfx)stubs.h
|
||||
|
||||
# This makes the Info or DVI file of the documentation from the Texinfo source.
|
||||
.PHONY: info dvi
|
||||
info dvi:
|
||||
$(MAKE) -C manual $@
|
||||
|
||||
# This makes all the subdirectory targets.
|
||||
|
||||
# For each target, make it depend on DIR/target for each subdirectory DIR.
|
||||
$(+subdir_targets): %: $(addsuffix /%,$(subdirs))
|
||||
|
||||
# Compute a list of all those targets.
|
||||
all-subdirs-targets := $(foreach dir,$(subdirs),\
|
||||
$(addprefix $(dir)/,$(+subdir_targets)))
|
||||
|
||||
# The action for each of those is to cd into the directory and make the
|
||||
# target there.
|
||||
$(all-subdirs-targets):
|
||||
$(MAKE) -C $(@D) $(@F)
|
||||
|
||||
.PHONY: $(+subdir_targets) $(all-subdirs-targets)
|
||||
|
||||
# Targets to clean things up to various degrees.
|
||||
|
||||
.PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean
|
||||
|
||||
# Subroutines of all cleaning targets.
|
||||
parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
|
||||
-rm -f $(libc.a) $(addprefix $(objpfx),$(install-lib))
|
||||
parent-clean: parent-mostlyclean common-clean
|
||||
-rm -f $(addprefix $(common-objpfx),$(common-generated))
|
||||
-rm -f $(addprefix $(+sysdir_pfx),sysd-Makefile sysd-dirs sysd-rules)
|
||||
|
||||
clean: parent-clean
|
||||
# This is done this way rather than having `subdir_clean' be a
|
||||
# dependency of this target so that libc.a will be removed before the
|
||||
# subdirectories are dealt with and so they won't try to remove object
|
||||
# files from it when it's going to be removed anyway.
|
||||
@$(MAKE) subdir_clean no_deps=t
|
||||
mostlyclean: parent-mostlyclean
|
||||
@$(MAKE) subdir_mostlyclean no_deps=t
|
||||
|
||||
# The realclean target is just like distclean for the parent, but we want
|
||||
# the subdirs to know the difference in case they care.
|
||||
realclean distclean: parent-clean
|
||||
# This is done this way rather than having `subdir_distclean' be a
|
||||
# dependency of this target so that libc.a will be removed before the
|
||||
# subdirectories are dealt with and so they won't try to remove object
|
||||
# files from it when it's going to be removed anyway.
|
||||
@$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes
|
||||
|
||||
# Subroutine of distclean and realclean.
|
||||
distclean-1: subdir_$(distclean-1)
|
||||
-rm -f $(config-generated)
|
||||
-rm -f $(addprefix $(objpfx),config.status cache.cache)
|
||||
-rm -f $(addprefix $(objpfx),config.make config-name.h)
|
||||
ifdef objdir
|
||||
-rm -f $(objpfx)Makefile
|
||||
endif
|
||||
-rm -f $(sysdep-$(distclean-1))
|
||||
|
||||
.PHONY: echo_subdirs
|
||||
echo_subdirs:;@echo '$(subdirs)'
|
||||
|
||||
.PHONY: echo-distinfo parent_echo-distinfo
|
||||
echo-distinfo: parent_echo-distinfo subdir_echo-distinfo
|
||||
parent_echo-distinfo:
|
||||
@echo $(addprefix +header+,$(headers)) \
|
||||
$(addprefix +nodist+,$(generated))
|
||||
|
||||
# Make the distribution tarfile.
|
||||
|
||||
distribute := README INSTALL NOTES COPYING.LIB COPYING ChangeLog NEWS \
|
||||
Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
|
||||
ansidecl.h mkinstalldirs move-if-change install-sh \
|
||||
configure configure.in aclocal.m4 config.sub config.guess\
|
||||
config.make.in config-name.in Makefile.in \
|
||||
munch-tmpl.c munch.awk sysdep.h set-hooks.h libc-symbols.h
|
||||
|
||||
distribute := $(strip $(distribute))
|
||||
generated := $(generated) stubs.h
|
||||
|
||||
README: README.template version.c ; # Make-dist should update README.
|
||||
|
||||
define format-me
|
||||
@rm -f $@
|
||||
makeinfo --no-validate --no-warn --no-headers $< -o $@
|
||||
-chmod a-w $@
|
||||
endef
|
||||
INSTALL: manual/maint.texi; $(format-me)
|
||||
NOTES: manual/creature.texi; $(format-me)
|
6
Makefile.in
Normal file
6
Makefile.in
Normal file
@ -0,0 +1,6 @@
|
||||
# Generated from $Id$.
|
||||
|
||||
srcdir = @srcdir@
|
||||
|
||||
all .DEFAULT:
|
||||
$(MAKE) -C $(srcdir) objdir=`pwd` $@
|
544
Makerules
Normal file
544
Makerules
Normal file
@ -0,0 +1,544 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Common rules for making the GNU C library. This file is included
|
||||
# by the top-level Makefile and by all subdirectory makefiles
|
||||
# (through Rules).
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
|
||||
ifdef subdir
|
||||
.. := ../
|
||||
endif # subdir
|
||||
|
||||
# If `sources' was defined by the parent makefile, undefine it so
|
||||
# we will later get it from wildcard search in this directory.
|
||||
ifneq "$(findstring env,$(origin sources))" ""
|
||||
sources :=
|
||||
endif
|
||||
|
||||
headers := $(headers) $(sysdep_headers)
|
||||
|
||||
oPATH := $(PATH)
|
||||
PATH := this definition should take precedence over $(oPATH)
|
||||
ifeq ($(PATH),$(oPATH))
|
||||
You must not use the -e flag when building the GNU C library.
|
||||
else
|
||||
PATH := $(oPATH)
|
||||
endif
|
||||
|
||||
ifndef +included-Makeconfig
|
||||
include $(..)Makeconfig
|
||||
endif
|
||||
|
||||
# `configure' writes a definition of `config-sysdirs' in `config.make'.
|
||||
sysdirs = $(config-sysdirs)
|
||||
|
||||
+sysdir_pfx = $(common-objpfx)
|
||||
|
||||
export sysdirs := $(sysdirs)
|
||||
|
||||
+sysdep_dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
|
||||
ifdef objdir
|
||||
+sysdep_dirs := $(objdir) $(+sysdep_dirs)
|
||||
endif
|
||||
|
||||
# Add -I switches to get the right sysdep directories.
|
||||
# `+includes' in Makeconfig references $(+sysdep-includes).
|
||||
+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
|
||||
|
||||
# Include any system-specific makefiles.
|
||||
|
||||
# This is here so things in sysdep Makefiles can easily depend on foo.h as
|
||||
# appropriate and not worry about where foo.h comes from, which may be
|
||||
# system dependent and not known by that Makefile.
|
||||
vpath %.h $(subst $(empty) ,:,$(strip $(common-objpfx) \
|
||||
$(addprefix $(sysdep_dir)/,$(sysdirs)) \
|
||||
$(..)))
|
||||
|
||||
ifeq ($(wildcard $(+sysdir_pfx)sysd-Makefile),)
|
||||
# Don't do deps until this exists, because it might change the sources list.
|
||||
no_deps=t
|
||||
endif
|
||||
|
||||
# Some sysdep makefiles use this to distinguish being included here from
|
||||
# being included individually by a subdir makefile (hurd/Makefile needs this).
|
||||
in-Makerules := yes
|
||||
|
||||
ifndef avoid-generated
|
||||
include $(+sysdir_pfx)sysd-Makefile
|
||||
$(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules
|
||||
-@rm -f $@T
|
||||
(for dir in $(sysdirs); do \
|
||||
file=sysdeps/$$dir/Makefile; \
|
||||
if [ -f $(..)$$file ]; then \
|
||||
echo include "\$$(..)$$file"; \
|
||||
else true; fi; \
|
||||
done; \
|
||||
echo 'sysd-Makefile-done=t') > $@T
|
||||
mv -f $@T $@
|
||||
endif
|
||||
|
||||
# Reorder before-compile so that mach things come first, and hurd things
|
||||
# second, before all else. The mach and hurd subdirectories have many
|
||||
# generated header files which the much of rest of the library depends on,
|
||||
# so it is best to build them first (and mach before hurd, at that).
|
||||
before-compile := $(filter $(common-objpfx)mach% $(common-objpfx)hurd%,\
|
||||
$(before-compile)) \
|
||||
$(filter-out $(common-objpfx)mach% $(common-objpfx)hurd%,\
|
||||
$(before-compile))
|
||||
|
||||
# Remove existing files from `before-compile'. Things are added there when
|
||||
# they must exist for dependency generation to work right, but once they
|
||||
# exist there is no further need for every single file to depend on them,
|
||||
# and those gratuitous dependencies result in many gratuitous
|
||||
# recompilations.
|
||||
before-compile := $(filter-out $(wildcard $(before-compile)),$(before-compile))
|
||||
|
||||
# Don't let any before-compile file be an intermediate and get removed.
|
||||
ifdef before-compile
|
||||
$(before-compile):
|
||||
endif
|
||||
|
||||
# Generate an ordered list of implicit rules which find the source files in
|
||||
# each sysdep directory. The old method was to use vpath to search all the
|
||||
# sysdep directories. However, that had the problem that a .S file in a
|
||||
# later directory would be chosen over a .c file in an earlier directory,
|
||||
# which does not preserve the desired sysdeps ordering behavior.
|
||||
|
||||
# When making the list of .d files to include, we can't know which ones
|
||||
# have source in .s files, and thus do not in fact need a .d file.
|
||||
# So we must define rules to make .d files for .s files.
|
||||
define make-dummy-dep
|
||||
$(addprefix ln $(objpfx)dummy.d ,$(filter-out $(wildcard $@),$@))
|
||||
endef
|
||||
$(objpfx)dummy.d:
|
||||
echo '# .s files cannot contain includes, so they need no deps.' > $@
|
||||
|
||||
# It matters that this set of rules, for compiling from sources in
|
||||
# the current directory (the $srcdir/$subdir) come before the
|
||||
# generated sysdep rules in included from sysd-rules below. When
|
||||
# compiling in the source tree, generated sources go into the current
|
||||
# directory, and those should be chosen before any sources in sysdeps.
|
||||
$(objpfx)%.o: %.S $(before-compile); $(compile-command.S)
|
||||
$(objpfx)%.d: %.S $(before-compile); $(+make-deps)
|
||||
$(objpfx)%.o: %.s $(before-compile); $(compile-command.s)
|
||||
$(objpfx)%.d: %.s $(objpfx)dummy.d; $(make-dummy-dep)
|
||||
$(objpfx)%.o: %.c $(before-compile); $(compile-command.c)
|
||||
$(objpfx)%.d: %.c $(before-compile); $(+make-deps)
|
||||
|
||||
# Omit the objpfx rules when building in the source tree, because
|
||||
# objpfx is empty and so these rules just override the ones above.
|
||||
ifdef objpfx
|
||||
# Define first rules to find the source files in $(objpfx).
|
||||
# Generated source files will end up there.
|
||||
$(objpfx)%.o: $(objpfx)%.S $(before-compile); $(compile-command.S)
|
||||
$(objpfx)%.d: $(objpfx)%.S $(before-compile); $(+make-deps)
|
||||
$(objpfx)%.o: $(objpfx)%.s $(before-compile); $(compile-command.s)
|
||||
$(objpfx)%.d: $(objpfx)%.s $(objpfx)dummy.d; $(make-dummy-dep)
|
||||
$(objpfx)%.o: $(objpfx)%.c $(before-compile); $(compile-command.c)
|
||||
$(objpfx)%.d: $(objpfx)%.c $(before-compile); $(+make-deps)
|
||||
endif
|
||||
|
||||
# System-dependent makefiles can put in `inhibit-sysdep-asm' wildcard
|
||||
# patterns matching sysdep directories whose assembly source files should
|
||||
# be suppressed.
|
||||
ifdef inhibit-sysdep-asm
|
||||
define open-check-inhibit-asm
|
||||
case $$sysdir in $(subst $(empty) ,|,$(inhibit-sysdep-asm))) : ;; *)
|
||||
endef
|
||||
close-check-inhibit-asm = ;; esac
|
||||
endif
|
||||
|
||||
# Don't include sysd-rules until sysd-Makefile is already there and has been
|
||||
# included. It might define inhibit-sysdep-asm, which would affect the
|
||||
# contents of sysd-rules.
|
||||
ifdef sysd-Makefile-done
|
||||
include $(+sysdir_pfx)sysd-rules
|
||||
endif
|
||||
$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
|
||||
$(wildcard $(foreach dir,$(sysdirs),\
|
||||
$(sysdep_dir)/$(dir)/Makefile))
|
||||
-@rm -f $@T
|
||||
(for sysdir in $(sysdirs); do \
|
||||
dir="\$$(sysdep_dir)/$$sysdir"; \
|
||||
$(open-check-inhibit-asm) \
|
||||
echo "\$$(objpfx)%.o: $$dir/%.S \$$(before-compile); \
|
||||
\$$(compile-command.S)"; \
|
||||
echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
|
||||
\$$(+make-deps)"; \
|
||||
echo "\$$(objpfx)%.o: $$dir/%.s \$$(before-compile); \
|
||||
\$$(compile-command.s)"; \
|
||||
echo "\$$(objpfx)%.d: $$dir/%.s \$$(objpfx)dummy.d; \
|
||||
\$$(make-dummy-dep)" $(close-check-inhibit-asm); \
|
||||
echo "\$$(objpfx)%.o: $$dir/%.c \$$(before-compile); \
|
||||
\$$(compile-command.c)"; \
|
||||
echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
|
||||
\$$(+make-deps)"; \
|
||||
done) > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
ifndef compile-command.S
|
||||
compile-command.S = $(compile.S) $(OUTPUT_OPTION)
|
||||
endif
|
||||
ifndef compile-command.s
|
||||
compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
|
||||
endif
|
||||
ifndef compile-command.c
|
||||
compile-command.c = $(compile.c) $(OUTPUT_OPTION)
|
||||
endif
|
||||
|
||||
ifneq ($(filter %gcc,$(notdir $(firstword $(CC)))),)
|
||||
# GCC can grok options after the file name, and it looks nicer that way.
|
||||
compile.S = $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS)
|
||||
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
|
||||
else
|
||||
compile.S = $(COMPILE.S) -DASSEMBLER $(asm-CPPFLAGS) $<
|
||||
compile.c = $(COMPILE.c) $<
|
||||
endif
|
||||
|
||||
ifndef OUTPUT_OPTION
|
||||
ifdef objpfx
|
||||
# We need this for the output to go in the right place. It will default to
|
||||
# empty if make was configured to work with a cc that can't grok -c and -o
|
||||
# together. You can't compile the C library with such a compiler.
|
||||
OUTPUT_OPTION = -o $@
|
||||
endif
|
||||
endif
|
||||
|
||||
S-CPPFLAGS = $(asm-CPPFLAGS)
|
||||
define +make-deps
|
||||
-@rm -f $@
|
||||
$(+mkdep) $< $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
|
||||
sed -e 's,$*\.o,$(@:.d=.o) $@,' $(sed-remove-objpfx) > $(@:.d=.T)
|
||||
mv -f $(@:.d=.T) $@
|
||||
endef
|
||||
ifneq (,$(objpfx))
|
||||
sed-remove-objpfx = -e 's@ $(subst @,\@,$(objpfx))@ $$(objpfx)@g' \
|
||||
-e 's@^$(subst @,\@,$(objpfx))@$$(objpfx)@g'
|
||||
endif
|
||||
|
||||
# Figure out the source filenames in this directory.
|
||||
|
||||
override sources := $(addsuffix .c,$(filter-out $(elided-routines),\
|
||||
$(routines) $(aux) \
|
||||
$(sysdep_routines)))
|
||||
sysdep_routines := $(sysdep_routines)
|
||||
|
||||
# This is the list of all object files, gotten by
|
||||
# replacing every ".c" in `sources' with a ".o".
|
||||
override objects := $(addprefix $(objpfx),$(sources:.c=.o))
|
||||
|
||||
+depfiles := $(strip $(sources:.c=.d) \
|
||||
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs))) \
|
||||
$(addsuffix .d,$(others) $(tests)))
|
||||
+depfiles := $(addprefix $(objpfx),\
|
||||
$(filter-out $(addsuffix .d,$(omit-deps)),\
|
||||
$(+depfiles)))
|
||||
|
||||
$(objpfx)depend-$(subdir): Makefile
|
||||
ifdef +depfiles
|
||||
for file in $(+depfiles:$(objpfx)%=%); do \
|
||||
echo "include \$$(objpfx)$$file"; \
|
||||
done > $@-tmp
|
||||
mv -f $@-tmp $@
|
||||
else
|
||||
cp /dev/null $@
|
||||
endif
|
||||
|
||||
ifneq ($(no_deps),t)
|
||||
# Include the generated dependencies of the sources in this directory.
|
||||
include $(objpfx)depend-$(subdir)
|
||||
endif
|
||||
|
||||
# Maximize efficiency by minimizing the number of rules.
|
||||
.SUFFIXES: # Clear the suffix list.
|
||||
# Add the suffixes we use.
|
||||
.SUFFIXES: .a .o .S .s .c .h .d
|
||||
|
||||
# Generic rule for making directories.
|
||||
%/:
|
||||
# mkdir isn't smart enough to strip a trailing /.
|
||||
mkdir $(@:%/=%)
|
||||
|
||||
# Make sure that object files are not removed
|
||||
# when they are intermediates between sources and library members.
|
||||
# This can go away with make v4.
|
||||
.PRECIOUS: %.o
|
||||
|
||||
# Make sure that the parent library archive is never removed.
|
||||
.PRECIOUS: $(libc.a)
|
||||
|
||||
# Use the verbose option of ar and tar when not running silently.
|
||||
ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
|
||||
verbose := v
|
||||
else # -s
|
||||
verbose :=
|
||||
endif # not -s
|
||||
|
||||
ARFLAGS := r$(verbose)
|
||||
|
||||
# This makes all the object files in the parent library archive.
|
||||
|
||||
.PHONY: lib libobjs lib-noranlib
|
||||
$(libc.a): $(libc.a)(__.SYMDEF)
|
||||
lib: $(libc.a)
|
||||
|
||||
+libobjs := $(patsubst %,$(libc.a)(%),$(notdir $(objects)))
|
||||
libobjs: $(+libobjs)
|
||||
lib-noranlib: libobjs
|
||||
|
||||
# Define a pattern rule that will match many targets libc.%(foo.o), for
|
||||
# each foo in $(objects) (% will just happen always to match `a'). This is
|
||||
# the only way to define a rule that updates many targets at once with one
|
||||
# sequence of commands.
|
||||
ifdef objects
|
||||
$(patsubst %,$(libc.a:a=)\%(%),$(notdir $(objects))): $(objpfx)stamp-$(subdir);
|
||||
$(objpfx)stamp-$(subdir): $(objects)
|
||||
# $(+libc_lock_open)
|
||||
ifdef objdir
|
||||
cd $(objdir); $(AR) cru$(verbose) libc.a $(patsubst $(objpfx)%,%,$^)
|
||||
else
|
||||
$(AR) cru$(verbose) $(..)libc.a $^
|
||||
endif
|
||||
# $(+libc_lock_close)
|
||||
touch $@
|
||||
endif
|
||||
|
||||
$(libc.a)(__.SYMDEF): $(+libobjs)
|
||||
$(RANLIB) $@
|
||||
|
||||
define +libc_lock_open
|
||||
@. $(..)libc-lock-open
|
||||
endef
|
||||
define +libc_lock_close
|
||||
@rm -f $(..)LOCK-libc.a
|
||||
endef
|
||||
|
||||
# This makes all the object files.
|
||||
.PHONY: objects objs
|
||||
objects objs: $(objects) $(addprefix $(objpfx),$(extra-objs))
|
||||
|
||||
# Installation.
|
||||
|
||||
# $(install-lib) are installed from the object directory into $(libdir);
|
||||
# files in $(install-lib) matching `lib%.a' are ranlib'd after installation
|
||||
# unless they also appear in $(non-lib.a). $(install-data) are installed
|
||||
# as they are into $(datadir). $(headers) are installed as they are in
|
||||
# $(includedir). $(install-bin) and $(install-sbin) are installed from the
|
||||
# object directory into $(bindir) and $(sbindir), respectively.
|
||||
# $(install-others) are absolute path names of files to install; rules to
|
||||
# install them are defined elsewhere.
|
||||
|
||||
# The simple library name to install libc.a under.
|
||||
# This could be defined by a sysdep Makefile.
|
||||
ifndef libc-name
|
||||
libc-name := c
|
||||
endif
|
||||
|
||||
define do-install
|
||||
$(make-target-directory)
|
||||
$(INSTALL_DATA) $< $@
|
||||
endef
|
||||
|
||||
# Make the target directory if it doesn't exist. Because of make's
|
||||
# directory cache, this will produce the `mkdir' command when the directory
|
||||
# already exists, if it didn't exist at the start of the `make' run. The
|
||||
# `-' prefix ignores errors from mkdir, so there will just be some
|
||||
# gratuitous but harmless `File exists' messages.
|
||||
define make-target-directory
|
||||
$(addprefix -mkdir ,$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
|
||||
endef
|
||||
|
||||
# Any directory (parent or subdir) that has any object files to build
|
||||
# should install libc.a; this way "make install" in a subdir is guaranteed
|
||||
# to install everything it changes.
|
||||
ifdef objects
|
||||
install: $(libdir)/lib$(libprefix)$(libc-name).a
|
||||
# We avoid depending on lib-noranlib because that makes the parent make
|
||||
# subdir_lib in all the subdirs, when the make install run they do will
|
||||
# update the library anyway. Running ranlib after installing makes the
|
||||
# __.SYMDEF time stamp up to date, which avoids messages from some linkers.
|
||||
# Depending on subdir_install gets all the subdirs to update the library,
|
||||
# and is optimal for `make install' at top level.
|
||||
$(libdir)/lib$(libprefix)$(libc-name).a: libobjs subdir_install
|
||||
$(make-target-directory)
|
||||
$(INSTALL_DATA) $(libc.a) $@
|
||||
$(RANLIB) $@
|
||||
endif
|
||||
|
||||
ifdef install-bin
|
||||
$(addprefix $(bindir)/,$(install-bin)): $(bindir)/%: $(objpfx)%
|
||||
$(make-target-directory)
|
||||
$(INSTALL_PROGRAM) $< $@
|
||||
endif
|
||||
ifdef install-sbin
|
||||
$(addprefix $(sbindir)/,$(install-sbin)): $(sbindir)/%: $(objpfx)%
|
||||
$(make-target-directory)
|
||||
$(INSTALL_PROGRAM) $< $@
|
||||
endif
|
||||
ifdef install-lib
|
||||
install-lib.a := $(filter lib%.a,$(install-lib))
|
||||
install-lib-non.a := $(filter-out lib%.a,$(install-lib))
|
||||
ifdef install-lib-non.a
|
||||
$(addprefix $(libdir)/$(libprefix),$(install-lib-non.a)): \
|
||||
$(libdir)/$(libprefix)%: $(objpfx)%
|
||||
$(do-install)
|
||||
endif
|
||||
ifdef install-lib.a
|
||||
$(install-lib.a:lib%.a=$(libdir)/lib$(libprefix)%.a): \
|
||||
$(libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a
|
||||
$(do-install)
|
||||
$(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F)))
|
||||
endif
|
||||
endif
|
||||
ifdef install-data
|
||||
$(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install)
|
||||
endif
|
||||
headers := $(strip $(headers))
|
||||
ifdef headers
|
||||
$(addprefix $(includedir)/,$(headers)): \
|
||||
$(includedir)/%: %;$(do-install)
|
||||
endif # headers
|
||||
|
||||
.PHONY: install-bin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
|
||||
install-data-nosubdir install-headers-nosubdir
|
||||
install-bin-nosubdir: $(addprefix $(bindir)/,$(install-bin))
|
||||
install-sbin-nosubdir: $(addprefix $(sbindir)/,$(install-sbin))
|
||||
install-lib-nosubdir: $(addprefix $(libdir)/,\
|
||||
$(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
|
||||
$(addprefix $(libprefix),$(install-lib-non.a)))
|
||||
install-data-nosubdir: $(addprefix $(datadir)/,$(install-data))
|
||||
install-headers-nosubdir: $(addprefix $(includedir)/,$(headers))
|
||||
install-others-nosubdir: $(install-others)
|
||||
|
||||
# We need all the `-nosubdir' targets so that `install' in the parent
|
||||
# doesn't depend on several things which each iterate over the subdirs.
|
||||
# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
|
||||
# subroutine. Then in the parent `install-FOO' also causes subdir makes.
|
||||
install-%:: install-%-nosubdir ;
|
||||
|
||||
.PHONY: install install-no-libc.a-nosubdir
|
||||
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
|
||||
install-bin-nosubdir install-lib-nosubdir \
|
||||
install-others-nosubdir install-sbin-nosubdir
|
||||
install: install-no-libc.a-nosubdir
|
||||
|
||||
# Command to compile $< in $(objdir) using the native libraries.
|
||||
define native-compile
|
||||
cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
|
||||
$(addprefix $$cwd/,$^) -o $(@F)
|
||||
endef
|
||||
|
||||
# Command to compile $< in $(common-objdir) using the native libraries.
|
||||
define common-objdir-compile
|
||||
cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=%) -o $(@F)
|
||||
endef
|
||||
|
||||
# We always want to use configuration definitions.
|
||||
BUILD_CFLAGS = -include $(common-objpfx)config.h
|
||||
|
||||
# Support the GNU standard name for this target.
|
||||
.PHONY: check
|
||||
check: tests
|
||||
|
||||
.PHONY: TAGS
|
||||
TAGS: distinfo $(..)MakeTAGS
|
||||
$(MAKE) $(addprefix -f ,$^)
|
||||
|
||||
.PHONY: echo-headers
|
||||
echo-headers:
|
||||
@echo $(headers)
|
||||
|
||||
|
||||
# Common cleaning targets.
|
||||
|
||||
.PHONY: common-mostlyclean common-clean mostlyclean clean
|
||||
clean: common-clean
|
||||
mostlyclean: common-mostlyclean
|
||||
|
||||
# Remove the object files.
|
||||
common-mostlyclean:
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(others) \
|
||||
$(addsuffix .o,$(tests) $(others)) \
|
||||
$(addsuffix .out,$(tests)))
|
||||
-rm -f $(objects) $(addprefix $(objpfx),$(extra-objs) stamp-$(subdir))
|
||||
-rm -f core TAGS
|
||||
|
||||
# Also remove the dependencies and generated source files.
|
||||
common-clean: common-mostlyclean
|
||||
-rm -f $(objpfx)depend-$(subdir) $(+depfiles)
|
||||
-rm -f $(addprefix $(objpfx),$(generated))
|
||||
|
||||
# Produce a file `stub-$(subdir)' which contains `#define __stub_FUNCTION'
|
||||
# for each function which is a stub. We grovel over all the .d files
|
||||
# looking for references to source files in sysdeps/stub. Then we grovel
|
||||
# over each referenced source file to see what stub function it defines.
|
||||
|
||||
.PHONY: stubs # The parent Makefile calls this target.
|
||||
stubs: $(common-objpfx)stub-$(subdir)
|
||||
s = $(sysdep_dir)/stub
|
||||
$(common-objpfx)stub-$(subdir): $(+depfiles)
|
||||
# Use /dev/null since `...` might expand to empty.
|
||||
s=`cd $s; /bin/pwd`; \
|
||||
$(patsubst %,cd %;,$(objdir)) \
|
||||
sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
|
||||
`sed -n 's@^.*$s/\([a-z0-9_-]*\.c\).*$$@'"$$s"/'\1@p' \
|
||||
$(patsubst $(objpfx)%,%,$^) /dev/null` \
|
||||
/dev/null > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
# Make the distribution tar file.
|
||||
|
||||
.PHONY: dist
|
||||
dist: distinfo $(..)Make-dist
|
||||
$(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
|
||||
|
||||
dist: $(distribute)
|
||||
|
||||
# We used to simply export all these variables, but that frequently made the
|
||||
# environment get too large. Instead, we write all the information into
|
||||
# a generated makefile fragment `distinfo', and then include it with -f in
|
||||
# the sub-make that makes the distribution (above).
|
||||
distinfo: Makefile $(..)Makerules
|
||||
$(distinfo-vars)
|
||||
mv -f $@.new $@
|
||||
|
||||
define distinfo-vars
|
||||
rm -f $@.new
|
||||
$(foreach var,subdir sources elided-routines headers distribute \
|
||||
dont_distribute generated others tests,
|
||||
echo >> $@.new '$(var) := $($(var))')
|
||||
echo >> $@.new 'sources := $$(sources) $$(addsuffix .c,$$(elided-routines))'
|
||||
endef
|
||||
|
||||
ifneq (,$(strip $(gpl2lgpl)))
|
||||
ifneq (,$(wildcard $(..)gpl2lgpl.sed))
|
||||
# Snarf from the master source and frob the copying notice.
|
||||
$(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
|
||||
sed -f $^ > $@-tmp
|
||||
# So I don't edit them by mistake.
|
||||
chmod a-w $@-tmp
|
||||
mv -f $@-tmp $@
|
||||
test -d CVS && cvs commit -m'Updated from $^' $@
|
||||
endif
|
||||
endif
|
323
NEWS
Normal file
323
NEWS
Normal file
@ -0,0 +1,323 @@
|
||||
GNU C Library NEWS -- history of user-visible changes. 26 January 1995
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU C library bug reports to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
Version 1.10
|
||||
|
||||
* The library has changed from using GNU ld symbol aliases to using weak
|
||||
symbols where available. The ELF object file format supports weak
|
||||
symbols; GNU ld also supports weak symbols in the a.out format. (There
|
||||
is also now support for other GNU ld extensions in ELF. Use the
|
||||
`--with-elf' option to configure to indicate you have elf, and
|
||||
`--with-gnu-ld' if using GNU ld.) This changed resulted in the deletion
|
||||
of many files which contained only symbol aliases, reducing the size of
|
||||
the source and the compiled library; many other files were renamed to
|
||||
less cryptic names previously occupied by the symbol alias files.
|
||||
|
||||
* The pgrp functions have been regularized, slightly incompatibly but much
|
||||
less confusingly. The core functions are now `getpgid' and `setpgid',
|
||||
which take arguments for the PID to operate on; the POSIX.1 `getpgrp' (no
|
||||
argument) and BSD `setpgrp' (identical to `setpgid') functions are
|
||||
provided for compatibility. There is no longer an incompatible `getpgrp'
|
||||
with an argument declared under _BSD_SOURCE; no BSD code uses it.
|
||||
|
||||
* The new header file <fts.h> and suite of functions simplify programs that
|
||||
operate on directory trees. This code comes from 4.4 BSD.
|
||||
|
||||
* Converted to Autoconf version 2, so `configure' has more options.
|
||||
Run `configure --help' to see the details.
|
||||
|
||||
* The resolver code has been updated from the BIND-4.9.3-BETA14 release.
|
||||
|
||||
* The new function `malloc_find_object_address' finds the starting address
|
||||
of a malloc'd block, given any address within the block. This can be
|
||||
useful for debugging.
|
||||
|
||||
* The new functions `strtoq' and `strtouq' parse integer values from
|
||||
strings, like `strtol' and `strtoul', but they return `long long int' and
|
||||
`unsigned long long int' values, respectively (64-bit quantities).
|
||||
|
||||
* There is a new malloc debugging hook `__memalign_hook'.
|
||||
|
||||
* There are new typedefs `ushort' for `unsigned short int' and `uint' for
|
||||
`unsigned int' in <sys/types.h>. These are for compatibility only and
|
||||
their use is discouraged.
|
||||
|
||||
* The `-lmcheck' library to enable standard malloc debugging hooks is now
|
||||
done differently, so that it works even without GNU ld.
|
||||
|
||||
Version 1.09
|
||||
|
||||
* For cross-compilation you should now set `BUILD_CC' instead of `HOST_CC'.
|
||||
|
||||
* New header file <fstab.h> and new functions `getfsspec', `getfsent' and
|
||||
friends, for parsing /etc/fstab. This code comes from 4.4 BSD.
|
||||
|
||||
* The new function `daemon' from 4.4 BSD is useful for server programs that
|
||||
want to put themselves in the background.
|
||||
|
||||
* Joel Sherrill has contributed support for several standalone boards that
|
||||
run without an operating system.
|
||||
|
||||
* `printf', `scanf' and friends now accept a `q' type modifier for long
|
||||
long int as well as `ll'. Formats using these might be `%qu' or `%lld'.
|
||||
|
||||
* All of the code taken from BSD (notably most of the math and networking
|
||||
routines) has been updated from the BSD 4.4-Lite release.
|
||||
|
||||
* The resolver code has been updated from the BIND-4.9.3-BETA9 release.
|
||||
|
||||
* The new functions `getdomainname' and `setdomainname' fetch or change the
|
||||
YP/NIS domain name. These are system calls which exist on systems which
|
||||
have YP (aka NIS).
|
||||
|
||||
* The time zone data files have been updated for the latest international
|
||||
conventions.
|
||||
|
||||
* The SunRPC programs `portmap' and `rpcinfo' are now installed in
|
||||
$(sbindir) (usually /usr/local/sbin) instead of $(bindir).
|
||||
|
||||
Version 1.08
|
||||
|
||||
* The C library now includes support for Sun RPC, from Sun's free
|
||||
RPCSRC-4.0 distribution. The `portmap', `rpcinfo', and `rpcgen' programs
|
||||
are included. (There is still no support for YP.)
|
||||
|
||||
* Tom Quinn has contributed a port of the C library to SGI machines running
|
||||
Irix 4 (mips-sgi-irix4).
|
||||
|
||||
* The new `lockf' function is a simplified interface to the locking
|
||||
facilities of `fcntl', included for compatibility.
|
||||
|
||||
* New time functions `timegm', `timelocal', and `dysize' for compatibility.
|
||||
|
||||
* New header file <sys/timeb.h> and new function `ftime' for compatibility.
|
||||
|
||||
* New header files <poll.h> and <sys/poll.h> and new function `poll' for
|
||||
compatibility.
|
||||
|
||||
* The error message printed by `assert' for a failed assertion now includes
|
||||
the name of the program (if using GNU ld) and the name of the calling
|
||||
function (with versions of GCC that support this).
|
||||
|
||||
* The `psignal' function is now declared in <signal.h>, not <stdio.h>.
|
||||
|
||||
* The library now includes the <sys/mman.h> header file and memory
|
||||
management functions `mmap', `munmap', `mprotect', `msync', and
|
||||
`madvise', on systems that support those facilities.
|
||||
|
||||
* The interface for `mcheck' has changed slightly: the function called to
|
||||
abort the program when an allocation inconsistency is detected now takes
|
||||
an argument that indicates the type of failure. The new function
|
||||
`mprobe' lets you request a consistency check for a particular block at
|
||||
any time (checks are normally done only when you call `free' or `realloc'
|
||||
on a block).
|
||||
|
||||
* It is now possible to easily cross-compile the C library, building on one
|
||||
system a library to run on another machine and/or operating system. All
|
||||
you need to do is set the variable `HOST_CC' in `configparms' to the
|
||||
native compiler for programs to run on the machine you are building on (a
|
||||
few generator programs are used on Unix systems); set `CC' to the
|
||||
cross-compiler.
|
||||
|
||||
* The new function `fexecve' (only implemented on the GNU system) executes
|
||||
a program file given a file descriptor already open on the file.
|
||||
|
||||
Version 1.07
|
||||
|
||||
* Brendan Kehoe has contributed most of a port to the DEC Alpha
|
||||
running OSF/1 (alpha-dec-osf1). He says it is 75% complete.
|
||||
|
||||
* You can set the variable `libprefix' in `configparms' to specify a prefix
|
||||
to be prepended to installed library files; this makes it easy to install
|
||||
the GNU C library to be linked as `-lgnuc' or whatever.
|
||||
|
||||
* The new `stpncpy' is a cross between `stpcpy' and `strncpy': It
|
||||
copies a limited number of characters from a string, and returns the
|
||||
address of the last character written.
|
||||
|
||||
* You no longer need to check for whether the installed `stddef.h' is
|
||||
compatible with the GNU C library. configure now checks for you.
|
||||
|
||||
* You can now define a per-stream `fileno' function to convert the
|
||||
stream's cookie into an integral file descriptor.
|
||||
|
||||
* ``malloc (0)'' no longer returns a null pointer. Instead, it
|
||||
allocates zero bytes of storage, and returns a unique pointer which
|
||||
you can pass to `realloc' or `free'. The behavior is undefined if
|
||||
you dereference this pointer.
|
||||
|
||||
* The C library now runs on Sony NEWS m68k machines running either
|
||||
NewsOS 3 or NewsOS 4.
|
||||
|
||||
* The new `syscall' function is a system-dependent primitive function
|
||||
for invoking system calls. It has the canonical behavior on Unix
|
||||
systems, including unreliable return values for some calls (such as
|
||||
`pipe', `fork' and `getppid').
|
||||
|
||||
* The error code `EWOULDBLOCK' is now obsolete; it is always defined
|
||||
to `EAGAIN', which is the preferred name. On systems whose kernels
|
||||
use two distinct codes, the C library now translates EWOULDBLOCK to
|
||||
EAGAIN in every system call function.
|
||||
|
||||
Version 1.06
|
||||
|
||||
* The GNU C Library Reference Manual is now distributed with the library.
|
||||
`make dvi' will produce a DVI file of the printed manual.
|
||||
`make info' will produce Info files that you can read on line using C-h i
|
||||
in Emacs or the `info' program.
|
||||
Please send comments on the manual to bug-glibc-manual@prep.ai.mit.edu.
|
||||
|
||||
* The library now supports SVR4 on i386s (i386-unknown-sysv4).
|
||||
|
||||
* Brendan Kehoe has contributed a port to Sun SPARCs running Solaris 2.
|
||||
|
||||
* Jason Merrill has contributed a port to the Sequent Symmetry running
|
||||
Dynix version 3 (i386-sequent-dynix).
|
||||
|
||||
* The library has been ported to i386s running SCO 3.2.4 (also known as SCO
|
||||
ODT 2.0; i386-unknown-sco3.2.4) or SCO 3.2 (i386-unknown-sco3.2).
|
||||
|
||||
* New function `memory_warnings' lets you arrange to get warnings when
|
||||
malloc is running out of memory to allocate, like Emacs gives you.
|
||||
|
||||
* The C library now contains the relocating allocator used in Emacs 19 for
|
||||
its editing buffers. This allocator (ralloc) minimizes allocation
|
||||
overhead and fragmentation by moving allocated regions around whenever it
|
||||
needs to. You always refer to a ralloc'd region with a "handle" (a
|
||||
pointer to a pointer--an object of type `void **').
|
||||
|
||||
* There is a new `printf' format: `%m' gives you the string corresponding
|
||||
to the error code in `errno'.
|
||||
|
||||
* In `scanf' formats, you can now use `%as' or `%a[' to do the normal `%s'
|
||||
or `%[' conversion, but instead of filling in a fixed-sized buffer you
|
||||
pass, the `a' modifier says to fill in a `char **' you pass with a
|
||||
malloc'd string.
|
||||
|
||||
* The `fnmatch' function supports the new flag bits `FNM_LEADING_DIR' and
|
||||
`FNM_CASEFOLD'. `FNM_LEADING_DIR' lets a pattern like `foo*' match a
|
||||
name like `foo/bar'. `FNM_CASEFOLD' says to ignore case in matching.
|
||||
|
||||
* `mkstemp' is a traditional Unix function to atomically create and open a
|
||||
uniquely-named temporary file.
|
||||
|
||||
Version 1.05
|
||||
|
||||
* The standard location for the file that says what the local timezone is
|
||||
has changed again. It is now `/usr/local/etc/localtime' (or more
|
||||
precisely, `${prefix}/etc/localtime') rather than `/etc/localtime'.
|
||||
|
||||
* The distribution no longer contains any files with names longer than 14
|
||||
characters.
|
||||
|
||||
* `struct ttyent' has two new flag bits: TTY_TRUSTED and TTY_CONSOLE.
|
||||
These are set by the new `trusted' and `console' keywords in `/etc/ttys'.
|
||||
|
||||
* New functions `ttyslot' and `syslog' from 4.4 BSD.
|
||||
|
||||
Version 1.04
|
||||
|
||||
* The configuration process has changed quite a bit. The `configure'
|
||||
script is now used just like the configuration scripts for other GNU
|
||||
packages. The `sysdeps' directory hierarchy is much rearranged.
|
||||
The file `INSTALL' explains the new scheme in detail.
|
||||
|
||||
* The header files no longer need to be processed into ANSI C and
|
||||
traditional C versions. There is just one set of files to install, and
|
||||
it will work with ANSI or old C compilers (including `gcc -traditional').
|
||||
|
||||
* Brendan Kehoe and Ian Lance Taylor have ported the library to the
|
||||
MIPS DECStation running Ultrix 4.
|
||||
|
||||
* The Sun 4 startup code (crt0) can now properly load SunOS 4 shared libraries.
|
||||
Tom Quinn contributed the initial code. The GNU C library can NOT yet be
|
||||
made itself into a shared library.
|
||||
|
||||
* Yet further improved support for the i386, running 4.3 BSD-like systems
|
||||
(such as Mach 3 with the Unix single-server), or System V.
|
||||
|
||||
* New function `strncasecmp' to do case-insensitive string comparison
|
||||
with limited length.
|
||||
|
||||
* New function `strsep' is a reentrant alternative to `strtok'.
|
||||
|
||||
* New functions `scandir' and `alphasort' for searching directories.
|
||||
|
||||
* New function `setenv' is a better interface to `putenv'.
|
||||
|
||||
* Ian Lance Taylor has contributed an implementation of the SVID `ftw'
|
||||
function for traversing a directory tree.
|
||||
|
||||
* The GNU obstack package is now also part of the C library.
|
||||
The new function `open_obstack_stream' creates a stdio stream that
|
||||
writes onto an obstack; `obstack_printf' and `obstack_vprintf' do
|
||||
formatted output directly to an obstack.
|
||||
|
||||
* Miscellaneous new functions: reboot, nice, sigaltstack (4.4 BSD only),
|
||||
cfmakeraw, getusershell, getpass, swab, getttyent, seteuid, setegid.
|
||||
|
||||
* `FNM_FILE_NAME' is another name for `FNM_PATHNAME', used with `fnmatch'.
|
||||
|
||||
* The new functions `strfry' and `memfrob' do mysterious and wonderful
|
||||
things to your strings.
|
||||
|
||||
* There are some new test programs: test-fseek, testmb, and testrand.
|
||||
|
||||
* Some work has been done to begin porting the library to 4.4 BSD and Linux.
|
||||
These ports are not finished, but are a good starting place for really
|
||||
supporting those systems.
|
||||
|
||||
* `/etc/localtime' is now the standard location for the file that says what
|
||||
the local timezone is, rather than `/usr/local/lib/zoneinfo/localtime'.
|
||||
This follows the general principle that `/etc' is the place for all local
|
||||
configuration files.
|
||||
|
||||
* The C library header files now use `extern "C"' when used by the C++
|
||||
compiler, so the C library should now work with C++ code.
|
||||
|
||||
* The header file <bstring.h> is gone. <string.h> now declares bcopy,
|
||||
bcmp, bzero, and ffs.
|
||||
|
||||
* Mike Haertel (of GNU e?grep and malloc fame) has written a new sorting
|
||||
function which uses the `merge sort' algorithm, and is said to be
|
||||
significantly faster than the old GNU `qsort' function. Merge sort is
|
||||
now the standard `qsort' function. The new algorithm can require a lot
|
||||
of temporary storage; so, the old sorting function is called when the
|
||||
required storage is not available.
|
||||
|
||||
* The C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points.
|
||||
Because of the United States export restriction on DES implementations,
|
||||
we are distributing this code separately from the rest of the C library.
|
||||
There is an extra distribution tar file just for crypt; it is called
|
||||
`glibc-VERSION-crypt.tar.Z', e.g. `glibc-1.04-crypt.tar.Z'. You can just
|
||||
unpack the crypt distribution along with the rest of the C library and
|
||||
build; you can also build the library without getting crypt. Users
|
||||
outside the USA can get the crypt distribution via anonymous FTP from
|
||||
ftp.uni-c.dk [129.142.6.74], or another archive site outside the U.S.
|
||||
|
||||
* The code and header files taken from 4.4 BSD have been updated with the
|
||||
latest files released from Berkeley.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Copyright information:
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to anyone to make or distribute verbatim copies
|
||||
of this document as received, in any medium, provided that the
|
||||
copyright notice and this permission notice are preserved,
|
||||
thus giving the recipient permission to redistribute in turn.
|
||||
|
||||
Permission is granted to distribute modified versions
|
||||
of this document, or of portions of it,
|
||||
under the above conditions, provided also that they
|
||||
carry prominent notices stating who last changed them.
|
||||
|
||||
Local variables:
|
||||
version-control: never
|
||||
end:
|
95
NOTES
Normal file
95
NOTES
Normal file
@ -0,0 +1,95 @@
|
||||
Feature Test Macros
|
||||
-------------------
|
||||
|
||||
The exact set of features available when you compile a source file
|
||||
is controlled by which "feature test macros" you define.
|
||||
|
||||
If you compile your programs using `gcc -ansi', you get only the
|
||||
ANSI C library features, unless you explicitly request additional
|
||||
features by defining one or more of the feature macros. *Note GNU CC
|
||||
Command Options: (gcc.info)Invoking GCC, for more information about GCC
|
||||
options.
|
||||
|
||||
You should define these macros by using `#define' preprocessor
|
||||
directives at the top of your source code files. These directives
|
||||
*must* come before any `#include' of a system header file. It is best
|
||||
to make them the very first thing in the file, preceded only by
|
||||
comments. You could also use the `-D' option to GCC, but it's better
|
||||
if you make the source files indicate their own meaning in a
|
||||
self-contained way.
|
||||
|
||||
- Macro: _POSIX_SOURCE
|
||||
If you define this macro, then the functionality from the POSIX.1
|
||||
standard (IEEE Standard 1003.1) is available, as well as all of the
|
||||
ANSI C facilities.
|
||||
|
||||
- Macro: _POSIX_C_SOURCE
|
||||
If you define this macro with a value of `1', then the
|
||||
functionality from the POSIX.1 standard (IEEE Standard 1003.1) is
|
||||
made available. If you define this macro with a value of `2',
|
||||
then both the functionality from the POSIX.1 standard and the
|
||||
functionality from the POSIX.2 standard (IEEE Standard 1003.2) are
|
||||
made available. This is in addition to the ANSI C facilities.
|
||||
|
||||
- Macro: _BSD_SOURCE
|
||||
If you define this macro, functionality derived from 4.3 BSD Unix
|
||||
is included as well as the ANSI C, POSIX.1, and POSIX.2 material.
|
||||
|
||||
Some of the features derived from 4.3 BSD Unix conflict with the
|
||||
corresponding features specified by the POSIX.1 standard. If this
|
||||
macro is defined, the 4.3 BSD definitions take precedence over the
|
||||
POSIX definitions.
|
||||
|
||||
Due to the nature of some of the conflicts between 4.3 BSD and
|
||||
POSIX.1, you need to use a special "BSD compatibility library"
|
||||
when linking programs compiled for BSD compatibility. This is
|
||||
because some functions must be defined in two different ways, one
|
||||
of them in the normal C library, and one of them in the
|
||||
compatibility library. If your program defines `_BSD_SOURCE', you
|
||||
must give the option `-lbsd-compat' to the compiler or linker when
|
||||
linking the program, to tell it to find functions in this special
|
||||
compatibility library before looking for them in the normal C
|
||||
library.
|
||||
|
||||
- Macro: _SVID_SOURCE
|
||||
If you define this macro, functionality derived from SVID is
|
||||
included as well as the ANSI C, POSIX.1, and POSIX.2 material.
|
||||
|
||||
- Macro: _GNU_SOURCE
|
||||
If you define this macro, everything is included: ANSI C, POSIX.1,
|
||||
POSIX.2, BSD, SVID, and GNU extensions. In the cases where POSIX.1
|
||||
conflicts with BSD, the POSIX definitions take precedence.
|
||||
|
||||
If you want to get the full effect of `_GNU_SOURCE' but make the
|
||||
BSD definitions take precedence over the POSIX definitions, use
|
||||
this sequence of definitions:
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#define _SVID_SOURCE
|
||||
|
||||
Note that if you do this, you must link your program with the BSD
|
||||
compatibility library by passing the `-lbsd-compat' option to the
|
||||
compiler or linker. *Note:* If you forget to do this, you may get
|
||||
very strange errors at run time.
|
||||
|
||||
We recommend you use `_GNU_SOURCE' in new programs. If you don't
|
||||
specify the `-ansi' option to GCC and don't define any of these macros
|
||||
explicitly, the effect is the same as defining `_GNU_SOURCE'.
|
||||
|
||||
When you define a feature test macro to request a larger class of
|
||||
features, it is harmless to define in addition a feature test macro for
|
||||
a subset of those features. For example, if you define
|
||||
`_POSIX_C_SOURCE', then defining `_POSIX_SOURCE' as well has no effect.
|
||||
Likewise, if you define `_GNU_SOURCE', then defining either
|
||||
`_POSIX_SOURCE' or `_POSIX_C_SOURCE' or `_SVID_SOURCE' as well has no
|
||||
effect.
|
||||
|
||||
Note, however, that the features of `_BSD_SOURCE' are not a subset of
|
||||
any of the other feature test macros supported. This is because it
|
||||
defines BSD features that take precedence over the POSIX features that
|
||||
are requested by the other macros. For this reason, defining
|
||||
`_BSD_SOURCE' in addition to the other feature test macros does have an
|
||||
effect: it causes the BSD features to take priority over the conflicting
|
||||
POSIX features.
|
||||
|
67
README
Normal file
67
README
Normal file
@ -0,0 +1,67 @@
|
||||
This directory contains the version 1.09.5 test release of the GNU C Library.
|
||||
Many bugs have been fixed since the last release.
|
||||
Some bugs surely remain.
|
||||
|
||||
As of this release, the GNU C library has been ported to the following
|
||||
configurations:
|
||||
|
||||
alpha-dec-osf1
|
||||
i386-bsd4.3
|
||||
i386-force_cpu386-none
|
||||
i386-gnu (for Hurd development only)
|
||||
i386-isc2.2
|
||||
i386-isc3
|
||||
i386-sco3.2
|
||||
i386-sco3.2v4
|
||||
i386-sequent-bsd
|
||||
i386-sysv
|
||||
i386-sysv4
|
||||
i960-nindy960-none
|
||||
m68k-hp-bsd4.3
|
||||
m68k-mvme135-none
|
||||
m68k-mvme136-none
|
||||
m68k-sony-newsos3
|
||||
m68k-sony-newsos4
|
||||
m68k-sun-sunos4
|
||||
mips-dec-ultrix4
|
||||
mips-sgi-irix4
|
||||
sparc-sun-solaris2
|
||||
sparc-sun-sunos4
|
||||
|
||||
Porting the library is not hard. If you are interested in doing a port,
|
||||
please get on the mailing list by sending electronic mail to
|
||||
bug-glibc-request@prep.ai.mit.edu.
|
||||
|
||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points.
|
||||
Because of the United States export restriction on DES implementations,
|
||||
we are distributing this code separately from the rest of the C
|
||||
library. There is an extra distribution tar file just for crypt; it is
|
||||
called `glibc-1.09.5-crypt.tar.gz'. You can just unpack the crypt
|
||||
distribution along with the rest of the C library and build; you can
|
||||
also build the library without getting crypt. Users outside the USA
|
||||
can get the crypt distribution via anonymous FTP from ftp.uni-c.dk
|
||||
[129.142.6.74], or another archive site outside the USA. Archive
|
||||
maintainers are encouraged to copy this distribution to their archives
|
||||
outside the USA. Please get it from ftp.uni-c.dk; transferring this
|
||||
distribution from prep.ai.mit.edu (or any other site in the USA) to a
|
||||
site outside the USA is in violation of US export laws.
|
||||
|
||||
See the file INSTALL to find out how to configure, build, install, and port
|
||||
the GNU C library.
|
||||
|
||||
The GNU C Library is completely documented by the Texinfo manual found
|
||||
in the `manual/' subdirectory. The manual is still being updated and
|
||||
contains some known errors and omissions; we regret that we do not have
|
||||
the resources to work on the manual as much as we would like. Please
|
||||
send comments on the manual to bug-glibc-manual@prep.ai.mit.edu, and
|
||||
not to the library bug-reporting address.
|
||||
|
||||
The file NOTES contains a description of the feature-test macros used
|
||||
in the GNU C library, explaining how you can tell the library what
|
||||
facilities you want it to make available.
|
||||
|
||||
Send bug reports to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
The GNU C Library is free software. See the file COPYING.LIB for copying
|
||||
conditions.
|
67
README.template
Normal file
67
README.template
Normal file
@ -0,0 +1,67 @@
|
||||
This directory contains the version VERSION test release of the GNU C Library.
|
||||
Many bugs have been fixed since the last release.
|
||||
Some bugs surely remain.
|
||||
|
||||
As of this release, the GNU C library has been ported to the following
|
||||
configurations:
|
||||
|
||||
alpha-dec-osf1
|
||||
i386-bsd4.3
|
||||
i386-force_cpu386-none
|
||||
i386-gnu (for Hurd development only)
|
||||
i386-isc2.2
|
||||
i386-isc3
|
||||
i386-sco3.2
|
||||
i386-sco3.2v4
|
||||
i386-sequent-bsd
|
||||
i386-sysv
|
||||
i386-sysv4
|
||||
i960-nindy960-none
|
||||
m68k-hp-bsd4.3
|
||||
m68k-mvme135-none
|
||||
m68k-mvme136-none
|
||||
m68k-sony-newsos3
|
||||
m68k-sony-newsos4
|
||||
m68k-sun-sunos4
|
||||
mips-dec-ultrix4
|
||||
mips-sgi-irix4
|
||||
sparc-sun-solaris2
|
||||
sparc-sun-sunos4
|
||||
|
||||
Porting the library is not hard. If you are interested in doing a port,
|
||||
please get on the mailing list by sending electronic mail to
|
||||
bug-glibc-request@prep.ai.mit.edu.
|
||||
|
||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points.
|
||||
Because of the United States export restriction on DES implementations,
|
||||
we are distributing this code separately from the rest of the C
|
||||
library. There is an extra distribution tar file just for crypt; it is
|
||||
called `glibc-VERSION-crypt.tar.gz'. You can just unpack the crypt
|
||||
distribution along with the rest of the C library and build; you can
|
||||
also build the library without getting crypt. Users outside the USA
|
||||
can get the crypt distribution via anonymous FTP from ftp.uni-c.dk
|
||||
[129.142.6.74], or another archive site outside the USA. Archive
|
||||
maintainers are encouraged to copy this distribution to their archives
|
||||
outside the USA. Please get it from ftp.uni-c.dk; transferring this
|
||||
distribution from prep.ai.mit.edu (or any other site in the USA) to a
|
||||
site outside the USA is in violation of US export laws.
|
||||
|
||||
See the file INSTALL to find out how to configure, build, install, and port
|
||||
the GNU C library.
|
||||
|
||||
The GNU C Library is completely documented by the Texinfo manual found
|
||||
in the `manual/' subdirectory. The manual is still being updated and
|
||||
contains some known errors and omissions; we regret that we do not have
|
||||
the resources to work on the manual as much as we would like. Please
|
||||
send comments on the manual to bug-glibc-manual@prep.ai.mit.edu, and
|
||||
not to the library bug-reporting address.
|
||||
|
||||
The file NOTES contains a description of the feature-test macros used
|
||||
in the GNU C library, explaining how you can tell the library what
|
||||
facilities you want it to make available.
|
||||
|
||||
Send bug reports to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
The GNU C Library is free software. See the file COPYING.LIB for copying
|
||||
conditions.
|
128
Rules
Normal file
128
Rules
Normal file
@ -0,0 +1,128 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Rules for making a subdirectory in the GNU C library.
|
||||
# Each subdirectory Makefile defines some variables and includes this.
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
all: # Don't let the default goal come from Makeconfig.
|
||||
|
||||
include ../Makeconfig
|
||||
|
||||
ifndef subdir
|
||||
Each subdirectory makefile must define the `subdir' variable.
|
||||
endif
|
||||
# This is benign and useless in GNU make before 3.63.
|
||||
export subdir := $(subdir)
|
||||
|
||||
# This is the default target; it makes the library and auxiliary programs.
|
||||
.PHONY: all
|
||||
all: lib others
|
||||
|
||||
ifneq "$(findstring env,$(origin headers))" ""
|
||||
headers :=
|
||||
endif
|
||||
|
||||
ifneq "$(findstring env,$(origin generated))" ""
|
||||
generated :=
|
||||
endif
|
||||
|
||||
ifeq "$(strip $(headers))" ""
|
||||
ifneq "$(wildcard $(subdir).h)" ""
|
||||
override headers := $(subdir).h
|
||||
endif
|
||||
endif
|
||||
|
||||
include ../Makerules
|
||||
|
||||
.PHONY: subdir_lib
|
||||
subdir_lib: lib-noranlib
|
||||
|
||||
# Some subdirs need to install a dummy library.
|
||||
# They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
|
||||
dep-dummy-lib = $(objpfx)dummy.o
|
||||
define make-dummy-lib
|
||||
$(AR) cr$(verbose) $@ $<
|
||||
endef
|
||||
$(objpfx)dummy.o:
|
||||
@rm -f $(@:.o=.c)
|
||||
echo 'void __dummy__ () { }' > $(@:.o=.c)
|
||||
$(CC) -c $(@:.o=.c) -o $@
|
||||
|
||||
# This makes all the auxilliary and test programs.
|
||||
|
||||
.PHONY: others tests
|
||||
others: $(addprefix $(objpfx),$(others))
|
||||
ifeq ($(cross-compiling),yes)
|
||||
tests: $(addprefix $(objpfx),$(tests))
|
||||
else
|
||||
tests: $(tests:%=$(objpfx)%.out)
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(others) $(tests))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests)): %: %.o $(libc.a)
|
||||
$(+link)
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(tests))" ""
|
||||
# These are the implicit rules for making test outputs
|
||||
# from the test programs and whatever input files are present.
|
||||
$(objpfx)%.out: $(objpfx)% %.args %.input
|
||||
$(dir $<)$(notdir $<) `cat $(word 2,$^)` < $(word 3,$^) > $@
|
||||
$(objpfx)%.out: $(objpfx)% %.args
|
||||
$(dir $<)$(notdir $<) `cat $(word 2,$^)` > $@
|
||||
$(objpfx)%.out: $(objpfx)% %.input
|
||||
$(dir $<)$(notdir $<) < $(word 2,$^) > $@
|
||||
$(objpfx)%.out: $(objpfx)%
|
||||
$(dir $<)$(notdir $<) > $@
|
||||
endif # tests
|
||||
|
||||
.PHONY: distclean realclean subdir_distclean subdir_realclean \
|
||||
subdir_clean subdir_mostlyclean
|
||||
subdir_mostlyclean: mostlyclean
|
||||
subdir_clean: clean
|
||||
subdir_distclean: distclean
|
||||
subdir_realclean: realclean
|
||||
realclean: distclean
|
||||
distclean: clean
|
||||
|
||||
.PHONY: subdir_echo-headers
|
||||
subdir_echo-headers: echo-headers
|
||||
|
||||
.PHONY: subdir_echo-distinfo
|
||||
subdir_echo-distinfo:
|
||||
@echo $(addprefix +header+,$(headers)) \
|
||||
$(addprefix +nodist+,$(generated) $(dont_distribute))
|
||||
|
||||
# We want to install everything except the library itself, but update all
|
||||
# our portions of the library because the parent make will install it later
|
||||
# (likewise the stubs file).
|
||||
.PHONY: subdir_install
|
||||
subdir_install: install-no-libc.a lib-noranlib stubs
|
||||
|
||||
.PHONY: subdir_TAGS subdir_dist
|
||||
subdir_TAGS: TAGS
|
||||
subdir_dist: dist
|
||||
|
||||
# Convenient target to update all the generated source files.
|
||||
.PHONY: generated
|
||||
generated: $(addprefix $(objpfx),$(generated))
|
32
aclocal.m4
vendored
Normal file
32
aclocal.m4
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
|
||||
dnl which appears in configure.in before the sysdep configure scripts are run.
|
||||
dnl Each sysdep configure.in does GLIBC_PROVIDES first, to avoid any
|
||||
dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
|
||||
dnl
|
||||
define(AC_FD_MSG,4)dnl Autoconf lossage.
|
||||
AC_DEFUN([GLIBC_PROVIDES], [dnl
|
||||
AC_PROVIDE([AC_PROG_INSTALL])dnl
|
||||
AC_PROVIDE([AC_PROG_RANLIB])dnl
|
||||
AC_PROVIDE([AC_PROG_CC])dnl
|
||||
AC_PROVIDE([AC_PROG_CPP])dnl
|
||||
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
|
||||
])dnl
|
||||
dnl
|
||||
dnl Check for a symbol
|
||||
dnl
|
||||
AC_DEFUN(AC_CHECK_SYMBOL, [dnl
|
||||
AC_MSG_CHECKING(for $1)
|
||||
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
|
||||
AC_TRY_LINK(,
|
||||
changequote(,)dnl
|
||||
extern char *$1[]; puts(*$1);,
|
||||
changequote([,])dnl
|
||||
ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
|
||||
if test "$ac_cv_check_symbol_$1" = yes; then
|
||||
changequote(,)dnl
|
||||
ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
|
||||
changequote([,])dnl
|
||||
AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
|
||||
dnl
|
108
ansidecl.h
Normal file
108
ansidecl.h
Normal file
@ -0,0 +1,108 @@
|
||||
/* Copyright (C) 1991 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 modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the GNU C Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ANSI and traditional C compatibility macros
|
||||
|
||||
ANSI C is assumed if __STDC__ is #defined.
|
||||
|
||||
Macro ANSI C definition Traditional C definition
|
||||
----- ---- - ---------- ----------- - ----------
|
||||
PTR `void *' `char *'
|
||||
LONG_DOUBLE `long double' `double'
|
||||
CONST `const' `'
|
||||
VOLATILE `volatile' `'
|
||||
SIGNED `signed' `'
|
||||
PTRCONST `void *const' `char *'
|
||||
|
||||
DEFUN(name, arglist, args)
|
||||
|
||||
Defines function NAME.
|
||||
|
||||
ARGLIST lists the arguments, separated by commas and enclosed in
|
||||
parentheses. ARGLIST becomes the argument list in traditional C.
|
||||
|
||||
ARGS list the arguments with their types. It becomes a prototype in
|
||||
ANSI C, and the type declarations in traditional C. Arguments should
|
||||
be separated with `AND'. For functions with a variable number of
|
||||
arguments, the last thing listed should be `DOTS'.
|
||||
|
||||
DEFUN_VOID(name)
|
||||
|
||||
Defines a function NAME, which takes no arguments.
|
||||
|
||||
EXFUN(name, prototype)
|
||||
|
||||
Is used in an external function declaration.
|
||||
In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
|
||||
parentheses). In traditional C it is `NAME()'.
|
||||
For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
|
||||
|
||||
For example:
|
||||
extern int EXFUN(printf, (CONST char *format DOTS));
|
||||
int DEFUN(fprintf, (stream, format),
|
||||
FILE *stream AND CONST char *format DOTS) { ... }
|
||||
void DEFUN_VOID(abort) { ... }
|
||||
*/
|
||||
|
||||
#ifndef _ANSIDECL_H
|
||||
|
||||
#define _ANSIDECL_H 1
|
||||
|
||||
|
||||
/* Every source file includes this file,
|
||||
so they will all get the switch for lint. */
|
||||
/* LINTLIBRARY */
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
|
||||
#define PTR void *
|
||||
#define PTRCONST void *CONST
|
||||
#define LONG_DOUBLE long double
|
||||
|
||||
#define AND ,
|
||||
#define NOARGS void
|
||||
#define CONST const
|
||||
#define VOLATILE volatile
|
||||
#define SIGNED signed
|
||||
#define DOTS , ...
|
||||
|
||||
#define EXFUN(name, proto) name proto
|
||||
#define DEFUN(name, arglist, args) name(args)
|
||||
#define DEFUN_VOID(name) name(NOARGS)
|
||||
|
||||
#else /* Not ANSI C. */
|
||||
|
||||
#define PTR char *
|
||||
#define PTRCONST PTR
|
||||
#define LONG_DOUBLE double
|
||||
|
||||
#define AND ;
|
||||
#define NOARGS
|
||||
#define CONST
|
||||
#define VOLATILE
|
||||
#define SIGNED
|
||||
#define DOTS
|
||||
|
||||
#define EXFUN(name, proto) name()
|
||||
#define DEFUN(name, arglist, args) name arglist args;
|
||||
#define DEFUN_VOID(name) name()
|
||||
|
||||
#endif /* ANSI C. */
|
||||
|
||||
|
||||
#endif /* ansidecl.h */
|
1
arpa/ftp.h
Normal file
1
arpa/ftp.h
Normal file
@ -0,0 +1 @@
|
||||
#include <inet/arpa/ftp.h>
|
1
arpa/inet.h
Normal file
1
arpa/inet.h
Normal file
@ -0,0 +1 @@
|
||||
#include <inet/arpa/inet.h>
|
1
arpa/nameser.h
Normal file
1
arpa/nameser.h
Normal file
@ -0,0 +1 @@
|
||||
#include <resolv/arpa/nameser.h>
|
1
arpa/telnet.h
Normal file
1
arpa/telnet.h
Normal file
@ -0,0 +1 @@
|
||||
#include <inet/arpa/telnet.h>
|
1
arpa/tftp.h
Normal file
1
arpa/tftp.h
Normal file
@ -0,0 +1 @@
|
||||
#include <inet/arpa/tftp.h>
|
26
assert/Makefile
Normal file
26
assert/Makefile
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright (C) 1991, 1994 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Sub-makefile for assert portion of the library.
|
||||
#
|
||||
subdir := assert
|
||||
|
||||
routines := assert assert-perr
|
||||
|
||||
include ../Rules
|
55
assert/assert-perr.c
Normal file
55
assert/assert-perr.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* Copyright (C) 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
extern const char *__assert_program_name; /* In assert.c. */
|
||||
|
||||
/* This function, when passed an error number, a filename, and a line
|
||||
number, prints a message on the standard error stream of the form:
|
||||
a.c:10: foobar: Unexpected error: Computer bought the farm
|
||||
It then aborts program execution via a call to `abort'. */
|
||||
|
||||
#ifdef FATAL_PREPARE_INCLUDE
|
||||
#include FATAL_PREPARE_INCLUDE
|
||||
#endif
|
||||
|
||||
void
|
||||
__assert_perror_fail (int errnum,
|
||||
const char *file, unsigned int line,
|
||||
const char *function)
|
||||
{
|
||||
#ifdef FATAL_PREPARE
|
||||
FATAL_PREPARE;
|
||||
#endif
|
||||
|
||||
/* Print the message. */
|
||||
(void) fprintf (stderr, "%s%s%s:%u: %s%sUnexpected error: %s.\n",
|
||||
__assert_program_name ? __assert_program_name : "",
|
||||
__assert_program_name ? ": " : "",
|
||||
file, line,
|
||||
function ? function : "", function ? ": " : "",
|
||||
strerror (errnum));
|
||||
(void) fflush (stderr);
|
||||
|
||||
abort ();
|
||||
}
|
83
assert/assert.c
Normal file
83
assert/assert.c
Normal file
@ -0,0 +1,83 @@
|
||||
/* Copyright (C) 1991, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
CONST char *__assert_program_name;
|
||||
|
||||
/* This function, when passed a string containing an asserted
|
||||
expression, a filename, and a line number, prints a message
|
||||
on the standard error stream of the form:
|
||||
a.c:10: foobar: Assertion `a == b' failed.
|
||||
It then aborts program execution via a call to `abort'. */
|
||||
|
||||
#ifdef FATAL_PREPARE_INCLUDE
|
||||
#include FATAL_PREPARE_INCLUDE
|
||||
#endif
|
||||
|
||||
void
|
||||
DEFUN(__assert_fail, (assertion, file, line, function),
|
||||
CONST char *assertion AND
|
||||
CONST char *file AND unsigned int line AND CONST char *function)
|
||||
{
|
||||
#ifdef FATAL_PREPARE
|
||||
FATAL_PREPARE;
|
||||
#endif
|
||||
|
||||
/* Print the message. */
|
||||
(void) fprintf (stderr, "%s%s%s:%u: %s%sAssertion `%s' failed.\n",
|
||||
__assert_program_name ? __assert_program_name : "",
|
||||
__assert_program_name ? ": " : "",
|
||||
file, line,
|
||||
function ? function : "", function ? ": " : "",
|
||||
assertion);
|
||||
(void) fflush (stderr);
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
DEFUN(set_progname, (argc, argv, envp),
|
||||
int argc AND char **argv AND char **envp)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (argv && argv[0])
|
||||
{
|
||||
p = strrchr (argv[0], '/');
|
||||
if (p == NULL)
|
||||
__assert_program_name = argv[0];
|
||||
else
|
||||
__assert_program_name = p + 1;
|
||||
}
|
||||
|
||||
(void) &set_progname; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
text_set_element (__libc_subinit, set_progname);
|
||||
|
||||
#endif
|
98
assert/assert.h
Normal file
98
assert/assert.h
Normal file
@ -0,0 +1,98 @@
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* ANSI Standard: 4.2 DIAGNOSTICS <assert.h>
|
||||
*/
|
||||
|
||||
#ifdef _ASSERT_H
|
||||
|
||||
#undef _ASSERT_H
|
||||
#undef assert
|
||||
|
||||
#endif /* assert.h */
|
||||
|
||||
#define _ASSERT_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* void assert (int expression);
|
||||
|
||||
If NDEBUG is defined, do nothing.
|
||||
If not, and EXPRESSION is zero, print an error message and abort. */
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
#define assert(expr) ((void) 0)
|
||||
|
||||
/* void assert_perror (int errnum);
|
||||
|
||||
If NDEBUG is defined, do nothing. If not, and ERRNUM is not zero, print an
|
||||
error message with the error text for ERRNUM and abort.
|
||||
(This is a GNU extension.) */
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#define assert_perror(errnum) ((void) 0)
|
||||
#endif
|
||||
|
||||
#else /* Not NDEBUG. */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* This prints an "Assertion failed" message and aborts. */
|
||||
extern void __assert_fail __P ((__const char *__assertion,
|
||||
__const char *__file,
|
||||
unsigned int __line,
|
||||
__const char *__function))
|
||||
__attribute__ ((__noreturn__));
|
||||
|
||||
/* Likewise, but prints the error text for ERRNUM. */
|
||||
extern void __assert_perror_fail __P ((int __errnum,
|
||||
__const char *__file,
|
||||
unsigned int __line,
|
||||
__const char *__function))
|
||||
__attribute__ ((__noreturn__));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#define assert(expr) \
|
||||
((void) ((expr) || \
|
||||
(__assert_fail (__STRING(expr), \
|
||||
__FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#define assert_perror(errnum) \
|
||||
((void) ((errnum) && (__assert_perror_fail ((errnum), \
|
||||
__FILE__, __LINE__, \
|
||||
__ASSERT_FUNCTION), 0)))
|
||||
#endif
|
||||
|
||||
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
|
||||
which contains the name of the function currently being defined.
|
||||
This is broken in G++ before version 2.6. */
|
||||
#if (!defined (__GNUC__) || __GNUC__ < 2 || \
|
||||
__GNUC_MINOR__ < (defined (__cplusplus) ? 6 : 4))
|
||||
#define __ASSERT_FUNCTION ((__const char *) 0)
|
||||
#else
|
||||
#define __ASSERT_FUNCTION __PRETTY_FUNCTION__
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NDEBUG. */
|
||||
|
55
bare/Makefile
Normal file
55
bare/Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
# Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
# Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
|
||||
# On-Line Applications Research Corporation.
|
||||
#
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
subdir := bare
|
||||
|
||||
bare-routines := brdinit console strtsupp
|
||||
routines = $(bare-routines)
|
||||
elided-routines = $(bare-routines)
|
||||
extra-objs = $(bare-routines:%=%.o)
|
||||
|
||||
install-lib = lib$(config-vendor).a
|
||||
|
||||
include ../Rules
|
||||
|
||||
#
|
||||
# For bare targets, the $(config-vendor) is the name of the board.
|
||||
# We will place the board dependent code ONLY in a library which
|
||||
# is board dependent. This way many target boards can share a
|
||||
# single libc.a. To resolve all symbols and successfully link
|
||||
# a program, the application must link against libc.a and libMY_TARGET.a.
|
||||
# For example, the target specific library for the Motorola MVME135
|
||||
# board will be named libmvme135.a. To link a program for the
|
||||
# MVME135, one must link against -lc and -lmvme135.
|
||||
#
|
||||
|
||||
lib: $(objpfx)lib$(config-vendor).a
|
||||
|
||||
$(objpfx)lib$(config-vendor).a: $(bare-routines:%=$(objpfx)%.o)
|
||||
# This library is small enough that it's simplest to recreate the archive
|
||||
# from scratch each time.
|
||||
rm -f $@
|
||||
ifdef objdir
|
||||
cd $(objdir); $(AR) cq$(verbose) $@ $(^:$(objpfx)%=%)
|
||||
else
|
||||
$(AR) cq$(verbose) $@ $^
|
||||
endif
|
||||
$(RANLIB) $@
|
20
conf/portability.h
Normal file
20
conf/portability.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* This file is used by some of the resolver code in inet/ that
|
||||
comes from BIND 4.9. I have written this file instead of modifying
|
||||
those things not to use it so that I can later drop in replacement
|
||||
files from future BIND distributions without change. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Some BIND code decides it can omit the definitions of some functions
|
||||
if BSD is defined to some value. That might make sense when the BIND
|
||||
code is augmenting or replacing an existing system library, but we can
|
||||
never omit a function here, since we are defining the system library. */
|
||||
|
||||
#undef BSD
|
||||
|
||||
/* Some code does stupid compatibility kludges for SunOS braindeath
|
||||
#ifdef sun. */
|
||||
|
||||
#undef sun
|
10
config-name.in
Normal file
10
config-name.in
Normal file
@ -0,0 +1,10 @@
|
||||
/* @configure_input@ -*- C -*-
|
||||
Generated from $Id$.
|
||||
|
||||
This is used only by the generic `uname' function for systems with no real
|
||||
`uname' call. If this data is not correct, it does not matter much. */
|
||||
|
||||
#define UNAME_SYSNAME "@uname_sysname@"
|
||||
#define UNAME_RELEASE "@uname_release@"
|
||||
#define UNAME_VERSION "@uname_version@"
|
||||
#define UNAME_MACHINE "@host_cpu@-@host_vendor@"
|
494
config.guess
vendored
Executable file
494
config.guess
vendored
Executable file
@ -0,0 +1,494 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit system type (host/target name).
|
||||
#
|
||||
# Only a few systems have been added to this list; please add others
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
|
||||
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:V*:*)
|
||||
# After 1.2, OSF1 uses "V1.3" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*)
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
else
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||
# it's likely to be more like Solaris than SunOS4.
|
||||
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:*:*)
|
||||
case "`/usr/bin/arch -k`" in
|
||||
Series*|S4*)
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||
exit 0 ;;
|
||||
sun3*:SunOS:*:*)
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RISC*:ULTRIX:*:*)
|
||||
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:5*:RISCos)
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
m88k:*:4*:R4*)
|
||||
echo m88k-motorola-sysv4
|
||||
exit 0 ;;
|
||||
m88k:*:3*:R3*)
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit 0 ;;
|
||||
M88*:*:R3*:*)
|
||||
# Delta 88k system running SVR3
|
||||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||
echo m88k-tektronix-sysv3
|
||||
exit 0 ;;
|
||||
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||
echo m68k-tektronix-bsd
|
||||
exit 0 ;;
|
||||
*:IRIX*:*:*)
|
||||
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||
exit 0 ;;
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i[34]86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (!__power_pc())
|
||||
exit(1);
|
||||
puts("powerpc-ibm-aix3.2.5");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
else
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:4)
|
||||
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1
|
||||
elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1.1
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||
exit 0 ;;
|
||||
*:AIX:*:*)
|
||||
echo rs6000-ibm-aix
|
||||
exit 0 ;;
|
||||
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
exit 0 ;;
|
||||
DPX/2?00:B.O.S.:*:*)
|
||||
echo m68k-bull-sysv3
|
||||
exit 0 ;;
|
||||
9000/[34]??:4.3bsd:1.*:*)
|
||||
echo m68k-hp-bsd
|
||||
exit 0 ;;
|
||||
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||
echo m68k-hp-bsd4.4
|
||||
exit 0 ;;
|
||||
9000/[3478]??:HP-UX:*:*)
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||
results, however. */
|
||||
if (CPU_IS_PA_RISC (cpu))
|
||||
{
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||
}
|
||||
}
|
||||
else if (CPU_IS_HP_MC68K (cpu))
|
||||
puts ("m68k-hitachi-hiuxwe2");
|
||||
else puts ("unknown-hitachi-hiuxwe2");
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:UNICOS:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:UNICOS:*:*)
|
||||
echo ymp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY-2:UNICOS:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
hp3[0-9][05]:NetBSD:*:*)
|
||||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux
|
||||
exit 0 ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i[34]86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i[34]86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-unknown-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
exit 0 ;;
|
||||
i860:*:4.*:*) # i860-SVR4
|
||||
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||
fi
|
||||
exit 0 ;;
|
||||
mini*:CTIX:SYS*5:*)
|
||||
# "miniframe"
|
||||
echo m68010-convergent-sysv
|
||||
exit 0 ;;
|
||||
M680[234]0:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
|
||||
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4.3 && exit 0 ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m680[234]0:LynxOS:2.2*:*)
|
||||
echo m68k-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i[34]86:LynxOS:2.2*:*)
|
||||
echo i386-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.2*:*)
|
||||
echo sparc-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.2*:*)
|
||||
echo rs6000-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
*:SINIX-*:*:*)
|
||||
if uname -p 2>/dev/null >/dev/null ; then
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
echo ${UNAME_MACHINE}-sni-sysv4
|
||||
else
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-unknown-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
#if !defined (ultrix)
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
#else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit 0 ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit 0 ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#echo '(Unable to guess system type)' 1>&2
|
||||
|
||||
exit 1
|
30
config.h.in
Normal file
30
config.h.in
Normal file
@ -0,0 +1,30 @@
|
||||
/* Define if using GNU ld, with support for weak symbols in a.out,
|
||||
and for symbol set and warning messages extensions in a.out and ELF.
|
||||
This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld. */
|
||||
#undef HAVE_GNU_LD
|
||||
|
||||
/* Define if using ELF, which supports weak symbols.
|
||||
This implies HAVE_WEAK_SYMBOLS; set by --with-elf. */
|
||||
#undef HAVE_ELF
|
||||
|
||||
/* Define if weak symbols are available in the assembler and
|
||||
linker being used. Set by --with-weak-symbols. */
|
||||
#undef HAVE_WEAK_SYMBOLS
|
||||
|
||||
/* Define if using the GNU assembler, gas. */
|
||||
#undef HAVE_GNU_AS
|
||||
|
||||
/* These symbols might be defined by some sysdeps configures. */
|
||||
|
||||
/* sysdeps/generic/configure.in */
|
||||
#undef HAVE_PSIGNAL
|
||||
|
||||
/* sysdeps/unix/common/configure.in */
|
||||
#undef HAVE_SYS_SIGLIST
|
||||
#undef HAVE__SYS_SIGLIST
|
||||
#undef HAVE__CTYPE_
|
||||
#undef HAVE___CTYPE_
|
||||
#undef HAVE___CTYPE
|
||||
#undef HAVE__CTYPE__
|
||||
#undef HAVE__CTYPE
|
||||
#undef HAVE__LOCP
|
26
config.make.in
Normal file
26
config.make.in
Normal file
@ -0,0 +1,26 @@
|
||||
# @configure_input@
|
||||
# From $Id$.
|
||||
# Don't edit this file. Put configuration parameters in configparms instead.
|
||||
|
||||
config-machine = @host_cpu@
|
||||
config-vendor = @host_vendor@
|
||||
config-os = @host_os@
|
||||
config-sysdirs = @sysnames@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
config-defines = @DEFS@
|
||||
gnu-as = @gnu_as@
|
||||
gnu-ld = @gnu_ld@
|
||||
elf = @elf@
|
||||
weak-symbols = @weak@
|
||||
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# More variables may be inserted below by configure.
|
816
config.sub
vendored
Executable file
816
config.sub
vendored
Executable file
@ -0,0 +1,816 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
# Each package is responsible for reporting which valid configurations
|
||||
# it does not support. The user should be able to distinguish
|
||||
# a failure to support a valid configuration from a meaningless
|
||||
# configuration.
|
||||
|
||||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS (if any).
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
### recognize some manufacturers as not being operating systems, so we
|
||||
### can provide default operating systems below.
|
||||
case $os in
|
||||
-sun*os*)
|
||||
# Prevent following clause from handling this invalid input.
|
||||
;;
|
||||
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
;;
|
||||
-lynx)
|
||||
os=-lynxos
|
||||
;;
|
||||
-ptx*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||
;;
|
||||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
|
||||
| powerpc | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
| hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||
| pdp11-* | sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
altos | altos3068)
|
||||
basic_machine=m68k-altos
|
||||
;;
|
||||
am29k)
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigados
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c2)
|
||||
basic_machine=c2-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c32)
|
||||
basic_machine=c32-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c34)
|
||||
basic_machine=c34-convex
|
||||
os=-bsd
|
||||
;;
|
||||
convex-c38)
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
;;
|
||||
delta88)
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
;;
|
||||
dpx2* | dpx2*-bull)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
;;
|
||||
elxsi)
|
||||
basic_machine=elxsi-elxsi
|
||||
os=-bsd
|
||||
;;
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
genix)
|
||||
basic_machine=ns32k-ns
|
||||
;;
|
||||
gmicro)
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
h8300hms)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
;;
|
||||
hp300-*)
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp300bsd)
|
||||
basic_machine=m68k-hp
|
||||
os=-bsd
|
||||
;;
|
||||
hp300hpux)
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[345]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[345]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[345]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[345]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
-irix*)
|
||||
;;
|
||||
*)
|
||||
os=-irix4
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
isi68 | isi)
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
magnum | m3230)
|
||||
basic_machine=mips-mips
|
||||
os=-sysv
|
||||
;;
|
||||
merlin)
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news1000)
|
||||
basic_machine=m68030-sony
|
||||
os=-newsos
|
||||
;;
|
||||
news-3600 | risc-news)
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
-nextstep* )
|
||||
;;
|
||||
-ns2*)
|
||||
os=-nextstep2
|
||||
;;
|
||||
*)
|
||||
os=-nextstep3
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nh3000)
|
||||
basic_machine=m68k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nh[45]000)
|
||||
basic_machine=m88k-harris
|
||||
os=-cxux
|
||||
;;
|
||||
nindy960)
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
paragon)
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium-*)
|
||||
# We will change tis to say i586 once there has been
|
||||
# time for various packages to start to recognize that.
|
||||
basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
sh)
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
;;
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
sun2os3)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun2os4)
|
||||
basic_machine=m68000-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3os3)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun3os4)
|
||||
basic_machine=m68k-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun4os3)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos3
|
||||
;;
|
||||
sun4os4)
|
||||
basic_machine=sparc-sun
|
||||
os=-sunos4
|
||||
;;
|
||||
sun3 | sun3-*)
|
||||
basic_machine=m68k-sun
|
||||
;;
|
||||
sun4)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
ultra3)
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
;;
|
||||
vms)
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
vxworks68)
|
||||
basic_machine=m68k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
;;
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
mips)
|
||||
basic_machine=mips-mips
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
basic_machine=orion-highlevel
|
||||
;;
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we canonicalize certain aliases for manufacturers.
|
||||
case $basic_machine in
|
||||
*-digital*)
|
||||
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||
;;
|
||||
*-commodore*)
|
||||
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-unixware* | svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative must end in a *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
|
||||
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
|
||||
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta | -udi | -eabi)
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
-osf*)
|
||||
os=-osf
|
||||
;;
|
||||
-utek*)
|
||||
os=-bsd
|
||||
;;
|
||||
-dynix*)
|
||||
os=-bsd
|
||||
;;
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
-svr3)
|
||||
os=-sysv3
|
||||
;;
|
||||
-sysvr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
# Get rid of the `-' at the beginning of $os.
|
||||
os=`echo $os | sed 's/[^-]*-//'`
|
||||
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
# Here we handle the default operating systems that come with various machines.
|
||||
# The value should be what the vendor currently ships out the door with their
|
||||
# machine or put another way, the most popular os provided with the machine.
|
||||
|
||||
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||
# "-sun"), then you have to tell the case statement up towards the top
|
||||
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||
# will signal an error saying that MANUFACTURER isn't an operating
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
os=-ultrix4.2
|
||||
;;
|
||||
m68*-apollo)
|
||||
os=-domain
|
||||
;;
|
||||
i386-sun)
|
||||
os=-sunos4.0.2
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
*-hitachi)
|
||||
os=-hiux
|
||||
;;
|
||||
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigados
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
;;
|
||||
*-dolphin)
|
||||
os=-sysv3
|
||||
;;
|
||||
m68k-ccur)
|
||||
os=-rtu
|
||||
;;
|
||||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
*-crds)
|
||||
os=-unos
|
||||
;;
|
||||
*-ns)
|
||||
os=-genix
|
||||
;;
|
||||
i370-*)
|
||||
os=-mvs
|
||||
;;
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||
# manufacturer. We pick the logical manufacturer.
|
||||
vendor=unknown
|
||||
case $basic_machine in
|
||||
*-unknown)
|
||||
case $os in
|
||||
-riscix*)
|
||||
vendor=acorn
|
||||
;;
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-lynxos*)
|
||||
vendor=lynx
|
||||
;;
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-unos*)
|
||||
vendor=crds
|
||||
;;
|
||||
-dgux*)
|
||||
vendor=dg
|
||||
;;
|
||||
-luna*)
|
||||
vendor=omron
|
||||
;;
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
413
configure.in
Normal file
413
configure.in
Normal file
@ -0,0 +1,413 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_REVISION([$Id$])
|
||||
AC_PREREQ(2.1)dnl dnl Minimum Autoconf version required.
|
||||
AC_INIT(features.h)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
# This will get text that should go into config.make.
|
||||
config_vars=
|
||||
|
||||
# Check for a --with-gmp argument and set gmp-srcdir in config.make.
|
||||
AC_ARG_WITH(gmp, dnl
|
||||
--with-gmp=DIRECTORY find GMP source code in DIRECTORY (not needed),
|
||||
[dnl
|
||||
case "$with_gmp" in
|
||||
yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
|
||||
''|no) ;;
|
||||
*) config_vars="$config_vars
|
||||
gmp-srcdir = $withval" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_ARG_WITH(gnu-binutils, dnl
|
||||
--with-gnu-binutils if using GNU binutils (as and ld),
|
||||
gnu_binutils=yes, gnu_binutils=no)
|
||||
AC_ARG_WITH(gnu-ld, dnl
|
||||
--with-gnu-ld if using GNU ld (in the binutils package),
|
||||
gnu_ld=yes, gnu_ld=no)
|
||||
AC_ARG_WITH(gnu-as, dnl
|
||||
--with-gnu-as if using GNU as (in the binutils package),
|
||||
gnu_as=yes, gnu_as=no)
|
||||
test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
|
||||
AC_ARG_WITH(elf, dnl
|
||||
--with-elf if using the ELF object format,
|
||||
elf=yes, elf=no)
|
||||
AC_ARG_WITH(weak-symbols, dnl
|
||||
--with-weak-symbols if weak symbols are available in as and ld,
|
||||
weak=yes, weak=no)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
# We keep the original values in `$config_*' and never modify them, so we
|
||||
# can write them unchanged into config.make. Everything else uses
|
||||
# $machine, $vendor, and $os, and changes them whenever convenient.
|
||||
config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
|
||||
|
||||
sysdep_dir=$srcdir/sysdeps
|
||||
AC_MSG_CHECKING(sysdep dirs)
|
||||
AC_CACHE_VAL(libc_cv_sysdirs, [dnl
|
||||
machine=$config_machine
|
||||
vendor=$config_vendor
|
||||
os=$config_os
|
||||
|
||||
dnl We need to use [ and ] for other purposes for a while now.
|
||||
changequote(,)dnl
|
||||
# Expand the configuration machine name into a subdirectory by architecture
|
||||
# type and particular chip.
|
||||
case "$machine" in
|
||||
i[345]86)
|
||||
machine=i386/$machine ;;
|
||||
sparc[6789])
|
||||
machine=sparc/$machine ;;
|
||||
m68k)
|
||||
machine=m68k/m68020 ;;
|
||||
m680?0)
|
||||
machine=m68k/$machine ;;
|
||||
m88k)
|
||||
machine=m88k/m88100 ;;
|
||||
m88???)
|
||||
machine=m88k/$machine ;;
|
||||
mips64*)
|
||||
machine=mips/mips64/$machine ;;
|
||||
mips*)
|
||||
machine=mips/$machine ;;
|
||||
esac
|
||||
|
||||
# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
|
||||
os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
|
||||
|
||||
case "$os" in
|
||||
gnu*)
|
||||
base_os=mach/hurd ;;
|
||||
netbsd* | 386bsd*)
|
||||
base_os=unix/bsd/bsd4.4 ;;
|
||||
osf1* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
|
||||
base_os=unix/bsd ;;
|
||||
linux* | sysv* | isc* | esix* | sco* | minix* | irix4*)
|
||||
base_os=unix/sysv ;;
|
||||
solaris[2-9]*)
|
||||
base_os=unix/sysv/sysv4 ;;
|
||||
none)
|
||||
base_os=standalone ;;
|
||||
*)
|
||||
base_os='' ;;
|
||||
esac
|
||||
|
||||
# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
|
||||
tail=$os
|
||||
ostry=$os
|
||||
while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
|
||||
ostry="$ostry /$o"
|
||||
tail=$o
|
||||
done
|
||||
o=`echo $tail | sed 's/[0-9]*$//'`
|
||||
if test $o != $tail; then
|
||||
ostry="$ostry /$o"
|
||||
fi
|
||||
|
||||
# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
|
||||
base=
|
||||
tail=$base_os
|
||||
while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
|
||||
set $b
|
||||
base="$base /$1"
|
||||
tail="$2"
|
||||
done
|
||||
|
||||
# For sparc/sparc9, try sparc/sparc9 and then sparc.
|
||||
mach=
|
||||
tail=$machine
|
||||
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
|
||||
set $m
|
||||
mach="$mach /$1"
|
||||
tail="$2"
|
||||
done
|
||||
|
||||
dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
|
||||
changequote([,])dnl
|
||||
|
||||
# Find what sysdep directories exist.
|
||||
sysnames=
|
||||
for b in $base ''; do
|
||||
for m0 in $mach ''; do
|
||||
for v in /$vendor ''; do
|
||||
for o in /$ostry ''; do
|
||||
for m in $mach ''; do
|
||||
try="$m0$b$v$o$m"
|
||||
if test -d $sysdep_dir$try; then
|
||||
sysnames="$sysnames $try"
|
||||
{ test -n "$o" || test -n "$b"; } && os_used=t
|
||||
{ test -n "$m" || test -n "$m0"; } && machine_used=t
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
if test -z "$os_used" && test "$os" != none; then
|
||||
AC_MSG_ERROR(Operating system $os is not supported.)
|
||||
fi
|
||||
if test -z "$machine_used" && test "$machine" != none; then
|
||||
AC_MSG_ERROR(The $machine is not supported.)
|
||||
fi
|
||||
|
||||
# We have now validated the configuration.
|
||||
|
||||
# Remove the leading slashes.
|
||||
sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
|
||||
|
||||
# Prepend the machine's FPU directory unless --without-fp.
|
||||
if test "$with_fp" = no; then
|
||||
fpu_dirs=
|
||||
for m in $mach; do
|
||||
if test -d $sysdep_dir$m/fpu; then
|
||||
fpu_dirs="$fpu_dirs $m/fpu"
|
||||
fi
|
||||
done
|
||||
sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
|
||||
fi
|
||||
|
||||
# Expand the list of system names into a full list of directories
|
||||
# from each element's parent name and Implies file (if present).
|
||||
set $sysnames
|
||||
while test $# -gt 0; do
|
||||
name=$1
|
||||
shift
|
||||
|
||||
if test -f $sysdep_dir/$name/Implies; then
|
||||
# Collect more names from the `Implies' file (removing comments).
|
||||
implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
|
||||
for x in $implied; do
|
||||
test -d $sysdep_dir/$x || echo "Warning: $name implies nonexistent $x">&2
|
||||
done
|
||||
else
|
||||
implied=
|
||||
fi
|
||||
|
||||
# Add NAME to the list of names.
|
||||
names="$names $name"
|
||||
|
||||
# Find the parent of NAME, using the empty string if it has none.
|
||||
changequote(,)dnl
|
||||
parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
|
||||
changequote([,])dnl
|
||||
|
||||
# Add the names implied by NAME, and NAME's parent (if it has one), to
|
||||
# the list of names to be processed (the argument list). We prepend the
|
||||
# implied names to the list and append the parent. We want implied
|
||||
# directories to come before further directories inferred from the
|
||||
# configuration components; this ensures that for sysv4, unix/common
|
||||
# (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
|
||||
# after sysv4).
|
||||
sysnames="`echo $implied $* $parent`"
|
||||
test -n "$sysnames" && set $sysnames
|
||||
done
|
||||
|
||||
# Add the default directories.
|
||||
names="$names generic stub"
|
||||
|
||||
# Now uniquize the list.
|
||||
seen=
|
||||
sysnames=
|
||||
for name in $names; do
|
||||
if echo "$seen" | fgrep -x $name >/dev/null; then
|
||||
# Already in the list.
|
||||
true;
|
||||
else
|
||||
# A new one.
|
||||
if test -z "$seen"; then
|
||||
seen="$name" sysnames="$name"
|
||||
else
|
||||
seen="$seen
|
||||
$name"
|
||||
sysnames="$sysnames $name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
libc_cv_sysdirs="$sysnames"])
|
||||
AC_SUBST(sysnames) sysnames="$libc_cv_sysdirs"
|
||||
AC_MSG_RESULT(${sysnames})
|
||||
|
||||
case "$host_os" in
|
||||
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
|
||||
gnu_ld=yes gnu_as=yes
|
||||
esac
|
||||
case "$host_os" in
|
||||
gnu*elf* | linux*elf* | sysv4* | solaris2*)
|
||||
elf=yes
|
||||
esac
|
||||
|
||||
AC_PROG_INSTALL
|
||||
if test "$INSTALL" = "${srcdir}/install-sh"; then
|
||||
# The makefiles need to use a different form to find it in $srcdir.
|
||||
INSTALL='$(..)./install-sh'
|
||||
fi
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_CHECK_PROG(AR, ar, ar, ar)
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_MSG_CHECKING(signed size_t type)
|
||||
AC_CACHE_VAL(libc_cv_signed_size_t, [dnl
|
||||
echo '#include <stddef.h>
|
||||
FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
|
||||
if eval "$ac_cpp conftest.c 2>/dev/null" \
|
||||
| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
|
||||
libc_cv_signed_size_t=no
|
||||
else
|
||||
libc_cv_signed_size_t=yes
|
||||
fi
|
||||
rm -f conftest*])
|
||||
AC_MSG_RESULT($libc_cv_signed_size_t)
|
||||
if test $libc_cv_signed_size_t = yes; then
|
||||
dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
|
||||
cat >> confdefs.h <<\EOF
|
||||
#undef __SIZE_TYPE__
|
||||
#define __SIZE_TYPE__ unsigned
|
||||
EOF
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(libc-friendly stddef.h)
|
||||
AC_CACHE_VAL(libc_cv_friendly_stddef, [dnl
|
||||
AC_TRY_COMPILE(dnl
|
||||
[#define __need_size_t
|
||||
#define __need_wchar_t
|
||||
#include <stddef.h>
|
||||
#define __need_NULL
|
||||
#include <stddef.h>], [size_t size; wchar_t wchar;
|
||||
#ifdef offsetof
|
||||
#error stddef.h ignored __need_*
|
||||
#endif
|
||||
if (&size == NULL || &wchar == NULL) abort ();],
|
||||
libc_cv_friendly_stddef=yes,
|
||||
libc_cv_friendly_stddef=no)])
|
||||
AC_MSG_RESULT($libc_cv_friendly_stddef)
|
||||
if test $libc_cv_friendly_stddef = yes; then
|
||||
config_vars="$config_vars
|
||||
override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether we need to use -P to assemble .S files)
|
||||
AC_CACHE_VAL(libc_cv_need_minus_P, [dnl
|
||||
cat > conftest.S <<EOF
|
||||
#include "confdefs.h"
|
||||
/* Nothing whatsoever. */
|
||||
EOF
|
||||
if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
|
||||
libc_cv_need_minus_P=no
|
||||
else
|
||||
libc_cv_need_minus_P=yes
|
||||
fi
|
||||
rm -f conftest*])
|
||||
AC_MSG_RESULT($libc_cv_need_minus_P)
|
||||
if test $libc_cv_need_minus_P = yes; then
|
||||
config_vars="$config_vars
|
||||
asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
|
||||
fi
|
||||
|
||||
# sysdeps configure fragments may set these with files to be linked below.
|
||||
libc_link_dests=
|
||||
libc_link_sources=
|
||||
|
||||
# Iterate over all the sysdep directories we will use, running their
|
||||
# configure fragments, and looking for a uname implementation.
|
||||
uname=
|
||||
for dir in $sysnames; do
|
||||
if test -r $sysdep_dir/$dir/configure; then
|
||||
AC_MSG_RESULT(running configure fragment for $dir)
|
||||
. $sysdep_dir/$dir/configure
|
||||
fi
|
||||
if test -z "$uname"; then
|
||||
{ test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \
|
||||
&& uname=$dir
|
||||
fi
|
||||
done
|
||||
|
||||
AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
|
||||
|
||||
# If we will use the generic uname implementation, we must figure out what
|
||||
# it will say by examining the system, and write the results in config-name.h.
|
||||
if test "$uname" = generic; then
|
||||
|
||||
changequote(,)dnl
|
||||
uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
|
||||
changequote([,])dnl
|
||||
if test $uname_sysname != $config_os; then
|
||||
config_release=`echo $config_os | sed s/$uname_sysname//`
|
||||
fi
|
||||
dnl
|
||||
AC_DEFUN(LIBC_KERNEL_ID, [dnl
|
||||
if test -r /vmunix; then
|
||||
kernel_id=`strings /vmunix | grep UNIX`
|
||||
elif test -r /dynix; then
|
||||
kernel_id=`strings /dynix | grep DYNIX`
|
||||
else
|
||||
kernel_id=
|
||||
fi
|
||||
])dnl
|
||||
|
||||
AC_MSG_CHECKING(OS release for uname)
|
||||
AC_CACHE_VAL(libc_cv_uname_release, [dnl
|
||||
AC_REQUIRE([LIBC_KERNEL_ID])dnl
|
||||
changequote(,)dnl
|
||||
kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
|
||||
changequote([,])dnl
|
||||
if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
|
||||
!= x$config_release; then
|
||||
# The configuration release is a substring of the kernel release.
|
||||
libc_cv_uname_release=$kernel_release
|
||||
elif test x$config_release != x; then
|
||||
libc_cv_uname_release=$config_release
|
||||
elif test x$kernel_release != x; then
|
||||
libc_cv_uname_release=$kernel_release
|
||||
else
|
||||
libc_cv_uname_release=unknown
|
||||
fi])
|
||||
AC_MSG_RESULT($libc_cv_uname_release)
|
||||
uname_release="$libc_cv_uname_release"
|
||||
|
||||
AC_MSG_CHECKING(OS version for uname)
|
||||
AC_CACHE_VAL(libc_cv_uname_version, [dnl
|
||||
AC_REQUIRE([LIBC_KERNEL_ID])dnl
|
||||
changequote(,)dnl
|
||||
kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
|
||||
changequote([,])dnl
|
||||
if test -n "$kernel_version"; then
|
||||
libc_cv_uname_version="$kernel_version"
|
||||
else
|
||||
libc_cv_uname_version=unknown
|
||||
fi])
|
||||
AC_MSG_RESULT($libc_cv_uname_version)
|
||||
uname_version="$libc_cv_uname_version"
|
||||
|
||||
AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
|
||||
config_uname=config-name.h:config-name.in
|
||||
else
|
||||
# For non-generic uname, we don't need to create config-name.h at all.
|
||||
config_uname=
|
||||
fi
|
||||
|
||||
AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
|
||||
if test $gnu_ld = yes; then
|
||||
AC_DEFINE(HAVE_GNU_LD)
|
||||
fi
|
||||
if test $gnu_as = yes; then
|
||||
AC_DEFINE(HAVE_GNU_AS)
|
||||
fi
|
||||
if test $elf = yes; then
|
||||
AC_DEFINE(HAVE_ELF)
|
||||
fi
|
||||
if test $weak = yes; then
|
||||
AC_DEFINE(HAVE_WEAK_SYMBOLS)
|
||||
fi
|
||||
|
||||
|
||||
if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
|
||||
config_makefile=
|
||||
else
|
||||
config_makefile=Makefile
|
||||
fi
|
||||
|
||||
AC_OUTPUT(config.make ${config_makefile} ${config_uname}, ,
|
||||
[echo '$config_vars' >> config.make])
|
14
crypt-README
Normal file
14
crypt-README
Normal file
@ -0,0 +1,14 @@
|
||||
The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
|
||||
provides the Unix `crypt' function, plus some other entry points. Because
|
||||
of the United States export restriction on DES implementations, we are
|
||||
distributing this code separately from the rest of the C library. There is
|
||||
an extra distribution tar file just for crypt; it is called
|
||||
`glibc-1.07-crypt.tar.gz'. You can just unpack the crypt distribution
|
||||
along with the rest of the C library and build; you can also build the
|
||||
library without getting crypt. Users outside the USA can get the crypt
|
||||
distribution via anonymous FTP from ftp.uni-c.dk [129.142.6.74], or another
|
||||
archive site outside the USA. Archive maintainers are encouraged to copy
|
||||
this distribution to their archives outside the USA. Please get it from
|
||||
ftp.uni-c.dk; transferring this distribution from prep.ai.mit.edu (or any
|
||||
other site in the USA) to a site outside the USA is in violation of US
|
||||
export laws.
|
84
csu/Makefile
Normal file
84
csu/Makefile
Normal file
@ -0,0 +1,84 @@
|
||||
# Makefile for csu code for GNU C library.
|
||||
|
||||
# Copyright (C) 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
# This directory contains the C startup code (that which calls main). This
|
||||
# consists of the startfile, built from start.c and installed as crt0.o
|
||||
# (traditionally) or crt1.o (for ELF); and some initialization code which
|
||||
# is in the C library itself. In ELF we also install crti.o and crtn.o,
|
||||
# special "initializer" and "finalizer" files in used in the link to make
|
||||
# the .init and .fini sections work right; both these files are built (in
|
||||
# an arcane manner) from initfini.c.
|
||||
|
||||
subdir := csu
|
||||
|
||||
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
|
||||
extra-objs = start.o $(start-installed-name) $(csu-dummies)
|
||||
omit-deps = $(patsubst %.o,%,$(start-installed-name) $(csu-dummies))
|
||||
install-lib = $(start-installed-name) $(csu-dummies)
|
||||
distribute = initfini.c
|
||||
|
||||
all: # Make this the default target; it will be defined in Rules.
|
||||
|
||||
include ../Makeconfig
|
||||
|
||||
ifneq ($(elf),yes)
|
||||
# When not using ELF, there is just one startfile, called crt0.o.
|
||||
start-installed-name = crt0.o
|
||||
else
|
||||
# In the ELF universe, crt0.o is called crt1.o, and there are
|
||||
# some additional bizarre files.
|
||||
start-installed-name = crt1.o
|
||||
install-lib += crti.o crtn.o
|
||||
extra-objs += crti.o crtn.o
|
||||
generated += crti.s crtn.s
|
||||
omit-deps += crti crtn
|
||||
|
||||
# Compile initfini.c to assembly code, which contains embedded shell
|
||||
# commands that prodice crti.s-new and crtn.s-new when run. We need to
|
||||
# disable emission of .size directives and debugging information, since
|
||||
# they will get confused by the splitting of the output we do.
|
||||
$(objpfx)cr%i.s $(objpfx)cr%n.s: initfini.c
|
||||
-rm -f $(objpfx)crtcommon.tmp
|
||||
(echo 'cat > crtcommon.tmp <<\EOF_common'; \
|
||||
$(CC) $< $(CPPFLAGS) $(CFLAGS) -finhibit-size-directive -g0 -S -o -; \
|
||||
echo 'EOF_common') | (cd $(@D); $(SHELL))
|
||||
cat $(objpfx)crtcommon.tmp >> $(objpfx)crti.s-new
|
||||
cat $(objpfx)crtcommon.tmp >> $(objpfx)crtn.s-new
|
||||
rm -f $(objpfx)crtcommon.tmp
|
||||
mv -f $(objpfx)crti.s-new $(objpfx)crti.s
|
||||
mv -f $(objpfx)crtn.s-new $(objpfx)crtn.s
|
||||
endif
|
||||
|
||||
|
||||
include ../Rules
|
||||
|
||||
# The startfile is installed under different names, so we just call our
|
||||
# source file `start.c' and copy to the installed name after compiling.
|
||||
$(objpfx)$(start-installed-name): $(objpfx)start.o
|
||||
-rm -f $@
|
||||
ln $< $@
|
||||
|
||||
# These extra files are sometimes expected by system standard linking
|
||||
# procedures, but we have nothing for them to do. So compile empty files.
|
||||
$(addprefix $(objpfx),$(filter-out $(start-installed-name),$(csu-dummies))):
|
||||
cp /dev/null $(@:.o=.c)
|
||||
$(COMPILE.c) $(@:.o=.c) $(OUTPUT_OPTION)
|
||||
rm -f $(@:.o=.c)
|
||||
|
85
csu/initfini.c
Normal file
85
csu/initfini.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* Special .init and .fini section support.
|
||||
Copyright (C) 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/* This file is compiled into assembly code which is then surrounded by the
|
||||
lines `cat > crtcommon.tmp <<\EOF_common' and `EOF_common' and thus
|
||||
becomes a shell script which creates three files of assembly code.
|
||||
|
||||
* The first file is crti.s-new; this puts a function prologue at the
|
||||
beginning of the .init and .fini sections and defines global symbols for
|
||||
those addresses, so they can be called as functions.
|
||||
|
||||
* The second file is crtn.s-new; this puts the corresponding function
|
||||
epilogues in the .init and .fini sections.
|
||||
|
||||
* The third file is crtcommon.tmp, which is whatever miscellaneous cruft
|
||||
the compiler generated at the end; it should be appended to both crti.s-new
|
||||
and crtn.s-new. */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* These declarations make the functions go in the right sections when
|
||||
we define them below. GCC syntax does not allow the attribute
|
||||
specifications to be in the function definitions themselves. */
|
||||
void _init (void) __attribute__ ((section (".init")));
|
||||
void _fini (void) __attribute__ ((section (".fini")));
|
||||
|
||||
/* End the here document containing the initial common code.
|
||||
Then move the output file crtcommon.tmp to crti.s-new and crtn.s-new. */
|
||||
asm ("\nEOF_common\n\
|
||||
mv -f crtcommon.tmp crti.s-new\n\
|
||||
cp -f crti.s-new crtn.s-new");
|
||||
|
||||
/* Append the .init prologue to crti.s-new. */
|
||||
asm ("cat >> crti.s-new <<\\EOF.crti.init");
|
||||
void
|
||||
_init (void)
|
||||
{
|
||||
/* End the here document containing the .init prologue code.
|
||||
Then fetch the .section directive just written and append that
|
||||
to crtn.s-new, followed by the function epilogue. */
|
||||
asm ("\nEOF.crti.init
|
||||
\n\
|
||||
fgrep .init crti.s-new >>crtn.s-new\n\
|
||||
cat >> crtn.s-new <<\\EOF.crtn.init");
|
||||
}
|
||||
|
||||
/* End the here document containing the .init epilogue code.
|
||||
Then append the .fini prologue to crti.s-new. */
|
||||
asm ("\nEOF.crtn.init\
|
||||
\n\
|
||||
cat >> crti.s-new <<\\EOF.crti.fini");
|
||||
|
||||
void
|
||||
_fini (void)
|
||||
{
|
||||
/* End the here document containing the .fini prologue code.
|
||||
Then fetch the .section directive just written and append that
|
||||
to crtn.s-new, followed by the function epilogue. */
|
||||
asm ("\nEOF.crti.fini\
|
||||
\n\
|
||||
fgrep .fini crti.s-new >>crtn.s-new\n\
|
||||
cat >> crtn.s-new <<\\EOF.crtn.fini");
|
||||
}
|
||||
|
||||
/* End the here document containing the .fini epilogue code.
|
||||
Finally, put the remainder of the generated assembly into crtcommon.tmp. */
|
||||
asm ("\nEOF.crtn.fini\
|
||||
\n\
|
||||
cat > crtcommon.tmp <<\\EOF_common");
|
29
ctype/Makefile
Normal file
29
ctype/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (C) 1991, 1992, 1993 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Sub-makefile for ctype portion of the library.
|
||||
#
|
||||
subdir := ctype
|
||||
|
||||
routines := ctype ctype-extn
|
||||
aux := ctype-info
|
||||
|
||||
tests := test_ctype
|
||||
|
||||
include ../Rules
|
32
ctype/ctype-extn.c
Normal file
32
ctype/ctype-extn.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
|
||||
#define __NO_CTYPE
|
||||
#include <ctype.h>
|
||||
|
||||
/* Real function versions of the non-ANSI ctype functions. */
|
||||
|
||||
int DEFUN(isblank, (c), int c) { return __isctype ((c), _ISblank); }
|
||||
|
||||
int DEFUN(_tolower, (c), int c) { return __tolower(c); }
|
||||
int DEFUN(_toupper, (c), int c) { return __toupper(c); }
|
||||
|
||||
int DEFUN(toascii, (c), int c) { return __toascii(c); }
|
||||
int DEFUN(isascii, (c), int c) { return __isascii(c); }
|
30
ctype/ctype-info.c
Normal file
30
ctype/ctype-info.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 1991, 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <ctype.h>
|
||||
#include <localeinfo.h>
|
||||
|
||||
/* Defined in locale/locale-C-ct.c. */
|
||||
extern CONST unsigned short int __ctype_b_C[];
|
||||
extern CONST short int __ctype_tolower_C[];
|
||||
extern CONST short int __ctype_toupper_C[];
|
||||
|
||||
CONST unsigned short int *__ctype_b = __ctype_b_C + 1;
|
||||
CONST short int *__ctype_tolower = __ctype_tolower_C + 1;
|
||||
CONST short int *__ctype_toupper = __ctype_toupper_C + 1;
|
51
ctype/ctype.c
Normal file
51
ctype/ctype.c
Normal file
@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 1991, 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
|
||||
#define __NO_CTYPE
|
||||
#include <ctype.h>
|
||||
|
||||
/* Provide real-function versions of all the ctype macros. */
|
||||
|
||||
#define func(name, type) \
|
||||
int DEFUN(name, (c), int c) { return __isctype(c, type); }
|
||||
|
||||
func(isalnum, _ISalnum)
|
||||
func(isalpha, _ISalpha)
|
||||
func(iscntrl, _IScntrl)
|
||||
func(isdigit, _ISdigit)
|
||||
func(islower, _ISlower)
|
||||
func(isgraph, _ISgraph)
|
||||
func(isprint, _ISprint)
|
||||
func(ispunct, _ISpunct)
|
||||
func(isspace, _ISspace)
|
||||
func(isupper, _ISupper)
|
||||
func(isxdigit, _ISxdigit)
|
||||
|
||||
int
|
||||
DEFUN(tolower, (c), int c)
|
||||
{
|
||||
return __tolower (c);
|
||||
}
|
||||
|
||||
int
|
||||
DEFUN(toupper, (c), int c)
|
||||
{
|
||||
return __toupper (c);
|
||||
}
|
152
ctype/ctype.h
Normal file
152
ctype/ctype.h
Normal file
@ -0,0 +1,152 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* ANSI Standard 4.3: CHARACTER HANDLING <ctype.h>
|
||||
*/
|
||||
|
||||
#ifndef _CTYPE_H
|
||||
|
||||
#define _CTYPE_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* These are all the characteristics of characters. All the
|
||||
interdependencies (such as that an alphabetic is an uppercase or a
|
||||
lowercase) are here. If there get to be more than
|
||||
(sizeof (unsigned short int) * CHAR_BIT) distinct characteristics,
|
||||
many things must be changed that use `unsigned short int's. */
|
||||
enum
|
||||
{
|
||||
_ISupper = 1 << 0, /* UPPERCASE. */
|
||||
_ISlower = 1 << 1, /* lowercase. */
|
||||
_IScntrl = 1 << 2, /* Control character. */
|
||||
_ISdigit = 1 << 3, /* Numeric. */
|
||||
_ISspace = 1 << 4, /* Whitespace. */
|
||||
_IShex = 1 << 5, /* A - F, a - f. */
|
||||
_ISpunct = 1 << 6, /* Punctuation. */
|
||||
_NOgraph = 1 << 7, /* Printing but nongraphical. */
|
||||
_ISblank = 1 << 8, /* Blank (usually SPC and TAB). */
|
||||
_ISalpha = 1 << 9, /* Alphabetic. */
|
||||
_ISalnum = _ISalpha | _ISdigit, /* Alphanumeric. */
|
||||
_ISxdigit = _ISdigit | _IShex, /* Hexadecimal numeric. */
|
||||
_ISgraph = _ISalnum | _ISpunct, /* Graphical. */
|
||||
_ISprint = _ISgraph | _NOgraph /* Printing. */
|
||||
};
|
||||
|
||||
/* These are defined in localeinfo.c.
|
||||
The declarations here must match those in localeinfo.h.
|
||||
|
||||
These point to the second element ([1]) of arrays of size (UCHAR_MAX + 1).
|
||||
EOF is -1, so [EOF] is the first element of the original array.
|
||||
ANSI requires that the ctype functions work for `unsigned char' values
|
||||
and for EOF. The case conversion arrays are of `short int's rather than
|
||||
`unsigned char's because tolower (EOF) must be EOF, which doesn't fit
|
||||
into an `unsigned char'. */
|
||||
extern __const unsigned short int *__ctype_b; /* Characteristics. */
|
||||
extern __const short int *__ctype_tolower; /* Case conversions. */
|
||||
extern __const short int *__ctype_toupper; /* Case conversions. */
|
||||
|
||||
#define __isctype(c, type) \
|
||||
(__ctype_b[(int) (c)] & (unsigned short int) type)
|
||||
|
||||
#define __isascii(c) (((c) & (1 << 7)) == 0) /* If high bit is set. */
|
||||
#define __toascii(c) ((c) & 0x7f) /* Mask off high bit. */
|
||||
|
||||
#define __tolower(c) ((int) __ctype_tolower[(int) (c)])
|
||||
#define __toupper(c) ((int) __ctype_toupper[(int) (c)])
|
||||
|
||||
#define __exctype(name) extern int name __P ((int))
|
||||
|
||||
/* The following names are all functions:
|
||||
int isCHARACTERISTIC(int c);
|
||||
which return nonzero iff C has CHARACTERISTIC.
|
||||
For the meaning of the characteristic names, see the `enum' above. */
|
||||
__exctype (isalnum);
|
||||
__exctype (isalpha);
|
||||
__exctype (iscntrl);
|
||||
__exctype (isdigit);
|
||||
__exctype (islower);
|
||||
__exctype (isgraph);
|
||||
__exctype (isprint);
|
||||
__exctype (ispunct);
|
||||
__exctype (isspace);
|
||||
__exctype (isupper);
|
||||
__exctype (isxdigit);
|
||||
|
||||
#ifdef __USE_GNU
|
||||
__exctype (isblank);
|
||||
#endif
|
||||
|
||||
|
||||
/* Return the lowercase version of C. */
|
||||
extern int tolower __P ((int __c));
|
||||
|
||||
/* Return the uppercase version of C. */
|
||||
extern int toupper __P ((int __c));
|
||||
|
||||
|
||||
#if defined(__USE_SVID) || defined(__USE_MISC)
|
||||
|
||||
/* Return nonzero iff C is in the ASCII set
|
||||
(i.e., is no more than 7 bits wide). */
|
||||
extern int isascii __P ((int __c));
|
||||
|
||||
/* Return the part of C that is in the ASCII set
|
||||
(i.e., the low-order 7 bits of C). */
|
||||
extern int toascii __P ((int __c));
|
||||
|
||||
#endif /* Use SVID or use misc. */
|
||||
|
||||
#ifdef __USE_SVID
|
||||
/* These are the same as `toupper' and and `tolower'. */
|
||||
__exctype (_toupper);
|
||||
__exctype (_tolower);
|
||||
#endif
|
||||
|
||||
#ifndef __NO_CTYPE
|
||||
#define isalnum(c) __isctype((c), _ISalnum)
|
||||
#define isalpha(c) __isctype((c), _ISalpha)
|
||||
#define iscntrl(c) __isctype((c), _IScntrl)
|
||||
#define isdigit(c) __isctype((c), _ISdigit)
|
||||
#define islower(c) __isctype((c), _ISlower)
|
||||
#define isgraph(c) __isctype((c), _ISgraph)
|
||||
#define isprint(c) __isctype((c), _ISprint)
|
||||
#define ispunct(c) __isctype((c), _ISpunct)
|
||||
#define isspace(c) __isctype((c), _ISspace)
|
||||
#define isupper(c) __isctype((c), _ISupper)
|
||||
#define isxdigit(c) __isctype((c), _ISxdigit)
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#define isblank(c) __isctype((c), _ISblank)
|
||||
#endif
|
||||
|
||||
#define tolower(c) __tolower(c)
|
||||
#define toupper(c) __toupper(c)
|
||||
|
||||
#if defined(__USE_SVID) || defined(__USE_MISC)
|
||||
#define isascii(c) __isascii(c)
|
||||
#define toascii(c) __toascii(c)
|
||||
#endif
|
||||
|
||||
#endif /* Not __NO_CTYPE. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ctype.h */
|
92
ctype/test_ctype.c
Normal file
92
ctype/test_ctype.c
Normal file
@ -0,0 +1,92 @@
|
||||
/* Copyright (C) 1991, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
||||
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
|
||||
#define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static void
|
||||
DEFUN(print_char, (c), unsigned char c)
|
||||
{
|
||||
printf("%d/", (int) c);
|
||||
if (isgraph(c))
|
||||
printf("'%c'", c);
|
||||
else
|
||||
printf("'\\%.3o'", c);
|
||||
}
|
||||
|
||||
int
|
||||
DEFUN(main, (argc, argv), int argc AND char **argv)
|
||||
{
|
||||
register unsigned short int c;
|
||||
int lose = 0;
|
||||
|
||||
for (c = 0; c <= UCHAR_MAX; ++c)
|
||||
{
|
||||
print_char (c);
|
||||
|
||||
if (XOR (islower (c), ISLOWER (c)) || toupper (c) != TOUPPER (c))
|
||||
{
|
||||
fputs (" BOGUS", stdout);
|
||||
++lose;
|
||||
}
|
||||
|
||||
if (isascii(c))
|
||||
fputs(" isascii", stdout);
|
||||
if (isalnum(c))
|
||||
fputs(" isalnum", stdout);
|
||||
if (isalpha(c))
|
||||
fputs(" isalpha", stdout);
|
||||
if (iscntrl(c))
|
||||
fputs(" iscntrl", stdout);
|
||||
if (isdigit(c))
|
||||
fputs(" isdigit", stdout);
|
||||
if (isgraph(c))
|
||||
fputs(" isgraph", stdout);
|
||||
if (islower(c))
|
||||
fputs(" islower", stdout);
|
||||
if (isprint(c))
|
||||
fputs(" isprint", stdout);
|
||||
if (ispunct(c))
|
||||
fputs(" ispunct", stdout);
|
||||
if (isspace(c))
|
||||
fputs(" isspace", stdout);
|
||||
if (isupper(c))
|
||||
fputs(" isupper", stdout);
|
||||
if (isxdigit(c))
|
||||
fputs(" isxdigit", stdout);
|
||||
if (isblank(c))
|
||||
fputs(" isblank", stdout);
|
||||
fputs("; lower = ", stdout);
|
||||
print_char(tolower(c));
|
||||
fputs("; upper = ", stdout);
|
||||
print_char(toupper(c));
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
exit (lose ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
32
dirent/Makefile
Normal file
32
dirent/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Sub-makefile for dirent portion of the library.
|
||||
#
|
||||
subdir := dirent
|
||||
|
||||
headers := dirent.h dirstream.h
|
||||
routines := opendir closedir readdir rewinddir \
|
||||
seekdir telldir scandir alphasort \
|
||||
getdents
|
||||
distribute := direct.h
|
||||
|
||||
tests := list tst-seekdir
|
||||
|
||||
include ../Rules
|
29
dirent/alphasort.c
Normal file
29
dirent/alphasort.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* Copyright (C) 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
DEFUN(alphasort, (a, b),
|
||||
CONST PTR a AND CONST PTR b)
|
||||
{
|
||||
return strcmp (((struct dirent *) a)->d_name,
|
||||
((struct dirent *) b)->d_name);
|
||||
}
|
149
dirent/dirent.h
Normal file
149
dirent/dirent.h
Normal file
@ -0,0 +1,149 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT_H
|
||||
|
||||
#define _DIRENT_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <gnu/types.h>
|
||||
|
||||
|
||||
/* Directory entry structure.
|
||||
|
||||
This structure is laid out identically to the `struct direct' that
|
||||
represents directory entries in the GNU Hurd and in BSD 4.4 (and
|
||||
incidentally, on disk in the Berkeley fast file system). The `readdir'
|
||||
implementations for GNU and BSD know this; you must change them if you
|
||||
change this structure. */
|
||||
|
||||
struct dirent
|
||||
{
|
||||
__ino_t d_fileno; /* File serial number. */
|
||||
unsigned short int d_reclen; /* Length of the whole `struct dirent'. */
|
||||
unsigned char d_type; /* File type, possibly unknown. */
|
||||
unsigned char d_namlen; /* Length of the file name. */
|
||||
|
||||
/* Only this member is in the POSIX standard. */
|
||||
char d_name[1]; /* File name (actually longer). */
|
||||
};
|
||||
|
||||
#if defined(__USE_BSD) || defined(__USE_MISC)
|
||||
#define d_ino d_fileno /* Backward compatibility. */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_BSD
|
||||
/* File types for `d_type'. */
|
||||
enum
|
||||
{
|
||||
DT_UNKNOWN = 0,
|
||||
DT_FIFO = 1,
|
||||
DT_CHR = 2,
|
||||
DT_DIR = 4,
|
||||
DT_BLK = 6,
|
||||
DT_REG = 8,
|
||||
DT_LNK = 10,
|
||||
DT_SOCK = 12
|
||||
};
|
||||
|
||||
/* Convert between stat structure types and directory types. */
|
||||
#define IFTODT(mode) (((mode) & 0170000) >> 12)
|
||||
#define DTTOIF(dirtype) ((dirtype) << 12)
|
||||
#endif
|
||||
|
||||
|
||||
/* Get the system-dependent definition of `DIR',
|
||||
the data type of directory stream objects. */
|
||||
#include <dirstream.h>
|
||||
|
||||
/* Open a directory stream on NAME.
|
||||
Return a DIR stream on the directory, or NULL if it could not be opened. */
|
||||
extern DIR *opendir __P ((__const char *__name));
|
||||
|
||||
/* Close the directory stream DIRP.
|
||||
Return 0 if successful, -1 if not. */
|
||||
extern int closedir __P ((DIR * __dirp));
|
||||
|
||||
/* Read a directory entry from DIRP.
|
||||
Return a pointer to a `struct dirent' describing the entry,
|
||||
or NULL for EOF or error. The storage returned may be overwritten
|
||||
by a later readdir call on the same DIR stream. */
|
||||
extern struct dirent *readdir __P ((DIR * __dirp));
|
||||
|
||||
/* Rewind DIRP to the beginning of the directory. */
|
||||
extern void rewinddir __P ((DIR * __dirp));
|
||||
|
||||
#if defined(__USE_BSD) || defined(__USE_MISC)
|
||||
|
||||
#ifndef MAXNAMLEN
|
||||
/* Get the definitions of the POSIX.1 limits. */
|
||||
#include <posix1_lim.h>
|
||||
|
||||
/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
|
||||
#ifdef NAME_MAX
|
||||
#define MAXNAMLEN NAME_MAX
|
||||
#else
|
||||
#define MAXNAMLEN 255
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <gnu/types.h>
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* Seek to position POS on DIRP. */
|
||||
extern void seekdir __P ((DIR * __dirp, __off_t __pos));
|
||||
|
||||
/* Return the current position of DIRP. */
|
||||
extern __off_t telldir __P ((DIR * __dirp));
|
||||
|
||||
/* Scan the directory DIR, calling SELECT on each directory entry.
|
||||
Entries for which SELECT returns nonzero are individually malloc'd,
|
||||
sorted using qsort with CMP, and collected in a malloc'd array in
|
||||
*NAMELIST. Returns the number of entries selected, or -1 on error. */
|
||||
extern int scandir __P ((__const char *__dir,
|
||||
struct dirent ***__namelist,
|
||||
int (*__select) __P ((struct dirent *)),
|
||||
int (*__cmp) __P ((__const __ptr_t,
|
||||
__const __ptr_t))));
|
||||
|
||||
/* Function to compare two `struct dirent's alphabetically. */
|
||||
extern int alphasort __P ((__const __ptr_t, __const __ptr_t));
|
||||
|
||||
|
||||
/* Read directory entries from FD into BUF, reading at most NBYTES.
|
||||
Reading starts at offset *BASEP, and *BASEP is updated with the new
|
||||
position after reading. Returns the number of bytes read; zero when at
|
||||
end of directory; or -1 for errors. */
|
||||
extern __ssize_t __getdirentries __P ((int __fd, char *__buf,
|
||||
size_t __nbytes, __off_t *__basep));
|
||||
extern __ssize_t getdirentries __P ((int __fd, char *__buf,
|
||||
size_t __nbytes, __off_t *__basep));
|
||||
|
||||
|
||||
#endif /* Use BSD or misc. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* dirent.h */
|
68
dirent/list.c
Normal file
68
dirent/list.c
Normal file
@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 1991, 1993 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
void
|
||||
DEFUN(test, (name), CONST char *name)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *entp;
|
||||
|
||||
puts(name);
|
||||
|
||||
dirp = opendir(name);
|
||||
if (dirp == NULL)
|
||||
{
|
||||
perror("opendir");
|
||||
return;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
while ((entp = readdir(dirp)) != NULL)
|
||||
printf("%s\tfile number %lu\n",
|
||||
entp->d_name, (unsigned long int) entp->d_fileno);
|
||||
|
||||
if (errno)
|
||||
perror ("readdir");
|
||||
|
||||
if (closedir(dirp) < 0)
|
||||
perror("closedir");
|
||||
}
|
||||
|
||||
int
|
||||
DEFUN(main, (argc, argv), int argc AND char **argv)
|
||||
{
|
||||
--argc;
|
||||
++argv;
|
||||
|
||||
if (argc == 0)
|
||||
test(".");
|
||||
else
|
||||
while (argc-- > 0)
|
||||
test(*argv++);
|
||||
|
||||
exit(0);
|
||||
return(0);
|
||||
}
|
89
dirent/scandir.c
Normal file
89
dirent/scandir.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* Copyright (C) 1992, 1993, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
DEFUN(scandir, (dir, namelist, select, cmp),
|
||||
CONST char *dir AND
|
||||
struct dirent ***namelist AND
|
||||
int EXFUN((*select), (struct dirent *)) AND
|
||||
int EXFUN((*cmp), (CONST PTR, CONST PTR)))
|
||||
{
|
||||
DIR *dp = opendir (dir);
|
||||
struct dirent **v = NULL;
|
||||
size_t vsize = 0, i;
|
||||
struct dirent *d;
|
||||
int save;
|
||||
|
||||
if (dp == NULL)
|
||||
return -1;
|
||||
|
||||
save = errno;
|
||||
errno = 0;
|
||||
|
||||
i = 0;
|
||||
while ((d = readdir (dp)) != NULL)
|
||||
if (select == NULL || (*select) (d))
|
||||
{
|
||||
if (i == vsize)
|
||||
{
|
||||
struct dirent **new;
|
||||
if (vsize == 0)
|
||||
vsize = 10;
|
||||
else
|
||||
vsize *= 2;
|
||||
new = (struct dirent **) realloc (v, vsize * sizeof (*v));
|
||||
if (new == NULL)
|
||||
{
|
||||
lose:
|
||||
errno = ENOMEM;
|
||||
break;
|
||||
}
|
||||
v = new;
|
||||
}
|
||||
|
||||
v[i] = (struct dirent *) malloc (sizeof (**v));
|
||||
if (v[i] == NULL)
|
||||
goto lose;
|
||||
|
||||
*v[i++] = *d;
|
||||
}
|
||||
|
||||
if (errno != 0)
|
||||
{
|
||||
save = errno;
|
||||
(void) closedir (dp);
|
||||
while (i > 0)
|
||||
free (v[--i]);
|
||||
free (v);
|
||||
errno = save;
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void) closedir (dp);
|
||||
errno = save;
|
||||
|
||||
/* Sort the list if we have a comparison function to sort with. */
|
||||
if (cmp != NULL)
|
||||
qsort (v, i, sizeof (*v), cmp);
|
||||
*namelist = v;
|
||||
return i;
|
||||
}
|
40
dirent/tst-seekdir.c
Normal file
40
dirent/tst-seekdir.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
DIR * dirp;
|
||||
long save3;
|
||||
int i = 0;
|
||||
struct dirent *dp;
|
||||
|
||||
dirp = opendir(".");
|
||||
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
|
||||
{
|
||||
/* save position 3 (fourth entry) */
|
||||
if (i++ == 3)
|
||||
save3 = telldir(dirp);
|
||||
|
||||
printf("%s\n", dp->d_name);
|
||||
|
||||
/* stop at 400 (just to make sure dirp->__offset and dirp->__size are
|
||||
scrambled */
|
||||
if (i == 400)
|
||||
break;
|
||||
}
|
||||
|
||||
/* go back to saved entry */
|
||||
seekdir (dirp, save3);
|
||||
|
||||
|
||||
/* print remaining files (3-last) */
|
||||
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
|
||||
printf("%s\n", dp->d_name);
|
||||
|
||||
|
||||
closedir (dirp);
|
||||
exit(0);
|
||||
}
|
587
elf/elf.h
Normal file
587
elf/elf.h
Normal file
@ -0,0 +1,587 @@
|
||||
/* This file defines standard ELF types, structures, and macros.
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
Contributed by Ian Lance Taylor (ian@cygnus.com).
|
||||
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _ELF_H
|
||||
#define _ELF_H 1
|
||||
|
||||
|
||||
/* Standard ELF types.
|
||||
|
||||
Using __attribute__ mode ensures that gcc will choose the right for
|
||||
these types. */
|
||||
|
||||
typedef unsigned int Elf32_Addr __attribute__ ((mode (SI)));
|
||||
typedef unsigned int Elf32_Half __attribute__ ((mode (HI)));
|
||||
typedef unsigned int Elf32_Off __attribute__ ((mode (SI)));
|
||||
typedef int Elf32_Sword __attribute__ ((mode (SI)));
|
||||
typedef unsigned int Elf32_Word __attribute__ ((mode (SI)));
|
||||
|
||||
/* The ELF file header. This appears at the start of every ELF file. */
|
||||
|
||||
#define EI_NIDENT (16)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
|
||||
Elf32_Half e_type; /* Object file type */
|
||||
Elf32_Half e_machine; /* Architecture */
|
||||
Elf32_Word e_version; /* Object file version */
|
||||
Elf32_Addr e_entry; /* Entry point virtual address */
|
||||
Elf32_Off e_phoff; /* Program header table file offset */
|
||||
Elf32_Off e_shoff; /* Section header table file offset */
|
||||
Elf32_Word e_flags; /* Processor-specific flags */
|
||||
Elf32_Half e_ehsize; /* ELF header size in bytes */
|
||||
Elf32_Half e_phentsize; /* Program header table entry size */
|
||||
Elf32_Half e_phnum; /* Program header table entry count */
|
||||
Elf32_Half e_shentsize; /* Section header table entry size */
|
||||
Elf32_Half e_shnum; /* Section header table entry count */
|
||||
Elf32_Half e_shstrndx; /* Section header string table index */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
/* Fields in the e_ident array. The EI_* macros are indices into the
|
||||
array. The macros under each EI_* macro are the values the byte
|
||||
may have. */
|
||||
|
||||
#define EI_MAG0 0 /* File identification byte 0 index */
|
||||
#define ELFMAG0 0x7f /* Magic number byte 0 */
|
||||
|
||||
#define EI_MAG1 1 /* File identification byte 1 index */
|
||||
#define ELFMAG1 'E' /* Magic number byte 1 */
|
||||
|
||||
#define EI_MAG2 2 /* File identification byte 2 index */
|
||||
#define ELFMAG2 'L' /* Magic number byte 2 */
|
||||
|
||||
#define EI_MAG3 3 /* File identification byte 3 index */
|
||||
#define ELFMAG3 'F' /* Magic number byte 3 */
|
||||
|
||||
#define EI_CLASS 4 /* File class byte index */
|
||||
#define ELFCLASSNONE 0 /* Invalid class */
|
||||
#define ELFCLASS32 1 /* 32-bit objects */
|
||||
#define ELFCLASS64 2 /* 64-bit objects */
|
||||
|
||||
#define EI_DATA 5 /* Data encoding byte index */
|
||||
#define ELFDATANONE 0 /* Invalid data encoding */
|
||||
#define ELFDATA2LSB 1 /* 2's complement, little endian */
|
||||
#define ELFDATA2MSB 2 /* 2's complement, big endian */
|
||||
|
||||
#define EI_VERSION 6 /* File version byte index */
|
||||
/* Value must be EV_CURRENT */
|
||||
|
||||
#define EI_PAD 7 /* Byte index of padding bytes */
|
||||
|
||||
/* Legal values for e_type (object file type). */
|
||||
|
||||
#define ET_NONE 0 /* No file type */
|
||||
#define ET_REL 1 /* Relocatable file */
|
||||
#define ET_EXEC 2 /* Executable file */
|
||||
#define ET_DYN 3 /* Shared object file */
|
||||
#define ET_CORE 4 /* Core file */
|
||||
#define ET_LOPROC 0xff00 /* Processor-specific */
|
||||
#define ET_HIPROC 0xffff /* Processor-specific */
|
||||
|
||||
/* Legal values for e_machine (architecture). */
|
||||
|
||||
#define EM_NONE 0 /* No machine */
|
||||
#define EM_M32 1 /* AT&T WE 32100 */
|
||||
#define EM_SPARC 2 /* SUN SPARC */
|
||||
#define EM_386 3 /* Intel 80386 */
|
||||
#define EM_68K 4 /* Motorola m68k family */
|
||||
#define EM_88K 5 /* Motorola m88k family */
|
||||
#define EM_486 6 /* Intel 80486 */
|
||||
#define EM_860 7 /* Intel 80860 */
|
||||
#define EM_MIPS 8 /* MIPS R3000 big-endian */
|
||||
#define EM_S370 9 /* Amdhal */
|
||||
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
|
||||
|
||||
#define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */
|
||||
|
||||
#define EM_PARISC 15 /* HPPA */
|
||||
|
||||
/* If it is necessary to assign new unofficial EM_* values, please
|
||||
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
|
||||
chances of collision with official or non-GNU unofficial values. */
|
||||
|
||||
/* Legal values for e_version (version). */
|
||||
|
||||
#define EV_NONE 0 /* Invalid ELF version */
|
||||
#define EV_CURRENT 1 /* Current version */
|
||||
|
||||
/* Section header. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word sh_name; /* Section name (string tbl index) */
|
||||
Elf32_Word sh_type; /* Section type */
|
||||
Elf32_Word sh_flags; /* Section flags */
|
||||
Elf32_Addr sh_addr; /* Section virtual addr at execution */
|
||||
Elf32_Off sh_offset; /* Section file offset */
|
||||
Elf32_Word sh_size; /* Section size in bytes */
|
||||
Elf32_Word sh_link; /* Link to another section */
|
||||
Elf32_Word sh_info; /* Additional section information */
|
||||
Elf32_Word sh_addralign; /* Section alignment */
|
||||
Elf32_Word sh_entsize; /* Entry size if section holds table */
|
||||
} Elf32_Shdr;
|
||||
|
||||
/* Special section indices. */
|
||||
|
||||
#define SHN_UNDEF 0 /* Undefined section */
|
||||
#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
|
||||
#define SHN_LOPROC 0xff00 /* Start of processor-specific */
|
||||
#define SHN_HIPROC 0xff1f /* End of processor-specific */
|
||||
#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
|
||||
#define SHN_COMMON 0xfff2 /* Associated symbol is common */
|
||||
#define SHN_HIRESERVE 0xffff /* End of reserved indices */
|
||||
|
||||
/* Legal values for sh_type (section type). */
|
||||
|
||||
#define SHT_NULL 0 /* Section header table entry unused */
|
||||
#define SHT_PROGBITS 1 /* Program data */
|
||||
#define SHT_SYMTAB 2 /* Symbol table */
|
||||
#define SHT_STRTAB 3 /* String table */
|
||||
#define SHT_RELA 4 /* Relocation entries with addends */
|
||||
#define SHT_HASH 5 /* Symbol hash table */
|
||||
#define SHT_DYNAMIC 6 /* Dynamic linking information */
|
||||
#define SHT_NOTE 7 /* Notes */
|
||||
#define SHT_NOBITS 8 /* Program space with no data (bss) */
|
||||
#define SHT_REL 9 /* Relocation entries, no addends */
|
||||
#define SHT_SHLIB 10 /* Reserved */
|
||||
#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
|
||||
#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
|
||||
#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
|
||||
#define SHT_LOUSER 0x80000000 /* Start of application-specific */
|
||||
#define SHT_HIUSER 0x8fffffff /* End of application-specific */
|
||||
|
||||
/* Legal values for sh_flags (section flags). */
|
||||
|
||||
#define SHF_WRITE (1 << 0) /* Writable */
|
||||
#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
|
||||
#define SHF_EXECINSTR (1 << 2) /* Executable */
|
||||
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
|
||||
|
||||
/* Symbol table entry. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word st_name; /* Symbol name (string tbl index) */
|
||||
Elf32_Addr st_value; /* Symbol value */
|
||||
Elf32_Word st_size; /* Symbol size */
|
||||
unsigned char st_info; /* Symbol type and binding */
|
||||
unsigned char st_other; /* No defined meaning, 0 */
|
||||
Elf32_Half st_shndx; /* Section index */
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Special symbol index. */
|
||||
|
||||
#define STN_UNDEF 0 /* Undefined symbol */
|
||||
|
||||
/* How to extract and insert information held in the st_info field. */
|
||||
|
||||
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
|
||||
#define ELF32_ST_TYPE(val) ((val) & 0xf)
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Legal values for ST_BIND subfield of st_info (symbol binding). */
|
||||
|
||||
#define STB_LOCAL 0 /* Local symbol */
|
||||
#define STB_GLOBAL 1 /* Global symbol */
|
||||
#define STB_WEAK 2 /* Weak symbol */
|
||||
#define STB_LOPROC 13 /* Start of processor-specific */
|
||||
#define STB_HIPROC 15 /* End of processor-specific */
|
||||
|
||||
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
|
||||
|
||||
#define STT_NOTYPE 0 /* Symbol type is unspecified */
|
||||
#define STT_OBJECT 1 /* Symbol is a data object */
|
||||
#define STT_FUNC 2 /* Symbol is a code object */
|
||||
#define STT_SECTION 3 /* Symbol associated with a section */
|
||||
#define STT_FILE 4 /* Symbol's name is file name */
|
||||
#define STT_LOPROC 13 /* Start of processor-specific */
|
||||
#define STT_HIPROC 15 /* End of processor-specific */
|
||||
|
||||
/* Relocation table entry without addend (in section of type SHT_REL). */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset; /* Address */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocation table entry with addend (in section of type SHT_RELA). */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset; /* Address */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index */
|
||||
Elf32_Sword r_addend; /* Addend */
|
||||
} Elf32_Rela;
|
||||
|
||||
/* How to extract and insert information held in the r_info field. */
|
||||
|
||||
#define ELF32_R_SYM(val) ((val) >> 8)
|
||||
#define ELF32_R_TYPE(val) ((val) & 0xff)
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
|
||||
|
||||
/* Program segment header. */
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* Segment type */
|
||||
Elf32_Off p_offset; /* Segment file offset */
|
||||
Elf32_Addr p_vaddr; /* Segment virtual address */
|
||||
Elf32_Addr p_paddr; /* Segment physical address */
|
||||
Elf32_Word p_filesz; /* Segment size in file */
|
||||
Elf32_Word p_memsz; /* Segment size in memory */
|
||||
Elf32_Word p_flags; /* Segment flags */
|
||||
Elf32_Word p_align; /* Segment alignment */
|
||||
} Elf32_Phdr;
|
||||
|
||||
/* Legal values for p_type (segment type). */
|
||||
|
||||
#define PT_NULL 0 /* Program header table entry unused */
|
||||
#define PT_LOAD 1 /* Loadable program segment */
|
||||
#define PT_DYNAMIC 2 /* Dynamic linking information */
|
||||
#define PT_INTERP 3 /* Program interpreter */
|
||||
#define PT_NOTE 4 /* Auxiliary information */
|
||||
#define PT_SHLIB 5 /* Reserved */
|
||||
#define PT_PHDR 6 /* Entry for header table itself */
|
||||
#define PT_LOPROC 0x70000000 /* Start of processor-specific */
|
||||
#define PT_HIPROC 0x7fffffff /* End of processor-specific */
|
||||
|
||||
/* Legal values for p_flags (segment flags). */
|
||||
|
||||
#define PF_X (1 << 0) /* Segment is executable */
|
||||
#define PF_W (1 << 1) /* Segment is writable */
|
||||
#define PF_R (1 << 2) /* Segment is readable */
|
||||
#define PF_MASKPROC 0xf0000000 /* Processor-specific */
|
||||
|
||||
/* Dynamic section entry. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Sword d_tag; /* Dynamic entry type */
|
||||
union
|
||||
{
|
||||
Elf32_Word d_val; /* Integer value */
|
||||
Elf32_Addr d_ptr; /* Address value */
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
/* Legal values for d_tag (dynamic entry type). */
|
||||
|
||||
#define DT_NULL 0 /* Marks end of dynamic section */
|
||||
#define DT_NEEDED 1 /* Name of needed library */
|
||||
#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
|
||||
#define DT_PLTGOT 3 /* Processor defined value */
|
||||
#define DT_HASH 4 /* Address of symbol hash table */
|
||||
#define DT_STRTAB 5 /* Address of string table */
|
||||
#define DT_SYMTAB 6 /* Address of symbol table */
|
||||
#define DT_RELA 7 /* Address of Rela relocs */
|
||||
#define DT_RELASZ 8 /* Total size of Rela relocs */
|
||||
#define DT_RELAENT 9 /* Size of one Rela reloc */
|
||||
#define DT_STRSZ 10 /* Size of string table */
|
||||
#define DT_SYMENT 11 /* Size of one symbol table entry */
|
||||
#define DT_INIT 12 /* Address of init function */
|
||||
#define DT_FINI 13 /* Address of termination function */
|
||||
#define DT_SONAME 14 /* Name of shared object */
|
||||
#define DT_RPATH 15 /* Library search path */
|
||||
#define DT_SYMBOLIC 16 /* Start symbol search here */
|
||||
#define DT_REL 17 /* Address of Rel relocs */
|
||||
#define DT_RELSZ 18 /* Total size of Rel relocs */
|
||||
#define DT_RELENT 19 /* Size of one Rel reloc */
|
||||
#define DT_PLTREL 20 /* Type of reloc in PLT */
|
||||
#define DT_DEBUG 21 /* For debugging; unspecified */
|
||||
#define DT_TEXTREL 22 /* Reloc might modify .text */
|
||||
#define DT_JMPREL 23 /* Address of PLT relocs */
|
||||
#define DT_LOPROC 0x70000000 /* Start of processor-specific */
|
||||
#define DT_HIPROC 0x7fffffff /* End of processor-specific */
|
||||
|
||||
/* Standard 64 bit ELF types. */
|
||||
|
||||
typedef unsigned int Elf64_Addr __attribute__ ((mode (DI)));
|
||||
typedef unsigned int Elf64_Half __attribute__ ((mode (HI)));
|
||||
typedef unsigned int Elf64_Off __attribute__ ((mode (DI)));
|
||||
typedef int Elf64_Sword __attribute__ ((mode (SI)));
|
||||
typedef int Elf64_Sxword __attribute__ ((mode (DI)));
|
||||
typedef unsigned int Elf64_Word __attribute__ ((mode (SI)));
|
||||
typedef unsigned int Elf64_Xword __attribute__ ((mode (DI)));
|
||||
typedef unsigned int Elf64_Byte __attribute__ ((mode (QI)));
|
||||
typedef unsigned int Elf64_Section __attribute__ ((mode (HI)));
|
||||
|
||||
/* 64 bit ELF file header. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
|
||||
Elf64_Half e_type; /* Object file type */
|
||||
Elf64_Half e_machine; /* Architecture */
|
||||
Elf64_Word e_version; /* Object file version */
|
||||
Elf64_Addr e_entry; /* Entry point virtual address */
|
||||
Elf64_Off e_phoff; /* Program header table file offset */
|
||||
Elf64_Off e_shoff; /* Section header table file offset */
|
||||
Elf64_Word e_flags; /* Processor-specific flags */
|
||||
Elf64_Half e_ehsize; /* ELF header size in bytes */
|
||||
Elf64_Half e_phentsize; /* Program header table entry size */
|
||||
Elf64_Half e_phnum; /* Program header table entry count */
|
||||
Elf64_Half e_shentsize; /* Section header table entry size */
|
||||
Elf64_Half e_shnum; /* Section header table entry count */
|
||||
Elf64_Half e_shstrndx; /* Section header string table index */
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/* 64 bit section header. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf64_Word sh_name; /* Section name (string tbl index) */
|
||||
Elf64_Word sh_type; /* Section type */
|
||||
Elf64_Xword sh_flags; /* Section flags */
|
||||
Elf64_Addr sh_addr; /* Section virtual addr at execution */
|
||||
Elf64_Off sh_offset; /* Section file offset */
|
||||
Elf64_Xword sh_size; /* Section size in bytes */
|
||||
Elf64_Word sh_link; /* Link to another section */
|
||||
Elf64_Word sh_info; /* Additional section information */
|
||||
Elf64_Xword sh_addralign; /* Section alignment */
|
||||
Elf64_Xword sh_entsize; /* Entry size if section holds table */
|
||||
} Elf64_Shdr;
|
||||
|
||||
/* 64 bit symbol table entry. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf64_Word st_name; /* Symbol name (string tbl index) */
|
||||
Elf64_Byte st_info; /* Symbol type and binding */
|
||||
Elf64_Byte st_other; /* No defined meaning, 0 */
|
||||
Elf64_Section st_shndx; /* Section index */
|
||||
Elf64_Addr st_value; /* Symbol value */
|
||||
Elf64_Xword st_size; /* Symbol size */
|
||||
} Elf64_Sym;
|
||||
|
||||
/* The 64 bit st_info field is the same as the 32 bit one. */
|
||||
|
||||
#define ELF64_ST_BIND(val) (((unsigned char) (val)) >> 4)
|
||||
#define ELF64_ST_TYPE(val) ((val) & 0xf)
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* I have seen two different definitions of the Elf64_Rel and
|
||||
Elf64_Rela structures, so we'll leave them out until Novell (or
|
||||
whoever) gets their act together. */
|
||||
|
||||
/* Auxiliary vector. */
|
||||
|
||||
/* This vector is normally only used by the program interpreter. The
|
||||
usual definition in an ABI supplement uses the name auxv_t. The
|
||||
vector is not usually defined in a standard <elf.h> file, but it
|
||||
can't hurt. We rename it to avoid conflicts. The sizes of these
|
||||
types are an arrangement between the exec server and the program
|
||||
interpreter, so we don't fully specify them here. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int a_type; /* Entry type */
|
||||
union
|
||||
{
|
||||
long a_val; /* Integer value */
|
||||
void *a_ptr; /* Pointer value */
|
||||
void (*a_fcn) (); /* Function pointer value */
|
||||
} a_un;
|
||||
} Elf32_auxv_t;
|
||||
|
||||
/* Legal values for a_type (entry type). */
|
||||
|
||||
#define AT_NULL 0 /* End of vector */
|
||||
#define AT_IGNORE 1 /* Entry should be ignored */
|
||||
#define AT_EXECFD 2 /* File descriptor of program */
|
||||
#define AT_PHDR 3 /* Program headers for program */
|
||||
#define AT_PHENT 4 /* Size of program header entry */
|
||||
#define AT_PHNUM 5 /* Number of program headers */
|
||||
#define AT_PAGESZ 6 /* System page size */
|
||||
#define AT_BASE 7 /* Base address of interpreter */
|
||||
#define AT_FLAGS 8 /* Flags */
|
||||
#define AT_ENTRY 9 /* Entry point of program */
|
||||
#define AT_NOTELF 10 /* Program is not ELF */
|
||||
#define AT_UID 11 /* Real uid */
|
||||
#define AT_EUID 12 /* Effective uid */
|
||||
#define AT_GID 13 /* Read gid */
|
||||
#define AT_EGID 14 /* Effective gid */
|
||||
|
||||
/* Intel 80386 specific definitions. */
|
||||
|
||||
/* i386 relocs. */
|
||||
|
||||
#define R_386_NONE 0 /* No reloc */
|
||||
#define R_386_32 1 /* Direct 32 bit */
|
||||
#define R_386_PC32 2 /* PC relative 32 bit */
|
||||
#define R_386_GOT32 3 /* 32 bit GOT entry */
|
||||
#define R_386_PLT32 4 /* 32 bit PLT address */
|
||||
#define R_386_COPY 5 /* Copy symbol at runtime */
|
||||
#define R_386_GLOB_DAT 6 /* Create GOT entry */
|
||||
#define R_386_JMP_SLOT 7 /* Create PLT entry */
|
||||
#define R_386_RELATIVE 8 /* Adjust by program base */
|
||||
#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
|
||||
#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
|
||||
|
||||
/* SUN SPARC specific definitions. */
|
||||
|
||||
/* SPARC relocs. */
|
||||
|
||||
#define R_SPARC_NONE 0 /* No reloc */
|
||||
#define R_SPARC_8 1 /* Direct 8 bit */
|
||||
#define R_SPARC_16 2 /* Direct 16 bit */
|
||||
#define R_SPARC_32 3 /* Direct 32 bit */
|
||||
#define R_SPARC_DISP8 4 /* PC relative 8 bit */
|
||||
#define R_SPARC_DISP16 5 /* PC relative 16 bit */
|
||||
#define R_SPARC_DISP32 6 /* PC relative 32 bit */
|
||||
#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
|
||||
#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
|
||||
#define R_SPARC_HI22 9 /* High 22 bit */
|
||||
#define R_SPARC_22 10 /* Direct 22 bit */
|
||||
#define R_SPARC_13 11 /* Direct 13 bit */
|
||||
#define R_SPARC_LO10 12 /* Truncated 10 bit */
|
||||
#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
|
||||
#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
|
||||
#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
|
||||
#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
|
||||
#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
|
||||
#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
|
||||
#define R_SPARC_COPY 19 /* Copy symbol at runtime */
|
||||
#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
|
||||
#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
|
||||
#define R_SPARC_RELATIVE 22 /* Adjust by program base */
|
||||
#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
|
||||
|
||||
/* MIPS R3000 specific definitions. */
|
||||
|
||||
/* Legal values for e_flags field of Elf32_Ehdr. */
|
||||
|
||||
#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
|
||||
#define EF_MIPS_PIC 2 /* Contains PIC code */
|
||||
#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
|
||||
#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
|
||||
|
||||
/* Special section indices. */
|
||||
|
||||
#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
|
||||
#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
|
||||
#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
|
||||
|
||||
/* Legal values for sh_type field of Elf32_Shdr. */
|
||||
|
||||
#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
|
||||
#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
|
||||
#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
|
||||
#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
|
||||
#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information */
|
||||
#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
|
||||
|
||||
/* Legal values for sh_flags field of Elf32_Shdr. */
|
||||
|
||||
#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
|
||||
|
||||
/* Entries found in sections of type SHT_MIPS_GPTAB. */
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
Elf32_Word gt_current_g_value; /* -G value used for compilation */
|
||||
Elf32_Word gt_unused; /* Not used */
|
||||
} gt_header; /* First entry in section */
|
||||
struct
|
||||
{
|
||||
Elf32_Word gt_g_value; /* If this value were used for -G */
|
||||
Elf32_Word gt_bytes; /* This many bytes would be used */
|
||||
} gt_entry; /* Subsequent entries in section */
|
||||
} Elf32_gptab;
|
||||
|
||||
/* Entry found in sections of type SHT_MIPS_REGINFO. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word ri_gprmask; /* General registers used */
|
||||
Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
|
||||
Elf32_Sword ri_gp_value; /* $gp register value */
|
||||
} Elf32_RegInfo;
|
||||
|
||||
/* MIPS relocs. */
|
||||
|
||||
#define R_MIPS_NONE 0 /* No reloc */
|
||||
#define R_MIPS_16 1 /* Direct 16 bit */
|
||||
#define R_MIPS_32 2 /* Direct 32 bit */
|
||||
#define R_MIPS_REL32 3 /* PC relative 32 bit */
|
||||
#define R_MIPS_26 4 /* Direct 26 bit shifted */
|
||||
#define R_MIPS_HI16 5 /* High 16 bit */
|
||||
#define R_MIPS_LO16 6 /* Low 16 bit */
|
||||
#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
|
||||
#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
|
||||
#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
|
||||
#define R_MIPS_PC16 10 /* PC relative 16 bit */
|
||||
#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
|
||||
#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
|
||||
|
||||
/* Legal values for p_type field of Elf32_Phdr. */
|
||||
|
||||
#define PT_MIPS_REGINFO 0x70000000 /* Regiser usage information */
|
||||
|
||||
/* Legal values for d_tag field of Elf32_Dyn. */
|
||||
|
||||
#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
|
||||
#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
|
||||
#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
|
||||
#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
|
||||
#define DT_MIPS_FLAGS 0x70000005 /* Flags */
|
||||
#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
|
||||
#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
|
||||
#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
|
||||
#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
|
||||
#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
|
||||
#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
|
||||
#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
|
||||
#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
|
||||
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
|
||||
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
|
||||
|
||||
/* Legal values for DT_MIPS_FLAG Elf32_Dyn entry. */
|
||||
|
||||
#define RHF_NONE 0 /* No flags */
|
||||
#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
|
||||
#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
|
||||
#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
|
||||
|
||||
/* Entries found in sections of type SHT_MIPS_LIBLIST. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word l_name; /* Name (string table index) */
|
||||
Elf32_Word l_time_stamp; /* Timestamp */
|
||||
Elf32_Word l_checksum; /* Checksum */
|
||||
Elf32_Word l_version; /* Interface version */
|
||||
Elf32_Word l_flags; /* Flags */
|
||||
} Elf32_Lib;
|
||||
|
||||
/* Legal values for l_flags. */
|
||||
|
||||
#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
|
||||
#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
|
||||
|
||||
/* Entries found in sections of type SHT_MIPS_CONFLICT. */
|
||||
|
||||
typedef Elf32_Addr Elf32_Conflict;
|
||||
|
||||
|
||||
#endif /* elf.h */
|
45
errno.h
Normal file
45
errno.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* ANSI Standard: 4.1.3 Errors <errno.h>
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H
|
||||
|
||||
#define _ERRNO_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get the error number constants. */
|
||||
#include <errnos.h>
|
||||
|
||||
/* Declare the `errno' variable. */
|
||||
extern int errno;
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* The full and simple forms of the name with which the program was
|
||||
invoked. These variables are set up automatically at startup based on
|
||||
the value of ARGV[0] (this works only if you use GNU ld). */
|
||||
extern char *program_invocation_name, *program_invocation_short_name;
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* errno.h */
|
157
features.h
Normal file
157
features.h
Normal file
@ -0,0 +1,157 @@
|
||||
/* Copyright (C) 1991, 1992, 1993 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _FEATURES_H
|
||||
|
||||
#define _FEATURES_H 1
|
||||
|
||||
/* These are defined by the user (or the compiler)
|
||||
to specify the desired environment:
|
||||
|
||||
__STRICT_ANSI__ ANSI Standard C.
|
||||
_POSIX_SOURCE IEEE Std 1003.1.
|
||||
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if ==2 add IEEE Std 1003.2.
|
||||
_BSD_SOURCE ANSI, POSIX, and 4.3BSD things.
|
||||
_SVID_SOURCE ANSI, POSIX, and SVID things.
|
||||
_GNU_SOURCE All of the above, plus GNU extensions.
|
||||
|
||||
The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
|
||||
If none of these are defined, the default is _GNU_SOURCE.
|
||||
If more than one of these are defined, they accumulate.
|
||||
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
|
||||
together give you ANSI C, 1003.1, and 1003.2, but nothing else.
|
||||
|
||||
These are defined by this file and are used by the
|
||||
header files to decide what to declare or define:
|
||||
|
||||
__USE_POSIX Define IEEE Std 1003.1 things.
|
||||
__USE_POSIX2 Define IEEE Std 1003.2 things.
|
||||
__USE_BSD Define 4.3BSD things.
|
||||
__USE_SVID Define SVID things.
|
||||
__USE_MISC Define things common to BSD and System V Unix.
|
||||
__USE_GNU Define GNU extensions.
|
||||
__FAVOR_BSD Favor 4.3BSD things in cases of conflict.
|
||||
|
||||
The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
|
||||
|
||||
All macros defined by this file are defined as 1.
|
||||
All macros listed above as possibly being defined by this file are
|
||||
explicitly undefined if they are not explicitly defined.
|
||||
Feature-test macros that are not defined by the user or compiler
|
||||
but are implied by the other feature-test macros defined (or by the
|
||||
lack of any definitions) are defined by the file. */
|
||||
|
||||
|
||||
/* Undefine everything, so we get a clean slate. */
|
||||
#undef __USE_POSIX
|
||||
#undef __USE_POSIX2
|
||||
#undef __USE_BSD
|
||||
#undef __USE_SVID
|
||||
#undef __USE_MISC
|
||||
#undef __USE_GNU
|
||||
#undef __FAVOR_BSD
|
||||
|
||||
|
||||
/* If nothing is defined, define _GNU_SOURCE. */
|
||||
#if (!defined(_GNU_SOURCE) && !defined(__STRICT_ANSI__) && \
|
||||
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||
!defined(_BSD_SOURCE) && !defined(_SVID_SOURCE))
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Always use ANSI things. */
|
||||
#define __USE_ANSI 1
|
||||
|
||||
|
||||
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
|
||||
#ifdef _BSD_SOURCE
|
||||
#define __FAVOR_BSD 1
|
||||
#endif
|
||||
|
||||
|
||||
/* If nothing (other than _GNU_SOURCE) is defined,
|
||||
define _BSD_SOURCE and _SVID_SOURCE. */
|
||||
#if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
|
||||
!defined(_POSIX_C_SOURCE) && !defined(_BSD_SOURCE) && \
|
||||
!defined(_SVID_SOURCE))
|
||||
#define _BSD_SOURCE 1
|
||||
#define _SVID_SOURCE 1
|
||||
#endif
|
||||
|
||||
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */
|
||||
#if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
|
||||
!defined(_POSIX_C_SOURCE))
|
||||
#define _POSIX_SOURCE 1
|
||||
#define _POSIX_C_SOURCE 2
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1
|
||||
#define __USE_POSIX 1
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
|
||||
#define __USE_POSIX2 1
|
||||
#endif
|
||||
|
||||
#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE)
|
||||
#define __USE_MISC 1
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_SOURCE
|
||||
#define __USE_BSD 1
|
||||
#endif
|
||||
|
||||
#ifdef _SVID_SOURCE
|
||||
#define __USE_SVID 1
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __USE_GNU 1
|
||||
#endif
|
||||
|
||||
|
||||
#undef __GNU_LIBRARY__
|
||||
#define __GNU_LIBRARY__ 1
|
||||
|
||||
|
||||
#if !defined(__GNUC__) || __GNUC__ < 2
|
||||
/* In GCC version 2, (__extension__ EXPR) will not complain
|
||||
about GCC extensions used in EXPR under -ansi or -pedantic. */
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
|
||||
/* This is here only because every header file already includes this one. */
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/* This is here only because every header file already includes this one. */
|
||||
#ifndef _LIBC
|
||||
/* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
|
||||
<stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
|
||||
which will always return failure (and set errno to ENOSYS).
|
||||
|
||||
We avoid including <stubs.h> when compiling the C library itself to
|
||||
avoid a dependency loop. stubs.h depends on every object file. If
|
||||
this #include were done for the library source code, then every object
|
||||
file would depend on stubs.h. */
|
||||
|
||||
#include <stubs.h>
|
||||
#endif
|
||||
|
||||
#endif /* __features.h */
|
75
gnu-stabs.h
Normal file
75
gnu-stabs.h
Normal file
@ -0,0 +1,75 @@
|
||||
#error This file is obsolete.
|
||||
|
||||
/* Copyright (C) 1991, 1992, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef __GNU_STABS_H
|
||||
|
||||
#define __GNU_STABS_H 1
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
|
||||
/* Alias a function:
|
||||
function_alias(creat, _creat, int, (file, mode),
|
||||
DEFUN(creat, (file, mode),
|
||||
CONST char *file AND int mode))
|
||||
Yes, this is very repetitive. Nothing you can do about it, so shut up. */
|
||||
#define function_alias(name, _name, type, args, defun) \
|
||||
symbol_alias (_name, name);
|
||||
|
||||
#define function_alias_void(name, _name, args, defun) \
|
||||
symbol_alias (_name, name);
|
||||
|
||||
#ifdef NO_UNDERSCORES
|
||||
#define __SYMBOL_PREFIX
|
||||
#else
|
||||
#define __SYMBOL_PREFIX "_"
|
||||
#endif
|
||||
|
||||
/* Make references to ALIAS refer to SYMBOL. */
|
||||
#define symbol_alias(symbol, alias) \
|
||||
asm(".stabs \"" __SYMBOL_PREFIX #alias "\",11,0,0,0\n"\
|
||||
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0")
|
||||
|
||||
/* Issue a warning message from the linker whenever SYMBOL is referenced. */
|
||||
#define warn_references(symbol, msg) \
|
||||
asm(".stabs \"" msg "\",30,0,0,0\n" \
|
||||
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0")
|
||||
|
||||
#define stub_warning(name) \
|
||||
warn_references(name, \
|
||||
"warning: " #name " is not implemented and will always fail")
|
||||
|
||||
#define text_set_element(set, symbol) \
|
||||
asm(".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol)
|
||||
#define data_set_element(set, symbol) \
|
||||
asm(".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
|
||||
#define bss_set_element(set, symbol) \
|
||||
asm(".stabs \"" __SYMBOL_PREFIX #set "\",27,0,0," __SYMBOL_PREFIX #symbol)
|
||||
|
||||
#else /* No GNU stabs. */
|
||||
|
||||
#define function_alias(name, _name, type, args, defun) \
|
||||
type defun { return _name args; }
|
||||
|
||||
#define function_alias_void(name, _name, args, defun) \
|
||||
void defun { _name args; }
|
||||
|
||||
#endif /* GNU stabs. */
|
||||
|
||||
#endif /* gnu-stabs.h */
|
1
gnu/signal.h
Normal file
1
gnu/signal.h
Normal file
@ -0,0 +1 @@
|
||||
#include <signal/gnu/signal.h>
|
1
gnu/time.h
Normal file
1
gnu/time.h
Normal file
@ -0,0 +1 @@
|
||||
#include <time/gnu/time.h>
|
1
gnu/types.h
Normal file
1
gnu/types.h
Normal file
@ -0,0 +1 @@
|
||||
#include <posix/gnu/types.h>
|
1
gnu/wait.h
Normal file
1
gnu/wait.h
Normal file
@ -0,0 +1 @@
|
||||
#include <posix/gnu/wait.h>
|
4
gnulib/.cvsignore
Normal file
4
gnulib/.cvsignore
Normal file
@ -0,0 +1,4 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
23
gnulib/Makefile
Normal file
23
gnulib/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (C) 1991 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
subdir := gnulib
|
||||
|
||||
# Which routines are required is machine-dependent.
|
||||
|
||||
include ../Rules
|
29
grp/Makefile
Normal file
29
grp/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (C) 1991, 1992 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
|
||||
# modify it under the terms of the GNU Library General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
#
|
||||
# Sub-makefile for grp portion of the library.
|
||||
#
|
||||
subdir := grp
|
||||
|
||||
routines := grpopen grpread fgetgrent getgrent getgrgid getgrnam \
|
||||
initgroups setgroups
|
||||
|
||||
tests := testgrp
|
||||
|
||||
include ../Rules
|
41
grp/fgetgrent.c
Normal file
41
grp/fgetgrent.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <grp.h>
|
||||
|
||||
|
||||
/* Read a group entry from STREAM. */
|
||||
struct group *
|
||||
DEFUN(fgetgrent, (stream), FILE *stream)
|
||||
{
|
||||
static PTR info = NULL;
|
||||
if (info == NULL)
|
||||
{
|
||||
info = __grpalloc();
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return __grpread(stream, info);
|
||||
}
|
67
grp/getgrent.c
Normal file
67
grp/getgrent.c
Normal file
@ -0,0 +1,67 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <grp.h>
|
||||
|
||||
static FILE *stream = NULL;
|
||||
|
||||
/* Rewind the stream. */
|
||||
void
|
||||
DEFUN_VOID(setgrent)
|
||||
{
|
||||
if (stream != NULL)
|
||||
rewind(stream);
|
||||
}
|
||||
|
||||
|
||||
/* Close the stream. */
|
||||
void
|
||||
DEFUN_VOID(endgrent)
|
||||
{
|
||||
if (stream != NULL)
|
||||
{
|
||||
(void) fclose(stream);
|
||||
stream = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read an entry from the stream. */
|
||||
struct group *
|
||||
DEFUN_VOID(getgrent)
|
||||
{
|
||||
static PTR info = NULL;
|
||||
if (info == NULL)
|
||||
{
|
||||
info = __grpalloc();
|
||||
if (info == NULL)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
stream = __grpopen();
|
||||
if (stream == NULL)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(__grpread(stream, info));
|
||||
}
|
50
grp/getgrgid.c
Normal file
50
grp/getgrgid.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
|
||||
/* Search for an entry with a matching group ID. */
|
||||
struct group *
|
||||
DEFUN(getgrgid, (gid), register gid_t gid)
|
||||
{
|
||||
static PTR info = NULL;
|
||||
register FILE *stream;
|
||||
register struct group *g;
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
info = __grpalloc();
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream = __grpopen();
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((g = __grpread(stream, info)) != NULL)
|
||||
if (g->gr_gid == (gid_t) gid)
|
||||
break;
|
||||
|
||||
(void) fclose(stream);
|
||||
return g;
|
||||
}
|
50
grp/getgrnam.c
Normal file
50
grp/getgrnam.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <grp.h>
|
||||
|
||||
/* Search for an entry with a matching name. */
|
||||
struct group *
|
||||
DEFUN(getgrnam, (name), register CONST char *name)
|
||||
{
|
||||
static PTR info = NULL;
|
||||
register FILE *stream;
|
||||
register struct group *g;
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
info = __grpalloc();
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream = __grpopen();
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
while ((g = __grpread(stream, info)) != NULL)
|
||||
if (!strcmp(g->gr_name, name))
|
||||
break;
|
||||
|
||||
(void) fclose(stream);
|
||||
return g;
|
||||
}
|
101
grp/grp.h
Normal file
101
grp/grp.h
Normal file
@ -0,0 +1,101 @@
|
||||
/* Copyright (C) 1991, 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
|
||||
*/
|
||||
|
||||
#ifndef _GRP_H
|
||||
|
||||
#define _GRP_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <gnu/types.h>
|
||||
|
||||
|
||||
/* The group structure. */
|
||||
struct group
|
||||
{
|
||||
char *gr_name; /* Group name. */
|
||||
char *gr_passwd; /* Password. */
|
||||
__gid_t gr_gid; /* Group ID. */
|
||||
char **gr_mem; /* Member list. */
|
||||
};
|
||||
|
||||
|
||||
#if defined(__USE_SVID) || defined(__USE_GNU)
|
||||
#define __need_FILE
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Return a new stream open on the group file. */
|
||||
extern FILE *__grpopen __P ((void));
|
||||
|
||||
/* Read a group entry from STREAM, filling in G.
|
||||
Return the `struct group' of G if successful, NULL on failure. */
|
||||
extern struct group *__grpread __P ((FILE * __stream, __ptr_t __g));
|
||||
|
||||
/* Return a chunk of memory containing pre-initialized data for __grpread. */
|
||||
extern __ptr_t __grpalloc __P ((void));
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
|
||||
/* Rewind the group-file stream. */
|
||||
extern void setgrent __P ((void));
|
||||
|
||||
/* Close the group-file stream. */
|
||||
extern void endgrent __P ((void));
|
||||
|
||||
/* Read an entry from the group-file stream, opening it if necessary. */
|
||||
extern struct group *getgrent __P ((void));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_SVID
|
||||
/* Read a group entry from STREAM. */
|
||||
extern struct group *fgetgrent __P ((FILE * __stream));
|
||||
#endif
|
||||
|
||||
/* Search for an entry with a matching group ID. */
|
||||
extern struct group *getgrgid __P ((__gid_t __gid));
|
||||
|
||||
/* Search for an entry with a matching group name. */
|
||||
extern struct group *getgrnam __P ((__const char *__name));
|
||||
|
||||
|
||||
#ifdef __USE_BSD
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* Set the group set for the current user to GROUPS (N of them). */
|
||||
extern int setgroups __P ((size_t __n, __const __gid_t * groups));
|
||||
|
||||
/* Initialize the group set for the current user
|
||||
by reading the group database and using all groups
|
||||
of which USER is a member. Also include GROUP. */
|
||||
extern int initgroups __P ((__const char *user, __gid_t group));
|
||||
|
||||
#endif /* Use BSD. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* grp.h */
|
28
grp/grpopen.c
Normal file
28
grp/grpopen.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* Copyright (C) 1991 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <stdio.h>
|
||||
#include <grp.h>
|
||||
|
||||
/* Return a new stream open on the group file. */
|
||||
FILE *
|
||||
DEFUN_VOID(__grpopen)
|
||||
{
|
||||
return fopen("/etc/group", "r");
|
||||
}
|
135
grp/grpread.c
Normal file
135
grp/grpread.c
Normal file
@ -0,0 +1,135 @@
|
||||
/* Copyright (C) 1991, 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
|
||||
/* This is the function that all the others are based on.
|
||||
The format of the group file is known only here. */
|
||||
|
||||
/* Structure containing info kept by each __grpread caller. */
|
||||
typedef struct
|
||||
{
|
||||
char *buf;
|
||||
size_t buflen;
|
||||
size_t max_members;
|
||||
char **members;
|
||||
struct group g;
|
||||
} grpread_info;
|
||||
|
||||
|
||||
/* Return a chunk of memory containing a pre-initialized `grpread_info'. */
|
||||
PTR
|
||||
DEFUN_VOID(__grpalloc)
|
||||
{
|
||||
grpread_info *info = (PTR) malloc (sizeof(grpread_info));
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
info->buf = NULL;
|
||||
info->buflen = 0;
|
||||
|
||||
info->max_members = 5;
|
||||
info->members = (char **) malloc (5 * sizeof(char *));
|
||||
if (info->members == NULL)
|
||||
{
|
||||
free ((PTR) info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/* Read a group entry from STREAM, filling in G. */
|
||||
struct group *
|
||||
DEFUN(__grpread, (stream, g), FILE *stream AND PTR CONST g)
|
||||
{
|
||||
register grpread_info *CONST info = (grpread_info *) g;
|
||||
char *start, *end;
|
||||
register size_t i;
|
||||
|
||||
/* Idiocy checks. */
|
||||
if (stream == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
if (__getline (&info->buf, &info->buflen, stream) == -1)
|
||||
return NULL;
|
||||
while (info->buf[0] == '#');
|
||||
|
||||
start = info->buf;
|
||||
end = strchr (start, ':');
|
||||
if (end == NULL)
|
||||
return NULL;
|
||||
*end = '\0';
|
||||
info->g.gr_name = start;
|
||||
|
||||
start = end + 1;
|
||||
end = strchr (start, ':');
|
||||
if (end == NULL)
|
||||
return NULL;
|
||||
*end = '\0';
|
||||
info->g.gr_passwd = start;
|
||||
|
||||
info->g.gr_gid = (gid_t) strtol (end + 1, &end, 10);
|
||||
if (*end != ':')
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
start = end + 1;
|
||||
end = strchr (start, ',');
|
||||
if (end == NULL)
|
||||
{
|
||||
end = strchr (start, '\n');
|
||||
if (end == start)
|
||||
break;
|
||||
if (end == NULL)
|
||||
return NULL;
|
||||
*end = '\0';
|
||||
end = NULL;
|
||||
}
|
||||
else
|
||||
*end = '\0';
|
||||
|
||||
if (i == info->max_members - 2)
|
||||
{
|
||||
info->max_members += 5;
|
||||
info->members = (char **)
|
||||
realloc ((PTR) info->members, info->max_members * sizeof (char *));
|
||||
if (info->members == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info->members[i++] = start;
|
||||
} while (end != NULL);
|
||||
info->members[i] = NULL;
|
||||
info->g.gr_mem = info->members;
|
||||
|
||||
return &info->g;
|
||||
}
|
73
grp/initgroups.c
Normal file
73
grp/initgroups.c
Normal file
@ -0,0 +1,73 @@
|
||||
/* Copyright (C) 1989, 1991, 1993 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <grp.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/* Initialize the group set for the current user
|
||||
by reading the group database and using all groups
|
||||
of which USER is a member. Also include GROUP. */
|
||||
int
|
||||
DEFUN(initgroups, (user, group),
|
||||
CONST char *user AND gid_t group)
|
||||
{
|
||||
#ifdef NGROUPS_MAX
|
||||
#if NGROUPS_MAX == 0
|
||||
return 0;
|
||||
#else
|
||||
static PTR info = NULL;
|
||||
register FILE *stream;
|
||||
register struct group *g;
|
||||
gid_t groups[NGROUPS_MAX];
|
||||
register size_t n;
|
||||
|
||||
if (info == NULL)
|
||||
{
|
||||
info = __grpalloc();
|
||||
if (info == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
stream = __grpopen();
|
||||
if (stream == NULL)
|
||||
return -1;
|
||||
|
||||
n = 0;
|
||||
groups[n++] = group;
|
||||
|
||||
while (n < NGROUPS_MAX && (g = __grpread(stream, info)) != NULL)
|
||||
if (g->gr_gid != group)
|
||||
{
|
||||
register char **m;
|
||||
|
||||
for (m = g->gr_mem; *m != NULL; ++m)
|
||||
if (!strcmp(*m, user))
|
||||
groups[n++] = g->gr_gid;
|
||||
}
|
||||
|
||||
return setgroups(n, groups);
|
||||
#endif
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
45
grp/testgrp.c
Normal file
45
grp/testgrp.c
Normal file
@ -0,0 +1,45 @@
|
||||
#include <ansidecl.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
DEFUN_VOID(main)
|
||||
{
|
||||
uid_t me;
|
||||
struct passwd *my_passwd;
|
||||
struct group *my_group;
|
||||
char **members;
|
||||
|
||||
me = getuid ();
|
||||
my_passwd = getpwuid (me);
|
||||
if (my_passwd == NULL)
|
||||
perror ("getpwuid");
|
||||
else
|
||||
{
|
||||
printf ("My login name is %s.\n", my_passwd->pw_name);
|
||||
printf ("My uid is %d.\n", (int)(my_passwd->pw_uid));
|
||||
printf ("My home directory is %s.\n", my_passwd->pw_dir);
|
||||
printf ("My default shell is %s.\n", my_passwd->pw_shell);
|
||||
|
||||
my_group = getgrgid (my_passwd->pw_gid);
|
||||
if (my_group == NULL)
|
||||
perror ("getgrgid");
|
||||
else
|
||||
{
|
||||
printf ("My default group is %s (%d).\n",
|
||||
my_group->gr_name, (int)(my_passwd->pw_gid));
|
||||
printf ("The members of this group are:\n");
|
||||
for (members = my_group->gr_mem; *members != NULL; ++members)
|
||||
printf (" %s\n", *members);
|
||||
}
|
||||
}
|
||||
|
||||
exit (my_passwd && my_group ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
|
4
hurd/.cvsignore
Normal file
4
hurd/.cvsignore
Normal file
@ -0,0 +1,4 @@
|
||||
*.gz *.Z *.tar *.tgz
|
||||
=*
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
117
hurd/Makefile
Normal file
117
hurd/Makefile
Normal file
@ -0,0 +1,117 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
# modify it under the terms of the GNU Library General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# The GNU C Library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
# Cambridge, MA 02139, USA.
|
||||
|
||||
subdir := hurd
|
||||
|
||||
all:
|
||||
|
||||
# Some things below (but before including Rules) use configuration variables.
|
||||
include ../Makeconfig
|
||||
|
||||
|
||||
headers = hurd.h $(interface-headers) \
|
||||
$(addprefix hurd/,fd.h id.h port.h signal.h userlink.h \
|
||||
resource.h threadvar.h)
|
||||
|
||||
distribute := hurdfault.h intr-rpc.awk intr-rpc.defs STATUS
|
||||
|
||||
# The RPC interfaces go in a separate library.
|
||||
interface-library := libhurduser.a
|
||||
user-interfaces := $(addprefix hurd/,\
|
||||
auth process startup \
|
||||
msg msg_reply msg_request \
|
||||
exec core interrupt \
|
||||
fs fsys io term socket ifsock)
|
||||
server-interfaces := hurd/msg
|
||||
|
||||
routines = hurdinit hurdid hurdlookup hurdpid hurdrlimit hurdprio hurdexec \
|
||||
setauth \
|
||||
pid2task task2pid \
|
||||
getuids setuids getumask fchroot \
|
||||
hurdsock hurdauth invoke-trans \
|
||||
privports \
|
||||
msgportdemux \
|
||||
fopenport \
|
||||
vpprintf \
|
||||
ports-get ports-set hurdports hurdmsg \
|
||||
$(sig) $(dtable) hurdinline
|
||||
sig = hurdsig hurdfault faultexc siginfo hurd-raise preempt-sig \
|
||||
trampoline longjmp-ts catch-exc exc2signal hurdkill
|
||||
dtable = dtable port2fd new-fd alloc-fd intern-fd \
|
||||
getdport openport \
|
||||
fd-close fd-read fd-write hurdioctl ctty-input ctty-output
|
||||
|
||||
# XXX this is a temporary hack; see hurdmalloc.h
|
||||
routines += hurdmalloc
|
||||
distribute += hurdmalloc.h
|
||||
|
||||
# Get the proper definition of `hurd-srcdir'.
|
||||
include ../sysdeps/mach/hurd/Makefile
|
||||
|
||||
# Use and install the Hurd header files directly out of the Hurd source.
|
||||
|
||||
# Find the MiG defs files in the Hurd source.
|
||||
vpath %.defs $(hurd-srcdir)
|
||||
|
||||
# Install all .h and .defs files we find in the Hurd's hurd/ directory.
|
||||
hurd-headers := $(patsubst $(hurd-srcdir)/%,%,\
|
||||
$(wildcard $(addprefix $(hurd-srcdir)/hurd/,\
|
||||
*.defs *.h)))
|
||||
|
||||
|
||||
# Don't distribute the Hurd headers; they are in the Hurd distribution.
|
||||
dont_distribute = $(hurd-headers)
|
||||
|
||||
# DO NOT try to remake these in any way!!!
|
||||
$(addprefix $(hurd-srcdir)/,$(hurd-headers)) : ;
|
||||
install-others += $(addprefix $(includedir)/,$(hurd-headers))
|
||||
$(includedir)/hurd/%: $(hurd-srcdir)/hurd/%; $(do-install)
|
||||
|
||||
include ../mach/Machrules
|
||||
include ../Rules
|
||||
|
||||
# intr-rpc.defs defines the INTR_INTERFACE macro to make the generated RPC
|
||||
# stubs send-interruptible, and to prefix them with `hurd_intr_rpc_'.
|
||||
user-MIGFLAGS += -imacros intr-rpc.defs
|
||||
|
||||
# Run each generated user stub through intr-rpc.awk, which will detect
|
||||
# stubs __hurd_intr_rpc_% and generate the user-callable function for the
|
||||
# stub: this is a wrapper which calls __hurd_intr_rpc_% inside
|
||||
# HURD_EINTR_RPC.
|
||||
define transform-user-stub
|
||||
gawk -v call=$${call} -f $(word 2,$^) \
|
||||
$(objpfx)tmp_$${call}.c > $(objpfx)tmpi_$${call}.c; \
|
||||
rm -f $(objpfx)tmp_$${call}.c;
|
||||
endef
|
||||
transform-user-stub-output = tmpi
|
||||
|
||||
$(foreach if,$(user-interfaces),$($(if)-calls:%=$(objpfx)RPC_%.o))): \
|
||||
hurd/signal.h
|
||||
|
||||
$(user-interfaces:%=$(objpfx)%.ustamp): intr-rpc.awk
|
||||
|
||||
$(objpfx)fault%.c $(objpfx)fault%.h: $(mach-srcdir)/mach/%.defs
|
||||
$(MIG) $(MIGFLAGS) -prefix _hurdsig_fault_ \
|
||||
-server $(@:.h=.c) -sheader $(@:.c=.h) \
|
||||
-user /dev/null -header /dev/null \
|
||||
$<
|
||||
generated += faultexc.c faultexc.h
|
||||
|
||||
# We need this static dependency to get faultexc.h generated the first time.
|
||||
$(objpfx)hurdfault.o $(objpfx)hurdfault.d: \
|
||||
$(objpfx)faultexc.h $(objpfx)faultexc.c
|
37
hurd/Notes
Normal file
37
hurd/Notes
Normal file
@ -0,0 +1,37 @@
|
||||
The library pays attention to some envariables:
|
||||
|
||||
CORESERVER -- Name of core server naming point; falls back to /servers/core
|
||||
COREFILE -- Name of file to write core dump in; falls back to core
|
||||
GNUTARGET -- Passed to core server to specify flavor of core dump format
|
||||
|
||||
New functions:
|
||||
|
||||
int openport (io_t port);
|
||||
FILE *fopenport (mach_port_t, const char *mode);
|
||||
file_t getdport (int fd);
|
||||
|
||||
task_t pid2task (pid_t);
|
||||
pid_t task2pid (task_t);
|
||||
|
||||
int fchroot (int fd);
|
||||
mode_t getumask (void);
|
||||
|
||||
int getuids (int n, uid_t *uidset);
|
||||
|
||||
error_t hurd_path_lookup (file_t root, file_t cwd,
|
||||
const char *path, int flags, mode_t mode,
|
||||
file_t *port);
|
||||
error_t hurd_path_split (file_t root, file_t cwd,
|
||||
const char *path,
|
||||
file_t *dir, char **name);
|
||||
file_t path_lookup (const char *path, int flags, mode_t mode);
|
||||
file_t path_split (const char *path, char **name);
|
||||
|
||||
process_t getproc (void);
|
||||
int setproc (process_t);
|
||||
file_t getcrdir (void);
|
||||
int setcrdir (file_t);
|
||||
file_t getcwdir (void);
|
||||
int setcwdir (file_t);
|
||||
auth_t getauth (void);
|
||||
int setauth (auth_t); /* Reauthenticates all library ports. */
|
72
hurd/STATUS
Normal file
72
hurd/STATUS
Normal file
@ -0,0 +1,72 @@
|
||||
Status of Hurd support in libc. Last updated 22 Nov 1994.
|
||||
Roland McGrath <roland@gnu.ai.mit.edu>
|
||||
|
||||
Everything not noted below is implemented, most of it tested. There are
|
||||
various very small things unfinished or thought to be perhaps wrong
|
||||
throughout the code, marked by comments containing `XXX'.
|
||||
|
||||
|
||||
* Signals and job control work, but are a very hairy area.
|
||||
There are various ways the signal thread can block and fail
|
||||
to respond when the program is losing badly.
|
||||
|
||||
* We are not sure about possible races between setpgrp (A, pgrp) from
|
||||
process B vs process A receiving proc_newids.
|
||||
|
||||
* The rest of libc (stdio et al) is not safe for multithreaded programs.
|
||||
mutex locks should be added to various things.
|
||||
|
||||
* Recovery from faults in the signal thread is not implemented yet.
|
||||
|
||||
* longjmp needs to clean up reply port, intr_port; needs thought about.
|
||||
|
||||
* Cooperation with cthreads is not finished. If you link with cthreads,
|
||||
libc internal code still does not use real condition variables.
|
||||
sigsuspend currently does a busy wait where it should use a condition.
|
||||
Signal state is per kernel thread; for unwired cthreads it should be per
|
||||
cthread instead.
|
||||
|
||||
* sigaltstack/sigstack do not really work: the signal stack needs thread
|
||||
variables and cthread data set up, which is not done.
|
||||
|
||||
* malloc is a kludge.
|
||||
|
||||
* Nothing uses mapped io. Eventually stdio and read/write/seek should. I
|
||||
have written a little code for this, but it is far from finished.
|
||||
|
||||
* Resource limits do not really work; current implementation is patchy and
|
||||
inconsistent.
|
||||
|
||||
* libc implicitly uses some environment variables. This is a security
|
||||
problem for setuid exec. Probably crt0 should remove the variables from
|
||||
the environment if setuid.
|
||||
|
||||
* The miscellaneous msg.defs calls are only partially implemented.
|
||||
|
||||
* The default SIGINFO handler needs to be written.
|
||||
|
||||
* File locking is not implemented; the RPC interface is not there yet.
|
||||
|
||||
* The current getitimer/setitimer implementation is a kludge.
|
||||
|
||||
* mmap cannot do MAP_NOEXTEND.
|
||||
|
||||
* Unimplemented calls (from the 4.4 system call list):
|
||||
acct
|
||||
fstatfs
|
||||
getfh
|
||||
getfsstat
|
||||
getrusage
|
||||
madvise
|
||||
mincore
|
||||
mount
|
||||
msync
|
||||
profil
|
||||
recvmsg
|
||||
revoke
|
||||
sendmsg
|
||||
setpriority
|
||||
sstk
|
||||
statfs
|
||||
swapon
|
||||
unmount
|
127
hurd/alloc-fd.c
Normal file
127
hurd/alloc-fd.c
Normal file
@ -0,0 +1,127 @@
|
||||
/* Copyright (C) 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
#include <hurd/resource.h>
|
||||
#include <stdlib.h>
|
||||
#include "hurdmalloc.h" /* XXX */
|
||||
|
||||
/* Allocate a new file descriptor and return it, locked. The new
|
||||
descriptor number will be no less than FIRST_FD. If the table is full,
|
||||
set errno to EMFILE and return NULL. If FIRST_FD is negative or bigger
|
||||
than the size of the table, set errno to EINVAL and return NULL. */
|
||||
|
||||
struct hurd_fd *
|
||||
_hurd_alloc_fd (int *fd, int first_fd)
|
||||
{
|
||||
int i;
|
||||
void *crit;
|
||||
long int rlimit;
|
||||
|
||||
if (first_fd < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
crit = _hurd_critical_section_lock ();
|
||||
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
search:
|
||||
for (i = first_fd; i < _hurd_dtablesize; ++i)
|
||||
{
|
||||
struct hurd_fd *d = _hurd_dtable[i];
|
||||
if (d == NULL)
|
||||
{
|
||||
/* Allocate a new descriptor structure for this slot,
|
||||
initializing its port cells to nil. The test below will catch
|
||||
and return this descriptor cell after locking it. */
|
||||
d = _hurd_new_fd (MACH_PORT_NULL, MACH_PORT_NULL);
|
||||
if (d == NULL)
|
||||
{
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
return NULL;
|
||||
}
|
||||
_hurd_dtable[i] = d;
|
||||
}
|
||||
|
||||
__spin_lock (&d->port.lock);
|
||||
if (d->port.port == MACH_PORT_NULL)
|
||||
{
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
if (fd != NULL)
|
||||
*fd = i;
|
||||
return d;
|
||||
}
|
||||
else
|
||||
__spin_unlock (&d->port.lock);
|
||||
}
|
||||
|
||||
__mutex_lock (&_hurd_rlimit_lock);
|
||||
rlimit = _hurd_rlimits[RLIMIT_OFILE].rlim_cur;
|
||||
__mutex_unlock (&_hurd_rlimit_lock);
|
||||
|
||||
if (first_fd < rlimit)
|
||||
{
|
||||
/* The descriptor table is full. Check if we have reached the
|
||||
resource limit, or only the allocated size. */
|
||||
if (_hurd_dtablesize < rlimit)
|
||||
{
|
||||
/* Enlarge the table. */
|
||||
int save = errno;
|
||||
struct hurd_fd **new;
|
||||
/* Try to double the table size (but don't exceed the limit).
|
||||
If there isn't any at all, give it three slots (because
|
||||
stdio will take that many anyway). */
|
||||
int size = _hurd_dtablesize ? _hurd_dtablesize * 2 : 3;
|
||||
if (size > rlimit)
|
||||
size = rlimit;
|
||||
/* If we fail to allocate that, decrement the desired size
|
||||
until we succeed in allocating it. */
|
||||
do
|
||||
new = realloc (_hurd_dtable, size * sizeof (*_hurd_dtable));
|
||||
while (new == NULL && size-- > _hurd_dtablesize);
|
||||
if (new != NULL)
|
||||
{
|
||||
/* We managed to allocate a new table. Now install it. */
|
||||
errno = save;
|
||||
first_fd = _hurd_dtablesize;
|
||||
/* Initialize the new slots. */
|
||||
for (i = first_fd; i < size; ++i)
|
||||
new[i] = NULL;
|
||||
_hurd_dtablesize = size;
|
||||
_hurd_dtable = new;
|
||||
/* Go back to the loop to initialize the first new slot. */
|
||||
goto search;
|
||||
}
|
||||
}
|
||||
else
|
||||
errno = EMFILE;
|
||||
}
|
||||
else
|
||||
errno = EINVAL; /* Bogus FIRST_FD value. */
|
||||
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
|
||||
return NULL;
|
||||
}
|
78
hurd/catch-exc.c
Normal file
78
hurd/catch-exc.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* Copyright (C) 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <mach/exc_server.h>
|
||||
#include <hurd/signal.h>
|
||||
|
||||
/* Called by the microkernel when a thread gets an exception. */
|
||||
|
||||
kern_return_t
|
||||
_S_catch_exception_raise (mach_port_t port,
|
||||
thread_t thread,
|
||||
task_t task,
|
||||
int exception,
|
||||
int code,
|
||||
int subcode)
|
||||
{
|
||||
int signo, error;
|
||||
long int sigcode;
|
||||
struct hurd_sigstate *ss;
|
||||
|
||||
if (task != __mach_task_self ())
|
||||
/* The sender wasn't the kernel. */
|
||||
return EPERM;
|
||||
|
||||
/* Call the machine-dependent function to translate the Mach exception
|
||||
codes into a signal number and subcode. */
|
||||
_hurd_exception2signal (exception, code, subcode,
|
||||
&signo, &sigcode, &error);
|
||||
|
||||
/* Find the sigstate structure for the faulting thread. */
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
|
||||
if (ss->thread == thread)
|
||||
break;
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
if (ss == NULL)
|
||||
ss = _hurd_thread_sigstate (thread); /* Allocate a fresh one. */
|
||||
|
||||
if (__spin_lock_locked (&ss->lock))
|
||||
{
|
||||
/* Loser. The thread faulted with its sigstate lock held. Its
|
||||
sigstate data is now suspect. So we reset the parts of it which
|
||||
could cause trouble for the signal thread. Anything else
|
||||
clobbered therein will just hose this user thread, but it's
|
||||
faulting already.
|
||||
|
||||
This is almost certainly a library bug: unless random memory
|
||||
clobberation caused the sigstate lock to gratuitously appear held,
|
||||
no code should do anything that can fault while holding the
|
||||
sigstate lock. */
|
||||
|
||||
ss->critical_section = 0;
|
||||
ss->context = NULL;
|
||||
__spin_unlock (&ss->lock);
|
||||
}
|
||||
|
||||
/* Post the signal. */
|
||||
_hurd_internal_post_signal (ss, signo, sigcode, error,
|
||||
MACH_PORT_NULL, MACH_MSG_TYPE_PORT_SEND,
|
||||
0);
|
||||
|
||||
return KERN_SUCCESS;
|
||||
}
|
77
hurd/ctty-input.c
Normal file
77
hurd/ctty-input.c
Normal file
@ -0,0 +1,77 @@
|
||||
/* _hurd_ctty_input -- Do an input RPC and generate SIGTTIN if necessary.
|
||||
Copyright (C) 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
|
||||
/* Call *RPC on PORT and/or CTTY. If a call on CTTY returns EBACKGROUND,
|
||||
generate SIGTTIN or EIO as appropriate. */
|
||||
|
||||
error_t
|
||||
_hurd_ctty_input (io_t port, io_t ctty, error_t (*rpc) (io_t))
|
||||
{
|
||||
error_t err;
|
||||
|
||||
do
|
||||
{
|
||||
err = (*rpc) (ctty != MACH_PORT_NULL ? ctty : port);
|
||||
if (ctty != MACH_PORT_NULL && err == EBACKGROUND)
|
||||
{
|
||||
/* We are a background job and tried to read from the tty.
|
||||
We should probably get a SIGTTIN signal. */
|
||||
struct hurd_sigstate *ss;
|
||||
if (_hurd_orphaned)
|
||||
/* Our process group is orphaned. Don't stop; just fail. */
|
||||
err = EIO;
|
||||
else
|
||||
{
|
||||
ss = _hurd_self_sigstate ();
|
||||
__spin_lock (&ss->lock);
|
||||
if (__sigismember (&ss->blocked, SIGTTIN) ||
|
||||
ss->actions[SIGTTIN].sa_handler == SIG_IGN)
|
||||
/* We are blocking or ignoring SIGTTIN. Just fail. */
|
||||
err = EIO;
|
||||
__spin_unlock (&ss->lock);
|
||||
}
|
||||
if (err == EBACKGROUND)
|
||||
{
|
||||
/* Send a SIGTTIN signal to our process group.
|
||||
|
||||
We must remember here not to clobber ERR, since
|
||||
the loop condition below uses it to recall that
|
||||
we should retry after a stop. */
|
||||
|
||||
__USEPORT (CTTYID, _hurd_sig_post (0, SIGTTIN, port));
|
||||
/* XXX what to do if error here? */
|
||||
|
||||
/* At this point we should have just run the handler for
|
||||
SIGTTIN or resumed after being stopped. Now this is
|
||||
still a "system call", so check to see if we should
|
||||
restart it. */
|
||||
__spin_lock (&ss->lock);
|
||||
if (!(ss->actions[SIGTTIN].sa_flags & SA_RESTART))
|
||||
err = EINTR;
|
||||
__spin_unlock (&ss->lock);
|
||||
}
|
||||
}
|
||||
/* If the last RPC generated a SIGTTIN, loop to try it again. */
|
||||
} while (err == EBACKGROUND);
|
||||
|
||||
return err;
|
||||
}
|
82
hurd/ctty-output.c
Normal file
82
hurd/ctty-output.c
Normal file
@ -0,0 +1,82 @@
|
||||
/* _hurd_ctty_output -- Do an output RPC and generate SIGTTOU if necessary.
|
||||
Copyright (C) 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
|
||||
/* Call *RPC on PORT and/or CTTY. If a call on CTTY returns EBACKGROUND,
|
||||
generate SIGTTOU if appropriate. */
|
||||
|
||||
error_t
|
||||
_hurd_ctty_output (io_t port, io_t ctty, error_t (*rpc) (io_t))
|
||||
{
|
||||
error_t err;
|
||||
struct hurd_sigstate *ss;
|
||||
io_t ioport;
|
||||
|
||||
/* Don't use the ctty io port if we are blocking or ignoring SIGTTOU. */
|
||||
if (ctty == MACH_PORT_NULL)
|
||||
ioport = port;
|
||||
else
|
||||
{
|
||||
ss = _hurd_self_sigstate ();
|
||||
__spin_lock (&ss->lock);
|
||||
if (__sigismember (&ss->blocked, SIGTTOU) ||
|
||||
ss->actions[SIGTTOU].sa_handler == SIG_IGN)
|
||||
ioport = port;
|
||||
else
|
||||
ioport = ctty;
|
||||
__spin_unlock (&ss->lock);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
err = (*rpc) (ioport);
|
||||
if (ioport == ctty && err == EBACKGROUND)
|
||||
{
|
||||
if (_hurd_orphaned)
|
||||
/* Our process group is orphaned, so we never generate a
|
||||
signal; we just fail. */
|
||||
err = EIO;
|
||||
else
|
||||
{
|
||||
/* Send a SIGTTOU signal to our process group.
|
||||
|
||||
We must remember here not to clobber ERR, since
|
||||
the loop condition below uses it to recall that
|
||||
we should retry after a stop. */
|
||||
|
||||
__USEPORT (CTTYID, _hurd_sig_post (0, SIGTTOU, port));
|
||||
/* XXX what to do if error here? */
|
||||
|
||||
/* At this point we should have just run the handler for
|
||||
SIGTTOU or resumed after being stopped. Now this is
|
||||
still a "system call", so check to see if we should
|
||||
restart it. */
|
||||
__spin_lock (&ss->lock);
|
||||
if (!(ss->actions[SIGTTOU].sa_flags & SA_RESTART))
|
||||
err = EINTR;
|
||||
__spin_unlock (&ss->lock);
|
||||
}
|
||||
}
|
||||
/* If the last RPC generated a SIGTTOU, loop to try it again. */
|
||||
} while (err == EBACKGROUND);
|
||||
|
||||
return err;
|
||||
}
|
277
hurd/dtable.c
Normal file
277
hurd/dtable.c
Normal file
@ -0,0 +1,277 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/term.h>
|
||||
#include <hurd/fd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <cthreads.h> /* For `struct mutex'. */
|
||||
#include "set-hooks.h"
|
||||
#include "hurdmalloc.h" /* XXX */
|
||||
|
||||
|
||||
struct mutex _hurd_dtable_lock = MUTEX_INITIALIZER; /* XXX ld bug; must init */
|
||||
struct hurd_fd **_hurd_dtable;
|
||||
int _hurd_dtablesize;
|
||||
|
||||
|
||||
DEFINE_HOOK (_hurd_fd_subinit, (void));
|
||||
|
||||
/* Initialize the file descriptor table at startup. */
|
||||
|
||||
static void
|
||||
init_dtable (void)
|
||||
{
|
||||
register size_t i;
|
||||
|
||||
__mutex_init (&_hurd_dtable_lock);
|
||||
|
||||
/* The initial size of the descriptor table is that of the passed-in
|
||||
table. It will be expanded as necessary up to _hurd_dtable_rlimit. */
|
||||
_hurd_dtablesize = _hurd_init_dtablesize;
|
||||
|
||||
/* Allocate the vector of pointers. */
|
||||
_hurd_dtable = malloc (_hurd_dtablesize * sizeof (*_hurd_dtable));
|
||||
if (_hurd_dtablesize != 0 && _hurd_dtable == NULL)
|
||||
__libc_fatal ("hurd: Can't allocate file descriptor table\n");
|
||||
|
||||
/* Initialize the descriptor table. */
|
||||
for (i = 0; i < _hurd_init_dtablesize; ++i)
|
||||
{
|
||||
if (_hurd_init_dtable[i] == MACH_PORT_NULL)
|
||||
/* An unused descriptor is marked by a null pointer. */
|
||||
_hurd_dtable[i] = NULL;
|
||||
else
|
||||
{
|
||||
/* Allocate a new file descriptor structure. */
|
||||
struct hurd_fd *new = malloc (sizeof (struct hurd_fd));
|
||||
if (new == NULL)
|
||||
__libc_fatal ("hurd: Can't allocate initial file descriptors\n");
|
||||
|
||||
/* Initialize the port cells. */
|
||||
_hurd_port_init (&new->port, MACH_PORT_NULL);
|
||||
_hurd_port_init (&new->ctty, MACH_PORT_NULL);
|
||||
|
||||
/* Install the port in the descriptor.
|
||||
This sets up all the ctty magic. */
|
||||
_hurd_port2fd (new, _hurd_init_dtable[i], 0);
|
||||
|
||||
_hurd_dtable[i] = new;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear out the initial descriptor table.
|
||||
Everything must use _hurd_dtable now. */
|
||||
__vm_deallocate (__mach_task_self (),
|
||||
(vm_address_t) _hurd_init_dtable,
|
||||
_hurd_init_dtablesize * sizeof (_hurd_init_dtable[0]));
|
||||
_hurd_init_dtable = NULL;
|
||||
_hurd_init_dtablesize = 0;
|
||||
|
||||
/* Initialize the remaining empty slots in the table. */
|
||||
for (; i < _hurd_dtablesize; ++i)
|
||||
_hurd_dtable[i] = NULL;
|
||||
|
||||
/* Run things that want to run after the file descriptor table
|
||||
is initialized. */
|
||||
RUN_HOOK (_hurd_fd_subinit, ());
|
||||
|
||||
(void) &init_dtable; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
text_set_element (_hurd_subinit, init_dtable);
|
||||
|
||||
/* XXX when the linker supports it, the following functions should all be
|
||||
elsewhere and just have text_set_elements here. */
|
||||
|
||||
/* Called by `getdport' to do its work. */
|
||||
|
||||
static file_t
|
||||
get_dtable_port (int fd)
|
||||
{
|
||||
file_t dport;
|
||||
int err = HURD_DPORT_USE (fd, __mach_port_mod_refs (__mach_task_self (),
|
||||
(dport = port),
|
||||
MACH_PORT_RIGHT_SEND,
|
||||
1));
|
||||
if (err)
|
||||
{
|
||||
errno = err;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
return dport;
|
||||
}
|
||||
|
||||
file_t (*_hurd_getdport_fn) (int fd) = get_dtable_port;
|
||||
|
||||
#include <hurd/signal.h>
|
||||
|
||||
/* We are in the child fork; the dtable lock is still held.
|
||||
The parent has inserted send rights for all the normal io ports,
|
||||
but we must recover ctty-special ports for ourselves. */
|
||||
static error_t
|
||||
fork_child_dtable (void)
|
||||
{
|
||||
error_t err;
|
||||
int i;
|
||||
|
||||
err = 0;
|
||||
|
||||
for (i = 0; !err && i < _hurd_dtablesize; ++i)
|
||||
{
|
||||
struct hurd_fd *d = _hurd_dtable[i];
|
||||
if (d == NULL)
|
||||
continue;
|
||||
|
||||
/* No other thread is using the send rights in the child task. */
|
||||
d->port.users = d->ctty.users = NULL;
|
||||
|
||||
if (d->ctty.port != MACH_PORT_NULL)
|
||||
{
|
||||
/* There was a ctty-special port in the parent.
|
||||
We need to get one for ourselves too. */
|
||||
__mach_port_deallocate (__mach_task_self (), d->ctty.port);
|
||||
err = __term_open_ctty (d->port.port, _hurd_pid, _hurd_pgrp,
|
||||
&d->ctty.port);
|
||||
if (err)
|
||||
d->ctty.port = MACH_PORT_NULL;
|
||||
}
|
||||
|
||||
/* XXX for each fd with a cntlmap, reauth and re-map_cntl. */
|
||||
}
|
||||
return err;
|
||||
|
||||
(void) &fork_child_dtable; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
data_set_element (_hurd_fork_locks, _hurd_dtable_lock); /* XXX ld bug: bss */
|
||||
text_set_element (_hurd_fork_child_hook, fork_child_dtable);
|
||||
|
||||
/* Called when our process group has changed. */
|
||||
|
||||
static void
|
||||
ctty_new_pgrp (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
HURD_CRITICAL_BEGIN;
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
for (i = 0; i < _hurd_dtablesize; ++i)
|
||||
{
|
||||
struct hurd_fd *const d = _hurd_dtable[i];
|
||||
struct hurd_userlink ulink, ctty_ulink;
|
||||
io_t port, ctty;
|
||||
|
||||
if (d == NULL)
|
||||
/* Nothing to do for an unused descriptor cell. */
|
||||
continue;
|
||||
|
||||
port = _hurd_port_get (&d->port, &ulink);
|
||||
ctty = _hurd_port_get (&d->ctty, &ctty_ulink);
|
||||
|
||||
if (ctty != MACH_PORT_NULL)
|
||||
{
|
||||
/* This fd has a ctty-special port. We need a new one, to tell
|
||||
the io server of our different process group. */
|
||||
io_t new;
|
||||
if (__term_open_ctty (port, _hurd_pid, _hurd_pgrp, &new))
|
||||
new = MACH_PORT_NULL;
|
||||
_hurd_port_set (&d->ctty, new);
|
||||
}
|
||||
|
||||
_hurd_port_free (&d->port, &ulink, port);
|
||||
_hurd_port_free (&d->ctty, &ctty_ulink, ctty);
|
||||
}
|
||||
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
HURD_CRITICAL_END;
|
||||
|
||||
(void) &ctty_new_pgrp; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
text_set_element (_hurd_pgrp_changed_hook, ctty_new_pgrp);
|
||||
|
||||
/* Called to reauthenticate the dtable when the auth port changes. */
|
||||
|
||||
static void
|
||||
reauth_dtable (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
HURD_CRITICAL_BEGIN;
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
for (i = 0; i < _hurd_dtablesize; ++i)
|
||||
{
|
||||
struct hurd_fd *const d = _hurd_dtable[i];
|
||||
mach_port_t new, newctty, ref;
|
||||
|
||||
if (d == NULL)
|
||||
/* Nothing to do for an unused descriptor cell. */
|
||||
continue;
|
||||
|
||||
ref = __mach_reply_port ();
|
||||
|
||||
/* Take the descriptor cell's lock. */
|
||||
__spin_lock (&d->port.lock);
|
||||
|
||||
/* Reauthenticate the descriptor's port. */
|
||||
if (d->port.port != MACH_PORT_NULL &&
|
||||
! __io_reauthenticate (d->port.port,
|
||||
ref, MACH_MSG_TYPE_MAKE_SEND) &&
|
||||
! __USEPORT (AUTH, __auth_user_authenticate
|
||||
(port,
|
||||
d->port.port,
|
||||
ref, MACH_MSG_TYPE_MAKE_SEND,
|
||||
&new)))
|
||||
{
|
||||
/* Replace the port in the descriptor cell
|
||||
with the newly reauthenticated port. */
|
||||
|
||||
if (d->ctty.port != MACH_PORT_NULL &&
|
||||
! __io_reauthenticate (d->ctty.port,
|
||||
ref, MACH_MSG_TYPE_MAKE_SEND) &&
|
||||
! __USEPORT (AUTH, __auth_user_authenticate
|
||||
(port,
|
||||
d->ctty.port,
|
||||
ref, MACH_MSG_TYPE_MAKE_SEND,
|
||||
&newctty)))
|
||||
_hurd_port_set (&d->ctty, newctty);
|
||||
|
||||
_hurd_port_locked_set (&d->port, new);
|
||||
}
|
||||
else
|
||||
/* Lost. Leave this descriptor cell alone. */
|
||||
__spin_unlock (&d->port.lock);
|
||||
|
||||
__mach_port_destroy (__mach_task_self (), ref);
|
||||
}
|
||||
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
HURD_CRITICAL_END;
|
||||
|
||||
(void) &reauth_dtable; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
text_set_element (_hurd_reauth_hook, reauth_dtable);
|
43
hurd/fchroot.c
Normal file
43
hurd/fchroot.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
|
||||
/* Change the current root directory to FD. */
|
||||
int
|
||||
DEFUN(fchroot, (fd), int fd)
|
||||
{
|
||||
error_t err;
|
||||
file_t dir;
|
||||
|
||||
err = __USEPORT (CRDIR,
|
||||
({ file_t crdir = port;
|
||||
HURD_DPORT_USE (fd,
|
||||
__hurd_file_name_lookup (crdir, port, "",
|
||||
0, 0, &dir));
|
||||
}));
|
||||
|
||||
if (err)
|
||||
return __hurd_fail (err);
|
||||
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
|
||||
return 0;
|
||||
}
|
46
hurd/fd-close.c
Normal file
46
hurd/fd-close.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* Copyright (C) 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd/fd.h>
|
||||
|
||||
error_t
|
||||
_hurd_fd_close (struct hurd_fd *fd)
|
||||
{
|
||||
error_t err;
|
||||
|
||||
HURD_CRITICAL_BEGIN;
|
||||
|
||||
__spin_lock (&fd->port.lock);
|
||||
if (fd->port.port == MACH_PORT_NULL)
|
||||
{
|
||||
__spin_unlock (&fd->port.lock);
|
||||
err = EBADF;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clear the descriptor's port cells.
|
||||
This deallocates the ports if noone else is still using them. */
|
||||
_hurd_port_set (&fd->ctty, MACH_PORT_NULL);
|
||||
_hurd_port_locked_set (&fd->port, MACH_PORT_NULL);
|
||||
err = 0;
|
||||
}
|
||||
|
||||
HURD_CRITICAL_END;
|
||||
|
||||
return err;
|
||||
}
|
49
hurd/fd-read.c
Normal file
49
hurd/fd-read.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Copyright (C) 1993, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
#include <string.h>
|
||||
|
||||
error_t
|
||||
_hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes)
|
||||
{
|
||||
error_t err;
|
||||
char *data;
|
||||
mach_msg_type_number_t nread;
|
||||
|
||||
error_t readfd (io_t port)
|
||||
{
|
||||
return __io_read (port, &data, &nread, -1, *nbytes);
|
||||
}
|
||||
|
||||
data = buf;
|
||||
if (err = HURD_FD_PORT_USE (fd, _hurd_ctty_input (port, ctty, readfd)))
|
||||
return err;
|
||||
|
||||
if (data != buf)
|
||||
{
|
||||
memcpy (buf, data, nread);
|
||||
__vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
|
||||
}
|
||||
|
||||
*nbytes = nread;
|
||||
return 0;
|
||||
}
|
42
hurd/fd-write.c
Normal file
42
hurd/fd-write.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* _hurd_fd_write -- write to a file descriptor; handles job control et al.
|
||||
Copyright (C) 1993, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
|
||||
error_t
|
||||
_hurd_fd_write (struct hurd_fd *fd, const void *buf, size_t *nbytes)
|
||||
{
|
||||
error_t err;
|
||||
mach_msg_type_number_t wrote;
|
||||
|
||||
error_t writefd (io_t port)
|
||||
{
|
||||
return __io_write (port, buf, *nbytes, -1, &wrote);
|
||||
}
|
||||
|
||||
err = HURD_FD_PORT_USE (fd, _hurd_ctty_output (port, ctty, writefd));
|
||||
|
||||
if (! err)
|
||||
*nbytes = wrote;
|
||||
|
||||
return err;
|
||||
}
|
131
hurd/fopenport.c
Normal file
131
hurd/fopenport.c
Normal file
@ -0,0 +1,131 @@
|
||||
/* Copyright (C) 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <hurd.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Read up to N chars into BUF from COOKIE.
|
||||
Return how many chars were read, 0 for EOF or -1 for error. */
|
||||
static ssize_t
|
||||
readio (void *cookie, char *buf, size_t n)
|
||||
{
|
||||
mach_msg_type_number_t nread;
|
||||
error_t err;
|
||||
char *bufp = buf;
|
||||
|
||||
nread = n;
|
||||
if (err = __io_read ((io_t) cookie, &bufp, &nread, -1, n))
|
||||
return __hurd_fail (err);
|
||||
|
||||
if (bufp != buf)
|
||||
{
|
||||
memcpy (buf, bufp, nread);
|
||||
__vm_deallocate (__mach_task_self (),
|
||||
(vm_address_t) bufp, (vm_size_t) nread);
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
/* Write up to N chars from BUF to COOKIE.
|
||||
Return how many chars were written or -1 for error. */
|
||||
static ssize_t
|
||||
writeio (void *cookie, const char *buf, size_t n)
|
||||
{
|
||||
mach_msg_type_number_t wrote;
|
||||
error_t err;
|
||||
|
||||
if (err = __io_write ((io_t) cookie, buf, n, -1, &wrote))
|
||||
return __hurd_fail (err);
|
||||
|
||||
return wrote;
|
||||
}
|
||||
|
||||
/* Move COOKIE's file position *POS bytes, according to WHENCE.
|
||||
The current file position is stored in *POS.
|
||||
Returns zero if successful, nonzero if not. */
|
||||
static int
|
||||
seekio (void *cookie, fpos_t *pos, int whence)
|
||||
{
|
||||
error_t error = __io_seek ((file_t) cookie, *pos, whence, pos);
|
||||
if (error)
|
||||
return __hurd_fail (error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close the file associated with COOKIE.
|
||||
Return 0 for success or -1 for failure. */
|
||||
static int
|
||||
closeio (void *cookie)
|
||||
{
|
||||
error_t error = __mach_port_deallocate (__mach_task_self (),
|
||||
(mach_port_t) cookie);
|
||||
if (error)
|
||||
return __hurd_fail (error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const __io_functions funcsio = { readio, writeio, seekio, closeio };
|
||||
|
||||
|
||||
/* Defined in fopen.c. */
|
||||
extern int EXFUN(__getmode, (CONST char *mode, __io_mode *mptr));
|
||||
|
||||
|
||||
/* Open a stream on PORT. MODE is as for fopen. */
|
||||
|
||||
FILE *
|
||||
__fopenport (mach_port_t port, const char *mode)
|
||||
{
|
||||
register FILE *stream;
|
||||
__io_mode m;
|
||||
int pflags;
|
||||
error_t err;
|
||||
|
||||
if (!__getmode (mode, &m))
|
||||
return NULL;
|
||||
|
||||
/* Verify the PORT is valid allows the access MODE specifies. */
|
||||
|
||||
if (err = __io_get_openmodes (port, &pflags))
|
||||
return __hurd_fail (err), NULL;
|
||||
|
||||
/* Check the access mode. */
|
||||
if ((m.__read && !(pflags & O_READ)) || (m.__write && !(pflags & O_WRITE)))
|
||||
{
|
||||
errno = EBADF;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream = __newstream ();
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
||||
stream->__cookie = (PTR) port;
|
||||
stream->__mode = m;
|
||||
stream->__io_funcs = funcsio;
|
||||
stream->__room_funcs = __default_room_functions;
|
||||
stream->__seen = 1;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
weak_alias (__fopenport, fopenport)
|
54
hurd/getdport.c
Normal file
54
hurd/getdport.c
Normal file
@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
|
||||
/* This is initialized in dtable.c when that gets linked in.
|
||||
If dtable.c is not linked in, it will be zero. */
|
||||
file_t (*_hurd_getdport_fn) (int fd);
|
||||
|
||||
file_t
|
||||
__getdport (int fd)
|
||||
{
|
||||
if (_hurd_getdport_fn)
|
||||
/* dtable.c has defined the function to fetch a port from the real file
|
||||
descriptor table. */
|
||||
return (*_hurd_getdport_fn) (fd);
|
||||
|
||||
/* getdport is the only use of file descriptors,
|
||||
so we don't bother allocating a real table. */
|
||||
|
||||
if (_hurd_init_dtable == NULL)
|
||||
/* Never had a descriptor table. */
|
||||
return EBADF;
|
||||
|
||||
if (fd < 0 || fd > _hurd_init_dtablesize ||
|
||||
_hurd_init_dtable[fd] == MACH_PORT_NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
|
||||
MACH_PORT_RIGHT_SEND, 1);
|
||||
return _hurd_init_dtable[fd];
|
||||
}
|
||||
}
|
||||
|
||||
weak_alias (__getdport, getdport)
|
63
hurd/getuids.c
Normal file
63
hurd/getuids.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright (C) 1993, 1994 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/id.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
__getuids (int n, uid_t *uidset)
|
||||
{
|
||||
error_t err;
|
||||
int nuids;
|
||||
void *crit;
|
||||
|
||||
crit = _hurd_critical_section_lock ();
|
||||
__mutex_lock (&_hurd_id.lock);
|
||||
|
||||
if (err = _hurd_check_ids ())
|
||||
{
|
||||
__mutex_unlock (&_hurd_id.lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
return __hurd_fail (err);
|
||||
}
|
||||
|
||||
nuids = _hurd_id.gen.nuids;
|
||||
|
||||
if (n != 0)
|
||||
{
|
||||
/* Copy the uids onto stack storage and then release the idlock. */
|
||||
uid_t uids[nuids];
|
||||
memcpy (uids, _hurd_id.gen.uids, sizeof (uids));
|
||||
__mutex_unlock (&_hurd_id.lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
|
||||
/* Now that the lock is released, we can safely copy the
|
||||
uid set into the user's array, which might fault. */
|
||||
if (nuids > n)
|
||||
nuids = n;
|
||||
memcpy (uidset, uids, nuids * sizeof (uid_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
__mutex_unlock (&_hurd_id.lock);
|
||||
_hurd_critical_section_unlock (crit);
|
||||
}
|
||||
|
||||
return nuids;
|
||||
}
|
25
hurd/getumask.c
Normal file
25
hurd/getumask.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* Copyright (C) 1992 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
|
||||
mode_t
|
||||
getumask (void)
|
||||
{
|
||||
return _hurd_umask;
|
||||
}
|
48
hurd/hurd-raise.c
Normal file
48
hurd/hurd-raise.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 1994, 1995 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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
#include <hurd/msg.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
/* Handle signal SIGNO in the calling thread.
|
||||
If SS is not NULL it is the sigstate for the calling thread;
|
||||
SS->lock is held on entry and released before return. */
|
||||
|
||||
void
|
||||
_hurd_raise_signal (struct hurd_sigstate *ss,
|
||||
int signo, long int sigcode, int sigerror)
|
||||
{
|
||||
if (ss == NULL)
|
||||
{
|
||||
ss = _hurd_self_sigstate ();
|
||||
__spin_lock (&ss->lock);
|
||||
}
|
||||
|
||||
/* Mark SIGNO as pending to be delivered. */
|
||||
__sigaddset (&ss->pending, signo);
|
||||
ss->pending_data[signo].code = sigcode;
|
||||
ss->pending_data[signo].error = sigerror;
|
||||
|
||||
__spin_unlock (&ss->lock);
|
||||
|
||||
/* Send a message to the signal thread so it
|
||||
will wake up and check for pending signals. */
|
||||
__msg_sig_post (_hurd_msgport, 0, __mach_task_self ());
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user