add directory gnu
This commit is contained in:
481
gnu/glibc/glibc-1.03/COPYING.LIB
Normal file
481
gnu/glibc/glibc-1.03/COPYING.LIB
Normal file
@@ -0,0 +1,481 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This 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.
|
||||
|
||||
This 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 this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
1229
gnu/glibc/glibc-1.03/ChangeLog
Normal file
1229
gnu/glibc/glibc-1.03/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
476
gnu/glibc/glibc-1.03/INSTALL
Normal file
476
gnu/glibc/glibc-1.03/INSTALL
Normal file
@@ -0,0 +1,476 @@
|
||||
This is Info file INSTALL, produced by Makeinfo-1.44 from the input
|
||||
file manual/maint.texinfo.
|
||||
|
||||
|
||||
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'. If you do not have GNU
|
||||
`make', life is more difficult. We recommend porting GNU `make' to
|
||||
your system rather than trying to install the GNU C library without
|
||||
it. *Really.*
|
||||
|
||||
To configure the GNU C library for your system, run the script
|
||||
`configure' with `sh'. You must give as an argument to the script a
|
||||
word describing your system, such as `sun4' or `hp300'.
|
||||
|
||||
By default, the `configure' script will set things up to build
|
||||
things into a subdirectory of the library source directory whose name
|
||||
is the name of the system you configure for. For example,
|
||||
`configure sun4' creates and uses a directory called `sun4'. If you
|
||||
give a second argument to `configure', that is used as the directory
|
||||
name instead.
|
||||
|
||||
You can build for several machines from the same source directory,
|
||||
by specifying the subdirectory that `configure' created when you
|
||||
configured for that machine in the `make' variable `ARCH'. For
|
||||
example, use `make ARCH=sun4', or put `ARCH=sun4' in your environment.
|
||||
If you don't specify a value for `ARCH', the variable `machine' is
|
||||
used if defined; otherwise `make' will build for the configuration
|
||||
most recently configured for.
|
||||
|
||||
Now edit the file `Makeconfig' to set the compilation parameters,
|
||||
and what directories to install the library and header files in. See
|
||||
the comments in `Makeconfig' for the details. If you are building for
|
||||
several machines, you can put just the values specific to a particular
|
||||
machine in a file called `Makeconfig' in the object directory for that
|
||||
machine (for example, `sun4/Makeconfig'). This should *not* be an
|
||||
edited copy of `Makeconfig'. Make a new file containing just the
|
||||
variables in `Makeconfig' that you want to set specially for the
|
||||
particular machine. These values will override the values defined in
|
||||
`Makeconfig'.
|
||||
|
||||
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.) If possible, you should use the GNU linker, GNU `ld',
|
||||
when linking programs with the GNU C library. If you are going to use
|
||||
GNU `ld', be sure to specify `-DHAVE_GNU_LD' in `Makeconfig'.
|
||||
|
||||
To build the library and header files, type `make'. 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. Using the `-w' option
|
||||
to `make' may make the output easier to understand (this option tells
|
||||
`make' to print messages telling you what subdirectories it is working
|
||||
on).
|
||||
|
||||
To install the library and header files, type `make install', after
|
||||
setting the installation directories in `Makeconfig' (or
|
||||
`MACHINE/Makeconfig'). This will build things if necessary, before
|
||||
installing them.
|
||||
|
||||
|
||||
Reporting Bugs
|
||||
===============
|
||||
|
||||
There are probably bugs in the GNU C library. 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. 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.
|
||||
|
||||
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 Internet address `bug-gnu-libc@prep.ai.mit.edu'
|
||||
or UUCP path `mit-eddie!prep.ai.mit.edu!bug-gnu-libc'. If you have
|
||||
other problems with installation, use, or the documentation, please
|
||||
report those as well.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
The process of building the library is driven by the makefiles,
|
||||
which make heavy use of GNU `make' features. 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'). The idea is that
|
||||
`routines' is for modules that define functions in the library,
|
||||
and `aux' is for auxiliary modules containing things like data
|
||||
definitions. But the values of `routines' and `aux' are
|
||||
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 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" in 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. These are
|
||||
built by `make others'.
|
||||
|
||||
`install-lib'
|
||||
`install-data'
|
||||
`install'
|
||||
Files to be installed by `make install'. Things listed in
|
||||
`install-lib' are installed in the directory specified by
|
||||
`libdir' in `Makeconfig' (*note Installation::.). Things listed
|
||||
in `install-data' are installed in the directory specified by
|
||||
`datadir' in `Makeconfig'. Things listed in `install' are
|
||||
installed in the directory specified by `bindir' in `Makeconfig'.
|
||||
|
||||
`distribute'
|
||||
Other files from this subdirectory which should be put into a
|
||||
distribution tar file. The source and header files listed in the
|
||||
other standard variables, and the makefile itself, need not be
|
||||
listed here. Only define `distribute' if there are files used in
|
||||
an unusual way that should go into the distribution.
|
||||
|
||||
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
|
||||
directories. Each subdirectory of `sysdeps' contains source files for
|
||||
a particular machine or operating system, or for a class of machine or
|
||||
operating system. A configuration is specified by an ordered list of
|
||||
these subdirectories. Each subdirectory implicitly appends its parent
|
||||
directory to the list. For example, specifying the list
|
||||
`unix/bsd/hp9k3bsd' is equivalent to specifying the list
|
||||
`unix/bsd/hp9k3bsd 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/hp9k3bsd/Implies' contains:
|
||||
|
||||
# HP 9000 series 300 is 68k.
|
||||
m68k
|
||||
|
||||
Since `m68k/Implies' contains:
|
||||
|
||||
# 68k uses IEEE 754 floating point.
|
||||
ieee754
|
||||
|
||||
and `unix/bsd/Implies' contains:
|
||||
|
||||
# BSD has Internet-related things.
|
||||
unix/inet
|
||||
|
||||
and `unix/Implies' contains:
|
||||
|
||||
posix
|
||||
|
||||
the final list is ` unix/bsd/hp9k3bsd unix/bsd m68k unix/inet unix
|
||||
ieee754 posix '.
|
||||
|
||||
There are two "special" subdirectories of `sysdeps', `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.
|
||||
These functions always return an error, and set `errno' to `ENOSYS'
|
||||
(Function not implemented). A source file is known to be
|
||||
system-dependent by its having a version in `generic' or `stub', so
|
||||
every system-dependent function should have 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 commands 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 whole new
|
||||
sets of routines 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 the 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.
|
||||
|
||||
That is the general system for how system-dependencies are isolated.
|
||||
The rest of this section describes details of particular
|
||||
implementations for classes of systems, and how existing classes and
|
||||
systems are organized.
|
||||
|
||||
|
||||
|
||||
The Layout of the `sysdeps' Directory Hierarchy
|
||||
------------------------------------------------
|
||||
|
||||
Different machine architectures are generally at the top level of
|
||||
the `sysdeps' hierarchy. For example, `sysdeps/sparc' and
|
||||
`sysdeps/m68k'. These contain things specific to those machine
|
||||
architectures (perhaps with subdirectories for specialization of those
|
||||
architectures, such as `sysdeps/m68k/68881'), but not specific to any
|
||||
particular operating system.
|
||||
|
||||
Things specific to a particular operating system on a particular
|
||||
machine are canonically put in a subdirectory in the section of the
|
||||
hierarchy for the operating system, usually with an `Implies' file
|
||||
referring to the top-level subdirectory under `sysdeps' for the
|
||||
particular machine. For example, `unix/bsd/hp9k3bsd' implies `m68k'.
|
||||
|
||||
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 uses, usually last.
|
||||
|
||||
`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 is 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. See *Note Porting to
|
||||
Unix::. `unix' implies `posix'.
|
||||
|
||||
`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 routines 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' in `sysdeps/unix' does not adequately
|
||||
define them. They must be defined 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,
|
||||
`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).
|
||||
|
||||
|
||||
Compatibility with Traditional C
|
||||
=================================
|
||||
|
||||
Although the GNU C library implements the ANSI C library facilities,
|
||||
you *can* use the GNU C library with traditional, "pre-ANSI" C
|
||||
compilers. However, there are a couple things you need to watch out
|
||||
for.
|
||||
|
||||
You must include a different set of header files when compiling your
|
||||
program using a traditional C compiler than when compiling with an ANSI
|
||||
C compiler. (This is because traditional C compilers do not understand
|
||||
the function prototypes used in the ANSI C header files. On the other
|
||||
hand, if you are using an ANSI C compiler like GCC, you should use the
|
||||
ANSI C header files because the prototypes permit the compiler to do a
|
||||
better job of detecting errors in calls to library functions.) You can
|
||||
tell the C compiler what directories to search for header files by
|
||||
using the `-I' option. Set the `trad-incldir' variable in
|
||||
`Makeconfig' to choose where to install this set of header files.
|
||||
|
||||
You also need to be careful because the content and organization of
|
||||
the GNU C library header files differs from that of traditional C
|
||||
implementations. This means you may need to make changes to your
|
||||
program in order to get it to compile.
|
||||
|
||||
|
||||
Contributors to the GNU C Library
|
||||
==================================
|
||||
|
||||
The GNU C library was written almost entirely by Roland McGrath.
|
||||
Some parts of the library were contributed by other people.
|
||||
|
||||
* The `getopt' and related functions were written by Richard
|
||||
Stallman, David J. MacKenzie, and Roland McGrath.
|
||||
|
||||
* 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.
|
||||
|
||||
* Most of the math functions are taken from 4.4 BSD, and are
|
||||
copyrighted by the Regents of the University of California. They
|
||||
have been modified only slightly to work with the GNU C library.
|
||||
|
||||
* The `qsort' function 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, from
|
||||
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 or Software.Distribution@CS.CMU.EDU
|
||||
School of Computer Science
|
||||
Carnegie Mellon University
|
||||
Pittsburgh PA 15213-3890
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Maintenance97
|
||||
Node: Installation141
|
||||
Node: Reporting Bugs3131
|
||||
Node: Porting4714
|
||||
Node: Hierarchy Conventions13569
|
||||
Node: Porting to Unix15729
|
||||
Node: Compatibility with Traditional C17429
|
||||
Node: Contributors to the GNU C Library18645
|
||||
|
||||
End Tag Table
|
||||
173
gnu/glibc/glibc-1.03/Make-dist
Normal file
173
gnu/glibc/glibc-1.03/Make-dist
Normal file
@@ -0,0 +1,173 @@
|
||||
# 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.
|
||||
|
||||
ifndef objpfx
|
||||
You must use the parent or subdirectory Makefile, not this one directly.
|
||||
endif
|
||||
|
||||
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.
|
||||
sysdep_dirs := $(shell find $(..)sysdeps -type d -print)
|
||||
else
|
||||
# Defined by the parent.
|
||||
sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
|
||||
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 echo-distinfo)
|
||||
all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
|
||||
+subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
|
||||
+subdir-headers := $(filter-out $(headers),$(all-headers))
|
||||
endif
|
||||
|
||||
# Find all sysdep sources and headers.
|
||||
+maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
|
||||
$(filter %.c %.S %.s %.h,$(distribute))
|
||||
foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
|
||||
+sysdeps := $(wildcard $(foreach dir,$(sysdep_dirs) $(source_dirs),\
|
||||
$(addprefix $(dir)/,$(+maybe-sysdeps))))
|
||||
|
||||
# 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)
|
||||
|
||||
+sysdep-names := $(sort $(notdir $(+sysdeps)))
|
||||
foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
|
||||
+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)
|
||||
+tsrcs := $(sort $(filter-out $(dont_distribute),$(+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))
|
||||
tardir := glibc-$(version)
|
||||
endif
|
||||
|
||||
$(..)glibc-%:
|
||||
ln -s . $@
|
||||
|
||||
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))
|
||||
|
||||
.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-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
|
||||
ifdef sysdep-Subdir-files
|
||||
subdirs := $(sort $(subdirs) $(shell cat $(sysdep-Subdir-files)))
|
||||
endif
|
||||
+sysdep-dist := $(foreach file,$(+sysdep-distfiles),\
|
||||
$(addprefix $(dir $(file)),$(shell cat $(file)))) \
|
||||
$(+sysdep-distfiles) \
|
||||
$(sysdep-Subdir-files)
|
||||
foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
|
||||
|
||||
+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies,\
|
||||
$(addsuffix /$(file),$(sysdep_dirs)))) \
|
||||
$(+sysdep-dist)
|
||||
|
||||
+tsrcs := $(distribute) $(+tsrcs) $(+sysdep-tsrcs)
|
||||
|
||||
.PHONY: dist
|
||||
# N.B.: The order in which these are done matters (so don't use -j).
|
||||
MAKEFLAGS = -j1 # I wonder if that works.
|
||||
dist: dist.tar subdir_dist de-.. dist.tar.Z
|
||||
|
||||
dist.tar: $(tardir) $(+tsrcs)
|
||||
tar ch$(verbose)f $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
|
||||
|
||||
de-..: dist.tar
|
||||
tar xf $< -C /tmp
|
||||
tar cf $< -C /tmp $(tardir)
|
||||
-rm -fr /tmp/$(tardir)
|
||||
|
||||
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 a-w $@
|
||||
|
||||
INSTALL: manual/maint.texinfo
|
||||
makeinfo +no-validate +no-warn +no-headers $<
|
||||
|
||||
%.Z: %
|
||||
compress -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
|
||||
|
||||
endif # Subdirectory vs. parent makefile
|
||||
|
||||
# Get these things out of the environment because they take up lots of space.
|
||||
override distribute :=
|
||||
override sources :=
|
||||
override objects :=
|
||||
override routines :=
|
||||
override aux :=
|
||||
280
gnu/glibc/glibc-1.03/Makeconfig
Normal file
280
gnu/glibc/glibc-1.03/Makeconfig
Normal file
@@ -0,0 +1,280 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
# You can put variables that are specific to a configuration in the file
|
||||
# Makeconfig in the object directory for that configuration. Variables
|
||||
# that do not vary between different configurations at your site can be
|
||||
# editted below.
|
||||
|
||||
ifndef ARCH
|
||||
ifdef machine
|
||||
ARCH = $(machine)
|
||||
else
|
||||
include $(..)config.status
|
||||
endif
|
||||
endif
|
||||
|
||||
# Directory for object files, libc.a, and ansi/ and trad/ directories.
|
||||
# If this is not defined, the object files live in the subdirectories
|
||||
# where their sources live, and libc.a and the ansi/ and trad/ directories
|
||||
# live in the parent directory (this probably doesn't work any more).
|
||||
ifdef ARCH
|
||||
ifeq ($(filter /%,$(ARCH)),)
|
||||
objdir := $(..)$(ARCH)
|
||||
else
|
||||
objdir = $(ARCH)
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(objdir)/Makeconfig),)
|
||||
include $(objdir)/Makeconfig
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# These are the configuration variables.
|
||||
#
|
||||
|
||||
|
||||
# Common prefix for all installation directories.
|
||||
ifndef prefix
|
||||
prefix = /usr/local
|
||||
endif
|
||||
|
||||
# Where to install the library and object files.
|
||||
ifndef libdir
|
||||
libdir = $(prefix)/lib
|
||||
endif
|
||||
|
||||
# Where to install the header files. There are two sets of header files
|
||||
# produced, an ANSI C set and a traditional C set. ansi-incldir, if
|
||||
# defined, is where to install the ANSI C set; trad-incldir, if defined, is
|
||||
# where to install the traditional C set. If you define both, you can
|
||||
# install both sets, in different places.
|
||||
ifndef ansi-incldir
|
||||
ansi-incldir = $(prefix)/include
|
||||
endif
|
||||
ifndef trad-incldir
|
||||
#trad-incldir = $(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)/lib
|
||||
endif
|
||||
|
||||
# Where to install programs.
|
||||
ifndef bindir
|
||||
bindir = $(prefix)/bin
|
||||
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 file
|
||||
# whose contents $(localtime) specifies. If this is a relative
|
||||
# pathname, it is relative to $(datadir)/zoneinfo.
|
||||
ifndef localtime-file
|
||||
localtime-file = 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.
|
||||
ifndef posixrules
|
||||
posixrules = US/Eastern
|
||||
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 $(datadir)/zoneinfo.
|
||||
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)
|
||||
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 -pipe
|
||||
endif
|
||||
|
||||
# These are preprocessor macros we want to predefine.
|
||||
# Define HAVE_GNU_LD if using GNU ld (which you should do if possible).
|
||||
# If you do this, you may need the GNU assembler as well.
|
||||
# If you don't do this, your library won't work as well (and won't be strictly
|
||||
# compliant with the ANSI C standard).
|
||||
+defines = $(defines) -DHAVE_GNU_LD
|
||||
|
||||
# Default flags to pass the C compiler.
|
||||
ifndef default_cflags
|
||||
+default_cflags := -g
|
||||
endif
|
||||
|
||||
# Command for linking programs with the C library.
|
||||
+link = $(LD) -o $@ -e __start $(objpfx)start.o $(^:lib=$(objpfx)libc.a) $(libdir)/gcc-gnulib $(objpfx)libc.a -lc
|
||||
|
||||
ifndef LD
|
||||
LD := ld -X
|
||||
endif
|
||||
|
||||
ifndef RANLIB
|
||||
RANLIB = ranlib
|
||||
endif
|
||||
|
||||
# Define non-empty if the C compiler understands -v (print version).
|
||||
+cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc
|
||||
|
||||
# Extra flags to pass to GCC.
|
||||
+gccwarn := -Wall -Wwrite-strings -Wpointer-arith -Wstrict-prototypes
|
||||
+gccopt := -fstrength-reduce -fcombine-regs
|
||||
|
||||
# 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 -tw
|
||||
|
||||
ifdef objdir
|
||||
objpfx = $(objdir)/
|
||||
libc.a = $(objpfx)libc.a
|
||||
else
|
||||
objpfx :=
|
||||
libc.a = $(..)libc.a
|
||||
endif
|
||||
|
||||
# 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)
|
||||
ifneq "$(filter -O,$(+cflags))" ""
|
||||
+cflags := $(+cflags) $(+gccopt)
|
||||
endif
|
||||
endif # gcc
|
||||
|
||||
# Don't duplicate options if we inherited variables from the parent.
|
||||
+cflags := $(sort $(+cflags))
|
||||
|
||||
|
||||
ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v
|
||||
ifneq "$(strip $(+cc_version))" ""
|
||||
# If Make is telling us version info, tell the compiler to do so as well.
|
||||
CC := $(CC) -v
|
||||
endif # +cc_version
|
||||
endif # -v
|
||||
|
||||
# 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.
|
||||
ifneq "$(..)" ""
|
||||
+includes = -I. -I$(patsubst %/,%,$(..)) $(includes)
|
||||
else
|
||||
+includes = -I. $(includes)
|
||||
endif
|
||||
|
||||
|
||||
# These are the variables that the implicit compilation rules use.
|
||||
CPPFLAGS = $(+includes) $(+defines) -DLIBC
|
||||
override CFLAGS = $(+cflags)
|
||||
|
||||
|
||||
# This is the macro that the implicit linking rules use.
|
||||
ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
|
||||
LDFLAGS := -g
|
||||
endif
|
||||
|
||||
|
||||
ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
|
||||
+gnu-stabs := yes
|
||||
endif
|
||||
|
||||
|
||||
endif # Makeconfig not yet included
|
||||
166
gnu/glibc/glibc-1.03/Makefile
Normal file
166
gnu/glibc/glibc-1.03/Makefile
Normal file
@@ -0,0 +1,166 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# 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 headers others # doc
|
||||
|
||||
include Makeconfig
|
||||
|
||||
include $(objpfx)sysd-dirs
|
||||
define \n
|
||||
|
||||
|
||||
endef
|
||||
+sysdep-subdirs := $(subst $(\n), ,$(+sysdep-subdirs))
|
||||
|
||||
# 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
|
||||
subdirs := $(strip $(+ansi_dirs) $(+posix_dirs) $(+other_dirs) \
|
||||
$(sysdep-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 mostlyclean subdir_clean\
|
||||
tests subdir_lint.out subdir_TAGS subdir_headers \
|
||||
subdir_echo-headers subdir_echo-distinfo subdir_install
|
||||
|
||||
headers := features.h errno.h errnos.h limits.h $(stddef.h) \
|
||||
float.h fl.h
|
||||
|
||||
headers: subdir_headers
|
||||
|
||||
echo-headers: subdir_echo-headers
|
||||
|
||||
ifdef +gnu-stabs
|
||||
# We're using the GNU linker, so we use the set-element init function.
|
||||
+init := set-init
|
||||
else
|
||||
# We're not using the GNU linker, so we use the munch init function.
|
||||
+init := munch-init
|
||||
|
||||
$(objpfx)munch-init.c: munch.awk munch-tmpl.c $(+subdir_inits)
|
||||
awk -f $< subdirs='$(+init_subdirs)' $(word 2,$^) > $@-tmp
|
||||
mv $@-tmp $@
|
||||
endif
|
||||
|
||||
aux := sysdep $(+init) version start
|
||||
|
||||
|
||||
# What to install.
|
||||
install-lib = libc.a crt0.o Mcrt1.o
|
||||
|
||||
|
||||
include Makerules
|
||||
|
||||
# Install from subdirectories too.
|
||||
install: subdir_install
|
||||
|
||||
# `crt0' is the traditional name for the startup code,
|
||||
# so that's what we install start.o as.
|
||||
$(objpfx)crt0.o: $(objpfx)start.o
|
||||
-rm -f $@
|
||||
ln $< $@
|
||||
|
||||
$(objpfx)Mcrt1.o:
|
||||
touch $@
|
||||
|
||||
lib: subdir_lib
|
||||
|
||||
|
||||
$(objpfx)sysd-dirs: $(+sysdir_pfx)sysdirs
|
||||
(echo define sysdep-subdirs; \
|
||||
for dir in `cat $<`; do \
|
||||
if [ -r $(sysdep_dir)/$$dir/Subdirs ]; then \
|
||||
cat $(sysdep_dir)/$$dir/Subdirs; \
|
||||
else true; \
|
||||
fi; \
|
||||
done; \
|
||||
echo endef) > $@-tmp
|
||||
mv $@-tmp $@
|
||||
|
||||
# This makes the Info file of the documentation from the Texinfo source.
|
||||
.PHONY: doc
|
||||
doc:
|
||||
$(MAKE) -C manual
|
||||
|
||||
# This makes all the subdirectory targets.
|
||||
.PHONY: $(+subdir_targets)
|
||||
$(+subdir_targets):
|
||||
@lose=nil; \
|
||||
for dir in $(subdirs); do \
|
||||
$(+cmdecho) $(MAKE) -C $$dir $@;\
|
||||
$(MAKE) -C $$dir $@ || lose=t; \
|
||||
done; \
|
||||
test $$lose = nil
|
||||
|
||||
# This clobbers everything that can be regenerated.
|
||||
.PHONY: clean realclean
|
||||
realclean: clean
|
||||
clean:
|
||||
-rm -f $(objects) $(+depfiles) munch-init.c
|
||||
-rm -f $(libc.a) dist.tar lint.out core TAGS
|
||||
-rm -f -r ansi/ trad/
|
||||
# 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
|
||||
|
||||
parent_TAGS: $(+allsources)
|
||||
$(etags) $^
|
||||
|
||||
.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+,$(dont_distribute))
|
||||
|
||||
# Make the distribution tarfile.
|
||||
|
||||
distribute := README INSTALL NOTES Q+A COPYING.LIB ChangeLog \
|
||||
Makefile Makeconfig Makerules Rules Make-dist \
|
||||
ansidecl.m4 ansidecl ansidecl.h \
|
||||
configure find-sysdirs \
|
||||
munch-tmpl.c munch.awk gnu-stabs.h sysdep.h
|
||||
|
||||
distribute := $(strip $(distribute))
|
||||
|
||||
.PHONY: dist
|
||||
dist: Make-dist
|
||||
$(MAKE) -f $< no_deps=t $(Make-dist-args)
|
||||
320
gnu/glibc/glibc-1.03/Makerules
Normal file
320
gnu/glibc/glibc-1.03/Makerules
Normal file
@@ -0,0 +1,320 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Propagated rules for making the GNU C library.
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
|
||||
ifdef 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
|
||||
|
||||
ifneq ($(findstring e,$(MAKEFLAGS)),)
|
||||
You must not use the -e flag when building the GNU C library.
|
||||
endif
|
||||
|
||||
# If defined, these will determine the value of `sources'.
|
||||
ifneq "$(findstring env,$(origin routines))" ""
|
||||
routines :=
|
||||
endif
|
||||
ifneq "$(findstring env,$(origin aux))" ""
|
||||
aux :=
|
||||
endif
|
||||
|
||||
endif # subdir
|
||||
|
||||
ifndef +included-Makeconfig
|
||||
include $(..)Makeconfig
|
||||
endif
|
||||
|
||||
# In make v4, we'll be able to really do this right (or something like that).
|
||||
ifeq (,)
|
||||
up-one = $(patsubst %/,%,$(dir $0))
|
||||
parents-of = $(foreach x,$0,$(notdir $x) \
|
||||
$(ifeq $(dir $x),./,$(parents-of $(up-one $x))))
|
||||
# Finish this someday....
|
||||
endif
|
||||
|
||||
ifdef objdir
|
||||
+sysdir_pfx = $(objpfx)
|
||||
else
|
||||
+sysdir_pfx = $(..)
|
||||
endif
|
||||
|
||||
# Right now, however, we do it with shell scripts and lots of strangeness.
|
||||
sysdep_dir := $(..)sysdeps
|
||||
ifndef sysdirs
|
||||
include $(+sysdir_pfx)sysdirs
|
||||
define \n
|
||||
|
||||
|
||||
endef
|
||||
sysdirs := $(subst $(\n), ,$(sysdirs))
|
||||
endif
|
||||
$(+sysdir_pfx)sysdirs: $(+sysdir_pfx)Sysnames $(..)find-sysdirs
|
||||
(echo define sysdirs; \
|
||||
$(dir $(word 2,$^))$(notdir $(word 2,$^)) < $<; \
|
||||
echo endef) > $@
|
||||
$(+sysdir_pfx)Sysnames:
|
||||
@(echo The GNU C Library has not been configured! ;\
|
||||
echo Run \`configure\' to configure it before building.\
|
||||
) >&2; exit 1
|
||||
|
||||
# Turn the list of sysdep names into a colon-separated list of directories
|
||||
# under SYSDEP_DIR (the base directory for sysdep files), and tell Make to
|
||||
# search for C and header files in those directories.
|
||||
+sysdep_dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
|
||||
ifdef objdir
|
||||
+sysdep_dirs := $(objdir) $(+sysdep_dirs)
|
||||
endif
|
||||
sysdep_path := $(subst $+ ,:,$(+sysdep_dirs))
|
||||
ifeq (,)
|
||||
override VPATH := $(sysdep_path)
|
||||
else
|
||||
vpath %.c $(sysdep_path)
|
||||
vpath %.S $(sysdep_path)
|
||||
vpath %.s $(sysdep_path)
|
||||
vpath %.h $(sysdep_path)
|
||||
endif
|
||||
|
||||
# Add -I switches to get the right sysdep directories.
|
||||
+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
|
||||
override CPPFLAGS := $(strip $(filter-out $(+sysdep-includes),$(CPPFLAGS)) \
|
||||
$(+sysdep-includes))
|
||||
|
||||
# Include any system-specific makefiles.
|
||||
|
||||
ifeq ($(wildcard $(+sysdir_pfx)sysdep-Makefile),)
|
||||
# Don't do deps until this exists, because it might change the sources list.
|
||||
no_deps=t
|
||||
endif
|
||||
|
||||
include $(+sysdir_pfx)sysdep-Makefile
|
||||
$(+sysdir_pfx)sysdep-Makefile: $(+sysdir_pfx)sysdirs
|
||||
(for dir in `cat $<`; do \
|
||||
file=sysdeps/$$dir/Makefile; \
|
||||
if [ -r $(..)$$file ]; then \
|
||||
echo include "\$$(..)$$file"; \
|
||||
else true; \
|
||||
fi; \
|
||||
done) > $@
|
||||
|
||||
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.
|
||||
# Remove the RCS and SCCS rules.
|
||||
%: %,v
|
||||
%: RCS/%,v
|
||||
%: s.%
|
||||
%: SCCS/s.%
|
||||
|
||||
# Add the suffixes we use.
|
||||
.SUFFIXES: .a .o .S .s .c .h .dep .m4
|
||||
|
||||
# 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)
|
||||
|
||||
# Figure out the source filenames in this directory.
|
||||
|
||||
override sources := $(addsuffix .c,$(routines) $(aux) \
|
||||
$(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))
|
||||
|
||||
# The order of these rules is important.
|
||||
|
||||
ifndef .S-rule # Bletch.
|
||||
$(objpfx)%.o: %.S $(before-compile)
|
||||
$(COMPILE.S) $< $(OUTPUT_OPTION)
|
||||
endif
|
||||
$(objpfx)%.o: %.s $(before-compile)
|
||||
$(COMPILE.s) $< $(OUTPUT_OPTION)
|
||||
$(objpfx)%.o: %.c $(before-compile)
|
||||
$(COMPILE.c) $< $(OUTPUT_OPTION)
|
||||
|
||||
# This makes all the object files in the parent library archive.
|
||||
|
||||
.PHONY: lib lib-noranlib libobjs
|
||||
lib: lib-noranlib
|
||||
$(RANLIB) $(libc.a)
|
||||
libobjs: lib-noranlib
|
||||
lib-noranlib: $(libc.a) ar-it
|
||||
$(libc.a): %: $(addprefix %,$(patsubst $(objpfx)%,(%),$(objects)))
|
||||
# $(AR) $(ARFLAGS) $@ $(patsubst $@(%),%,$?)
|
||||
|
||||
define +libc_lock_open
|
||||
@. $(..)libc-lock-open
|
||||
endef
|
||||
define +libc_lock_close
|
||||
@rm -f $(..)LOCK-libc.a
|
||||
endef
|
||||
|
||||
# Temporary until I get a better solution.
|
||||
.PHONY: ar-it
|
||||
ar-it: $(objects)
|
||||
# $(+libc_lock_open)
|
||||
ifdef objdir
|
||||
cd $(objdir); $(AR) ru$(verbose) libc.a $(patsubst $(objpfx)%,%,$^)
|
||||
else
|
||||
$(AR) u$(verbose) $(libc.a) $^
|
||||
endif
|
||||
# $(+libc_lock_close)
|
||||
|
||||
ifdef objects
|
||||
$(patsubst %,$(libc.a)(%),$(notdir $(objects))): $(libc.a)(%): $(objpfx)%;
|
||||
endif
|
||||
|
||||
|
||||
# This makes all the object files.
|
||||
.PHONY: objects objs
|
||||
objects objs: $(objects)
|
||||
|
||||
# Make the ansi and trad versions of the headers from the ansidecl sources.
|
||||
|
||||
headers := $(headers) $(sysdep_headers)
|
||||
|
||||
ifdef objpfx
|
||||
+headers_pfx = $(objpfx)
|
||||
else
|
||||
+headers_pfx = $(..)
|
||||
endif
|
||||
|
||||
+header_dirs := $(filter-out ./,$(dir $(headers)))
|
||||
|
||||
.PHONY: headers
|
||||
headers: $(+headers_pfx)ansi/ \
|
||||
$(addprefix $(+headers_pfx)ansi/,$(+header_dirs) $(headers)) \
|
||||
$(+headers_pfx)trad/ \
|
||||
$(addprefix $(+headers_pfx)trad/,$(+header_dirs) $(headers))
|
||||
|
||||
%/:
|
||||
# mkdir isn't smart enough to strip a trailing /.
|
||||
mkdir $(@:%/=%)
|
||||
|
||||
$(+headers_pfx)ansi/%: % $(..)ansidecl $(..)ansidecl.m4;$(+ansideclificate)
|
||||
$(+headers_pfx)trad/%: % $(..)ansidecl $(..)ansidecl.m4;$(+ansideclificate)
|
||||
|
||||
# The bit with awk is to remove all the newlines from
|
||||
# ansidecl.m4, so the output doesn't have 20 blank
|
||||
# lines at the beginning.
|
||||
+ansideclificate = $(dir $(word 2,$^))$(notdir $(word 2,$^)) \
|
||||
-$(firstword $(subst /, ,$(@:$(+headers_pfx)%=%))) $< > $@
|
||||
|
||||
|
||||
.PHONY: echo-headers
|
||||
echo-headers:
|
||||
@echo $(headers)
|
||||
|
||||
# Installation.
|
||||
|
||||
ifneq "$(findstring env,$(origin install-lib))" ""
|
||||
override install-lib :=
|
||||
endif
|
||||
ifneq "$(findstring env,$(origin install-data))" ""
|
||||
override install-data :=
|
||||
endif
|
||||
ifneq "$(findstring env,$(origin install))" ""
|
||||
override install :=
|
||||
endif
|
||||
|
||||
# install-lib are installed from the object directory into libdir.
|
||||
# install-data are installed as they are into datadir.
|
||||
# headers are installed from the object directory header directories into
|
||||
# one or both of ansi-incldir and trad-incldir.
|
||||
|
||||
do-install = $(INSTALL_DATA) $< $@
|
||||
|
||||
ifdef install
|
||||
$(addprefix $(bindir)/,$(install)): $(bindir)/%: $(objpfx)%
|
||||
$(INSTALL) $< $@
|
||||
endif
|
||||
ifdef install-lib
|
||||
$(addprefix $(libdir)/,$(install-lib)): $(libdir)/%: $(objpfx)%;$(do-install)
|
||||
endif
|
||||
ifdef install-data
|
||||
$(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install)
|
||||
endif
|
||||
+install := $(addprefix $(libdir)/,$(install-lib)) \
|
||||
$(addprefix $(datadir)/,$(install-data)) \
|
||||
$(addprefix $(bindir)/,$(install))
|
||||
ifdef headers
|
||||
ifdef ansi-incldir
|
||||
$(addprefix $(ansi-incldir)/,$(headers)): \
|
||||
$(ansi-incldir)/%: $(objpfx)ansi/%;$(do-install)
|
||||
+install := $(+install) $(addprefix $(ansi-incldir)/,$(headers))
|
||||
endif
|
||||
ifdef trad-incldir
|
||||
$(addprefix $(trad-incldir)/,$(headers)): \
|
||||
$(trad-incldir)/%: $(objpfx)trad/%;$(do-install)
|
||||
+install := $(+install) $(addprefix $(trad-incldir)/,$(headers))
|
||||
endif
|
||||
endif # headers
|
||||
+install := $(filter-out $(addprefix %/,$(no-install)),$(+install))
|
||||
|
||||
.PHONY: install
|
||||
install: $(dir $(+install)) $(+install)
|
||||
|
||||
define +make-deps
|
||||
$(+mkdep) $(CPPFLAGS) $< | sed 's,$*\.o,$(@:.dep=.o) $@,' > $@
|
||||
endef
|
||||
|
||||
# N.B.: The order of these two rules is important.
|
||||
$(objpfx)%.dep: %.S $(before-compile)
|
||||
$(+make-deps)
|
||||
$(objpfx)%.dep: %.c $(before-compile)
|
||||
$(+make-deps)
|
||||
|
||||
+depfiles := $(strip $(sources:.c=.dep) $(addsuffix .dep,$(others) $(tests)))
|
||||
+depfiles := $(addprefix $(objpfx),$(+depfiles))
|
||||
$(objpfx)depend-$(subdir): Makefile
|
||||
ifdef +depfiles
|
||||
(for file in $(patsubst $(objpfx)%,%,$(+depfiles)); do \
|
||||
echo "include $(objpfx)$$file"; \
|
||||
done) > $@
|
||||
else
|
||||
cp /dev/null $@
|
||||
endif
|
||||
75
gnu/glibc/glibc-1.03/NOTES
Normal file
75
gnu/glibc/glibc-1.03/NOTES
Normal file
@@ -0,0 +1,75 @@
|
||||
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
|
||||
Options: (gcc.info)Options, for more information about GCC options.
|
||||
|
||||
You should define these macros by using `#define' preprocessor
|
||||
directives at the top of your source code files. 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.
|
||||
|
||||
-- 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
|
||||
|
||||
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 as 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.
|
||||
|
||||
51
gnu/glibc/glibc-1.03/Q+A
Normal file
51
gnu/glibc/glibc-1.03/Q+A
Normal file
@@ -0,0 +1,51 @@
|
||||
The full manual for the GNU C library is currently under construction.
|
||||
In the mean time, here are some answers to common questions.
|
||||
|
||||
Q: What's it run on?
|
||||
A: The Fully Supported Systems are currently sun4 and hp9k300 running
|
||||
mt xinu 4.3BSD.
|
||||
|
||||
Q: What do I need to do to port the library to a new system?
|
||||
A: For starters, look at sysdep.h. That defines some macros which are
|
||||
used by many .S files which define the system calls. Most of the
|
||||
.S files are in machine-independent directories: unix, unix/bsd,
|
||||
etc. sysdep.h in the machine-dependent directories gives the gory
|
||||
details (see, for example, unix/bsd/sun/sun4/sysdep.h). Then email
|
||||
roland@prep.ai.mit.edu.
|
||||
|
||||
Q: Can I use pieces of this library for ...
|
||||
A: Yes. Please read the file COPYING.LIB for details.
|
||||
|
||||
Q: Can I use this library as a drop in replacement for /lib/libc.a or
|
||||
/usr/include?
|
||||
A: Not fully. On Fully Supported Systems, the library should be able
|
||||
function in this manner for many programs, but not all.
|
||||
|
||||
Q: Is this the long awaited GNU system?
|
||||
A: No. But it's a big part of it. When properly installed, the
|
||||
library and header files will provide source level emulation of GNU
|
||||
on Fully Supported Systems for many programs. GNU will have a lot
|
||||
of important functionality that the GNU C library on Unix does not
|
||||
give you. The purpose of the GNU C library on Unix is to give you
|
||||
a clean, standard-conformant library and set of header files that
|
||||
you can use to write POSIX/Unix programs and run them on your
|
||||
existing Unix system (which doesn't conform to the standards, or
|
||||
give you extra GNU extensions). Soon, the same programs will run
|
||||
under GNU with no source modification necessarily required.
|
||||
|
||||
Q: Can I use this library to compile bsd (sysv) code on a sysv (bsd)
|
||||
machine?
|
||||
A: Yes but. If the question is whether you can compile programs that
|
||||
were written for BSD on system V and vice-versa, the answer is yes (to
|
||||
some extent). The C library doesn't go to great pains to simulate
|
||||
facilities that the underlying operating system just doesn't provide;
|
||||
but it implements both BSD and System V interfaces to whatever system it
|
||||
is built for, emulating one flavor with the other where it is not
|
||||
difficult (like utime vs utimes, bcopy vs memcpy, strchr vs index,
|
||||
etc.). And you can use the feature test macros (see NOTES) to try to
|
||||
make the library appear to programs as whichever flavor of system you
|
||||
want.
|
||||
|
||||
Q: Can I use this library to cross compile to a foobox from a widgetbox?
|
||||
A: Yes, if foobox is a Fully Supported System, this should be possible.
|
||||
|
||||
31
gnu/glibc/glibc-1.03/README
Normal file
31
gnu/glibc/glibc-1.03/README
Normal file
@@ -0,0 +1,31 @@
|
||||
This directory contains the version 1.03 test release of the GNU C Library.
|
||||
Some bugs surely remain.
|
||||
|
||||
As of this release, the GNU C library has been ported to only three machines:
|
||||
sparcs and Sun 3s running SunOS 4.1, and HP 300s running 4.3 BSD. Porting
|
||||
the library is not hard. If you are interested in doing a port, please
|
||||
get on the mailing list bug-glibc-request@prep.ai.mit.edu
|
||||
|
||||
See the file INSTALL for how to configure, build, install, and port the GNU
|
||||
C library.
|
||||
|
||||
The manual for the GNU C library is still being worked on, and is not yet
|
||||
distributed. The file Q+A contains a few questions you're likely to have,
|
||||
and some answers.
|
||||
|
||||
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.
|
||||
|
||||
Please do not send patches for the file `Makeconfig'. That file is for
|
||||
configuration. You are meant to change it to suit your needs.
|
||||
|
||||
Please note that there are some files in the distribution whose names
|
||||
exceed 14 characters in length. None of these files are needed to build
|
||||
the library on System V, where a 14 character limit on the length of file
|
||||
names is imposed, so this is harmless.
|
||||
134
gnu/glibc/glibc-1.03/Rules
Normal file
134
gnu/glibc/glibc-1.03/Rules
Normal file
@@ -0,0 +1,134 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Propagated rules for making the GNU C library
|
||||
#
|
||||
ifneq (,)
|
||||
This makefile requires GNU Make.
|
||||
endif
|
||||
|
||||
include ../Makeconfig
|
||||
|
||||
ifndef subdir
|
||||
Each subdirectory makefile must define the `subdir' variable.
|
||||
endif
|
||||
|
||||
# This is the default target; it makes the library.
|
||||
.PHONY: all
|
||||
all: lib headers
|
||||
|
||||
ifneq "$(findstring env,$(origin headers))" ""
|
||||
override headers :=
|
||||
endif
|
||||
|
||||
ifeq "$(strip $(headers))" ""
|
||||
ifneq "$(wildcard $(subdir).h)" ""
|
||||
override headers := $(subdir).h
|
||||
endif
|
||||
endif
|
||||
|
||||
include ../Makerules
|
||||
|
||||
.PHONY: subdir_lib
|
||||
subdir_lib: lib-noranlib
|
||||
|
||||
.PHONY: subdir_headers
|
||||
subdir_headers: headers
|
||||
|
||||
# This makes all the auxilliary and test programs.
|
||||
|
||||
.PHONY: others tests
|
||||
others: $(addprefix $(objpfx),$(others))
|
||||
tests: $(tests:%=$(objpfx)%.out)
|
||||
|
||||
ifneq "$(strip $(others) $(tests))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests)): %: %.o lib
|
||||
$(+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
|
||||
|
||||
# This removes everything that can be regenerated
|
||||
# except for the object files and the object-file library members.
|
||||
.PHONY: mostlyclean
|
||||
mostlyclean:
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(others))
|
||||
-rm -f core TAGS depend
|
||||
|
||||
# This removes absolutely everything that can be regenerated.
|
||||
.PHONY: subdir_clean clean realclean
|
||||
subdir_clean realclean: clean
|
||||
+objs := $(objects)
|
||||
clean: mostlyclean
|
||||
-rm -f $(+objs) $(+depfiles)
|
||||
|
||||
.PHONY: subdir_echo-headers
|
||||
subdir_echo-headers: echo-headers
|
||||
|
||||
.PHONY: subdir_echo-distinfo
|
||||
subdir_echo-distinfo:
|
||||
@echo $(addprefix +header+,$(headers)) \
|
||||
$(addprefix +nodist+,$(dont_distribute))
|
||||
|
||||
.PHONY: subdir_install
|
||||
subdir_install: install
|
||||
|
||||
# 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.
|
||||
ifeq "$(subdir)" "ctype"
|
||||
+tags_sources := *.h $(sources)
|
||||
else
|
||||
+tags_sources := $(sources) *.h
|
||||
endif
|
||||
|
||||
# This makes the tags file.
|
||||
TAGS: $(+tags_sources)
|
||||
@$(cmdecho) '$(ctags) -f $@ ...'
|
||||
@$(ctags) -f $@ $^
|
||||
.PHONY: subdir_TAGS
|
||||
subdir_TAGS: TAGS
|
||||
|
||||
# Make the distribution tarfile for the parent makefile.
|
||||
|
||||
ifneq "$(findstring env,$(origin distribute))" ""
|
||||
override distribute :=
|
||||
endif
|
||||
|
||||
.PHONY: subdir_dist dist
|
||||
subdir_dist: dist
|
||||
dist: ../Make-dist
|
||||
$(MAKE) -f $< $(Make-dist-args)
|
||||
|
||||
# Keep these out of the environment so it doesn't get too big.
|
||||
override routines :=
|
||||
override aux :=
|
||||
override objects :=
|
||||
1
gnu/glibc/glibc-1.03/a.out.h
Normal file
1
gnu/glibc/glibc-1.03/a.out.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <misc/a.out.h>
|
||||
1
gnu/glibc/glibc-1.03/alloca.h
Normal file
1
gnu/glibc/glibc-1.03/alloca.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <stdlib/alloca.h>
|
||||
52
gnu/glibc/glibc-1.03/ansidecl
Normal file
52
gnu/glibc/glibc-1.03/ansidecl
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# 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.
|
||||
|
||||
if [ $# -ne 2 -a "$1" != -m4 ]; then
|
||||
echo "Usage: $0 [-ansi | -trad] FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
-ansi) macro=ansi ;;
|
||||
-trad) macro=trad ;;
|
||||
-m4) ansidecl=$2; macro=$3; shift; shift ;;
|
||||
*) echo "Usage: $0 [-ansi | -trad] FILE" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
file="$2"
|
||||
|
||||
if [ "$ansidecl" ]; then
|
||||
: Nothing.
|
||||
elif [ -r ansidecl.m4 ]; then
|
||||
ansidecl=ansidecl.m4
|
||||
elif [ -r ../ansidecl.m4 ]; then
|
||||
ansidecl=../ansidecl.m4
|
||||
else
|
||||
echo "$0: Can't find ansidecl.m4 in . or .." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Tell GNU m4 to shut up.
|
||||
M4OPTS=+quiet
|
||||
export M4OPTS
|
||||
|
||||
( echo "define(${macro},1)"; cat $ansidecl; cat "$file" ) |
|
||||
m4 | awk 'BEGIN { beginning = 1; }
|
||||
/^$/ { if (!beginning) printf "\n"; }
|
||||
/./ { beginning = 0; print $0; }'
|
||||
108
gnu/glibc/glibc-1.03/ansidecl.h
Normal file
108
gnu/glibc/glibc-1.03/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 */
|
||||
93
gnu/glibc/glibc-1.03/ansidecl.m4
Normal file
93
gnu/glibc/glibc-1.03/ansidecl.m4
Normal file
@@ -0,0 +1,93 @@
|
||||
ifdef(`comment',`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 General Public License as published by
|
||||
the Free Software Foundation; either version 2, 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.
|
||||
')
|
||||
|
||||
define(IGNORE,)
|
||||
define(STARTCOMMENT,`/*')
|
||||
define(ENDCOMMENT,`*/')
|
||||
define(INCLUDE,`include('$1`)')
|
||||
|
||||
ifdef(`ansi',`
|
||||
define(PTR,void *)
|
||||
define(LONG_DOUBLE,long double)
|
||||
|
||||
define(AND,`,')
|
||||
define(NOARGS,void)
|
||||
define(CONST,const)
|
||||
define(VOLATILE,volatile)
|
||||
define(SIGNED,signed)
|
||||
define(DOTS,`, ...')
|
||||
|
||||
define(EXFUN,$1$2)
|
||||
define(DEFUN,$1($3))
|
||||
define(DEFUN_VOID,$1(NOARGS))
|
||||
|
||||
define(IFANSI,$1)
|
||||
define(IFNANSI,)
|
||||
define(IFTRAD,)
|
||||
define(IFNTRAD,$1)
|
||||
')
|
||||
|
||||
ifdef(`trad',`
|
||||
define(PTR,char *)
|
||||
define(LONG_DOUBLE,double)
|
||||
|
||||
define(AND,;
|
||||
)
|
||||
define(NOARGS,)
|
||||
define(CONST,)
|
||||
define(VOLATILE,)
|
||||
define(SIGNED,)
|
||||
define(DOTS,)
|
||||
|
||||
define(EXFUN,$1())
|
||||
define(DEFUN,$1$2
|
||||
$3;)
|
||||
define(DEFUN_VOID,$1())
|
||||
|
||||
define(IFTRAD,$1)
|
||||
define(IFNTRAD,)
|
||||
define(IFANSI,)
|
||||
define(IFNANSI,$1)
|
||||
')
|
||||
|
||||
dnl Undefine all the standard m4 functions.
|
||||
changequote($, $)
|
||||
undefine($changequote$)
|
||||
undefine($regexp$)
|
||||
undefine($define$)
|
||||
undefine($divert$)
|
||||
undefine($divnum$)
|
||||
dnl undefine($include$)
|
||||
undefine($dnl$)
|
||||
undefine($dumpdef$)
|
||||
undefine($errprint$)
|
||||
undefine($eval$)
|
||||
undefine($ifdef$)
|
||||
undefine($incr$)
|
||||
undefine($index$)
|
||||
undefine($len$)
|
||||
undefine($maketemp$)
|
||||
undefine($shift$)
|
||||
undefine($sinclude$)
|
||||
undefine($substr$)
|
||||
undefine($syscmd$)
|
||||
undefine($translit$)
|
||||
undefine($undivert$)
|
||||
undefine($unix$)
|
||||
undefine($ifelse$)
|
||||
undefine($undefine$)
|
||||
78
gnu/glibc/glibc-1.03/arpa/ftp.h
Normal file
78
gnu/glibc/glibc-1.03/arpa/ftp.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)ftp.h 5.3 (Berkeley) 6/27/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for FTP
|
||||
* See RFC-765
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reply codes.
|
||||
*/
|
||||
#define PRELIM 1 /* positive preliminary */
|
||||
#define COMPLETE 2 /* positive completion */
|
||||
#define CONTINUE 3 /* positive intermediate */
|
||||
#define TRANSIENT 4 /* transient negative completion */
|
||||
#define ERROR 5 /* permanent negative completion */
|
||||
|
||||
/*
|
||||
* Type codes
|
||||
*/
|
||||
#define TYPE_A 1 /* ASCII */
|
||||
#define TYPE_E 2 /* EBCDIC */
|
||||
#define TYPE_I 3 /* image */
|
||||
#define TYPE_L 4 /* local byte size */
|
||||
|
||||
/*
|
||||
* Form codes
|
||||
*/
|
||||
#define FORM_N 1 /* non-print */
|
||||
#define FORM_T 2 /* telnet format effectors */
|
||||
#define FORM_C 3 /* carriage control (ASA) */
|
||||
|
||||
/*
|
||||
* Structure codes
|
||||
*/
|
||||
#define STRU_F 1 /* file (no record structure) */
|
||||
#define STRU_R 2 /* record structure */
|
||||
#define STRU_P 3 /* page structure */
|
||||
|
||||
/*
|
||||
* Mode types
|
||||
*/
|
||||
#define MODE_S 1 /* stream */
|
||||
#define MODE_B 2 /* block */
|
||||
#define MODE_C 3 /* compressed */
|
||||
|
||||
/*
|
||||
* Record Tokens
|
||||
*/
|
||||
#define REC_ESC '\377' /* Record-mode Escape */
|
||||
#define REC_EOR '\001' /* Record-mode End-of-Record */
|
||||
#define REC_EOF '\002' /* Record-mode End-of-File */
|
||||
|
||||
/*
|
||||
* Block Header
|
||||
*/
|
||||
#define BLK_EOR 0x80 /* Block is End-of-Record */
|
||||
#define BLK_EOF 0x40 /* Block is End-of-File */
|
||||
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
|
||||
#define BLK_RESTART 0x10 /* Block is Restart Marker */
|
||||
|
||||
#define BLK_BYTECOUNT 2 /* Bytes in this block */
|
||||
38
gnu/glibc/glibc-1.03/arpa/inet.h
Normal file
38
gnu/glibc/glibc-1.03/arpa/inet.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)inet.h 5.4 (Berkeley) 6/1/90
|
||||
*/
|
||||
|
||||
/* External definitions for functions in inet(3) */
|
||||
|
||||
#ifdef __STDC__
|
||||
extern unsigned long inet_addr(const char *);
|
||||
extern char *inet_ntoa(struct in_addr);
|
||||
extern struct in_addr inet_makeaddr(int , int);
|
||||
extern unsigned long inet_network(const char *);
|
||||
extern unsigned long inet_lnaof(struct in_addr);
|
||||
extern unsigned long inet_netof(struct in_addr);
|
||||
#else
|
||||
extern unsigned long inet_addr();
|
||||
extern char *inet_ntoa();
|
||||
extern struct in_addr inet_makeaddr();
|
||||
extern unsigned long inet_network();
|
||||
extern unsigned long inet_lnaof();
|
||||
extern unsigned long inet_netof();
|
||||
#endif
|
||||
233
gnu/glibc/glibc-1.03/arpa/nameser.h
Normal file
233
gnu/glibc/glibc-1.03/arpa/nameser.h
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)nameser.h 5.24 (Berkeley) 6/1/90
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define constants based on rfc883
|
||||
*/
|
||||
#define PACKETSZ 512 /* maximum packet size */
|
||||
#define MAXDNAME 256 /* maximum domain name */
|
||||
#define MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define MAXLABEL 63 /* maximum length of domain label */
|
||||
/* Number of bytes of fixed size data in query structure */
|
||||
#define QFIXEDSZ 4
|
||||
/* number of bytes of fixed size data in resource record */
|
||||
#define RRFIXEDSZ 10
|
||||
|
||||
/*
|
||||
* Internet nameserver port number
|
||||
*/
|
||||
#define NAMESERVER_PORT 53
|
||||
|
||||
/*
|
||||
* Currently defined opcodes
|
||||
*/
|
||||
#define QUERY 0x0 /* standard query */
|
||||
#define IQUERY 0x1 /* inverse query */
|
||||
#define STATUS 0x2 /* nameserver status query */
|
||||
/*#define xxx 0x3 /* 0x3 reserved */
|
||||
/* non standard */
|
||||
#define UPDATEA 0x9 /* add resource record */
|
||||
#define UPDATED 0xa /* delete a specific resource record */
|
||||
#define UPDATEDA 0xb /* delete all nemed resource record */
|
||||
#define UPDATEM 0xc /* modify a specific resource record */
|
||||
#define UPDATEMA 0xd /* modify all named resource record */
|
||||
|
||||
#define ZONEINIT 0xe /* initial zone transfer */
|
||||
#define ZONEREF 0xf /* incremental zone referesh */
|
||||
|
||||
/*
|
||||
* Currently defined response codes
|
||||
*/
|
||||
#define NOERROR 0 /* no error */
|
||||
#define FORMERR 1 /* format error */
|
||||
#define SERVFAIL 2 /* server failure */
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
/* non standard */
|
||||
#define NOCHANGE 0xf /* update failed to change db */
|
||||
|
||||
/*
|
||||
* Type values for resources and queries
|
||||
*/
|
||||
#define T_A 1 /* host address */
|
||||
#define T_NS 2 /* authoritative server */
|
||||
#define T_MD 3 /* mail destination */
|
||||
#define T_MF 4 /* mail forwarder */
|
||||
#define T_CNAME 5 /* connonical name */
|
||||
#define T_SOA 6 /* start of authority zone */
|
||||
#define T_MB 7 /* mailbox domain name */
|
||||
#define T_MG 8 /* mail group member */
|
||||
#define T_MR 9 /* mail rename name */
|
||||
#define T_NULL 10 /* null resource record */
|
||||
#define T_WKS 11 /* well known service */
|
||||
#define T_PTR 12 /* domain name pointer */
|
||||
#define T_HINFO 13 /* host information */
|
||||
#define T_MINFO 14 /* mailbox information */
|
||||
#define T_MX 15 /* mail routing information */
|
||||
#define T_TXT 16 /* text strings */
|
||||
/* non standard */
|
||||
#define T_UINFO 100 /* user (finger) information */
|
||||
#define T_UID 101 /* user ID */
|
||||
#define T_GID 102 /* group ID */
|
||||
#define T_UNSPEC 103 /* Unspecified format (binary data) */
|
||||
/* Query type values which do not appear in resource records */
|
||||
#define T_AXFR 252 /* transfer zone of authority */
|
||||
#define T_MAILB 253 /* transfer mailbox records */
|
||||
#define T_MAILA 254 /* transfer mail agent records */
|
||||
#define T_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Values for class field
|
||||
*/
|
||||
|
||||
#define C_IN 1 /* the arpa internet */
|
||||
#define C_CHAOS 3 /* for chaos net at MIT */
|
||||
#define C_HS 4 /* for Hesiod name server at MIT */
|
||||
/* Query class values which do not appear in resource records */
|
||||
#define C_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Status return codes for T_UNSPEC conversion routines
|
||||
*/
|
||||
#define CONV_SUCCESS 0
|
||||
#define CONV_OVERFLOW -1
|
||||
#define CONV_BADFMT -2
|
||||
#define CONV_BADCKSUM -3
|
||||
#define CONV_BADBUFLEN -4
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
|
||||
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
|
||||
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
|
||||
|
||||
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \
|
||||
defined(i386) || defined(BIT_ZERO_ON_RIGHT)
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#endif
|
||||
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
|
||||
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
|
||||
defined(MIPSEB) || defined (BIT_ZERO_ON_LEFT)
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#endif
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
/* you must determine what the correct bit order is for your compiler */
|
||||
UNDEFINED_BIT_ORDER;
|
||||
#endif
|
||||
/*
|
||||
* Structure for query header, the order of the fields is machine and
|
||||
* compiler dependent, in our case, the bits within a byte are assignd
|
||||
* least significant first, while the order of transmition is most
|
||||
* significant first. This requires a somewhat confusing rearrangement.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short id; /* query identification number */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
/* fields in third byte */
|
||||
u_char qr:1; /* response flag */
|
||||
u_char opcode:4; /* purpose of message */
|
||||
u_char aa:1; /* authoritive answer */
|
||||
u_char tc:1; /* truncated message */
|
||||
u_char rd:1; /* recursion desired */
|
||||
/* fields in fourth byte */
|
||||
u_char ra:1; /* recursion available */
|
||||
u_char pr:1; /* primary server required (non standard) */
|
||||
u_char unused:2; /* unused bits */
|
||||
u_char rcode:4; /* response code */
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
|
||||
/* fields in third byte */
|
||||
u_char rd:1; /* recursion desired */
|
||||
u_char tc:1; /* truncated message */
|
||||
u_char aa:1; /* authoritive answer */
|
||||
u_char opcode:4; /* purpose of message */
|
||||
u_char qr:1; /* response flag */
|
||||
/* fields in fourth byte */
|
||||
u_char rcode:4; /* response code */
|
||||
u_char unused:2; /* unused bits */
|
||||
u_char pr:1; /* primary server required (non standard) */
|
||||
u_char ra:1; /* recursion available */
|
||||
#endif
|
||||
/* remaining bytes */
|
||||
u_short qdcount; /* number of question entries */
|
||||
u_short ancount; /* number of answer entries */
|
||||
u_short nscount; /* number of authority entries */
|
||||
u_short arcount; /* number of resource entries */
|
||||
} HEADER;
|
||||
|
||||
/*
|
||||
* Defines for handling compressed domain names
|
||||
*/
|
||||
#define INDIR_MASK 0xc0
|
||||
|
||||
/*
|
||||
* Structure for passing resource records around.
|
||||
*/
|
||||
struct rrec {
|
||||
short r_zone; /* zone number */
|
||||
short r_class; /* class number */
|
||||
short r_type; /* type number */
|
||||
u_long r_ttl; /* time to live */
|
||||
int r_size; /* size of data area */
|
||||
char *r_data; /* pointer to data */
|
||||
};
|
||||
|
||||
extern u_short _getshort();
|
||||
extern u_long _getlong();
|
||||
|
||||
/*
|
||||
* Inline versions of get/put short/long.
|
||||
* Pointer is advanced; we assume that both arguments
|
||||
* are lvalues and will already be in registers.
|
||||
* cp MUST be u_char *.
|
||||
*/
|
||||
#define GETSHORT(s, cp) { \
|
||||
(s) = *(cp)++ << 8; \
|
||||
(s) |= *(cp)++; \
|
||||
}
|
||||
|
||||
#define GETLONG(l, cp) { \
|
||||
(l) = *(cp)++ << 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; \
|
||||
}
|
||||
|
||||
|
||||
#define PUTSHORT(s, cp) { \
|
||||
*(cp)++ = (s) >> 8; \
|
||||
*(cp)++ = (s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Warning: PUTLONG destroys its first argument.
|
||||
*/
|
||||
#define PUTLONG(l, cp) { \
|
||||
(cp)[3] = l; \
|
||||
(cp)[2] = (l >>= 8); \
|
||||
(cp)[1] = (l >>= 8); \
|
||||
(cp)[0] = l >> 8; \
|
||||
(cp) += sizeof(u_long); \
|
||||
}
|
||||
93
gnu/glibc/glibc-1.03/arpa/telnet.h
Normal file
93
gnu/glibc/glibc-1.03/arpa/telnet.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)telnet.h 5.3 (Berkeley) 6/27/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for the TELNET protocol.
|
||||
*/
|
||||
#define IAC 255 /* interpret as command: */
|
||||
#define DONT 254 /* you are not to use option */
|
||||
#define DO 253 /* please, you use option */
|
||||
#define WONT 252 /* I won't use option */
|
||||
#define WILL 251 /* I will use option */
|
||||
#define SB 250 /* interpret as subnegotiation */
|
||||
#define GA 249 /* you may reverse the line */
|
||||
#define EL 248 /* erase the current line */
|
||||
#define EC 247 /* erase the current character */
|
||||
#define AYT 246 /* are you there */
|
||||
#define AO 245 /* abort output--but let prog finish */
|
||||
#define IP 244 /* interrupt process--permanently */
|
||||
#define BREAK 243 /* break */
|
||||
#define DM 242 /* data mark--for connect. cleaning */
|
||||
#define NOP 241 /* nop */
|
||||
#define SE 240 /* end sub negotiation */
|
||||
#define EOR 239 /* end of record (transparent mode) */
|
||||
|
||||
#define SYNCH 242 /* for telfunc calls */
|
||||
|
||||
#ifdef TELCMDS
|
||||
char *telcmds[] = {
|
||||
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
|
||||
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
|
||||
};
|
||||
#endif
|
||||
|
||||
/* telnet options */
|
||||
#define TELOPT_BINARY 0 /* 8-bit data path */
|
||||
#define TELOPT_ECHO 1 /* echo */
|
||||
#define TELOPT_RCP 2 /* prepare to reconnect */
|
||||
#define TELOPT_SGA 3 /* suppress go ahead */
|
||||
#define TELOPT_NAMS 4 /* approximate message size */
|
||||
#define TELOPT_STATUS 5 /* give status */
|
||||
#define TELOPT_TM 6 /* timing mark */
|
||||
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
|
||||
#define TELOPT_NAOL 8 /* negotiate about output line width */
|
||||
#define TELOPT_NAOP 9 /* negotiate about output page size */
|
||||
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
|
||||
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
|
||||
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
|
||||
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
|
||||
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
|
||||
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
|
||||
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
|
||||
#define TELOPT_XASCII 17 /* extended ascic character set */
|
||||
#define TELOPT_LOGOUT 18 /* force logout */
|
||||
#define TELOPT_BM 19 /* byte macro */
|
||||
#define TELOPT_DET 20 /* data entry terminal */
|
||||
#define TELOPT_SUPDUP 21 /* supdup protocol */
|
||||
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
|
||||
#define TELOPT_SNDLOC 23 /* send location */
|
||||
#define TELOPT_TTYPE 24 /* terminal type */
|
||||
#define TELOPT_EOR 25 /* end or record */
|
||||
#define TELOPT_EXOPL 255 /* extended-options-list */
|
||||
|
||||
#ifdef TELOPTS
|
||||
#define NTELOPTS (1+TELOPT_EOR)
|
||||
char *telopts[NTELOPTS] = {
|
||||
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
|
||||
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
|
||||
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
|
||||
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
|
||||
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
|
||||
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
|
||||
};
|
||||
#endif
|
||||
|
||||
/* sub-option qualifiers */
|
||||
#define TELQUAL_IS 0 /* option is... */
|
||||
#define TELQUAL_SEND 1 /* send option */
|
||||
59
gnu/glibc/glibc-1.03/arpa/tftp.h
Normal file
59
gnu/glibc/glibc-1.03/arpa/tftp.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)tftp.h 5.2 (Berkeley) 6/27/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* Trivial File Transfer Protocol (IEN-133)
|
||||
*/
|
||||
#define SEGSIZE 512 /* data segment size */
|
||||
|
||||
/*
|
||||
* Packet types.
|
||||
*/
|
||||
#define RRQ 01 /* read request */
|
||||
#define WRQ 02 /* write request */
|
||||
#define DATA 03 /* data packet */
|
||||
#define ACK 04 /* acknowledgement */
|
||||
#define ERROR 05 /* error code */
|
||||
|
||||
struct tftphdr {
|
||||
short th_opcode; /* packet type */
|
||||
union {
|
||||
short tu_block; /* block # */
|
||||
short tu_code; /* error code */
|
||||
char tu_stuff[1]; /* request packet stuff */
|
||||
} th_u;
|
||||
char th_data[1]; /* data or error string */
|
||||
};
|
||||
|
||||
#define th_block th_u.tu_block
|
||||
#define th_code th_u.tu_code
|
||||
#define th_stuff th_u.tu_stuff
|
||||
#define th_msg th_data
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*/
|
||||
#define EUNDEF 0 /* not defined */
|
||||
#define ENOTFOUND 1 /* file not found */
|
||||
#define EACCESS 2 /* access violation */
|
||||
#define ENOSPACE 3 /* disk full or allocation exceeded */
|
||||
#define EBADOP 4 /* illegal TFTP operation */
|
||||
#define EBADID 5 /* unknown transfer ID */
|
||||
#define EEXISTS 6 /* file already exists */
|
||||
#define ENOUSER 7 /* no such user */
|
||||
1
gnu/glibc/glibc-1.03/assert.h
Normal file
1
gnu/glibc/glibc-1.03/assert.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <assert/assert.h>
|
||||
26
gnu/glibc/glibc-1.03/assert/Makefile
Normal file
26
gnu/glibc/glibc-1.03/assert/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Sub-makefile for assert portion of the library.
|
||||
#
|
||||
subdir := assert
|
||||
|
||||
routines := assert
|
||||
|
||||
include ../Rules
|
||||
45
gnu/glibc/glibc-1.03/assert/assert.c
Normal file
45
gnu/glibc/glibc-1.03/assert/assert.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* 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 <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* 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: Assertion `a == b' failed.
|
||||
It then aborts program execution via a call to abort(). */
|
||||
|
||||
int
|
||||
DEFUN(__assert_fail, (assertion, file, line),
|
||||
CONST char *assertion AND CONST char *file AND unsigned int line)
|
||||
{
|
||||
/* Print the message. */
|
||||
(void) fprintf(stderr, "%s:%u: Assertion `%s' failed.\n",
|
||||
file, line, assertion);
|
||||
(void) fflush(stderr);
|
||||
|
||||
abort();
|
||||
|
||||
/* This function never returns, so making it void would make sense,
|
||||
but returning something makes the assert macro easier to write. */
|
||||
return(0);
|
||||
}
|
||||
64
gnu/glibc/glibc-1.03/assert/assert.h
Normal file
64
gnu/glibc/glibc-1.03/assert/assert.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* ANSI Standard: 4.2 DIAGNOSTICS <assert.h>
|
||||
*/
|
||||
|
||||
#ifdef _ASSERT_H
|
||||
|
||||
#undef _ASSERT_H
|
||||
#undef assert
|
||||
#undef __assert_quotearg
|
||||
|
||||
#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)
|
||||
|
||||
#else /* Not NDEBUG. */
|
||||
|
||||
/* This prints an "Assertion failed" message and aborts. */
|
||||
extern int EXFUN(__assert_fail, (CONST char *__assertion,
|
||||
CONST char *__file, unsigned int __line));
|
||||
|
||||
/* IGNORE($ */
|
||||
#ifdef __STDC__
|
||||
/* $) IFANSI($ */
|
||||
#define __assert_quotearg(s) #s
|
||||
/* $) IGNORE($ */
|
||||
#else /* Not ANSI C. */
|
||||
/* $) IFTRAD($ */
|
||||
#define __assert_quotearg(s) "s"
|
||||
/* $) IGNORE($ */
|
||||
#endif /* ANSI C. */
|
||||
/* $) */
|
||||
|
||||
#define assert(expr) \
|
||||
((void) ((expr) || \
|
||||
__assert_fail(__assert_quotearg(expr), __FILE__, __LINE__)))
|
||||
|
||||
#endif /* NDEBUG. */
|
||||
1
gnu/glibc/glibc-1.03/bstring.h
Normal file
1
gnu/glibc/glibc-1.03/bstring.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <string/bstring.h>
|
||||
115
gnu/glibc/glibc-1.03/configure
vendored
Normal file
115
gnu/glibc/glibc-1.03/configure
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Configuration script for the GNU C Library.
|
||||
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Configure the GNU C Library.
|
||||
#
|
||||
|
||||
prog="`basename $0`"
|
||||
|
||||
if [ $# -ne 1 -a $# -ne 2 ]; then
|
||||
if [ $# -eq 0 -a "${ARCH-${machine}}" != "" ]; then
|
||||
set "${ARCH-${machine}}"
|
||||
else
|
||||
echo "Usage: $prog [-nfp] system [objdir]" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
nfp=
|
||||
|
||||
case $1 in
|
||||
-nfp | --nfp | --nf | --n)
|
||||
nfp=yes
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
vax)
|
||||
sysnames='unix/bsd/vax' ;;
|
||||
tahoe)
|
||||
sysnames='unix/bsd/tahoe' ;;
|
||||
sequent-i386 | seq386)
|
||||
sysnames='unix/bsd/seq386' ;;
|
||||
i386-sysv | i386v)
|
||||
sysnames='unix/i386/sysv' ;;
|
||||
i386-mach | i386-mach3 | i386_mach)
|
||||
sysnames='mach/i386' ;;
|
||||
sun4-os3 | sun-4-os3)
|
||||
sysnames='unix/bsd/sun/sun4 unix/bsd/sun/sunos3' ;;
|
||||
sun3-os3 | sun-3-os3)
|
||||
sysnames='unix/bsd/sun/sun3/os3' ;;
|
||||
sun4 | sun-4 | sun4-os4 | sun-4-os4)
|
||||
sysnames='unix/bsd/sun/sun4 unix/bsd/sun/sunos4' ;;
|
||||
sun3 | sun-3 | sun3-os4 | sun-3-os4)
|
||||
fpu=m68k/68881
|
||||
sysnames='unix/bsd/sun/sun3 unix/bsd/sun/sunos4' ;;
|
||||
news | news800)
|
||||
fpu=m68k/68881
|
||||
sysnames='unix/bsd/news' ;;
|
||||
hp300 | hp9k3bsd)
|
||||
fpu=m68k/68881
|
||||
sysnames='unix/bsd/hp9k3bsd' ;;
|
||||
hp800 | hp9k8)
|
||||
sysnames='unix/bsd/hp9k8' ;;
|
||||
*)
|
||||
echo ${prog}: System \`$1\' unrecognized. >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
if [ ! "$nfp" ]; then
|
||||
sysnames="$fpu $sysnames"
|
||||
fi
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
objdir=$2
|
||||
else
|
||||
objdir=$1
|
||||
fi
|
||||
|
||||
if [ ! -d $objdir ]; then
|
||||
if mkdir $objdir; then
|
||||
true;
|
||||
else
|
||||
echo "$prog: Couldn't make directory $objdir" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $sysnames > $objdir/Sysnames
|
||||
|
||||
cat - $objdir/Sysnames <<END
|
||||
Configuring the GNU C Library for \`$1'.
|
||||
Object files, etc. will go in the directory \`$objdir'.
|
||||
Using system-dependent files from directories:
|
||||
END
|
||||
|
||||
rm -f $objdir/sysdirs
|
||||
|
||||
ARCH=$objdir
|
||||
export ARCH
|
||||
|
||||
echo "#define LIBC_MACHINE \"$1\"" > $objdir/config-name.h
|
||||
|
||||
echo "ARCH=$ARCH" > config.status
|
||||
|
||||
exit 0
|
||||
1
gnu/glibc/glibc-1.03/ctype.h
Normal file
1
gnu/glibc/glibc-1.03/ctype.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <ctype/ctype.h>
|
||||
31
gnu/glibc/glibc-1.03/ctype/Makefile
Normal file
31
gnu/glibc/glibc-1.03/ctype/Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
# 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 ctype portion of the library.
|
||||
#
|
||||
subdir := ctype
|
||||
|
||||
routines := ctype ctype-extn
|
||||
aux := ctype-info
|
||||
|
||||
tests := test_ctype
|
||||
|
||||
|
||||
all:
|
||||
include ../Rules
|
||||
32
gnu/glibc/glibc-1.03/ctype/ctype-extn.c
Normal file
32
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/ctype/ctype-info.c
Normal file
30
gnu/glibc/glibc-1.03/ctype/ctype-info.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* 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 <ctype.h>
|
||||
#include <localeinfo.h>
|
||||
|
||||
/* Defined in locale/locale-C-ctype.c. */
|
||||
extern CONST unsigned short int __ctype_b_C[];
|
||||
extern CONST unsigned char __ctype_tolower_C[];
|
||||
extern CONST unsigned char __ctype_toupper_C[];
|
||||
|
||||
CONST unsigned short int *__ctype_b = __ctype_b_C + 1;
|
||||
CONST unsigned char *__ctype_tolower = __ctype_tolower_C + 1;
|
||||
CONST unsigned char *__ctype_toupper = __ctype_toupper_C + 1;
|
||||
51
gnu/glibc/glibc-1.03/ctype/ctype.c
Normal file
51
gnu/glibc/glibc-1.03/ctype/ctype.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/* 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>
|
||||
|
||||
/* 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);
|
||||
}
|
||||
142
gnu/glibc/glibc-1.03/ctype/ctype.h
Normal file
142
gnu/glibc/glibc-1.03/ctype/ctype.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* ANSI Standard 4.3: CHARACTER HANDLING <ctype.h>
|
||||
*/
|
||||
|
||||
#ifndef _CTYPE_H
|
||||
|
||||
#define _CTYPE_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* 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 = _ISupper | _ISlower, /* 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. */
|
||||
extern CONST unsigned short int *__ctype_b; /* Characteristics. */
|
||||
extern CONST unsigned char *__ctype_tolower; /* Case conversions. */
|
||||
extern CONST unsigned char *__ctype_toupper; /* Case conversions. */
|
||||
|
||||
#define __isctype(c, type) (__ctype_b[c] & (unsigned short int) type)
|
||||
|
||||
#define __isascii(c) (((c) & (1 << 7)) == 0)
|
||||
#define __toascii(c) ((c) & 0x7f)
|
||||
|
||||
#define __tolower(c) __ctype_tolower[c]
|
||||
#define __toupper(c) __ctype_toupper[c]
|
||||
|
||||
/* IGNORE(@ This line MUST be broken! m4 will not change it otherwise. @) */
|
||||
#define __exctype(name) \
|
||||
extern int EXFUN(name, (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 EXFUN(tolower, (int __c));
|
||||
|
||||
/* Return the uppercase version of C. */
|
||||
extern int EXFUN(toupper, (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 EXFUN(isascii, (int __c));
|
||||
|
||||
/* Return the part of C that is in the ASCII set
|
||||
(i.e., the low-order 7 bits of C). */
|
||||
extern int EXFUN(toascii, (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. */
|
||||
|
||||
#endif /* ctype.h */
|
||||
79
gnu/glibc/glibc-1.03/ctype/test_ctype.c
Normal file
79
gnu/glibc/glibc-1.03/ctype/test_ctype.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* 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 <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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;
|
||||
|
||||
for (c = 0; c <= UCHAR_MAX; ++c) {
|
||||
print_char(c);
|
||||
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(EXIT_SUCCESS);
|
||||
}
|
||||
1
gnu/glibc/glibc-1.03/dirent.h
Normal file
1
gnu/glibc/glibc-1.03/dirent.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <dirent/dirent.h>
|
||||
28
gnu/glibc/glibc-1.03/dirent/Makefile
Normal file
28
gnu/glibc/glibc-1.03/dirent/Makefile
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.
|
||||
|
||||
#
|
||||
# Sub-makefile for dirent portion of the library.
|
||||
#
|
||||
subdir := dirent
|
||||
|
||||
routines := opendir closedir readdir rewinddir seekdir telldir
|
||||
|
||||
tests := list
|
||||
|
||||
include ../Rules
|
||||
104
gnu/glibc/glibc-1.03/dirent/dirent.h
Normal file
104
gnu/glibc/glibc-1.03/dirent/dirent.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT_H
|
||||
|
||||
#define _DIRENT_H 1
|
||||
#include <features.h>
|
||||
|
||||
#include <gnu/types.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* Directory entry structure. */
|
||||
struct dirent
|
||||
{
|
||||
__ino_t d_fileno; /* File serial number. */
|
||||
size_t 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
|
||||
|
||||
/* Directory stream type. */
|
||||
typedef struct
|
||||
{
|
||||
int __fd; /* File descriptor. */
|
||||
|
||||
char *__data; /* Directory block. */
|
||||
size_t __allocation; /* Space allocated for the block. */
|
||||
size_t __offset; /* Current offset into the block. */
|
||||
size_t __size; /* Total valid data in the block. */
|
||||
|
||||
struct dirent __entry; /* Returned by `readdir'. */
|
||||
} DIR;
|
||||
|
||||
|
||||
/* Open a directory stream on NAME.
|
||||
Return a DIR stream on the directory, or NULL if it could not be opened. */
|
||||
extern DIR *EXFUN(opendir, (CONST char *__name));
|
||||
|
||||
/* Close the directory stream DIRP.
|
||||
Return 0 if successful, -1 if not. */
|
||||
extern int EXFUN(closedir, (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 *EXFUN(readdir, (DIR *__dirp));
|
||||
|
||||
/* Rewind DIRP to the beginning of the directory. */
|
||||
extern void EXFUN(rewinddir, (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>
|
||||
|
||||
/* Seek to position POS on DIRP. */
|
||||
extern void EXFUN(seekdir, (DIR *__dirp, __off_t __pos));
|
||||
|
||||
/* Return the current position of DIRP. */
|
||||
extern __off_t EXFUN(telldir, (DIR *__dirp));
|
||||
|
||||
#endif /* Use BSD or misc. */
|
||||
|
||||
|
||||
#endif /* dirent.h */
|
||||
64
gnu/glibc/glibc-1.03/dirent/list.c
Normal file
64
gnu/glibc/glibc-1.03/dirent/list.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* 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 <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;
|
||||
}
|
||||
|
||||
while ((entp = readdir(dirp)) != NULL)
|
||||
printf("%s\tfile number %lu\n",
|
||||
entp->d_name, (unsigned long int) entp->d_fileno);
|
||||
|
||||
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);
|
||||
}
|
||||
35
gnu/glibc/glibc-1.03/errno.h
Normal file
35
gnu/glibc/glibc-1.03/errno.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* ANSI Standard: 4.1.3 Errors <errno.h>
|
||||
*/
|
||||
|
||||
#ifndef _ERRNO_H
|
||||
|
||||
#define _ERRNO_H 1
|
||||
#include <features.h>
|
||||
|
||||
/* Get the error number constants. */
|
||||
#include <errnos.h>
|
||||
|
||||
/* Declare the `errno' variable. */
|
||||
extern VOLATILE int errno;
|
||||
|
||||
|
||||
#endif /* errno.h */
|
||||
1
gnu/glibc/glibc-1.03/fcntl.h
Normal file
1
gnu/glibc/glibc-1.03/fcntl.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <io/fcntl.h>
|
||||
140
gnu/glibc/glibc-1.03/features.h
Normal file
140
gnu/glibc/glibc-1.03/features.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/* 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. */
|
||||
|
||||
#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
|
||||
|
||||
|
||||
#endif /* __features.h */
|
||||
87
gnu/glibc/glibc-1.03/find-sysdirs
Normal file
87
gnu/glibc/glibc-1.03/find-sysdirs
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/bin/sh
|
||||
# Generate an ordered list of directories to search for sysdep files.
|
||||
|
||||
# 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.
|
||||
|
||||
# Reads standard input for the initial list of system directories. Each of
|
||||
# these directories may contain a file `Implies', containing a list of other
|
||||
# directories to search. The contents of the `Implies' file are inserted
|
||||
# between the directory containing the file and following directories.
|
||||
# Comments starting with `#' in the initial list or the `Implies' files are
|
||||
# ignored. The output is a list of names of subdirectories within the sysdep
|
||||
# directory to search for sysdep files.
|
||||
#
|
||||
# This script expects to be run from a makefile, with `sysdep_dir' defined in
|
||||
# the environment as the base directory for sysdep files.
|
||||
|
||||
if [ x$sysdep_dir = x ]; then
|
||||
echo "$0: Not run in proper environment! sysdep_dir undefined." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sysnames="`sed 's/#.*$//'`"
|
||||
|
||||
names=''
|
||||
|
||||
set $sysnames
|
||||
while [ $# -gt 0 ]; do
|
||||
name=$1
|
||||
shift
|
||||
|
||||
if [ -f $sysdep_dir/$name/Implies ]; then
|
||||
# Collect more names from the `Implies' file.
|
||||
implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
|
||||
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.
|
||||
parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
|
||||
|
||||
# Append the names implied by NAME, and NAME's parent (if it has one),
|
||||
# to the list of names to be processed (the argument list).
|
||||
sysnames="`echo $* $implied $parent`"
|
||||
if [ "$sysnames" != "" ]; then
|
||||
set $sysnames
|
||||
fi
|
||||
done
|
||||
|
||||
names="$names generic stub"
|
||||
|
||||
# Uniquize the list.
|
||||
seen=''
|
||||
for name in $names; do
|
||||
if echo "$seen" | fgrep -x $name >/dev/null; then
|
||||
# Already in the list.
|
||||
true;
|
||||
else
|
||||
# A new one.
|
||||
if [ "$seen" = "" ]; then
|
||||
seen="$name"
|
||||
else
|
||||
seen="$seen
|
||||
$name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$seen"
|
||||
54
gnu/glibc/glibc-1.03/float.h
Normal file
54
gnu/glibc/glibc-1.03/float.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* ANSI Standard: 2.2.4.2 Characteristics of floating types <float.h>
|
||||
*/
|
||||
|
||||
#if !defined(_FLOAT_H) || \
|
||||
(defined(__need_HUGE_VAL) && !defined(__HUGE_VAL_defined))
|
||||
|
||||
#ifndef __need_HUGE_VAL
|
||||
#define _FLOAT_H 1
|
||||
#include <features.h>
|
||||
#endif /* Don't need HUGE_VAL. */
|
||||
|
||||
#ifdef _FLOAT_H
|
||||
/* ANSI values for FLT_ROUNDS (the names are nonstandard). */
|
||||
#define _FLT_ROUNDS_INDETERMINATE (-1)
|
||||
#define _FLT_ROUNDS_TOZERO 0
|
||||
#define _FLT_ROUNDS_TONEAREST 1
|
||||
#define _FLT_ROUNDS_TOPOSINF 2
|
||||
#define _FLT_ROUNDS_TONEGINF 3
|
||||
#endif
|
||||
|
||||
#ifdef __HUGE_VAL_defined
|
||||
#undef __need_HUGE_VAL
|
||||
#endif /* HUGE_VAL defined. */
|
||||
|
||||
#if defined(_FLOAT_H) || defined(__need_HUGE_VAL)
|
||||
/* Include the machine-specific <float.h> file. */
|
||||
#include <fl.h>
|
||||
|
||||
#ifdef __need_HUGE_VAL
|
||||
#define __HUGE_VAL_defined 1
|
||||
#undef __need_HUGE_VAL
|
||||
#endif /* Need HUGE_VAL. */
|
||||
#endif /* <float.h> included or need HUGE_VAL. */
|
||||
|
||||
#endif /* float.h */
|
||||
1
gnu/glibc/glibc-1.03/fnmatch.h
Normal file
1
gnu/glibc/glibc-1.03/fnmatch.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <posix/fnmatch.h>
|
||||
1
gnu/glibc/glibc-1.03/getopt.h
Normal file
1
gnu/glibc/glibc-1.03/getopt.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <posix/getopt.h>
|
||||
1
gnu/glibc/glibc-1.03/glob.h
Normal file
1
gnu/glibc/glibc-1.03/glob.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <posix/glob.h>
|
||||
89
gnu/glibc/glibc-1.03/gnu-stabs.h
Normal file
89
gnu/glibc/glibc-1.03/gnu-stabs.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* 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. */
|
||||
|
||||
#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);
|
||||
|
||||
/* Make references to ALIAS refer to SYMBOL. */
|
||||
#ifdef __STDC__
|
||||
#define symbol_alias(symbol, alias) \
|
||||
asm(".stabs \"" "_" #alias "\",11,0,0,0\n"\
|
||||
".stabs \"" "_" #symbol "\",1,0,0,0")
|
||||
#else
|
||||
/* Your assembler better grok this right! */
|
||||
#define symbol_alias(symbol, alias) \
|
||||
asm(".stabs \"_/**/alias\",11,0,0,0\n.stabs \"_/**/symbol\",1,0,0,0")
|
||||
#endif
|
||||
|
||||
/* Issue a warning message from the linker whenever SYMBOL is referenced. */
|
||||
#ifdef __STDC__
|
||||
#define warn_references(symbol, msg) \
|
||||
asm(".stabs \"" msg "\",30,0,0,0\n" \
|
||||
".stabs \"_" #symbol "\",1,0,0,0")
|
||||
#else
|
||||
#define warn_references(symbol, msg) \
|
||||
asm(".stabs msg,30,0,0,0\n.stabs \"_/**/symbol\",1,0,0,0")
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#define stub_warning(name) \
|
||||
warn_references(name, \
|
||||
"warning: " #name " is not implemented and will always fail")
|
||||
#else
|
||||
#define stub_warning(name) \
|
||||
warn_references(name, \
|
||||
"warning: name is not implemented and will always fail")
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#define text_set_element(set, symbol) \
|
||||
asm(".stabs \"_" #set "\",23,0,0,_" #symbol)
|
||||
#define data_set_element(set, symbol) \
|
||||
asm(".stabs \"_" #set "\",25,0,0,_" #symbol)
|
||||
#else
|
||||
#define text_set_element(set, symbol) \
|
||||
asm(".stabs \"_/**/set\",23,0,0,_/**/symbol")
|
||||
#define data_set_element(set, symbol) \
|
||||
asm(".stabs \"_/**/set\",25,0,0,_/**/symbol")
|
||||
#endif
|
||||
|
||||
#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/glibc/glibc-1.03/gnu/signal.h
Normal file
1
gnu/glibc/glibc-1.03/gnu/signal.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <signal/gnu/signal.h>
|
||||
1
gnu/glibc/glibc-1.03/gnu/stat.h
Normal file
1
gnu/glibc/glibc-1.03/gnu/stat.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <io/gnu/stat.h>
|
||||
1
gnu/glibc/glibc-1.03/gnu/time.h
Normal file
1
gnu/glibc/glibc-1.03/gnu/time.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <time/gnu/time.h>
|
||||
1
gnu/glibc/glibc-1.03/gnu/types.h
Normal file
1
gnu/glibc/glibc-1.03/gnu/types.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <posix/gnu/types.h>
|
||||
1
gnu/glibc/glibc-1.03/gnu/wait.h
Normal file
1
gnu/glibc/glibc-1.03/gnu/wait.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <posix/gnu/wait.h>
|
||||
23
gnu/glibc/glibc-1.03/gnulib/Makefile
Normal file
23
gnu/glibc/glibc-1.03/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
|
||||
1
gnu/glibc/glibc-1.03/grp.h
Normal file
1
gnu/glibc/glibc-1.03/grp.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <grp/grp.h>
|
||||
29
gnu/glibc/glibc-1.03/grp/Makefile
Normal file
29
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/grp/fgetgrent.c
Normal file
41
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/grp/getgrent.c
Normal file
67
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/grp/getgrgid.c
Normal file
50
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/grp/getgrnam.c
Normal file
50
gnu/glibc/glibc-1.03/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;
|
||||
}
|
||||
98
gnu/glibc/glibc-1.03/grp/grp.h
Normal file
98
gnu/glibc/glibc-1.03/grp/grp.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
|
||||
*/
|
||||
|
||||
#ifndef _GRP_H
|
||||
|
||||
#define _GRP_H 1
|
||||
#include <features.h>
|
||||
|
||||
#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 *EXFUN(__grpopen, (NOARGS));
|
||||
|
||||
/* Read a group entry from STREAM, filling in G.
|
||||
Return the `struct group' of G if successful, NULL on failure. */
|
||||
extern struct group *EXFUN(__grpread, (FILE *__stream, PTR __g));
|
||||
|
||||
/* Return a chunk of memory containing pre-initialized data for __grpread. */
|
||||
extern PTR EXFUN(__grpalloc, (NOARGS));
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__USE_SVID) || defined(__USE_MISC)
|
||||
/* Rewind the group-file stream. */
|
||||
extern void EXFUN(setgrent, (NOARGS));
|
||||
|
||||
/* Close the group-file stream. */
|
||||
extern void EXFUN(endgrent, (NOARGS));
|
||||
|
||||
/* Read an entry from the group-file stream, opening it if necessary. */
|
||||
extern struct group *EXFUN(getgrent, (NOARGS));
|
||||
#endif
|
||||
|
||||
#ifdef __USE_SVID
|
||||
/* Read a group entry from STREAM. */
|
||||
extern struct group *EXFUN(fgetgrent, (FILE *__stream));
|
||||
#endif
|
||||
|
||||
/* Search for an entry with a matching group ID. */
|
||||
extern struct group *EXFUN(getgrgid, (__gid_t __gid));
|
||||
|
||||
/* Search for an entry with a matching group name. */
|
||||
extern struct group *EXFUN(getgrnam, (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 EXFUN(setgroups, (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 EXFUN(initgroups, (CONST char *user, __gid_t group));
|
||||
|
||||
#endif /* Use BSD. */
|
||||
|
||||
|
||||
#endif /* grp.h */
|
||||
28
gnu/glibc/glibc-1.03/grp/grpopen.c
Normal file
28
gnu/glibc/glibc-1.03/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
gnu/glibc/glibc-1.03/grp/grpread.c
Normal file
135
gnu/glibc/glibc-1.03/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;
|
||||
}
|
||||
65
gnu/glibc/glibc-1.03/grp/initgroups.c
Normal file
65
gnu/glibc/glibc-1.03/grp/initgroups.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Copyright (C) 1989, 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 <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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
40
gnu/glibc/glibc-1.03/grp/testgrp.c
Normal file
40
gnu/glibc/glibc-1.03/grp/testgrp.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#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);
|
||||
|
||||
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) {
|
||||
printf ("Couldn't find out about group %d.\n", (int)(my_passwd->pw_gid));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
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 (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
72
gnu/glibc/glibc-1.03/hurd/Makefile
Normal file
72
gnu/glibc/glibc-1.03/hurd/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
# 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.
|
||||
|
||||
subdir := hurd
|
||||
|
||||
interface-header-prefix = hurd/
|
||||
headers = hurd.h # $(interface-headers)
|
||||
|
||||
ifneq (,)
|
||||
user-interfaces := auth process \
|
||||
exec core interrupt \
|
||||
fs io socket term
|
||||
server-interfaces := misc
|
||||
endif
|
||||
|
||||
routines = __pid2task __task2pid pid2task task2pid \
|
||||
__setauth setauth hurdports \
|
||||
chcore fchcore fchroot \
|
||||
hurdauth hurdid hurdpath hurdpid hurdsig hurdsock \
|
||||
dtable __getdport getdport openport setdtablesize \
|
||||
sigportdemux _hurd_start_sigthread \
|
||||
getuids getumask \
|
||||
_hurd_dead_recv \
|
||||
fopenport __fopenport \
|
||||
$(interface-routines)
|
||||
aux := hurdsyms
|
||||
|
||||
all:
|
||||
|
||||
|
||||
# This rule needs to come before the implicit rules in Machrules.
|
||||
__%.c: intr_rpc.awk %_rpc.c
|
||||
gawk -v call=__$* -v rpc=__$*_rpc -f $^ > $@-new
|
||||
mv $@-new $@
|
||||
# __%_rpc.c is made with mig by Machrules.
|
||||
%_rpc.c: __%_rpc.c
|
||||
sed s/MACH_MSG_OPTION_NONE/MACH_SEND_INTERRUPT/ $< > $@
|
||||
|
||||
include ../mach/Machrules
|
||||
|
||||
ifdef user-interfaces
|
||||
include hurdintr
|
||||
endif
|
||||
hurdintr: hurdintr.awk $(user-interfaces:%=%.defs)
|
||||
awk -f $^ varname=intr-calls > $@-new
|
||||
mv $@-new $@
|
||||
|
||||
# Make the INTR user stubs be defined as CALL_rpc.
|
||||
migdefines := $(migdefines) $(foreach call,$(intr-calls),-D$(call)=$(call)_rpc)
|
||||
|
||||
interface-routines := $(filter-out %_rpc,$(interface-routines)) \
|
||||
$(intr-calls:%=__% %)
|
||||
dont_distribute = $(interface-routines:%=%.c) $(interface-headers)
|
||||
|
||||
distribute := intr_rpc.awk hurdintr.awk
|
||||
|
||||
include ../Rules
|
||||
31
gnu/glibc/glibc-1.03/hurd/__fopenport.c
Normal file
31
gnu/glibc/glibc-1.03/hurd/__fopenport.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* 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 <hurd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/* Open a stream on PORT. MODE is as for fopen. */
|
||||
|
||||
FILE *
|
||||
__fopenport (mach_port_t port, const char *mode)
|
||||
{
|
||||
/* The default io functions in sysd-stdio.c use Hurd io ports as cookies. */
|
||||
return __fopencookie ((void *) port, mode, __default_io_functions);
|
||||
}
|
||||
49
gnu/glibc/glibc-1.03/hurd/__getdport.c
Normal file
49
gnu/glibc/glibc-1.03/hurd/__getdport.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
const struct
|
||||
{
|
||||
size_t n;
|
||||
file_t (*getdport) (int fd);
|
||||
} _hurd_getdport_fn;
|
||||
|
||||
file_t
|
||||
__getdport (int fd)
|
||||
{
|
||||
if (_hurd_init_dtable != NULL)
|
||||
{
|
||||
/* getdport is the only use of file descriptors,
|
||||
so we don't bother allocating a real table. */
|
||||
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];
|
||||
}
|
||||
}
|
||||
else
|
||||
return (*_hurd_getdport_fn.getdport) (fd);
|
||||
}
|
||||
36
gnu/glibc/glibc-1.03/hurd/__pid2task.c
Normal file
36
gnu/glibc/glibc-1.03/hurd/__pid2task.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
task_t
|
||||
__pid2task (pid_t pid)
|
||||
{
|
||||
error_t err;
|
||||
task_t task;
|
||||
|
||||
err = _HURD_PORT_USE (&_hurd_proc,
|
||||
__proc_pid2task (port, pid, &task));
|
||||
if (err)
|
||||
{
|
||||
errno = err;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
return task;
|
||||
}
|
||||
88
gnu/glibc/glibc-1.03/hurd/__setauth.c
Normal file
88
gnu/glibc/glibc-1.03/hurd/__setauth.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
|
||||
|
||||
/* Things in the library which want to be run when the auth port changes. */
|
||||
const struct
|
||||
{
|
||||
size_t n;
|
||||
void (*fn[0]) ();
|
||||
} _hurd_reauth_hook;
|
||||
|
||||
|
||||
/* Set the auth port to NEW, and reauthenticate
|
||||
everything used by the library. */
|
||||
int
|
||||
__setauth (auth_t new)
|
||||
{
|
||||
error_t err;
|
||||
auth_t old;
|
||||
int d;
|
||||
mach_port_t ignore;
|
||||
void (**fn) (void);
|
||||
|
||||
/* Give the new send right a user reference.
|
||||
This is a good way to check that it is valid. */
|
||||
if (__mach_port_mod_refs (__mach_task_self (), new,
|
||||
MACH_PORT_RIGHT_SEND, 1))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Install the new port in the _hurd_auth cell. */
|
||||
__mutex_lock (&_hurd_idlock);
|
||||
_hurd_port_set (&_hurd_auth, new);
|
||||
_hurd_id_valid = 0;
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
|
||||
/* Reauthenticate with the proc server. */
|
||||
if (!_HURD_PORT_USE (&_hurd_proc,
|
||||
__proc_reauthenticate (port) ||
|
||||
__auth_user_authenticate (new, port, &ignore))
|
||||
&& ignore != MACH_PORT_NULL)
|
||||
__mach_port_deallocate (__mach_task_self (), ignore);
|
||||
|
||||
/* Reauthenticate the file descriptor table. */
|
||||
|
||||
if (_hurd_init_dtable != NULL)
|
||||
/* We just have the simple table we got at startup. */
|
||||
for (d = 0; d < _hurd_init_dtablesize; ++d)
|
||||
if (_hurd_init_dtable[d] != MACH_PORT_NULL)
|
||||
{
|
||||
mach_port_t new;
|
||||
if (! __io_reauthenticate (_hurd_init_dtable[d]) &&
|
||||
! _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_user_authenticate (_hurd_init_dtable[d],
|
||||
&new)))
|
||||
{
|
||||
__mach_port_deallocate (__mach_task_self (),
|
||||
_hurd_init_dtable[d]);
|
||||
_hurd_init_dtable[d] = new;
|
||||
}
|
||||
}
|
||||
|
||||
/* Run things which want to do reauthorization stuff. */
|
||||
for (fn = _hurd_reauth_hook.fn; *fn != NULL; ++fn)
|
||||
(**fn) ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
31
gnu/glibc/glibc-1.03/hurd/__task2pid.c
Normal file
31
gnu/glibc/glibc-1.03/hurd/__task2pid.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
pid_t
|
||||
__task2pid (task_t task)
|
||||
{
|
||||
error_t err;
|
||||
pid_t pid;
|
||||
err = _HURD_PORT_USE (&_hurd_proc,
|
||||
__proc_task2pid (proc, task, &pid));
|
||||
if (err)
|
||||
return __hurd_fail (err);
|
||||
return pid;
|
||||
}
|
||||
30
gnu/glibc/glibc-1.03/hurd/_hurd_dead_recv.c
Normal file
30
gnu/glibc/glibc-1.03/hurd/_hurd_dead_recv.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* 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>
|
||||
|
||||
/* Return a receive right to which there are no send rights in use. */
|
||||
mach_port_t
|
||||
_hurd_dead_recv (void)
|
||||
{
|
||||
static mach_port_t port = MACH_PORT_NULL;
|
||||
if (port == MACH_PORT_NULL)
|
||||
__mach_port_allocate (__mach_task_self (),
|
||||
MACH_PORT_RIGHT_RECEIVE, &port);
|
||||
return port;
|
||||
}
|
||||
39
gnu/glibc/glibc-1.03/hurd/chcore.c
Normal file
39
gnu/glibc/glibc-1.03/hurd/chcore.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* 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 <unistd.h>
|
||||
#include <hurd.h>
|
||||
|
||||
/* Change the current core to PATH. */
|
||||
int
|
||||
DEFUN(chcore, (path), CONST char *path)
|
||||
{
|
||||
error_t err;
|
||||
file_t old, ccdir;
|
||||
|
||||
ccdir = __path_lookup (path, FS_LOOKUP_EXECUTE, 0);
|
||||
if (ccdir == MACH_PORT_NULL)
|
||||
return -1;
|
||||
|
||||
_hurd_port_set (&_hurd_ccdir, ccdir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
206
gnu/glibc/glibc-1.03/hurd/dtable.c
Normal file
206
gnu/glibc/glibc-1.03/hurd/dtable.c
Normal file
@@ -0,0 +1,206 @@
|
||||
/* 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 <hurd.h>
|
||||
#include <gnu-stabs.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
struct _hurd_dtable _hurd_dtable;
|
||||
struct mutex _hurd_dtable_lock;
|
||||
int *_hurd_dtable_user_dealloc;
|
||||
|
||||
const struct _hurd_dtable_resizes _hurd_dtable_resizes;
|
||||
|
||||
|
||||
/* Initialize the file descriptor table at startup. */
|
||||
|
||||
static void
|
||||
init_dtable (void)
|
||||
{
|
||||
register size_t i;
|
||||
|
||||
__mutex_init (&_hurd_dtable_lock);
|
||||
|
||||
_hurd_dtable_user_dealloc = NULL;
|
||||
|
||||
/* The initial size of the descriptor table is that of the passed-in
|
||||
table, rounded up to a multiple of OPEN_MAX descriptors. */
|
||||
_hurd_dtable.size
|
||||
= (_hurd_init_dtablesize + OPEN_MAX - 1) / OPEN_MAX * OPEN_MAX;
|
||||
|
||||
_hurd_dtable.d = malloc (_hurd_dtable.size * sizeof (*_hurd_dtable.d));
|
||||
if (_hurd_dtable.d == NULL)
|
||||
__libc_fatal ("hurd: Can't allocate file descriptor table\n");
|
||||
|
||||
for (i = 0; i < _hurd_init_dtablesize; ++i)
|
||||
{
|
||||
struct _hurd_fd *const d = &_hurd_dtable.d[i];
|
||||
io_statbuf_t stb;
|
||||
io_t ctty;
|
||||
|
||||
_hurd_port_init (&d->port, _hurd_init_dtable[i]);
|
||||
d->flags = 0;
|
||||
|
||||
if (_hurd_ctty_fstype != 0 &&
|
||||
/* We have a controlling tty. Is this it? */
|
||||
! __io_stat (d->port.port, &stb) &&
|
||||
stb.stb_fstype == _hurd_ctty_fstype &&
|
||||
stb.stb_fsid == _hurd_ctty_fsid &&
|
||||
stb.stb_fileid == _hurd_ctty_fileid &&
|
||||
/* This is a descriptor to our controlling tty. */
|
||||
! __term_become_ctty (d->port.port, _hurd_pid, _hurd_pgrp,
|
||||
_hurd_sigport, &ctty))
|
||||
{
|
||||
/* Operations on CTTY return EBACKGROUND when we are not a
|
||||
foreground user of the tty. */
|
||||
d->port.port = ctty;
|
||||
ctty = _hurd_init_dtable[i];
|
||||
}
|
||||
else
|
||||
/* No ctty magic happening here. */
|
||||
ctty = MACH_PORT_NULL;
|
||||
|
||||
_hurd_port_init (&d->ctty, ctty);
|
||||
}
|
||||
|
||||
/* Initialize the remaining empty slots in the table. */
|
||||
for (; i < _hurd_dtable.size; ++i)
|
||||
{
|
||||
_hurd_port_init (&_hurd_dtable.d[i].port, MACH_PORT_NULL);
|
||||
_hurd_port_init (&_hurd_dtable.d[i].ctty, MACH_PORT_NULL);
|
||||
_hurd_dtable.d[i].flags = 0;
|
||||
}
|
||||
|
||||
/* Clear out the initial descriptor table.
|
||||
Everything must use _hurd_dtable now. */
|
||||
__vm_deallocate (__mach_task_self (),
|
||||
_hurd_init_dtable,
|
||||
_hurd_init_dtablesize * sizeof (_hurd_init_dtable[0]));
|
||||
_hurd_init_dtable = NULL;
|
||||
_hurd_init_dtablesize = 0;
|
||||
}
|
||||
|
||||
text_set_element (__libc_subinit, init_dtable);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
text_set_element (_hurd_getdport_fn, get_dtable_port);
|
||||
|
||||
/* Called on fork to install the dtable in NEWTASK.
|
||||
The dtable lock is held. */
|
||||
|
||||
static error_t
|
||||
fork_dtable (task_t newtask)
|
||||
{
|
||||
error_t err;
|
||||
int i;
|
||||
|
||||
err = 0;
|
||||
|
||||
for (i = 0; !err && i < _hurd_dtable.size; ++i)
|
||||
{
|
||||
int dealloc, dealloc_ctty;
|
||||
io_t port = _HURD_PORT_USE (&_hurd_dtable.d[i].port, &dealloc);
|
||||
io_t ctty = _HURD_PORT_USE (&_hurd_dtable.d[i].ctty, &dealloc_ctty);
|
||||
|
||||
if (port != MACH_PORT_NULL)
|
||||
err = __mach_port_insert_right (newtask, port, port,
|
||||
MACH_PORT_COPY_SEND);
|
||||
if (!err && ctty != MACH_PORT_NULL)
|
||||
err = __mach_port_insert_right (newtask, ctty, ctty,
|
||||
MACH_PORT_COPY_SEND);
|
||||
|
||||
_hurd_port_free (port, &dealloc);
|
||||
_hurd_port_free (ctty, &dealloc_ctty);
|
||||
|
||||
/* XXX for each fd with a cntlmap, reauth and re-map_cntl. */
|
||||
}
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
text_set_element (_hurd_fork_hook, fork_dtable);
|
||||
text_set_element (_hurd_fork_locks, _hurd_dtable_lock);
|
||||
|
||||
/* Called to reauthenticate the dtable when the auth port changes. */
|
||||
|
||||
static void
|
||||
reauth_dtable (void)
|
||||
{
|
||||
int d;
|
||||
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
for (d = 0; d < _hurd_dtable.size; ++d)
|
||||
{
|
||||
struct _hurd_fd *const d = &hurd_dtable.d[d];
|
||||
mach_port_t new, newctty;
|
||||
|
||||
/* Take the descriptor cell's lock. */
|
||||
__spin_lock (&cell->port.lock);
|
||||
|
||||
/* Reauthenticate the descriptor's port. */
|
||||
if (cell->port.port != MACH_PORT_NULL &&
|
||||
! __io_reauthenticate (cell->port.port) &&
|
||||
! _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_user_authenticate (port,
|
||||
cell->port.port, &new)))
|
||||
{
|
||||
/* Replace the port in the descriptor cell
|
||||
with the newly reauthenticated port. */
|
||||
|
||||
if (cell->ctty.port != MACH_PORT_NULL &&
|
||||
! __io_reauthenticate (cell->ctty.port) &&
|
||||
! _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_user_authenticate (port,
|
||||
cell->ctty.port,
|
||||
&newctty)))
|
||||
_hurd_port_set (&cell->ctty, newctty);
|
||||
|
||||
_hurd_port_locked_set (&cell->port, new);
|
||||
}
|
||||
else
|
||||
/* Lost. Leave this descriptor cell alone. */
|
||||
__spin_unlock (&cell->port.lock);
|
||||
}
|
||||
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
}
|
||||
|
||||
text_set_element (_hurd_reauth_hook, reauth_dtable);
|
||||
41
gnu/glibc/glibc-1.03/hurd/fchcore.c
Normal file
41
gnu/glibc/glibc-1.03/hurd/fchcore.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* 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 <unistd.h>
|
||||
#include <hurd.h>
|
||||
|
||||
/* Change the current core directory to FD. */
|
||||
int
|
||||
DEFUN(fchcore, (fd), int fd)
|
||||
{
|
||||
error_t err;
|
||||
file_t ccdir;
|
||||
|
||||
if (err = _HURD_DPORT_USE (fd,
|
||||
__mach_port_mod_refs (__mach_task_self (),
|
||||
(ccdir = port),
|
||||
MACH_PORT_RIGHT_SEND, 1)))
|
||||
return err;
|
||||
|
||||
_hurd_port_set (&_hurd_ccdir, ccdir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
41
gnu/glibc/glibc-1.03/hurd/fchroot.c
Normal file
41
gnu/glibc/glibc-1.03/hurd/fchroot.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* 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 <unistd.h>
|
||||
#include <hurd.h>
|
||||
|
||||
/* Change the current directory root to FD. */
|
||||
int
|
||||
DEFUN(fchroot, (fd), int fd)
|
||||
{
|
||||
error_t err;
|
||||
file_t crdir;
|
||||
|
||||
if (err = _HURD_DPORT_USE (fd,
|
||||
__mach_port_mod_refs (__mach_task_self (),
|
||||
(crdir = port),
|
||||
MACH_PORT_RIGHT_SEND, 1)))
|
||||
return err;
|
||||
|
||||
_hurd_port_set (&_hurd_crdir, crdir);
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
gnu/glibc/glibc-1.03/hurd/fopenport.c
Normal file
21
gnu/glibc/glibc-1.03/hurd/fopenport.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__fopenport, fopenport);
|
||||
21
gnu/glibc/glibc-1.03/hurd/getdport.c
Normal file
21
gnu/glibc/glibc-1.03/hurd/getdport.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__getdport, getdport);
|
||||
53
gnu/glibc/glibc-1.03/hurd/getuids.c
Normal file
53
gnu/glibc/glibc-1.03/hurd/getuids.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
/* Return the effective uid set. */
|
||||
int
|
||||
getuids (int n, uid_t *uidset)
|
||||
{
|
||||
int nuids;
|
||||
|
||||
__mutex_lock (&_hurd_idlock);
|
||||
if (!_hurd_id_valid)
|
||||
{
|
||||
error_t err = _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_getids (port, &_hurd_id));
|
||||
if (err)
|
||||
{
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
return __hurd_fail (err);
|
||||
}
|
||||
_hurd_id_valid = 1;
|
||||
}
|
||||
nuids = _hurd_id.nuids;
|
||||
if (uidset != NULL)
|
||||
{
|
||||
/* Copy into a temporary array before releasing the lock. */
|
||||
uid_t uids[nuids];
|
||||
memcpy (uids, _hurd_id.uids, sizeof (uids));
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
/* Lock is released; now copy into user array, which might fault. */
|
||||
memcpy (uidset, uids, sizeof (uids));
|
||||
}
|
||||
else
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
|
||||
return nuids;
|
||||
}
|
||||
25
gnu/glibc/glibc-1.03/hurd/getumask.c
Normal file
25
gnu/glibc/glibc-1.03/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;
|
||||
}
|
||||
488
gnu/glibc/glibc-1.03/hurd/hurd.h
Normal file
488
gnu/glibc/glibc-1.03/hurd/hurd.h
Normal file
@@ -0,0 +1,488 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _HURD_H
|
||||
|
||||
#define _HURD_H 1
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <features.h>
|
||||
|
||||
#include <mach.h>
|
||||
#include <hurd/hurd_types.h>
|
||||
#include <hurd/process.h>
|
||||
#include <hurd/fs.h>
|
||||
#include <hurd/io.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define __hurd_fail(err) (errno = (err), -1)
|
||||
|
||||
/* Lightweight user references for ports. */
|
||||
|
||||
/* Structure describing a cell containing a port.
|
||||
With the lock held, a user extracts PORT, and sets USER_DEALLOC to point
|
||||
to a word in his local storage. PORT can then safely be used. When
|
||||
PORT is no longer needed, with the lock held, the user examines
|
||||
USER_DEALLOC. If it is the same address that user stored there, it
|
||||
extracts *USER_DEALLOC, clears USER_DEALLOC to NULL, and releases the
|
||||
lock. If *USER_DEALLOC is set, the user deallocates the port he used. */
|
||||
struct _hurd_port
|
||||
{
|
||||
spin_lock_t lock; /* Locks rest. */
|
||||
mach_port_t port; /* Port. */
|
||||
int *user_dealloc; /* If not NULL, points to user's flag word. */
|
||||
};
|
||||
|
||||
/* Evaluate EXPR with the variable `port' bound to the port in PORTCELL. */
|
||||
#define _HURD_PORT_USE(portcell, expr) \
|
||||
({ struct _hurd_port *const __p = &(portcell); \
|
||||
int __dealloc; \
|
||||
const mach_port_t port = _hurd_port_get (__p, &__dealloc); \
|
||||
__typeof(expr) __result = (expr); \
|
||||
_hurd_port_free (__p, &__dealloc); \
|
||||
__result; })
|
||||
|
||||
/* Initialize *PORT to INIT. */
|
||||
static inline void
|
||||
_hurd_port_init (struct _hurd_port *port, mach_port_t init)
|
||||
{
|
||||
__spin_lock_init (&port->lock);
|
||||
port->port = init;
|
||||
port->user_dealloc = NULL;
|
||||
}
|
||||
|
||||
/* Get a reference to *PORT, which is locked.
|
||||
Pass return value and MYFLAG to _hurd_port_free when done. */
|
||||
static inline mach_port_t
|
||||
_hurd_port_locked_get (struct _hurd_port *port, int *myflag)
|
||||
{
|
||||
mach_port_t result;
|
||||
result = port->port;
|
||||
if (result != MACH_PORT_NULL)
|
||||
{
|
||||
port->user_dealloc = myflag;
|
||||
*myflag = 0;
|
||||
}
|
||||
__spin_unlock (&port->lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Same, but locks PORT first. */
|
||||
static inline mach_port_t
|
||||
_hurd_port_get (struct _hurd_port *port, int *myflag)
|
||||
{
|
||||
__spin_lock (&port->lock);
|
||||
return _hurd_port_locked_get (port, myflag);
|
||||
}
|
||||
|
||||
/* Free a reference gotten with
|
||||
`USED_PORT = _hurd_port_get (PORT, MYFLAG);' */
|
||||
static inline void
|
||||
_hurd_port_free (struct _hurd_port *port,
|
||||
int *myflag, mach_port_t used_port)
|
||||
{
|
||||
__spin_lock (&port->lock);
|
||||
if (port->user_dealloc == myflag)
|
||||
port->user_dealloc = NULL;
|
||||
__spin_unlock (&port->lock);
|
||||
if (*myflag)
|
||||
__mach_port_deallocate (__mach_task_self (), used_port);
|
||||
}
|
||||
|
||||
/* Set *PORT's port to NEWPORT. PORT is locked. */
|
||||
static inline void
|
||||
_hurd_port_locked_set (struct _hurd_port *port, mach_port_t newport)
|
||||
{
|
||||
mach_port_t old;
|
||||
if (port->user_dealloc == NULL)
|
||||
old = port->port;
|
||||
else
|
||||
{
|
||||
old = MACH_PORT_NULL;
|
||||
*port->user_dealloc = 1;
|
||||
}
|
||||
port->port = newport;
|
||||
__spin_unlock (&port->lock);
|
||||
if (old != MACH_PORT_NULL)
|
||||
__mach_port_deallocate (__mach_task_self (), old);
|
||||
}
|
||||
|
||||
/* Same, but locks PORT first. */
|
||||
static inline void
|
||||
_hurd_port_set (struct _hurd_port *port, mach_port_t newport)
|
||||
{
|
||||
__spin_lock (&port->lock);
|
||||
return _hurd_port_locked_set (port, newport);
|
||||
}
|
||||
|
||||
/* Basic ports and info, initialized by startup. */
|
||||
extern struct _hurd_port _hurd_proc, _hurd_auth;
|
||||
extern struct _hurd_port _hurd_ccdir, _hurd_cwdir, _hurd_crdir;
|
||||
extern volatile mode_t _hurd_umask;
|
||||
|
||||
extern struct mutex _hurd_ctty_lock;
|
||||
extern int _hurd_ctty_fstype;
|
||||
extern fsid_t _hurd_ctty_fsid;
|
||||
extern ino_t _hurd_ctty_fileid;
|
||||
|
||||
extern vm_address_t _hurd_stack_low, _hurd_stack_high; /* Not locked. */
|
||||
|
||||
extern thread_t _hurd_sigport_thread;
|
||||
extern mach_port_t _hurd_sigport; /* Locked by _hurd_siglock. */
|
||||
|
||||
/* Not locked. If we are using a real dtable,
|
||||
these are turned into that and then cleared at startup.
|
||||
If not, these are never changed after startup. */
|
||||
extern mach_port_t *_hurd_init_dtable;
|
||||
extern size_t _hurd_init_dtablesize;
|
||||
|
||||
/* File descriptor table. */
|
||||
struct _hurd_fd
|
||||
{
|
||||
struct _hurd_port port;
|
||||
int flags; /* fcntl flags; locked by port.lock. */
|
||||
|
||||
/* Normal port to the ctty. Also locked by port.lock.
|
||||
(The ctty.lock is only ever used when the port.lock is held.) */
|
||||
struct _hurd_port ctty;
|
||||
};
|
||||
|
||||
struct _hurd_dtable
|
||||
{
|
||||
int size; /* Number of elts in `d' array. */
|
||||
|
||||
/* Uses of individual descriptors are not locked. It is up to the user
|
||||
to synchronize descriptor operations on a single descriptor. */
|
||||
|
||||
struct _hurd_fd *d;
|
||||
};
|
||||
extern struct _hurd_dtable _hurd_dtable;
|
||||
|
||||
extern struct mutex _hurd_dtable_lock; /* Locks _hurd_dtable. */
|
||||
|
||||
/* If not NULL, pointed-to word is set when _hurd_dtable.d changes.
|
||||
User who set `user_dealloc' should free the _hurd_dtable.d value
|
||||
he used if his word is set when he is finished.
|
||||
If NULL, the old value of _hurd_dtable.d is freed by the setter. */
|
||||
int *_hurd_dtable_user_dealloc;
|
||||
|
||||
static inline struct _hurd_dtable
|
||||
_hurd_dtable_use (int *dealloc)
|
||||
{
|
||||
struct _hurd_dtable dtable;
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
_hurd_dtable_user_dealloc = dealloc;
|
||||
dtable = _hurd_dtable;
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
return dtable;
|
||||
}
|
||||
|
||||
struct _hurd_dtable_resizes
|
||||
{
|
||||
size_t n;
|
||||
void (*free) (void *);
|
||||
void *terminator;
|
||||
};
|
||||
extern const struct _hurd_dtable_resizes _hurd_dtable_resizes;
|
||||
|
||||
static inline void
|
||||
_hurd_dtable_done (struct _hurd_dtable dtable, int *dealloc)
|
||||
{
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
if (_hurd_dtable_user_dealloc == dealloc)
|
||||
_hurd_dtable_user_dealloc = NULL;
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
if (*dealloc)
|
||||
/* _hurd_dtable_resizes is a symbol set.
|
||||
setdtablesize.c gives it one element: free.
|
||||
If setdtablesize is not linked in, *DEALLOC
|
||||
will never get set, so we will never get here.
|
||||
This hair avoids linking in free if we don't need it. */
|
||||
(*_hurd_dtable_resizes.free) (dtable);
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a new file descriptor and set it to PORT.
|
||||
If the table is full, deallocate PORT, set errno, and return -1. */
|
||||
static inline int
|
||||
_hurd_dalloc (io_t port, io_t ctty, int flags)
|
||||
{
|
||||
int i;
|
||||
__mutex_lock (&hurd_dtable_lock);
|
||||
for (i = 0; i < _hurd_dtable.size; ++i)
|
||||
{
|
||||
struct _hurd_fd *d = &_hurd_dtable.d[i];
|
||||
__spin_lock (&d->port.lock);
|
||||
if (d->port.port == MACH_PORT_NULL)
|
||||
{
|
||||
d->port.port = port;
|
||||
d->port.user_dealloc = NULL;
|
||||
d->ctty.port = ctty;
|
||||
d->ctty.user_dealloc = NULL;
|
||||
d->flags = flags;
|
||||
__spin_unlock (&d->port.lock);
|
||||
__mutex_unlock (&hurd_dtable_lock);
|
||||
return i;
|
||||
}
|
||||
__spin_unlock (&d->port.lock);
|
||||
}
|
||||
__mutex_unlock (&hurd_dtable_lock);
|
||||
__mach_port_deallocate (__mach_task_self (), port);
|
||||
__mach_port_deallocate (__mach_task_self (), ctty);
|
||||
errno = EMFILE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns the descriptor cell for FD in DTABLE, locked. */
|
||||
static inline struct _hurd_fd *
|
||||
_hurd_dtable_fd (int fd, struct _hurd_dtable dtable)
|
||||
{
|
||||
if (fd < 0 || fd >= dtable.size)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
struct _hurd_fd *cell = &dtable.d[fd];
|
||||
__spin_lock (&cell->port.lock);
|
||||
if (cell->port.port == MACH_PORT_NULL)
|
||||
{
|
||||
__spin_unlock (&cell->port.lock);
|
||||
return NULL;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
struct _hurd_fd_user
|
||||
{
|
||||
struct _hurd_dtable dtable;
|
||||
struct _hurd_fd *d;
|
||||
};
|
||||
|
||||
/* Returns the descriptor cell for FD, locked. */
|
||||
static inline struct _hurd_fd_user
|
||||
_hurd_fd (int fd, int *dealloc)
|
||||
{
|
||||
struct _hurd_fd_user d;
|
||||
d.dtable = _hurd_dtable_use (dealloc);
|
||||
d.d = _hurd_dtable_fd (fd, dtable);
|
||||
if (d.d == NULL)
|
||||
_hurd_dtable_done (d.dtable, dealloc);
|
||||
return d;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_hurd_fd_done (struct _hurd_fd_user d, int *dealloc)
|
||||
{
|
||||
_hurd_dtable_done (d->dtable, dealloc);n
|
||||
}
|
||||
|
||||
/* Evaluate EXPR with the variable `port' bound to the port to FD,
|
||||
and `ctty' bound to the ctty port. */
|
||||
|
||||
#define _HURD_DPORT_USE(fd, expr) \
|
||||
({ int __dealloc_dt; \
|
||||
struct _hurd_fd_user __d = _hurd_fd (fd, &__dealloc_dt); \
|
||||
if (__cell.d == NULL) \
|
||||
EBADF; \
|
||||
else \
|
||||
{ \
|
||||
int __dealloc = 0, __dealloc_ctty = 0; \
|
||||
io_t port = _hurd_port_locked_get (&__d.d->port, &__dealloc); \
|
||||
io_t ctty = _hurd_port_locked_get (&__d.d->ctty, &__dealloc_ctty); \
|
||||
__typeof (expr) __result; \
|
||||
__result = (expr); \
|
||||
_hurd_port_free (&__d.d->port, port, &__dealloc); \
|
||||
if (ctty != MACH_PORT_NULL) \
|
||||
_hurd_port_free (&__d.d->ctty, ctty, &__dealloc_ctty); \
|
||||
_hurd_fd_done (__d, &__dealloc_dt); \
|
||||
__result; \
|
||||
} \
|
||||
}) \
|
||||
|
||||
/* Return the socket server for sockaddr domain DOMAIN. */
|
||||
extern socket_t _hurd_socket_server (int domain);
|
||||
|
||||
/* Return a receive right which will not be sent to. */
|
||||
extern mach_port_t _hurd_dead_recv (void);
|
||||
|
||||
|
||||
/* Current process IDs. */
|
||||
extern pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
||||
extern int _hurd_orphaned;
|
||||
|
||||
|
||||
/* User and group IDs. */
|
||||
extern mutex_t _hurd_idlock;
|
||||
extern int _hurd_id_valid; /* Nonzero if _hurd_id is valid. */
|
||||
extern idblock_t _hurd_id;
|
||||
extern auth_t _hurd_rid_auth; /* Cache used by access. */
|
||||
|
||||
|
||||
/* Unix `data break', for brk and sbrk.
|
||||
If brk and sbrk are not used, this info will not be initialized or used. */
|
||||
extern vm_address_t _hurd_brk; /* Data break. */
|
||||
extern vm_address_t _hurd_data_end; /* End of allocated space. */
|
||||
extern struct mutex _hurd_brk_lock; /* Locks brk and data_end. */
|
||||
extern int _hurd_set_data_limit (const struct rlimit *);
|
||||
|
||||
/* Set the data break; the brk lock must
|
||||
be held, and is released on return. */
|
||||
extern int _hurd_set_brk (vm_address_t newbrk);
|
||||
|
||||
/* Resource limit on core file size. Enforced by hurdsig.c. */
|
||||
extern int _hurd_core_limit;
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
/* Per-thread signal state. */
|
||||
struct _hurd_sigstate
|
||||
{
|
||||
thread_t thread;
|
||||
struct _hurd_sigstate *next; /* Linked-list of thread sigstates. */
|
||||
|
||||
struct mutex lock; /* Locks the rest of this structure. */
|
||||
sigset_t blocked;
|
||||
sigset_t pending;
|
||||
struct sigaction actions[NSIG];
|
||||
struct sigstack sigstack;
|
||||
int sigcodes[NSIG]; /* Codes for pending signals. */
|
||||
|
||||
int suspended; /* If nonzero, sig_post signals `arrived'. */
|
||||
struct condition arrived;
|
||||
|
||||
int vforked; /* Nonzero if this thread is a vfork child. */
|
||||
struct
|
||||
{
|
||||
process_t proc;
|
||||
file_t ccdir, cwdir, crdir, auth;
|
||||
mode_t umask;
|
||||
int ctty_fstype;
|
||||
fsid_t ctty_fsid;
|
||||
ino_t ctty_fileid;
|
||||
struct _hurd_dtable *dtable;
|
||||
jmp_buf continuation;
|
||||
} *vfork_saved;
|
||||
|
||||
/* Not locked. Used only by this thread,
|
||||
or by signal thread with this thread suspended. */
|
||||
mach_port_t intr_port; /* Port an interruptible RPC was sent on. */
|
||||
int intr_restart; /* If nonzero, restart interrupted RPC. */
|
||||
};
|
||||
/* Linked list of states of all threads
|
||||
whose state has been inquired about. */
|
||||
extern struct _hurd_sigstate *_hurd_sigstates;
|
||||
extern struct mutex _hurd_siglock; /* Locks _hurd_sigstates. */
|
||||
/* Get the sigstate of a given thread, taking its lock. */
|
||||
extern struct _hurd_sigstate *_hurd_thread_sigstate (thread_t);
|
||||
|
||||
/* Thread to receive process-global signals. */
|
||||
extern thread_t _hurd_sigthread;
|
||||
|
||||
/* Called by the machine-dependent exception handler. */
|
||||
extern void _hurd_exc_post_signal (thread_t, int sig, int code);
|
||||
|
||||
/* SS->lock is held on entry, and released before return. */
|
||||
extern void _hurd_internal_post_signal (reply_port_t,
|
||||
struct _hurd_sigstate *ss,
|
||||
int signo, int sigcode,
|
||||
sigset_t *restore_blocked);
|
||||
|
||||
/* Function run by the signal thread to receive from the signal port. */
|
||||
extern void _hurd_sigport_receive (void);
|
||||
|
||||
|
||||
/* Perform interruptible RPC CALL on PORT.
|
||||
The args in CALL should be constant or local variable refs.
|
||||
They may be evaluated many times, and must not change.
|
||||
PORT must not be deallocated before this RPC is finished. */
|
||||
#define _HURD_EINTR_RPC(port, call) \
|
||||
({
|
||||
error_t __err;
|
||||
struct _hurd_sigstate *__ss
|
||||
= _hurd_thread_sigstate (__mach_thread_self ());
|
||||
__mutex_unlock (&__ss->lock); /* Lock not needed. */
|
||||
/* If we get a signal and should return EINTR, the signal thread will
|
||||
clear this. The RPC might return EINTR when some other thread gets
|
||||
a signal, in which case we want to restart our call. */
|
||||
__ss->intr_restart = 1;
|
||||
/* This one needs to be last. A signal can arrive before here,
|
||||
and if intr_port were set before intr_restart are
|
||||
initialized, the signal thread would get confused. */
|
||||
__ss->intr_port = (port);
|
||||
/* A signal may arrive here, after intr_port is set,
|
||||
but before the mach_msg system call. The signal handler might do an
|
||||
interruptible RPC, and clobber intr_port; then it would not be set
|
||||
properly when we actually did send the RPC, and a later signal
|
||||
wouldn't interrupt that RPC. So, _hurd_run_sighandler saves
|
||||
intr_port in the sigcontext, and sigreturn restores them. */
|
||||
__do_call:
|
||||
switch (__err = (call))
|
||||
{
|
||||
case EINTR: /* RPC went out and was interrupted. */
|
||||
case MACH_SEND_INTERRUPTED: /* RPC didn't get out. */
|
||||
if (__ss->intr_restart)
|
||||
/* Restart the interrupted call. */
|
||||
goto __do_call;
|
||||
/* Return EINTR. */
|
||||
__err = EINTR;
|
||||
break;
|
||||
case MACH_RCV_PORT_DIED:
|
||||
/* Server didn't respond to interrupt_operation,
|
||||
so the signal thread destroyed the reply port. */
|
||||
__err = EINTR;
|
||||
break;
|
||||
}
|
||||
__ss->intr_port = MACH_PORT_NULL;
|
||||
__err;
|
||||
})
|
||||
|
||||
/* Calls to get and set basic ports. */
|
||||
extern process_t getproc (void);
|
||||
extern file_t getccdir (void), getcwdir (void), getcrdir (void);
|
||||
extern auth_t getauth (void);
|
||||
extern int setproc (process_t);
|
||||
extern int setccdir (file_t), setcwdir (file_t), setcrdir (file_t);
|
||||
|
||||
/* Does reauth with the proc server and fd io servers. */
|
||||
extern int __setauth (auth_t), setauth (auth_t);
|
||||
#define setauth __setauth
|
||||
|
||||
|
||||
extern error_t __hurd_path_split (file_t crdir, file_t cwdir,
|
||||
const char *file,
|
||||
file_t *dir, const char **name);
|
||||
#define hurd_path_split __hurd_path_split
|
||||
extern error_t __hurd_path_lookup (file_t crdir, file_t cwdir,
|
||||
const char *file,
|
||||
int flags, mode_t mode,
|
||||
file_t *file);
|
||||
#define hurd_path_lookup __hurd_path_lookup
|
||||
|
||||
/* Returns a port to the directory, and sets *NAME to the file name. */
|
||||
extern file_t __path_split (const char *file, const char **name);
|
||||
#define path_split __path_split
|
||||
|
||||
/* Looks up FILE with the given FLAGS and MODE (as for dir_pathtrans). */
|
||||
extern file_t __path_lookup (const char *file, int flags, mode_t mode);
|
||||
#define path_lookup __path_lookup
|
||||
|
||||
/* Open a file descriptor on a port. */
|
||||
extern int openport (io_t port);
|
||||
|
||||
|
||||
#endif /* hurd.h */
|
||||
100
gnu/glibc/glibc-1.03/hurd/hurdauth.c
Normal file
100
gnu/glibc/glibc-1.03/hurd/hurdauth.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
struct _hurd_port _hurd_auth;
|
||||
|
||||
error_t
|
||||
__add_auth (sigthread_t me,
|
||||
auth_t addauth)
|
||||
{
|
||||
error_t err;
|
||||
auth_t newauth;
|
||||
|
||||
if (err = _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_combine (port, addauth, &newauth)))
|
||||
return err;
|
||||
|
||||
/* XXX clobbers errno. Need per-thread errno. */
|
||||
err = __setauth (newauth);
|
||||
__mach_port_deallocate (__mach_task_self (), newauth);
|
||||
if (err)
|
||||
return errno;
|
||||
|
||||
__mach_port_deallocate (__mach_task_self (), addauth);
|
||||
return POSIX_SUCCESS;
|
||||
}
|
||||
|
||||
error_t
|
||||
__del_auth (sigthread_t me, task_t task,
|
||||
uid_t *uids, size_t nuids,
|
||||
gid_t *gids, size_t ngids)
|
||||
{
|
||||
error_t err;
|
||||
auth_t newauth;
|
||||
size_t i, j;
|
||||
|
||||
if (task != __mach_task_self ())
|
||||
return EPERM;
|
||||
|
||||
__mutex_lock (&_hurd_idlock);
|
||||
if (!_hurd_id_valid)
|
||||
{
|
||||
error_t err = _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_getids (port, &_hurd_id));
|
||||
if (err)
|
||||
{
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
return err;
|
||||
}
|
||||
_hurd_id_valid = 1;
|
||||
}
|
||||
|
||||
while (nuids-- > 0)
|
||||
{
|
||||
const uid_t uid = *uids++;
|
||||
for (i = 0; i < _hurd_id.nuids; ++i)
|
||||
if (_hurd_id.uidset[i] == uid)
|
||||
/* Move the last uid into this slot, and decrease the
|
||||
number of uids so the last slot is no longer used. */
|
||||
_hurd_id.uidset[i] = _hurd_id.uidset[--_hurd_id.nuids];
|
||||
}
|
||||
while (ngids-- > 0)
|
||||
{
|
||||
const gid_t gid = *gids++;
|
||||
for (i = 0; i < _hurd_id.ngroups; ++i)
|
||||
if (_hurd_id.gidset[i] == gid)
|
||||
/* Move the last gid into this slot, and decrease the
|
||||
number of gids so the last slot is no longer used. */
|
||||
_hurd_id.gidset[i] = _hurd_id.gidset[--_hurd_id.ngroups];
|
||||
}
|
||||
|
||||
err = _HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_makeauth (port, &_hurd_id, &newauth));
|
||||
_hurd_id_valid = !err;
|
||||
__mutex_unlock (&_hurd_idlock);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
err = __setauth (newauth); /* XXX clobbers errno */
|
||||
__mach_port_deallocate (__mach_task_self (), newauth);
|
||||
if (err)
|
||||
return errno;
|
||||
return POSIX_SUCCESS;
|
||||
}
|
||||
33
gnu/glibc/glibc-1.03/hurd/hurdid.c
Normal file
33
gnu/glibc/glibc-1.03/hurd/hurdid.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/* 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 <hurd.h>
|
||||
#include <gnu-stabs.h>
|
||||
|
||||
struct mutex _hurd_idlock;
|
||||
int _hurd_id_valid;
|
||||
struct idblock _hurd_id;
|
||||
|
||||
static void
|
||||
init_id (void)
|
||||
{
|
||||
__mutex_init (&_hurd_idlock);
|
||||
_hurd_id_valid = 0;
|
||||
}
|
||||
|
||||
text_set_element (__libc_subinit, init_id);
|
||||
25
gnu/glibc/glibc-1.03/hurd/hurdintr.awk
Normal file
25
gnu/glibc/glibc-1.03/hurd/hurdintr.awk
Normal file
@@ -0,0 +1,25 @@
|
||||
BEGIN { intr=0; wantcall=0; calls=""; }
|
||||
|
||||
$1 == "/*" && $2 == "INTR" && $3 == "*/" { intr=1; }
|
||||
|
||||
NF == 1 && $1 == "routine" { wantcall=1; next; }
|
||||
|
||||
intr != 0 && wantcall == 0 && NF >= 2 && $1 == "routine" \
|
||||
{
|
||||
if (substr($2, length($2)-2, 1) == "(")
|
||||
calls = calls " " substr($2, 0, length($2)-1);
|
||||
else calls = calls " " $2;
|
||||
intr=0;
|
||||
}
|
||||
|
||||
wantcall != 0 && NF >= 1 \
|
||||
{
|
||||
if (substr($1, length($1)-2, 1) == "(")
|
||||
calls = calls " " substr($1, 0, length($1)-1);
|
||||
else calls = calls " " $1;
|
||||
intr=0;
|
||||
}
|
||||
|
||||
{ wantcall=0; }
|
||||
|
||||
END { print varname " :=" calls; }
|
||||
190
gnu/glibc/glibc-1.03/hurd/hurdpath.c
Normal file
190
gnu/glibc/glibc-1.03/hurd/hurdpath.c
Normal file
@@ -0,0 +1,190 @@
|
||||
/* 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>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
error_t
|
||||
__hurd_path_lookup (file_t crdir, file_t cwdir,
|
||||
const char *path, int flags, mode_t mode,
|
||||
file_t *result)
|
||||
{
|
||||
error_t err;
|
||||
file_t startdir, result;
|
||||
|
||||
enum retry_type doretry;
|
||||
char retryname[PATH_MAX];
|
||||
file_t newpt;
|
||||
int dealloc_dir;
|
||||
int nloops;
|
||||
|
||||
if (*path == '/')
|
||||
{
|
||||
startdir = crdir;
|
||||
while (*path == '/')
|
||||
++path;
|
||||
}
|
||||
else
|
||||
startdir = cwdir;
|
||||
|
||||
dealloc_dir = 0;
|
||||
nloops = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
err = __dir_pathtrans (startdir, path, flags, mode,
|
||||
&doretry, retryname, &result);
|
||||
|
||||
if (dealloc_dir)
|
||||
__mach_port_deallocate (__mach_task_self (), startdir);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
switch (doretry)
|
||||
{
|
||||
case FS_RETRY_NONE:
|
||||
return POSIX_SUCCESS;
|
||||
|
||||
case FS_RETRY_REAUTH:
|
||||
__io_reauthenticate (*result);
|
||||
_HURD_PORT_USE (&_hurd_auth,
|
||||
__auth_user_authenticate (port, result, &newpt));
|
||||
__mach_port_deallocate (__mach_task_self (), *result);
|
||||
*result = newpt;
|
||||
/* Fall through. */
|
||||
|
||||
case FS_RETRY_NORMAL:
|
||||
if (nloops++ >= MAXSYMLINKS)
|
||||
return ELOOP;
|
||||
|
||||
if (retryname[0] == '/')
|
||||
{
|
||||
startdir = crdir;
|
||||
dealloc_dir = 0;
|
||||
path = retryname;
|
||||
do
|
||||
++path;
|
||||
while (*path == '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
startdir = *result;
|
||||
dealloc_dir = 1;
|
||||
path = retryname;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
error_t
|
||||
__hurd_path_split (file_t crdir, file_t cwdir,
|
||||
const char *path,
|
||||
file_t *dir, char **name)
|
||||
{
|
||||
const char *lastslash;
|
||||
|
||||
/* Skip leading slashes in the pathname. */
|
||||
if (*path == '/')
|
||||
{
|
||||
while (*path == '/')
|
||||
++path;
|
||||
--path; /* Leave on one slash. */
|
||||
}
|
||||
|
||||
lastslash = strrchr (path, '/');
|
||||
|
||||
if (lastslash != NULL)
|
||||
{
|
||||
if (lastslash == path)
|
||||
{
|
||||
/* "/foobar" => crdir + "foobar". */
|
||||
*name = path;
|
||||
__mach_port_mod_refs (__mach_task_self (), MACH_PORT_RIGHT_SEND,
|
||||
crdir, 1);
|
||||
*dir = crdir;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* "/dir1/dir2/.../file". */
|
||||
char dirname[lastslash - path + 1];
|
||||
memcpy (dirname, path, lastslash - path);
|
||||
dirname[lastslath - path] = '\0';
|
||||
*name = lastslash + 1;
|
||||
return __hurd_path_lookup (crdir, cwdir, dirname, 0, 0, dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* "foobar" => cwdir + "foobar". */
|
||||
*name = path;
|
||||
__mach_port_mod_refs (__mach_task_self (), MACH_PORT_RIGHT_SEND,
|
||||
cwdir, 1);
|
||||
*dir = cwdir;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
file_t
|
||||
__path_lookup (const char *path, int flags, mode_t mode)
|
||||
{
|
||||
error_t err;
|
||||
file_t result, crdir, cwdir;
|
||||
int dealloc_crdir, dealloc_cwdir;
|
||||
|
||||
crdir = _hurd_port_get (&_hurd_crdir, &dealloc_crdir);
|
||||
cwdir = _hurd_port_get (&_hurd_cwdir, &dealloc_cwdir);
|
||||
|
||||
err = __hurd_path_lookup (crdir, cwdir, path, flags, mode, &result);
|
||||
|
||||
_hurd_port_free (crdir, &dealloc_crdir);
|
||||
_hurd_port_free (cwdir, &dealloc_cwdir);
|
||||
|
||||
if (err)
|
||||
{
|
||||
errno = err;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
file_t
|
||||
__path_split (const char *path, char **name)
|
||||
{
|
||||
error_t err;
|
||||
file_t dir, crdir, cwdir;
|
||||
int dealloc_crdir, dealloc_cwdir;
|
||||
|
||||
crdir = _hurd_port_get (&_hurd_crdir, &dealloc_crdir);
|
||||
cwdir = _hurd_port_get (&_hurd_cwdir, &dealloc_cwdir);
|
||||
|
||||
err = __hurd_path_split (crdir, cwdir, path, &dir, name);
|
||||
|
||||
_hurd_port_free (crdir, &dealloc_crdir);
|
||||
_hurd_port_free (cwdir, &dealloc_cwdir);
|
||||
|
||||
if (err)
|
||||
{
|
||||
errno = err;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
return dir;
|
||||
}
|
||||
46
gnu/glibc/glibc-1.03/hurd/hurdpid.c
Normal file
46
gnu/glibc/glibc-1.03/hurd/hurdpid.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
||||
int _hurd_orphaned;
|
||||
|
||||
static void
|
||||
init_pids (void)
|
||||
{
|
||||
int dealloc;
|
||||
process_t proc = _hurd_port_get (&_hurd_proc, &dealloc);
|
||||
|
||||
__proc_getpids (proc, &_hurd_pid, &_hurd_ppid, &_hurd_orphaned);
|
||||
__proc_getpgrp (proc, _hurd_pid, &_hurd_pgrp);
|
||||
|
||||
_hurd_port_free (proc, &dealloc);
|
||||
}
|
||||
|
||||
text_set_element (__libc_subinit, init_pids);
|
||||
|
||||
error_t
|
||||
__proc_newids (sigthread_t me,
|
||||
pid_t ppid, pid_t pgrp, int orphaned)
|
||||
{
|
||||
_hurd_ppid = ppid;
|
||||
_hurd_pgrp = pgrp;
|
||||
_hurd_orphaned = orphaned;
|
||||
return POSIX_SUCCESS;
|
||||
}
|
||||
72
gnu/glibc/glibc-1.03/hurd/hurdports.c
Normal file
72
gnu/glibc/glibc-1.03/hurd/hurdports.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
#define GET(lock, type, what) \
|
||||
type get##what (void) \
|
||||
{ \
|
||||
return _hurd_getport (&_hurd_##what, &_hurd_##lock); \
|
||||
}
|
||||
|
||||
static inline mach_port_t
|
||||
get (struct _hurd_port *cell)
|
||||
{
|
||||
mach_port_t result;
|
||||
error_t err = _HURD_PORT_USE (cell,
|
||||
__mach_port_mod_refs (__mach_task_self (),
|
||||
(result = port),
|
||||
MACH_PORT_RIGHT_SEND,
|
||||
1));
|
||||
if (err)
|
||||
{
|
||||
errno = err;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
#define GET(type, what) \
|
||||
type get##what (void) { return get (&what); }
|
||||
|
||||
static inline int
|
||||
set (struct _hurd_port *cell, mach_port_t new)
|
||||
{
|
||||
error_t err;
|
||||
if (err = __mach_port_mod_refs (__mach_task_self (), new,
|
||||
MACH_PORT_RIGHT_SEND, 1))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
_hurd_port_set (cell, new);
|
||||
return 0;
|
||||
}
|
||||
#define SET(type, what) \
|
||||
int set##what (type new) { return set (&what, new); }
|
||||
|
||||
#define GETSET(type, what) \
|
||||
GET (type, what) SET (type, what)
|
||||
|
||||
GETSET (process_t, proc)
|
||||
GETSET (file_t, ccdir)
|
||||
GETSET (file_t, cwdir)
|
||||
GETSET (file_t, crdir)
|
||||
|
||||
/* setauth is nontrivial; see __setauth.c. */
|
||||
GET (auth_t, auth)
|
||||
486
gnu/glibc/glibc-1.03/hurd/hurdsig.c
Normal file
486
gnu/glibc/glibc-1.03/hurd/hurdsig.c
Normal file
@@ -0,0 +1,486 @@
|
||||
/* 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 <hurd.h>
|
||||
#include <gnu-stabs.h>
|
||||
|
||||
struct mutex _hurd_siglock;
|
||||
int _hurd_stopped;
|
||||
|
||||
/* Port that receives signals and other miscellaneous messages. */
|
||||
mach_port_t _hurd_sigport;
|
||||
|
||||
/* Thread which receives task-global signals. */
|
||||
thread_t _hurd_sigthread;
|
||||
|
||||
/* Linked-list of per-thread signal state. */
|
||||
struct _hurd_sigstate *_hurd_sigstates;
|
||||
|
||||
struct _hurd_sigstate *
|
||||
_hurd_thread_sigstate (thread_t thread)
|
||||
{
|
||||
struct _hurd_sigstate *ss;
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
|
||||
if (ss->thread == thread)
|
||||
break;
|
||||
if (ss == NULL)
|
||||
{
|
||||
ss = calloc (1, sizeof (*ss)); /* Zero-initialized. */
|
||||
if (ss == NULL)
|
||||
__libc_fatal ("hurd: Can't allocate thread sigstate\n");
|
||||
ss->thread = thread;
|
||||
__mutex_init (&ss->lock);
|
||||
ss->next = _hurd_sigstates;
|
||||
_hurd_sigstates = ss;
|
||||
}
|
||||
__mutex_lock (&ss->lock);
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
return ss;
|
||||
}
|
||||
|
||||
#include <hurd/core.h>
|
||||
|
||||
/* Limit on size of core files. */
|
||||
int _hurd_core_limit;
|
||||
|
||||
/* Call the core server to mummify us before we die.
|
||||
Returns nonzero if a core file was written. */
|
||||
static inline int
|
||||
write_corefile (int signo, int sigcode)
|
||||
{
|
||||
error_t err;
|
||||
mach_port_t coreserver;
|
||||
int dealloc_crdir, dealloc_ccdir;
|
||||
file_t crdir, ccdir;
|
||||
|
||||
if (_hurd_core_limit == 0)
|
||||
/* User doesn't want a core. */
|
||||
return 0;
|
||||
|
||||
coreserver = __path_lookup (_SERVERS_CORE, 0, 0);
|
||||
if (coreserver == MACH_PORT_NULL)
|
||||
return 0;
|
||||
|
||||
ccdir = _hurd_port_get (&_hurd_ccdir, &dealloc_ccdir);
|
||||
|
||||
crdir = _hurd_port_get (&_hurd_crdir, &dealloc_crdir);
|
||||
err = __hurd_path_lookup (crdir, ccdir, "core"
|
||||
FS_LOOKUP_WRITE|FS_LOOKUP_CREATE,
|
||||
0666 & ~_hurd_umask,
|
||||
&file);
|
||||
_hurd_port_free (crdir, &dealloc_crdir);
|
||||
|
||||
if (!err)
|
||||
{
|
||||
err = __core_dump_task (coreserver,
|
||||
__mach_task_self (),
|
||||
file,
|
||||
signo, sigcode,
|
||||
getenv ("GNUTARGET"));
|
||||
__mach_port_deallocate (__mach_task_self (), coreserver);
|
||||
if (!err && _hurd_core_limit != RLIM_INFINITY)
|
||||
{
|
||||
io_statbuf_t stb;
|
||||
err = __io_stat (file, &stb);
|
||||
if (!err && stb.stb_size > _hurd_core_limit)
|
||||
err = EFBIG;
|
||||
}
|
||||
__mach_port_deallocate (__mach_task_self (), file);
|
||||
if (err)
|
||||
(void) __dir_unlink (ccdir, "core");
|
||||
}
|
||||
|
||||
_hurd_port_free (ccdir, &dealloc_ccdir);
|
||||
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
||||
extern const size_t _hurd_thread_state_count;
|
||||
|
||||
/* How long to give servers to respond to
|
||||
interrupt_operation before giving up on them. */
|
||||
mach_msg_timeout_t _hurd_interrupt_timeout = 1000; /* One second. */
|
||||
|
||||
/* SS->thread is suspended. Fills STATE in with its registers.
|
||||
SS->lock is held and kept. */
|
||||
static inline void
|
||||
abort_rpcs (struct _hurd_sigstate *ss, int signo, void *state)
|
||||
{
|
||||
if (ss->intr_port != MACH_PORT_NULL)
|
||||
{
|
||||
/* This is the address the PC will be at if the thread
|
||||
is waiting for a mach_msg syscall to return. */
|
||||
extern const int __mach_msg_trap_syscall_pc;
|
||||
extern error_t _hurd_thread_state (thread_t, void *state);
|
||||
extern int *_hurd_thread_pc (void *state);
|
||||
|
||||
/* Abort whatever the thread is doing.
|
||||
If it is in the mach_msg syscall doing the send,
|
||||
the syscall will return MACH_SEND_INTERRUPTED. */
|
||||
__thread_abort (ss->thread);
|
||||
_hurd_thread_state (ss->thread, state);
|
||||
|
||||
if (_hurd_thread_pc (state) == &__mach_msg_trap_syscall_pc)
|
||||
{
|
||||
/* The thread was waiting for the RPC to return.
|
||||
Abort the operation. The RPC will return EINTR. */
|
||||
|
||||
struct
|
||||
{
|
||||
mach_msg_header_t header;
|
||||
mach_msg_type_t type;
|
||||
kern_return_t retcode;
|
||||
} msg;
|
||||
kern_return_t err;
|
||||
|
||||
msg.header.msgh_request_port = ss->intr_port;
|
||||
msg.header.msgh_reply_port = __mach_reply_port ();
|
||||
msg.header.msgh_seqno = 0;
|
||||
msg.header.msgh_id = 33000; /* interrupt_operation XXX */
|
||||
err = __mach_msg (&msg.header,
|
||||
MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TIMEOUT,
|
||||
sizeof (msg.header), sizeof (msg),
|
||||
msg.header.msgh_reply_port,
|
||||
_hurd_interrupt_timeout,
|
||||
MACH_PORT_NULL);
|
||||
if (err != MACH_MSG_SUCCESS)
|
||||
/* The interrupt didn't work.
|
||||
Destroy the receive right the thread is blocked on. */
|
||||
__mach_port_destroy (__mach_task_self (),
|
||||
/* XXX */
|
||||
_hurd_thread_reply_port (ss->thread));
|
||||
else
|
||||
/* In case the server returned something screwy. */
|
||||
__mach_msg_destroy (&msg.header);
|
||||
|
||||
/* Tell the thread whether it should restart the
|
||||
operation or return EINTR when it wakes up. */
|
||||
ss->intr_restart = ss->actions[signo].sa_flags & SA_RESTART;
|
||||
}
|
||||
|
||||
/* If the thread is anywhere before the system call trap,
|
||||
it will start the operation after the signal is handled.
|
||||
|
||||
If the thread is after the system call trap, but before it has
|
||||
cleared SS->intr_port, the operation is already finished. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Abort the RPCs being run by all threads but this one;
|
||||
all other threads should be suspended. */
|
||||
static inline void
|
||||
abort_all_rpcs (int signo, void *state)
|
||||
{
|
||||
thread_t me = __mach_thread_self ();
|
||||
thread_t *threads;
|
||||
size_t nthreads, i;
|
||||
|
||||
__task_threads (__mach_task_self (), &threads, &nthreads);
|
||||
for (i = 0; i < nthreads; ++i)
|
||||
{
|
||||
if (threads[i] != me)
|
||||
{
|
||||
struct _hurd_sigstate *ss = _hurd_thread_sigstate (*nthreads);
|
||||
abort_rpcs (ss, signo, state);
|
||||
__mutex_unlock (&ss->lock);
|
||||
}
|
||||
__mach_port_deallocate (__mach_task_self (), threads[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Deliver a signal.
|
||||
SS->lock is held on entry and released before return. */
|
||||
error_t
|
||||
_hurd_internal_post_signal (reply_port_t reply,
|
||||
struct _hurd_sigstate *ss,
|
||||
int signo,
|
||||
int sigcode,
|
||||
sigset_t *restore_blocked)
|
||||
{
|
||||
char thread_state[_hurd_thread_state_count];
|
||||
enum { stop, ignore, core, term } act;
|
||||
|
||||
if (ss->actions[signo].sa_handler == SIG_DFL)
|
||||
switch (signo)
|
||||
{
|
||||
case 0:
|
||||
/* A sig_post msg with SIGNO==0 is sent to
|
||||
tell us to check for pending signals. */
|
||||
act = ignore;
|
||||
break;
|
||||
|
||||
case SIGTTIN:
|
||||
case SIGTTOU:
|
||||
case SIGSTOP:
|
||||
case SIGTSTP:
|
||||
ss->pending &= ~sigmask (SIGCONT);
|
||||
act = stop;
|
||||
break;
|
||||
|
||||
case SIGCONT:
|
||||
ss->pending &= ~(sigmask (SIGSTOP) | sigmask (SIGTSTP) |
|
||||
sigmask (SIGTTIN) | sigmask (SIGTTOU));
|
||||
/* Fall through. */
|
||||
case SIGIO:
|
||||
case SIGURG:
|
||||
case SIGCHLD:
|
||||
case SIGWINCH:
|
||||
act = ignore;
|
||||
break;
|
||||
|
||||
case SIGQUIT:
|
||||
case SIGILL:
|
||||
case SIGTRAP:
|
||||
case SIGIOT:
|
||||
case SIGEMT:
|
||||
case SIGFPE:
|
||||
case SIGBUS:
|
||||
case SIGSEGV:
|
||||
case SIGSYS:
|
||||
act = core;
|
||||
break;
|
||||
|
||||
default:
|
||||
act = term;
|
||||
break;
|
||||
}
|
||||
else if (ss->actions[signo].sa_handler == SIG_IGN)
|
||||
act = ignore;
|
||||
else
|
||||
act = handle;
|
||||
if (_hurd_orphaned && (signo == SIGTTIN || signo == SIGTTOU) && act == stop)
|
||||
{
|
||||
sigcode = signo;
|
||||
signo = SIGKILL;
|
||||
act = term;
|
||||
}
|
||||
|
||||
/* Handle receipt of a blocked signal. */
|
||||
if ((__sigismember (signo, &ss->blocked) && act != ignore) ||
|
||||
(signo != SIGKILL && _hurd_stopped))
|
||||
{
|
||||
__sigaddmember (signo, &ss->pending);
|
||||
/* Save the code to be given to the handler when SIGNO is unblocked. */
|
||||
ss->sigcodes[signo] = sigcode;
|
||||
act = ignore;
|
||||
}
|
||||
|
||||
if (restore_blocked != NULL)
|
||||
ss->blocked = *restore_blocked;
|
||||
|
||||
switch (act)
|
||||
{
|
||||
case stop:
|
||||
if (reply != MACH_PORT_NULL)
|
||||
__sig_post_reply (reply, POSIX_SUCCESS);
|
||||
_HURD_PORT_USE
|
||||
(&_hurd_proc,
|
||||
({
|
||||
/* Hold the siglock while stopping other threads to be
|
||||
sure it is not held by another thread afterwards. */
|
||||
__mutex_unlock (&ss->lock);
|
||||
__mutex_lock (&_hurd_siglock);
|
||||
__proc_dostop (port, __mach_thread_self ());
|
||||
__mutex_unlock (&_hurd_siglock);
|
||||
abort_all_rpcs (signo, thread_state);
|
||||
__proc_markstop (port, signo);
|
||||
}));
|
||||
_hurd_stopped = 1;
|
||||
|
||||
__mutex_lock (&ss->lock);
|
||||
if (ss->suspended)
|
||||
/* There is a sigsuspend waiting. Tell it to wake up. */
|
||||
__condition_signal (&ss->arrived);
|
||||
else
|
||||
__mutex_unlock (&ss->lock);
|
||||
|
||||
return MIG_NO_REPLY; /* Already replied. */
|
||||
|
||||
case ignore:
|
||||
if (reply != MACH_PORT_NULL)
|
||||
__sig_post_reply (reply, POSIX_SUCCESS);
|
||||
break;
|
||||
|
||||
case core:
|
||||
case term:
|
||||
if (reply != MACH_PORT_NULL)
|
||||
__sig_post_reply (reply, POSIX_SUCCESS);
|
||||
_HURD_PORT_USE
|
||||
(&_hurd_proc,
|
||||
({
|
||||
__proc_dostop (port, __mach_thread_self ());
|
||||
abort_all_rpcs (signo, thread_state);
|
||||
__proc_exit (port,
|
||||
(W_EXITCODE (0, signo) |
|
||||
(act == core && write_corefile (signo, sigcode) ?
|
||||
WCOREDUMP : 0)))
|
||||
}));
|
||||
__task_terminate (__mach_task_self ());
|
||||
return MIG_NO_REPLY; /* Yeah, right. */
|
||||
|
||||
case handle:
|
||||
if (reply != MACH_PORT_NULL)
|
||||
__sig_post_reply (reply, POSIX_SUCCESS);
|
||||
__thread_suspend (ss->thread);
|
||||
abort_rpcs (ss, signo, thread_state);
|
||||
{
|
||||
const sigset_t blocked = ss->blocked;
|
||||
ss->blocked |= __sigmask (signo) | ss->actions[signo].sa_mask;
|
||||
_hurd_run_sighandler (ss->thread, signo, sigcode,
|
||||
ss->actions[signo].sa_handler,
|
||||
ss->actions[signo].sa_flags,
|
||||
blocked,
|
||||
&ss->sigstack,
|
||||
thread_state);
|
||||
}
|
||||
__thread_resume (ss->thread);
|
||||
}
|
||||
|
||||
/* We get here only if we are handling or ignoring the signal;
|
||||
otherwise we are stopped or dead by now. We still hold SS->lock.
|
||||
Check for pending signals, and loop to post them. */
|
||||
for (signo = 1; signo < NSIG; ++signo)
|
||||
if (__sigismember (signo, &ss->pending))
|
||||
{
|
||||
__sigdelmember (signo, &ss->pending);
|
||||
return _hurd_internal_post_signal (MACH_PORT_NULL, ss,
|
||||
signo, ss->sigcodes[signo],
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (ss->suspended)
|
||||
/* There is a sigsuspend waiting. Tell it to wake up. */
|
||||
__condition_signal (&ss->arrived);
|
||||
else
|
||||
__mutex_unlock (&ss->lock);
|
||||
|
||||
return MIG_NO_REPLY;
|
||||
}
|
||||
|
||||
/* Called by the proc server to send a signal. */
|
||||
error_t
|
||||
__sig_post (sigthread_t me,
|
||||
mig_reply_port_t reply,
|
||||
int signo,
|
||||
mach_port_t refport)
|
||||
{
|
||||
struct _hurd_sigstate *ss;
|
||||
|
||||
if (signo < 0 || signo >= NSIG)
|
||||
return EINVAL;
|
||||
|
||||
if (refport == __mach_task_self ())
|
||||
/* Can send any signal. */
|
||||
goto win;
|
||||
else if (refport == _hurd_cttyport)
|
||||
switch (signo)
|
||||
{
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGTSTP:
|
||||
case SIGHUP:
|
||||
goto win;
|
||||
}
|
||||
else
|
||||
{
|
||||
static mach_port_t sessport = MACH_PORT_NULL;
|
||||
if (sessport == MACH_PORT_NULL)
|
||||
_HURD_PORT_USE (&_hurd_proc,
|
||||
__proc_getsidport (port, &sessport));
|
||||
if (sessport != MACH_PORT_NULL &&
|
||||
refport == sessport && signo == SIGCONT)
|
||||
goto win;
|
||||
}
|
||||
|
||||
/* XXX async io? */
|
||||
return EPERM;
|
||||
|
||||
win:
|
||||
ss = _hurd_thread_sigstate (_hurd_sigthread);
|
||||
return _hurd_internal_post_signal (reply, ss, signo, 0, NULL);
|
||||
}
|
||||
|
||||
/* Called by the exception handler to take a signal. */
|
||||
void
|
||||
_hurd_exc_post_signal (thread_t thread, int signo, int sigcode)
|
||||
{
|
||||
(void) _hurd_internal_post_signal (MACH_PORT_NULL,
|
||||
_hurd_thread_sigstate (thread),
|
||||
signo, sigcode, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_hurdsig_init (void)
|
||||
{
|
||||
thread_t sigthread;
|
||||
|
||||
__mutex_init (&_hurd_siglock);
|
||||
|
||||
if (_hurd_sigport == MACH_PORT_NULL)
|
||||
if (err = __mach_port_allocate (__mach_task_self (),
|
||||
MACH_PORT_RIGHT_RECEIVE,
|
||||
&_hurd_sigport))
|
||||
__libc_fatal ("hurd: Can't create signal port receive right\n");
|
||||
|
||||
if (err = __thread_create (__mach_task_self (), &sigthread))
|
||||
__libc_fatal ("hurd: Can't create signal thread\n");
|
||||
if (err = _hurd_start_sigthread (sigthread, _hurd_sigport_receive))
|
||||
__libc_fatal ("hurd: Can't start signal thread\n");
|
||||
_hurd_sigport_thread = sigthread;
|
||||
|
||||
/* Make a send right to the signal port. */
|
||||
if (err = __mach_port_insert_right (__mach_task_self (),
|
||||
_hurd_sigport,
|
||||
MACH_PORT_RIGHT_MAKE_SEND))
|
||||
__libc_fatal ("hurd: Can't create send right to signal port\n");
|
||||
|
||||
/* Receive exceptions on the signal port. */
|
||||
__task_set_special_port (__mach_task_self (),
|
||||
TASK_EXCEPTION,
|
||||
_hurd_sigport);
|
||||
}
|
||||
|
||||
/* Make PROCSERVER be our proc server port.
|
||||
Tell the proc server that we exist. */
|
||||
|
||||
void
|
||||
_hurd_proc_init (process_t procserver, char **argv)
|
||||
{
|
||||
mach_port_t oldsig, oldtask;
|
||||
|
||||
_hurd_port_init (&_hurd_proc, procserver);
|
||||
|
||||
/* Tell the proc server where our args and environment are. */
|
||||
__proc_setprocargs (procserver, argv, __environ);
|
||||
|
||||
/* Initialize the signal code; Mach exceptions will become signals.
|
||||
This sets _hurd_sigport; it must be run before _hurd_proc_init. */
|
||||
_hurdsig_init ();
|
||||
|
||||
/* Give the proc server our task and signal ports. */
|
||||
__proc_setports (procserver,
|
||||
_hurd_sigport, __mach_task_self (),
|
||||
&oldsig, &oldtask);
|
||||
if (oldsig != MACH_PORT_NULL)
|
||||
__mach_port_deallocate (__mach_task_self (), oldsig);
|
||||
if (oldtask != MACH_PORT_NULL)
|
||||
__mach_port_deallocate (__mach_task_self (), oldtask);
|
||||
}
|
||||
90
gnu/glibc/glibc-1.03/hurd/hurdsock.c
Normal file
90
gnu/glibc/glibc-1.03/hurd/hurdsock.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/* _hurd_socket_server - Find the server for a socket domain.
|
||||
|
||||
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 <hurd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <gnu-stabs.h>
|
||||
|
||||
static struct mutex lock;
|
||||
static void
|
||||
init_sock (void)
|
||||
{
|
||||
__mutex_init (&lock);
|
||||
}
|
||||
text_set_element (__libc_subinit, init_sock);
|
||||
|
||||
static file_t sockdir = MACH_PORT_NULL;
|
||||
static file_t *servers;
|
||||
static int max_domain;
|
||||
|
||||
/* Return a port to the socket server for DOMAIN.
|
||||
Socket servers translate nodes in the directory _SERVERS_SOCKET
|
||||
(canonically /servers/socket). These naming point nodes are named
|
||||
by the simplest decimal representation of the socket domain number,
|
||||
for example "/servers/socket/3".
|
||||
|
||||
Socket servers are assumed not to change very often.
|
||||
The library keeps all the server socket ports it has ever looked up,
|
||||
and does not look them up in /servers/socket more than once. */
|
||||
|
||||
socket_t
|
||||
_hurd_socket_server (int domain)
|
||||
{
|
||||
error_t err;
|
||||
|
||||
__mutex_lock (&lock);
|
||||
|
||||
if (sockdir == MACH_PORT_NULL)
|
||||
{
|
||||
sockdir = __path_lookup (_SERVERS_SOCKET, FS_LOOKUP_EXEC, 0);
|
||||
if (sockdir == MACH_PORT_NULL)
|
||||
{
|
||||
__mutex_unlock (&lock);
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (domain > max_domain)
|
||||
{
|
||||
file_t *new = realloc (servers, (domain + 1) * sizeof (file_t));
|
||||
if (new == NULL)
|
||||
{
|
||||
__mutex_unlock (&lock);
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
while (max_domain < domain)
|
||||
new[max_domain++] = MACH_PORT_NULL;
|
||||
servers = new;
|
||||
}
|
||||
|
||||
{
|
||||
char name[100];
|
||||
sprintf (name, "%d", domain);
|
||||
if (err = _HURD_PORT_USE (&_hurd_crdir,
|
||||
__hurd_path_lookup (port, sockdir,
|
||||
name, 0, 0,
|
||||
&servers[domain])))
|
||||
errno = err;
|
||||
}
|
||||
|
||||
__mutex_unlock (&lock);
|
||||
|
||||
return servers[domain];
|
||||
}
|
||||
24
gnu/glibc/glibc-1.03/hurd/hurdsyms.c
Normal file
24
gnu/glibc/glibc-1.03/hurd/hurdsyms.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__hurd_path_lookup, hurd_path_lookup);
|
||||
symbol_alias (__path_lookup, path_lookup);
|
||||
symbol_alias (__hurd_path_split, hurd_path_split);
|
||||
symbol_alias (__path_split, path_split);
|
||||
28
gnu/glibc/glibc-1.03/hurd/intr_rpc.awk
Normal file
28
gnu/glibc/glibc-1.03/hurd/intr_rpc.awk
Normal file
@@ -0,0 +1,28 @@
|
||||
# Icky intimate knowledge of MiG output.
|
||||
|
||||
BEGIN { args=""; argsnext=0; echo=1; print "#include <hurd.h>"; }
|
||||
|
||||
$NF == rpc \
|
||||
{
|
||||
for (i = 1; i < NF; ++i) printf "%s ", $i;
|
||||
print call;
|
||||
next;
|
||||
}
|
||||
|
||||
args == "" && $1 == "#else" { argsnext=1; print $0; next; }
|
||||
|
||||
argsnext == 1 { args=$0; firstarg=substr($1, 2, length($1)-2); }
|
||||
|
||||
{ argsnext=0; }
|
||||
|
||||
/^{/ { echo=0; }
|
||||
|
||||
echo == 1 { print $0; }
|
||||
|
||||
/^}/ \
|
||||
{
|
||||
print "{";
|
||||
print " return _HURD_EINTR_RPC (" firstarg ", " rpc args ");";
|
||||
print "}";
|
||||
echo = 1;
|
||||
}
|
||||
43
gnu/glibc/glibc-1.03/hurd/openport.c
Normal file
43
gnu/glibc/glibc-1.03/hurd/openport.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
/* Open a file descriptor on a port. */
|
||||
|
||||
int
|
||||
openport (io_t port)
|
||||
{
|
||||
int fd;
|
||||
|
||||
/* Give the port a new user reference.
|
||||
This is a good way to check that it is valid. */
|
||||
if (__mach_port_mod_refs (__mach_task_self (), port,
|
||||
MACH_PORT_RIGHT_SEND, 1))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = _hurd_dalloc (port, 0);
|
||||
if (fd < 0)
|
||||
/* The descriptor table is full. */
|
||||
__mach_port_deallocate (__mach_task_self (), port);
|
||||
|
||||
return fd;
|
||||
}
|
||||
21
gnu/glibc/glibc-1.03/hurd/pid2task.c
Normal file
21
gnu/glibc/glibc-1.03/hurd/pid2task.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__pid2task, pid2task);
|
||||
21
gnu/glibc/glibc-1.03/hurd/setauth.c
Normal file
21
gnu/glibc/glibc-1.03/hurd/setauth.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__setauth, setauth);
|
||||
86
gnu/glibc/glibc-1.03/hurd/setdtablesize.c
Normal file
86
gnu/glibc/glibc-1.03/hurd/setdtablesize.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/* 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 <hurd.h>
|
||||
|
||||
/* Change the size of the descriptor table.
|
||||
You cannot shrink the table if any of the descriptors
|
||||
which would be removed are being used. */
|
||||
|
||||
int
|
||||
setdtablesize (size_t size)
|
||||
{
|
||||
int i;
|
||||
struct _hurd_fd *table;
|
||||
|
||||
__mutex_lock (&_hurd_dtable_lock);
|
||||
|
||||
/* Check that no descriptors which are in use are going to disappear. */
|
||||
for (i = size; i < _hurd_dtable.size; ++i)
|
||||
{
|
||||
struct _hurd_fd *const d = &_hurd_dtable.d[i];
|
||||
|
||||
__spin_lock (&d->port.lock);
|
||||
if (d->port.port != MACH_PORT_NULL)
|
||||
{
|
||||
__spin_unlock (&d->port.lock);
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Resize the table. */
|
||||
|
||||
if (_hurd_dtable_user_dealloc == NULL)
|
||||
/* Noone is using the table. We can relocate it. */
|
||||
table = realloc (_hurd_dtable.d, size * sizeof (*table));
|
||||
else
|
||||
/* Someone else is using the table.
|
||||
We must make a new copy, and let them free the old one. */
|
||||
table = malloc (size * sizeof (*table));
|
||||
|
||||
if (table == NULL)
|
||||
{
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_hurd_dtable_user_dealloc != NULL)
|
||||
{
|
||||
*_hurd_dtable_user_dealloc = 1;
|
||||
_hurd_dtable_user_dealloc = NULL;
|
||||
|
||||
memcpy (table, _hurd_dtable.d, _hurd_dtable.size * sizeof (table[0]));
|
||||
}
|
||||
|
||||
/* If the table grew, initialize the new slots. */
|
||||
for (i = _hurd_dtable.size; i < size; ++i)
|
||||
{
|
||||
table[i].flags = 0;
|
||||
_hurd_port_init (&table[i].port, MACH_PORT_NULL);
|
||||
_hurd_port_init (&table[i].ctty, MACH_PORT_NULL);
|
||||
}
|
||||
|
||||
_hurd_dtable.size = size;
|
||||
_hurd_dtable.d = table;
|
||||
|
||||
__mutex_unlock (&_hurd_dtable_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
64
gnu/glibc/glibc-1.03/hurd/sigportdemux.c
Normal file
64
gnu/glibc/glibc-1.03/hurd/sigportdemux.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* Demux messages sent on the signal port.
|
||||
|
||||
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 <hurd.h>
|
||||
|
||||
const struct
|
||||
{
|
||||
size_t n;
|
||||
mach_msg_id_t id[0];
|
||||
} _hurd_sigport_ids;
|
||||
const struct
|
||||
{
|
||||
size_t n;
|
||||
void (*routine[0]) (mach_msg_header_t *inp, mach_msg_header_t *outp);
|
||||
} _hurd_sigport_routines;
|
||||
|
||||
static boolean_t
|
||||
_hurd_sigport_demux (mach_msg_header_t *inp,
|
||||
mach_msg_header_t *outp)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (_hurd_sigport_ids.n != _hurd_sigport_routines.n)
|
||||
__libc_fatal ("LIBRARY BUG: bogus sigport demux table");
|
||||
|
||||
for (i = 0; i < _hurd_sigport_ids.n; ++i)
|
||||
if (inp->msgh_id == _hurd_sigport_ids.id[i])
|
||||
{
|
||||
(*_hurd_sigport_routines.routine[i]) (inp, outp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
mig_reply_header_t *r = (mig_reply_header_t *) outp;
|
||||
r->RetCode = MIG_BAD_ID;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the code that the signal thread runs. */
|
||||
void
|
||||
_hurd_sigport_receive (void)
|
||||
{
|
||||
while (1)
|
||||
(void) __mach_msg_server (_hurd_sigport_demux, __vm_page_size,
|
||||
_hurd_sigport);
|
||||
}
|
||||
21
gnu/glibc/glibc-1.03/hurd/task2pid.c
Normal file
21
gnu/glibc/glibc-1.03/hurd/task2pid.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/* 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 <gnu-stabs.h>
|
||||
|
||||
symbol_alias (__task2pid, task2pid);
|
||||
50
gnu/glibc/glibc-1.03/inet/Makefile
Normal file
50
gnu/glibc/glibc-1.03/inet/Makefile
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.
|
||||
|
||||
#
|
||||
# Sub-makefile for inet portion of the library.
|
||||
#
|
||||
subdir := inet
|
||||
|
||||
headers := inet-cvt.h netdb.h resolv.h \
|
||||
netinet/in.h \
|
||||
arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/telnet.h arpa/tftp.h \
|
||||
protocols/talkd.h protocols/timed.h
|
||||
|
||||
routines := ntohl ntohs htonl htons \
|
||||
inet_addr inet_lnaof inet_mkadr \
|
||||
inet_netof inet_ntoa inet_net \
|
||||
getnetbyad getnetbynm getnetent \
|
||||
getproto getprtent getprtname \
|
||||
getsrvbynm getsrvbypt getservent \
|
||||
res_comp res_debug res_init res_mkqry res_query res_send \
|
||||
gethstnmad sethostent \
|
||||
rcmd rexec ruserpass
|
||||
aux := herror
|
||||
|
||||
# Look for source files in bsd/ for dist.
|
||||
source_dirs := bsd
|
||||
|
||||
%.c: bsd/%.c
|
||||
(echo '#include <ansidecl.h>'; echo '#include "$<"') > $@-tmp
|
||||
mv $@-tmp $@
|
||||
|
||||
# No warnings about losing BSD code.
|
||||
override +gccwarn := -w
|
||||
|
||||
include ../Rules
|
||||
78
gnu/glibc/glibc-1.03/inet/arpa/ftp.h
Normal file
78
gnu/glibc/glibc-1.03/inet/arpa/ftp.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)ftp.h 5.3 (Berkeley) 6/27/88
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for FTP
|
||||
* See RFC-765
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reply codes.
|
||||
*/
|
||||
#define PRELIM 1 /* positive preliminary */
|
||||
#define COMPLETE 2 /* positive completion */
|
||||
#define CONTINUE 3 /* positive intermediate */
|
||||
#define TRANSIENT 4 /* transient negative completion */
|
||||
#define ERROR 5 /* permanent negative completion */
|
||||
|
||||
/*
|
||||
* Type codes
|
||||
*/
|
||||
#define TYPE_A 1 /* ASCII */
|
||||
#define TYPE_E 2 /* EBCDIC */
|
||||
#define TYPE_I 3 /* image */
|
||||
#define TYPE_L 4 /* local byte size */
|
||||
|
||||
/*
|
||||
* Form codes
|
||||
*/
|
||||
#define FORM_N 1 /* non-print */
|
||||
#define FORM_T 2 /* telnet format effectors */
|
||||
#define FORM_C 3 /* carriage control (ASA) */
|
||||
|
||||
/*
|
||||
* Structure codes
|
||||
*/
|
||||
#define STRU_F 1 /* file (no record structure) */
|
||||
#define STRU_R 2 /* record structure */
|
||||
#define STRU_P 3 /* page structure */
|
||||
|
||||
/*
|
||||
* Mode types
|
||||
*/
|
||||
#define MODE_S 1 /* stream */
|
||||
#define MODE_B 2 /* block */
|
||||
#define MODE_C 3 /* compressed */
|
||||
|
||||
/*
|
||||
* Record Tokens
|
||||
*/
|
||||
#define REC_ESC '\377' /* Record-mode Escape */
|
||||
#define REC_EOR '\001' /* Record-mode End-of-Record */
|
||||
#define REC_EOF '\002' /* Record-mode End-of-File */
|
||||
|
||||
/*
|
||||
* Block Header
|
||||
*/
|
||||
#define BLK_EOR 0x80 /* Block is End-of-Record */
|
||||
#define BLK_EOF 0x40 /* Block is End-of-File */
|
||||
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
|
||||
#define BLK_RESTART 0x10 /* Block is Restart Marker */
|
||||
|
||||
#define BLK_BYTECOUNT 2 /* Bytes in this block */
|
||||
38
gnu/glibc/glibc-1.03/inet/arpa/inet.h
Normal file
38
gnu/glibc/glibc-1.03/inet/arpa/inet.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)inet.h 5.4 (Berkeley) 6/1/90
|
||||
*/
|
||||
|
||||
/* External definitions for functions in inet(3) */
|
||||
|
||||
#ifdef __STDC__
|
||||
extern unsigned long inet_addr(const char *);
|
||||
extern char *inet_ntoa(struct in_addr);
|
||||
extern struct in_addr inet_makeaddr(int , int);
|
||||
extern unsigned long inet_network(const char *);
|
||||
extern unsigned long inet_lnaof(struct in_addr);
|
||||
extern unsigned long inet_netof(struct in_addr);
|
||||
#else
|
||||
extern unsigned long inet_addr();
|
||||
extern char *inet_ntoa();
|
||||
extern struct in_addr inet_makeaddr();
|
||||
extern unsigned long inet_network();
|
||||
extern unsigned long inet_lnaof();
|
||||
extern unsigned long inet_netof();
|
||||
#endif
|
||||
233
gnu/glibc/glibc-1.03/inet/arpa/nameser.h
Normal file
233
gnu/glibc/glibc-1.03/inet/arpa/nameser.h
Normal file
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (c) 1983, 1989 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that: (1) source distributions retain this entire copyright
|
||||
* notice and comment, and (2) distributions including binaries display
|
||||
* the following acknowledgement: ``This product includes software
|
||||
* developed by the University of California, Berkeley and its contributors''
|
||||
* in the documentation or other materials provided with the distribution
|
||||
* and in all advertising materials mentioning features or use of this
|
||||
* software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)nameser.h 5.24 (Berkeley) 6/1/90
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define constants based on rfc883
|
||||
*/
|
||||
#define PACKETSZ 512 /* maximum packet size */
|
||||
#define MAXDNAME 256 /* maximum domain name */
|
||||
#define MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define MAXLABEL 63 /* maximum length of domain label */
|
||||
/* Number of bytes of fixed size data in query structure */
|
||||
#define QFIXEDSZ 4
|
||||
/* number of bytes of fixed size data in resource record */
|
||||
#define RRFIXEDSZ 10
|
||||
|
||||
/*
|
||||
* Internet nameserver port number
|
||||
*/
|
||||
#define NAMESERVER_PORT 53
|
||||
|
||||
/*
|
||||
* Currently defined opcodes
|
||||
*/
|
||||
#define QUERY 0x0 /* standard query */
|
||||
#define IQUERY 0x1 /* inverse query */
|
||||
#define STATUS 0x2 /* nameserver status query */
|
||||
/*#define xxx 0x3 /* 0x3 reserved */
|
||||
/* non standard */
|
||||
#define UPDATEA 0x9 /* add resource record */
|
||||
#define UPDATED 0xa /* delete a specific resource record */
|
||||
#define UPDATEDA 0xb /* delete all nemed resource record */
|
||||
#define UPDATEM 0xc /* modify a specific resource record */
|
||||
#define UPDATEMA 0xd /* modify all named resource record */
|
||||
|
||||
#define ZONEINIT 0xe /* initial zone transfer */
|
||||
#define ZONEREF 0xf /* incremental zone referesh */
|
||||
|
||||
/*
|
||||
* Currently defined response codes
|
||||
*/
|
||||
#define NOERROR 0 /* no error */
|
||||
#define FORMERR 1 /* format error */
|
||||
#define SERVFAIL 2 /* server failure */
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
/* non standard */
|
||||
#define NOCHANGE 0xf /* update failed to change db */
|
||||
|
||||
/*
|
||||
* Type values for resources and queries
|
||||
*/
|
||||
#define T_A 1 /* host address */
|
||||
#define T_NS 2 /* authoritative server */
|
||||
#define T_MD 3 /* mail destination */
|
||||
#define T_MF 4 /* mail forwarder */
|
||||
#define T_CNAME 5 /* connonical name */
|
||||
#define T_SOA 6 /* start of authority zone */
|
||||
#define T_MB 7 /* mailbox domain name */
|
||||
#define T_MG 8 /* mail group member */
|
||||
#define T_MR 9 /* mail rename name */
|
||||
#define T_NULL 10 /* null resource record */
|
||||
#define T_WKS 11 /* well known service */
|
||||
#define T_PTR 12 /* domain name pointer */
|
||||
#define T_HINFO 13 /* host information */
|
||||
#define T_MINFO 14 /* mailbox information */
|
||||
#define T_MX 15 /* mail routing information */
|
||||
#define T_TXT 16 /* text strings */
|
||||
/* non standard */
|
||||
#define T_UINFO 100 /* user (finger) information */
|
||||
#define T_UID 101 /* user ID */
|
||||
#define T_GID 102 /* group ID */
|
||||
#define T_UNSPEC 103 /* Unspecified format (binary data) */
|
||||
/* Query type values which do not appear in resource records */
|
||||
#define T_AXFR 252 /* transfer zone of authority */
|
||||
#define T_MAILB 253 /* transfer mailbox records */
|
||||
#define T_MAILA 254 /* transfer mail agent records */
|
||||
#define T_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Values for class field
|
||||
*/
|
||||
|
||||
#define C_IN 1 /* the arpa internet */
|
||||
#define C_CHAOS 3 /* for chaos net at MIT */
|
||||
#define C_HS 4 /* for Hesiod name server at MIT */
|
||||
/* Query class values which do not appear in resource records */
|
||||
#define C_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Status return codes for T_UNSPEC conversion routines
|
||||
*/
|
||||
#define CONV_SUCCESS 0
|
||||
#define CONV_OVERFLOW -1
|
||||
#define CONV_BADFMT -2
|
||||
#define CONV_BADCKSUM -3
|
||||
#define CONV_BADBUFLEN -4
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
|
||||
#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
|
||||
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
|
||||
|
||||
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \
|
||||
defined(i386) || defined(BIT_ZERO_ON_RIGHT)
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#endif
|
||||
#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \
|
||||
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \
|
||||
defined(MIPSEB) || defined (BIT_ZERO_ON_LEFT)
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#endif
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
/* you must determine what the correct bit order is for your compiler */
|
||||
UNDEFINED_BIT_ORDER;
|
||||
#endif
|
||||
/*
|
||||
* Structure for query header, the order of the fields is machine and
|
||||
* compiler dependent, in our case, the bits within a byte are assignd
|
||||
* least significant first, while the order of transmition is most
|
||||
* significant first. This requires a somewhat confusing rearrangement.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u_short id; /* query identification number */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
/* fields in third byte */
|
||||
u_char qr:1; /* response flag */
|
||||
u_char opcode:4; /* purpose of message */
|
||||
u_char aa:1; /* authoritive answer */
|
||||
u_char tc:1; /* truncated message */
|
||||
u_char rd:1; /* recursion desired */
|
||||
/* fields in fourth byte */
|
||||
u_char ra:1; /* recursion available */
|
||||
u_char pr:1; /* primary server required (non standard) */
|
||||
u_char unused:2; /* unused bits */
|
||||
u_char rcode:4; /* response code */
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
|
||||
/* fields in third byte */
|
||||
u_char rd:1; /* recursion desired */
|
||||
u_char tc:1; /* truncated message */
|
||||
u_char aa:1; /* authoritive answer */
|
||||
u_char opcode:4; /* purpose of message */
|
||||
u_char qr:1; /* response flag */
|
||||
/* fields in fourth byte */
|
||||
u_char rcode:4; /* response code */
|
||||
u_char unused:2; /* unused bits */
|
||||
u_char pr:1; /* primary server required (non standard) */
|
||||
u_char ra:1; /* recursion available */
|
||||
#endif
|
||||
/* remaining bytes */
|
||||
u_short qdcount; /* number of question entries */
|
||||
u_short ancount; /* number of answer entries */
|
||||
u_short nscount; /* number of authority entries */
|
||||
u_short arcount; /* number of resource entries */
|
||||
} HEADER;
|
||||
|
||||
/*
|
||||
* Defines for handling compressed domain names
|
||||
*/
|
||||
#define INDIR_MASK 0xc0
|
||||
|
||||
/*
|
||||
* Structure for passing resource records around.
|
||||
*/
|
||||
struct rrec {
|
||||
short r_zone; /* zone number */
|
||||
short r_class; /* class number */
|
||||
short r_type; /* type number */
|
||||
u_long r_ttl; /* time to live */
|
||||
int r_size; /* size of data area */
|
||||
char *r_data; /* pointer to data */
|
||||
};
|
||||
|
||||
extern u_short _getshort();
|
||||
extern u_long _getlong();
|
||||
|
||||
/*
|
||||
* Inline versions of get/put short/long.
|
||||
* Pointer is advanced; we assume that both arguments
|
||||
* are lvalues and will already be in registers.
|
||||
* cp MUST be u_char *.
|
||||
*/
|
||||
#define GETSHORT(s, cp) { \
|
||||
(s) = *(cp)++ << 8; \
|
||||
(s) |= *(cp)++; \
|
||||
}
|
||||
|
||||
#define GETLONG(l, cp) { \
|
||||
(l) = *(cp)++ << 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; \
|
||||
}
|
||||
|
||||
|
||||
#define PUTSHORT(s, cp) { \
|
||||
*(cp)++ = (s) >> 8; \
|
||||
*(cp)++ = (s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Warning: PUTLONG destroys its first argument.
|
||||
*/
|
||||
#define PUTLONG(l, cp) { \
|
||||
(cp)[3] = l; \
|
||||
(cp)[2] = (l >>= 8); \
|
||||
(cp)[1] = (l >>= 8); \
|
||||
(cp)[0] = l >> 8; \
|
||||
(cp) += sizeof(u_long); \
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user