summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-02-11 18:15:10 +0000
committerphk <phk@FreeBSD.org>1996-02-11 18:15:10 +0000
commit6954927bf885474250f9dd2e29d396d9a823b65e (patch)
tree3dcbd7f46d5cd4996aeaaf1b334392c9871ec69b /gnu
parent76962777f49d30ddfb54fae360af67d41345f1ad (diff)
downloadFreeBSD-src-6954927bf885474250f9dd2e29d396d9a823b65e.zip
FreeBSD-src-6954927bf885474250f9dd2e29d396d9a823b65e.tar.gz
Remove libgnumalloc.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libmalloc/COPYING.LIB481
-rw-r--r--gnu/lib/libmalloc/ChangeLog291
-rw-r--r--gnu/lib/libmalloc/Makefile12
-rw-r--r--gnu/lib/libmalloc/Makefile.gnu57
-rw-r--r--gnu/lib/libmalloc/OChangeLog34
-rw-r--r--gnu/lib/libmalloc/README12
-rw-r--r--gnu/lib/libmalloc/VERSION2
-rw-r--r--gnu/lib/libmalloc/calloc.c39
-rw-r--r--gnu/lib/libmalloc/cfree.c43
-rw-r--r--gnu/lib/libmalloc/getpagesize.h38
-rw-r--r--gnu/lib/libmalloc/gmalloc-head.c6
-rw-r--r--gnu/lib/libmalloc/malloc.c622
-rw-r--r--gnu/lib/libmalloc/malloc.h261
-rw-r--r--gnu/lib/libmalloc/mcheck.c133
-rw-r--r--gnu/lib/libmalloc/mem-limits.h132
-rw-r--r--gnu/lib/libmalloc/memalign.c61
-rw-r--r--gnu/lib/libmalloc/morecore.c44
-rw-r--r--gnu/lib/libmalloc/mstats.c39
-rw-r--r--gnu/lib/libmalloc/mtrace.awk36
-rw-r--r--gnu/lib/libmalloc/mtrace.c150
-rw-r--r--gnu/lib/libmalloc/ralloc.c514
-rw-r--r--gnu/lib/libmalloc/valloc.c44
-rw-r--r--gnu/lib/libmalloc/vm-limit.c134
23 files changed, 0 insertions, 3185 deletions
diff --git a/gnu/lib/libmalloc/COPYING.LIB b/gnu/lib/libmalloc/COPYING.LIB
deleted file mode 100644
index eb685a5..0000000
--- a/gnu/lib/libmalloc/COPYING.LIB
+++ /dev/null
@@ -1,481 +0,0 @@
- 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!
diff --git a/gnu/lib/libmalloc/ChangeLog b/gnu/lib/libmalloc/ChangeLog
deleted file mode 100644
index 260c979..0000000
--- a/gnu/lib/libmalloc/ChangeLog
+++ /dev/null
@@ -1,291 +0,0 @@
-Wed Jun 2 17:45:38 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/Makefile (%.gz): Renamed target from %.z; use -v flag.
- (malloc/ChangeLog): Use mv -f.
-
-Mon May 31 21:49:04 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/mtrace.c: #include <stdio.h>; malloc.h no longer does.
-
-Sun May 30 20:04:50 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/malloc.c (malloc): #if 0 out ``if (SIZE == 0) return NULL''.
-
- * malloc/malloc.h [_MALLOC_INTERNAL]: Don't include <stdio.h>.
- [_MALLOC_INTERNAL]: Move config.h, limits.h, and mem* to front of file.
- (NULL): Move after stddef.h.
-
- * malloc/valloc.c: Don't include config.h; malloc.h already did.
-
- * malloc/malloc.c: Undo rms's change.
-
- * malloc/mcheck.c, malloc/malloc.h: Undo rms's change.
-
-Sat May 29 13:04:38 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * malloc/malloc.c (malloc) [emacs]: If size is 0, make it 1.
-
- * malloc/malloc.h (CONST): Define this always,
- rather than `const' sometimes.
- (memory_warnings): Use CONST, not __const, in decl.
- * malloc/mcheck.c (checkhdr): Use CONST, not const.
-
-Fri May 14 19:34:54 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/Makefile: Remove depend-malloc dependency on malloc/gmalloc.c.
-
-Wed May 12 19:43:37 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * malloc/cfree.c: Put malloc.h include in _MALLOC_INTERNAL conditional.
-
-Wed May 12 16:24:23 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/cfree.c: Include <malloc.h> instead of <stdlib.h>.
- [_LIBC]: Use function_alias only under this conditional.
- [! _LIBC] (cfree): Define a function that just calls free.
-
-Mon May 10 16:56:09 1993 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
-
- * malloc/cfree.c: Put the meat of the file inside a "#if
- defined(__GNU_LIBRARY__)" clause, so that gmalloc.c, which
- incorporates this file, can be used outside of the C library.
-
-Sun May 9 16:57:43 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/Makefile (malloc-dist): Add ChangeLog and mem-limits.h.
- (malloc/ChangeLog): New rule using Noah's changelog-extract.
- (malloc.tar): Use o flag to tar to make compatible archives.
- (gmalloc-routines): Add calloc, valloc, and cfree.
- (dist-routines): Remove [cv]alloc from here.
- (routines): Remove cfree from here.
-
-Fri Mar 26 14:53:30 1993 Michael John Haertel (mike@skinner.cs.uoregon.edu)
-
- * malloc/malloc.c (malloc): Start searching at _heapindex, not
- MALLOC_SEARCH_START.
- * malloc/malloc.h (MALLOC_SEARCH_START): Macro removed.
- * malloc/realloc.c (realloc): When malloc returns NULL, handle the
- case of the block we need to unfree (which was just freed) having
- been coalesced with its neighbors.
-
-Thu Mar 25 13:40:17 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * Rules (mostlyclean): Remove the .o files for $(tests) and $(others).
- Remove $(objpfx)depend-$(subdir).
- (clean): Remove $(extra-objs).
- * Makefile (clean): Remove $(install-lib) from $(objdir).
- Don't try to remove ansi/ and trad/ or dist.tar or lint.out.
- Remove $(objpfx)depend-.
- * time/Makefile (extra-objs): Define new var.
- * malloc/Makefile (extra-objs): Likewise.
-
-Wed Mar 24 16:09:26 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/Makefile (malloc/%.c, malloc/%.h): Rules removed.
-
-Mon Mar 22 15:35:54 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/malloc.h [_MALLOC_INTERNAL]
- [__GNU_LIBRARY__ || STDC_HEADERS || USG] (memmove): Define in
- terms of bcopy.
- * malloc/malloc/gmalloc-head.c: Redo previously undone change.
-
-Thu Mar 18 04:59:21 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu)
-
- * malloc/malloc/gmalloc-head.c: Undo previous change.
-
-Tue Mar 9 11:32:35 1993 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
-
- * malloc/malloc/gmalloc-head.c: Remove #definitions of memset,
- memcpy, and memmove; this is taken care of by malloc.h anyway.
-
-Thu Feb 25 14:49:52 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/malloc.h [_MALLOC_INTERNAL]: Move #include <stdio.h> to
- front of file; it needs to come before size_t/ptrdiff_t frobnication.
-
-Mon Feb 22 12:19:19 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/dist-Makefile (gmalloc.c): Depend on Makefile.
-
- * malloc/Makefile (gmalloc-routines): New variable.
- (dist-routines): Use it.
- (malloc/Makefile): Also replace <GMALLOC-SOURCES> with
- $(gmalloc-routines).
- (malloc/Makefile): Make it unwritable to avoid accidental lossage.
- Depend on Makefile.
-
- * malloc/dist-Makefile (gmalloc): New variable: <GMALLOC-SOURCES>.
- (gmalloc.c): Use $(gmalloc), not $(sources).
- Make the file unwritable to avoid accidental lossage.
-
- * malloc/mtrace.c: Don't #include <stdio.h> because <malloc.h> did
- it for us.
-
- * malloc/valloc.c [! __GNU_LIBRARY__]: Replace hairy conditionals
- with #include "getpagesize.h".
- * malloc/Makefile (distribute, malloc-dist): Add getpagesize.h.
-
-Thu Feb 18 14:34:00 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/mcheck.c (checkhdr): Use `const', not `__const'.
-
-Tue Dec 29 18:18:58 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/Makefile (dist-headers): Define to malloc.h.
- (headers): Replace malloc.h with $(dist-headers).
- (malloc/Makefile): Use $(dist-headers) in place of $(headers).
- (malloc-dist, distribute): Replace ChangeLog with OChangeLog.
-
- * malloc/dist-Makefile (malloc.tar{,.Z}): Depend on FORCE.
- (FORCE): Define empty target.
-
-Tue Oct 27 18:11:19 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/mcheck.c (mcheck): Set abortfunc to either FUNC or abort;
- never leave it unchanged.
- Return 0 if mcheck_used; -1 if not.
- * malloc/malloc.h (mcheck): Change return type in decl.
-
-Thu Oct 15 19:25:46 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/malloc.h (__after_morecore_hook): Declare new var.
- * malloc/malloc.c (__after_morecore_hook): Define it.
- (align): Call it.
-
-Mon Oct 12 15:56:07 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/malloc.h (r_alloc, r_alloc_free, r_re_alloc): Declare.
-
- * malloc/Makefile (dist-routines): Add ralloc.
- (gpl2lgpl): Add ralloc.c.
-
-Mon Oct 12 13:37:16 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/malloc.h: Declare memory_warnings.
- * malloc/Makefile (dist-routines): Add vm-limit.
- (distribute): Add mem-limits.h.
- (gpl2lgpl): Add vm-limit.c, mem-limits.h.
-
-Thu Aug 27 15:58:13 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * malloc/malloc.h [! __STDC__] (ptrdiff_t): #define.
-
-Wed Aug 26 18:15:47 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/free.c (__free): Rename to _free_internal.
- (free), malloc/malloc.c (morecore): Change callers.
- * malloc/malloc.h: Change decl.
-
-Tue Aug 18 17:38:13 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/Makefile (obstack.%): Remove rule.
- (gpl2lgpl): Define this instead.
- * posix/Makefile (gpl2lgpl): Define to include getopt source files.
- * Makerules ($(gpl2lgpl)): New rule to snarf code and frob its
- copying notices.
-
-Tue Jul 7 03:11:23 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/Makefile (dist-routines): Define with routines for malloc.tar.
- (routines): Define with that plus the rest.
- (nodist): Remove.
- (routines): Add obstack.
- (headers): Add obstack.h.
- (obstack.%): New rule.
-
-Thu Jun 25 21:01:40 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * sysdeps/unix/morecore.c (__default_morecore): Deansideclized.
- * malloc/*.c: Only #include <malloc.h> #ifndef _MALLOC_INTERNAL.
-
-Thu Jun 4 16:41:56 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/malloc.h (mtrace): Declare.
-
- * malloc/malloc.h, malloc/calloc.c, malloc/free.c, malloc/malloc.c,
- malloc/mcheck.c, malloc/memalign.c, malloc/mstats.c,
- malloc/mtrace.c, malloc/realloc.c, malloc/valloc.c: Deansideclized;
- changed copyright notices to be independent of libc.
- * malloc/Makefile (glob/%.c, glob/%.h): Don't need to ansideclificate.
-
-Fri May 22 01:52:04 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * assert/assert.h, ctype/ctype.h, dirent/dirent.h, grp/grp.h,
- locale/locale.h, locale/localeinfo.h, math/math.h,
- misc/sys/file.h, misc/sys/ioctl.h, misc/sys/ptrace.h,
- misc/sys/uio.h, misc/sgtty.h, misc/nlist.h, posix/gnu/types.h,
- posix/sys/wait.h, posix/sys/types.h, posix/sys/times.h,
- posix/sys/utsname.h, posix/unistd.h, posix/tar.h, posix/utime.h,
- posix/wordexp.h, posix/glob.h, posix/fnmatch.h, pwd/pwd.h,
- resource/sys/resource.h, resource/sys/vlimit.h,
- resource/sys/vtimes.h, setjmp/setjmp.h, signal/signal.h,
- signal/gnu/signal.h, socket/sys/socket.h, stdio/stdio.h,
- stdio/printf.h, stdlib/alloca.h, stdlib/stdlib.h, string/string.h,
- termios/termios.h, time/sys/time.h, time/time.h, io/sys/stat.h,
- io/fcntl.h, errno.h, stddef.h, malloc/malloc.h:
- Deansideclized. Use <sys/cdefs.h> macros instead of ansidecl and
- C++ cruft.
- * features.h: #include <sys/cdefs.h>.
-
-Sun May 17 15:50:00 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu)
-
- * malloc/mtrace.c (old_{free,malloc,realloc}_hook): Renamed to tr_&
- to not conflict with mcheck.c when combined into gmalloc.c.
-
-Tue Apr 28 19:25:21 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu)
-
- * malloc/valloc.c [emacs]: #include "config.h"
-
-Thu Apr 23 13:55:34 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu)
-
- * malloc/realloc.c, malloc/malloc.c: Don't #define memcpy or memset
- if already #define'd.
-
-Tue Apr 21 04:16:56 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu)
-
- * malloc/Makefile: Moved include ../Rules after malloc.tar rules.
- They need $(routines), which Rules clears.
-
- * malloc/realloc.c (MIN): Renamed to min. Conflicted with HPUX
- system header files.
-
-Tue Mar 17 17:31:06 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * malloc/dist-README: Changed mailing list addr to bug-glibc.
-
-Sun Mar 15 00:01:05 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu)
-
- * malloc/Makefile (malloc/gmalloc.c): Depend on headers and sources.
-
-Fri Mar 13 17:20:19 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * malloc/Makefile (libmcheck.a), Makefile (crt0.o): Remove target
- first; don't use -f to ln.
-
-Tue Feb 25 01:42:16 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * malloc/dist-README: Fixed mailing list addr.
-
-Mon Feb 17 05:04:00 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * malloc/Makefile (distribute): Add mcheck-init.c.
-
-Fri Feb 14 01:52:12 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * Makeconfig: Added comments describing objdir/Makeconfig and
- editting Makeconfig.
- (prefix, libdir, INSTALL, INSTALL_DATA): New variables for installing.
- * Makerules (install): New target.
- * Makefile (+subdir_targets): Add subdir_install.
- (install): Depend on subdir_install.
- (install-lib): Define variable to install libc.a and crt0.o.
- * misc/Makefile (install-lib): Install bsd-compat.
- * malloc/Makefile (install-lib): Install mcheck-init.
-
-Wed Feb 12 12:12:12 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu)
-
- * malloc/mtrace.c: Use %p fmt for pointers.
-
-
-Find older changes in OChangeLog.
diff --git a/gnu/lib/libmalloc/Makefile b/gnu/lib/libmalloc/Makefile
deleted file mode 100644
index 1d33b0f..0000000
--- a/gnu/lib/libmalloc/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id: Makefile,v 1.4 1993/12/28 07:54:51 smace Exp $
-
-
-CFLAGS+= -I${.CURDIR}
-
-LIB= gnumalloc
-SRCS+= malloc.c cfree.c calloc.c morecore.c
-SRCS+= memalign.c valloc.c mcheck.c mtrace.c mstats.c vm-limit.c
-SRCS+= ralloc.c
-NOMAN= noman
-
-.include <bsd.lib.mk>
diff --git a/gnu/lib/libmalloc/Makefile.gnu b/gnu/lib/libmalloc/Makefile.gnu
deleted file mode 100644
index ec35f74..0000000
--- a/gnu/lib/libmalloc/Makefile.gnu
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public License
-# as published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-
-# The GNU C Library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-
-# You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB. If
-# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-# Cambridge, MA 02139, USA.
-
-# Makefile for standalone distribution of malloc.
-
-# Use this on System V.
-#CPPFLAGS = -DUSG
-
-.PHONY: all
-all: libmalloc.a gmalloc.o
-
-gmalloc = malloc.c free.c cfree.c realloc.c calloc.c morecore.c memalign.c valloc.c
-sources = malloc.c free.c cfree.c realloc.c calloc.c morecore.c memalign.c valloc.c mcheck.c mtrace.c mstats.c vm-limit.c ralloc.c
-objects = malloc.o free.o cfree.o realloc.o calloc.o morecore.o memalign.o valloc.o mcheck.o mtrace.o mstats.o vm-limit.o ralloc.o
-headers = malloc.h
-
-libmalloc.a: $(objects)
- ar crv $@ $(objects)
- ranlib $@
-
-$(objects): $(headers)
-
-gmalloc.c: gmalloc-head.c $(headers) $(gmalloc) Makefile
- cat gmalloc-head.c $(headers) $(gmalloc) > $@-tmp
- mv -f $@-tmp $@
-# Make it unwritable to avoid accidentally changing the file,
-# since it is generated and any changes would be lost.
- chmod a-w $@
-
-.c.o:
- $(CC) $(CFLAGS) $(CPPFLAGS) -I. -c $< $(OUTPUT_OPTION)
-
-.PHONY: clean realclean malloc-clean malloc-realclean
-clean malloc-clean:
- -rm -f libmalloc.a *.o core
-realclean malloc-realclean: clean
- -rm -f TAGS tags *~
-
-# For inside the C library.
-malloc.tar malloc.tar.Z: FORCE
- $(MAKE) -C .. $@
-FORCE:
diff --git a/gnu/lib/libmalloc/OChangeLog b/gnu/lib/libmalloc/OChangeLog
deleted file mode 100644
index 452aa53..0000000
--- a/gnu/lib/libmalloc/OChangeLog
+++ /dev/null
@@ -1,34 +0,0 @@
- **** All newer entries are in the C library ChangeLog file. ****
-
-Thu Jul 11 18:15:04 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
-
- * Merged with C library version, which now has its own subdir.
- * malloc.h, *.c: Use ansideclisms and #ifdefs for portability both
- in and out of the C library.
- * Makefile: New makefile for malloc subdir in libc.
- Has targets to create malloc.tar{,.Z} by ansidecl processing on srcs.
- * malloc/Makefile: New file; Makefile for standalone distribution.
- * malloc/README: New file; info for same.
-
-Fri Apr 6 00:18:36 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * Makefile: Add comments.
-
-Thu Apr 5 23:08:14 1990 Mike Haertel (mike at albert.ai.mit.edu)
-
- * mcheck.c (mcheck, checkhdr): Support user-supplied abort()
- function.
- * malloc.h: Declare __free().
- * Makefile: New target libmalloc.a.
-
-Thu Apr 5 21:56:03 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
-
- * free.c (free): Split into free and __free.
- * malloc.c (morecore): Call __free on oldinfo.
-
-Local Variables:
-mode: indented-text
-left-margin: 8
-fill-column: 76
-version-control: never
-End:
diff --git a/gnu/lib/libmalloc/README b/gnu/lib/libmalloc/README
deleted file mode 100644
index b5655c9..0000000
--- a/gnu/lib/libmalloc/README
+++ /dev/null
@@ -1,12 +0,0 @@
-This is the standalone distribution of GNU malloc.
-GNU malloc is part of the GNU C Library, but is also distributed separately.
-
-If you find bugs in GNU malloc, send reports to bug-glibc@prep.ai.mit.edu.
-
-GNU malloc is free software. See the file COPYING.LIB for copying conditions.
-
-The makefile builds libmalloc.a and gmalloc.o. If you are using GNU malloc
-to replace your system's existing malloc package, it is important to make
-sure you get all GNU functions, not some of the GNU functions and some from
-the system library. gmalloc.o has all the functions in one file, so using
-that will make sure you don't accidentally mix the two malloc packages.
diff --git a/gnu/lib/libmalloc/VERSION b/gnu/lib/libmalloc/VERSION
deleted file mode 100644
index c07e080..0000000
--- a/gnu/lib/libmalloc/VERSION
+++ /dev/null
@@ -1,2 +0,0 @@
-this version of GNU malloc was obtained from prep.ai.mit.edu on
-9/22/1993. There was no version noted.
diff --git a/gnu/lib/libmalloc/calloc.c b/gnu/lib/libmalloc/calloc.c
deleted file mode 100644
index f870e94..0000000
--- a/gnu/lib/libmalloc/calloc.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-/* Allocate an array of NMEMB elements each SIZE bytes long.
- The entire array is initialized to zeros. */
-__ptr_t
-calloc (nmemb, size)
- register size_t nmemb;
- register size_t size;
-{
- register __ptr_t result = malloc (nmemb * size);
-
- if (result != NULL)
- (void) memset (result, 0, nmemb * size);
-
- return result;
-}
diff --git a/gnu/lib/libmalloc/cfree.c b/gnu/lib/libmalloc/cfree.c
deleted file mode 100644
index adc1ff6..0000000
--- a/gnu/lib/libmalloc/cfree.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#undef cfree
-
-#ifdef _LIBC
-
-#include <ansidecl.h>
-#include <gnu-stabs.h>
-
-function_alias(cfree, free, void, (ptr),
- DEFUN(cfree, (ptr), PTR ptr))
-
-#else
-
-void
-cfree (ptr)
- __ptr_t ptr;
-{
- free (ptr);
-}
-
-#endif
diff --git a/gnu/lib/libmalloc/getpagesize.h b/gnu/lib/libmalloc/getpagesize.h
deleted file mode 100644
index 2d43f26..0000000
--- a/gnu/lib/libmalloc/getpagesize.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifdef BSD
-#ifndef BSD4_1
-#define HAVE_GETPAGESIZE
-#endif
-#endif
-
-#ifndef HAVE_GETPAGESIZE
-
-#ifdef VMS
-#define getpagesize() 512
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef _SC_PAGESIZE
-#define getpagesize() sysconf(_SC_PAGESIZE)
-#else
-
-#include <sys/param.h>
-
-#ifdef EXEC_PAGESIZE
-#define getpagesize() EXEC_PAGESIZE
-#else
-#ifdef NBPG
-#define getpagesize() NBPG * CLSIZE
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* no CLSIZE */
-#else /* no NBPG */
-#define getpagesize() NBPC
-#endif /* no NBPG */
-#endif /* no EXEC_PAGESIZE */
-#endif /* no _SC_PAGESIZE */
-
-#endif /* not HAVE_GETPAGESIZE */
-
diff --git a/gnu/lib/libmalloc/gmalloc-head.c b/gnu/lib/libmalloc/gmalloc-head.c
deleted file mode 100644
index e5f82c3..0000000
--- a/gnu/lib/libmalloc/gmalloc-head.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* DO NOT EDIT THIS FILE -- it is automagically generated. -*- C -*- */
-
-#define _MALLOC_INTERNAL
-
-/* The malloc headers and source files from the C library follow here. */
-
diff --git a/gnu/lib/libmalloc/malloc.c b/gnu/lib/libmalloc/malloc.c
deleted file mode 100644
index 3c1ee99..0000000
--- a/gnu/lib/libmalloc/malloc.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/* Memory allocator `malloc'.
- Copyright 1990, 1991, 1992, 1993 Free Software Foundation
- Written May 1989 by Mike Haertel.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-/* How to really get more memory. */
-__ptr_t (*__morecore) __P ((ptrdiff_t __size)) = __default_morecore;
-
-/* Debugging hook for `malloc'. */
-__ptr_t (*__malloc_hook) __P ((size_t __size));
-
-/* Pointer to the base of the first block. */
-char *_heapbase;
-
-/* Block information table. Allocated with align/__free (not malloc/free). */
-malloc_info *_heapinfo;
-
-/* Number of info entries. */
-static size_t heapsize;
-
-/* Search index in the info table. */
-size_t _heapindex;
-
-/* Limit of valid info table indices. */
-size_t _heaplimit;
-
-/* Free lists for each fragment size. */
-struct list _fraghead[BLOCKLOG];
-
-/* Instrumentation. */
-size_t _chunks_used;
-size_t _bytes_used;
-size_t _chunks_free;
-size_t _bytes_free;
-
-/* Are you experienced? */
-int __malloc_initialized;
-
-void (*__after_morecore_hook) __P ((void));
-
-/* Aligned allocation. */
-static __ptr_t align __P ((size_t));
-static __ptr_t
-align (size)
- size_t size;
-{
- __ptr_t result;
- unsigned long int adj;
-
- result = (*__morecore) (size);
- adj = (unsigned long int) ((unsigned long int) ((char *) result -
- (char *) NULL)) % BLOCKSIZE;
- if (adj != 0)
- {
- adj = BLOCKSIZE - adj;
- (void) (*__morecore) (adj);
- result = (char *) result + adj;
- }
-
- if (__after_morecore_hook)
- (*__after_morecore_hook) ();
-
- return result;
-}
-
-/* Set everything up and remember that we have. */
-static int initialize __P ((void));
-static int
-initialize ()
-{
- heapsize = HEAP / BLOCKSIZE;
- _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info));
- if (_heapinfo == NULL)
- return 0;
- memset (_heapinfo, 0, heapsize * sizeof (malloc_info));
- _heapinfo[0].free.size = 0;
- _heapinfo[0].free.next = _heapinfo[0].free.prev = 0;
- _heapindex = 0;
- _heapbase = (char *) _heapinfo;
- __malloc_initialized = 1;
- return 1;
-}
-
-/* Get neatly aligned memory, initializing or
- growing the heap info table as necessary. */
-static __ptr_t morecore __P ((size_t));
-static __ptr_t
-morecore (size)
- size_t size;
-{
- __ptr_t result;
- malloc_info *newinfo, *oldinfo;
- size_t newsize;
-
- result = align (size);
- if (result == NULL)
- return NULL;
-
- /* Check if we need to grow the info table. */
- if ((size_t) BLOCK ((char *) result + size) > heapsize)
- {
- newsize = heapsize;
- while ((size_t) BLOCK ((char *) result + size) > newsize)
- newsize *= 2;
- newinfo = (malloc_info *) align (newsize * sizeof (malloc_info));
- if (newinfo == NULL)
- {
- (*__morecore) (-size);
- return NULL;
- }
- memset (newinfo, 0, newsize * sizeof (malloc_info));
- memcpy (newinfo, _heapinfo, heapsize * sizeof (malloc_info));
- oldinfo = _heapinfo;
- newinfo[BLOCK (oldinfo)].busy.type = 0;
- newinfo[BLOCK (oldinfo)].busy.info.size
- = BLOCKIFY (heapsize * sizeof (malloc_info));
- _heapinfo = newinfo;
- _free_internal (oldinfo);
- heapsize = newsize;
- }
-
- _heaplimit = BLOCK ((char *) result + size);
- return result;
-}
-
-/* Allocate memory from the heap. */
-__ptr_t
-malloc (size)
- size_t size;
-{
- __ptr_t result;
- size_t block, blocks, lastblocks, start;
- register size_t i;
- struct list *next;
-
- /* ANSI C allows `malloc (0)' to either return NULL, or to return a
- valid address you can realloc and free (though not dereference).
-
- It turns out that some extant code (sunrpc, at least Ultrix's version)
- expects `malloc (0)' to return non-NULL and breaks otherwise.
- Be compatible. */
-
-#if 0
- if (size == 0)
- return NULL;
-#endif
-
- if (__malloc_hook != NULL)
- return (*__malloc_hook) (size);
-
- if (!__malloc_initialized)
- if (!initialize ())
- return NULL;
-
- if (size < sizeof (struct list))
- size = sizeof (struct list);
-
- /* Determine the allocation policy based on the request size. */
- if (size <= BLOCKSIZE / 2)
- {
- /* Small allocation to receive a fragment of a block.
- Determine the logarithm to base two of the fragment size. */
- register size_t log = 1;
- --size;
- while ((size /= 2) != 0)
- ++log;
-
- /* Look in the fragment lists for a
- free fragment of the desired size. */
- next = _fraghead[log].next;
- if (next != NULL)
- {
- /* There are free fragments of this size.
- Pop a fragment out of the fragment list and return it.
- Update the block's nfree and first counters. */
- result = (__ptr_t) next;
- next->prev->next = next->next;
- if (next->next != NULL)
- next->next->prev = next->prev;
- block = BLOCK (result);
- if (--_heapinfo[block].busy.info.frag.nfree != 0)
- _heapinfo[block].busy.info.frag.first = (unsigned long int)
- ((unsigned long int) ((char *) next->next - (char *) NULL)
- % BLOCKSIZE) >> log;
-
- /* Update the statistics. */
- ++_chunks_used;
- _bytes_used += 1 << log;
- --_chunks_free;
- _bytes_free -= 1 << log;
- }
- else
- {
- /* No free fragments of the desired size, so get a new block
- and break it into fragments, returning the first. */
- result = malloc (BLOCKSIZE);
- if (result == NULL)
- return NULL;
-
- /* Link all fragments but the first into the free list. */
- for (i = 1; i < (size_t) (BLOCKSIZE >> log); ++i)
- {
- next = (struct list *) ((char *) result + (i << log));
- next->next = _fraghead[log].next;
- next->prev = &_fraghead[log];
- next->prev->next = next;
- if (next->next != NULL)
- next->next->prev = next;
- }
-
- /* Initialize the nfree and first counters for this block. */
- block = BLOCK (result);
- _heapinfo[block].busy.type = log;
- _heapinfo[block].busy.info.frag.nfree = i - 1;
- _heapinfo[block].busy.info.frag.first = i - 1;
-
- _chunks_free += (BLOCKSIZE >> log) - 1;
- _bytes_free += BLOCKSIZE - (1 << log);
- _bytes_used -= BLOCKSIZE - (1 << log);
- }
- }
- else
- {
- /* Large allocation to receive one or more blocks.
- Search the free list in a circle starting at the last place visited.
- If we loop completely around without finding a large enough
- space we will have to get more memory from the system. */
- blocks = BLOCKIFY (size);
- start = block = _heapindex;
- while (_heapinfo[block].free.size < blocks)
- {
- block = _heapinfo[block].free.next;
- if (block == start)
- {
- /* Need to get more from the system. Check to see if
- the new core will be contiguous with the final free
- block; if so we don't need to get as much. */
- block = _heapinfo[0].free.prev;
- lastblocks = _heapinfo[block].free.size;
- if (_heaplimit != 0 && block + lastblocks == _heaplimit &&
- (*__morecore) (0) == ADDRESS (block + lastblocks) &&
- (morecore ((blocks - lastblocks) * BLOCKSIZE)) != NULL)
- {
- _heapinfo[block].free.size = blocks;
- _bytes_free += (blocks - lastblocks) * BLOCKSIZE;
- continue;
- }
- result = morecore (blocks * BLOCKSIZE);
- if (result == NULL)
- return NULL;
- block = BLOCK (result);
- _heapinfo[block].busy.type = 0;
- _heapinfo[block].busy.info.size = blocks;
- ++_chunks_used;
- _bytes_used += blocks * BLOCKSIZE;
- return result;
- }
- }
-
- /* At this point we have found a suitable free list entry.
- Figure out how to remove what we need from the list. */
- result = ADDRESS (block);
- if (_heapinfo[block].free.size > blocks)
- {
- /* The block we found has a bit left over,
- so relink the tail end back into the free list. */
- _heapinfo[block + blocks].free.size
- = _heapinfo[block].free.size - blocks;
- _heapinfo[block + blocks].free.next
- = _heapinfo[block].free.next;
- _heapinfo[block + blocks].free.prev
- = _heapinfo[block].free.prev;
- _heapinfo[_heapinfo[block].free.prev].free.next
- = _heapinfo[_heapinfo[block].free.next].free.prev
- = _heapindex = block + blocks;
- }
- else
- {
- /* The block exactly matches our requirements,
- so just remove it from the list. */
- _heapinfo[_heapinfo[block].free.next].free.prev
- = _heapinfo[block].free.prev;
- _heapinfo[_heapinfo[block].free.prev].free.next
- = _heapindex = _heapinfo[block].free.next;
- --_chunks_free;
- }
-
- _heapinfo[block].busy.type = 0;
- _heapinfo[block].busy.info.size = blocks;
- ++_chunks_used;
- _bytes_used += blocks * BLOCKSIZE;
- _bytes_free -= blocks * BLOCKSIZE;
- }
-
- return result;
-}
-
-#define min(A, B) ((A) < (B) ? (A) : (B))
-
-/* Debugging hook for realloc. */
-__ptr_t (*__realloc_hook) __P ((__ptr_t __ptr, size_t __size));
-
-/* Resize the given region to the new size, returning a pointer
- to the (possibly moved) region. This is optimized for speed;
- some benchmarks seem to indicate that greater compactness is
- achieved by unconditionally allocating and copying to a
- new region. This module has incestuous knowledge of the
- internals of both free and malloc. */
-__ptr_t
-realloc (ptr, size)
- __ptr_t ptr;
- size_t size;
-{
- __ptr_t result;
- int type;
- size_t block, blocks, oldlimit;
-
- if (size == 0)
- {
- free (ptr);
- return malloc (0);
- }
- else if (ptr == NULL)
- return malloc (size);
-
- if (__realloc_hook != NULL)
- return (*__realloc_hook) (ptr, size);
-
- block = BLOCK (ptr);
-
- type = _heapinfo[block].busy.type;
- switch (type)
- {
- case 0:
- /* Maybe reallocate a large block to a small fragment. */
- if (size <= BLOCKSIZE / 2)
- {
- result = malloc (size);
- if (result != NULL)
- {
- memcpy (result, ptr, size);
- free (ptr);
- return result;
- }
- }
-
- /* The new size is a large allocation as well;
- see if we can hold it in place. */
- blocks = BLOCKIFY (size);
- if (blocks < _heapinfo[block].busy.info.size)
- {
- /* The new size is smaller; return
- excess memory to the free list. */
- _heapinfo[block + blocks].busy.type = 0;
- _heapinfo[block + blocks].busy.info.size
- = _heapinfo[block].busy.info.size - blocks;
- _heapinfo[block].busy.info.size = blocks;
- free (ADDRESS (block + blocks));
- result = ptr;
- }
- else if (blocks == _heapinfo[block].busy.info.size)
- /* No size change necessary. */
- result = ptr;
- else
- {
- /* Won't fit, so allocate a new region that will.
- Free the old region first in case there is sufficient
- adjacent free space to grow without moving. */
- blocks = _heapinfo[block].busy.info.size;
- /* Prevent free from actually returning memory to the system. */
- oldlimit = _heaplimit;
- _heaplimit = 0;
- free (ptr);
- _heaplimit = oldlimit;
- result = malloc (size);
- if (result == NULL)
- {
- /* Now we're really in trouble. We have to unfree
- the thing we just freed. Unfortunately it might
- have been coalesced with its neighbors. */
- if (_heapindex == block)
- (void) malloc (blocks * BLOCKSIZE);
- else
- {
- __ptr_t previous = malloc ((block - _heapindex) * BLOCKSIZE);
- (void) malloc (blocks * BLOCKSIZE);
- free (previous);
- }
- return NULL;
- }
- if (ptr != result)
- memmove (result, ptr, blocks * BLOCKSIZE);
- }
- break;
-
- default:
- /* Old size is a fragment; type is logarithm
- to base two of the fragment size. */
- if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type))
- /* The new size is the same kind of fragment. */
- result = ptr;
- else
- {
- /* The new size is different; allocate a new space,
- and copy the lesser of the new size and the old. */
- result = malloc (size);
- if (result == NULL)
- return NULL;
- memcpy (result, ptr, min (size, (size_t) 1 << type));
- free (ptr);
- }
- break;
- }
-
- return result;
-}
-
-/* Debugging hook for free. */
-void (*__free_hook) __P ((__ptr_t __ptr));
-
-/* List of blocks allocated by memalign. */
-struct alignlist *_aligned_blocks = NULL;
-
-/* Return memory to the heap.
- Like `free' but don't call a __free_hook if there is one. */
-void
-_free_internal (ptr)
- __ptr_t ptr;
-{
- int type;
- size_t block, blocks;
- register size_t i;
- struct list *prev, *next;
-
- block = BLOCK (ptr);
-
- type = _heapinfo[block].busy.type;
- switch (type)
- {
- case 0:
- /* Get as many statistics as early as we can. */
- --_chunks_used;
- _bytes_used -= _heapinfo[block].busy.info.size * BLOCKSIZE;
- _bytes_free += _heapinfo[block].busy.info.size * BLOCKSIZE;
-
- /* Find the free cluster previous to this one in the free list.
- Start searching at the last block referenced; this may benefit
- programs with locality of allocation. */
- i = _heapindex;
- if (i > block)
- while (i > block)
- i = _heapinfo[i].free.prev;
- else
- {
- do
- i = _heapinfo[i].free.next;
- while (i > 0 && i < block);
- i = _heapinfo[i].free.prev;
- }
-
- /* Determine how to link this block into the free list. */
- if (block == i + _heapinfo[i].free.size)
- {
- /* Coalesce this block with its predecessor. */
- _heapinfo[i].free.size += _heapinfo[block].busy.info.size;
- block = i;
- }
- else
- {
- /* Really link this block back into the free list. */
- _heapinfo[block].free.size = _heapinfo[block].busy.info.size;
- _heapinfo[block].free.next = _heapinfo[i].free.next;
- _heapinfo[block].free.prev = i;
- _heapinfo[i].free.next = block;
- _heapinfo[_heapinfo[block].free.next].free.prev = block;
- ++_chunks_free;
- }
-
- /* Now that the block is linked in, see if we can coalesce it
- with its successor (by deleting its successor from the list
- and adding in its size). */
- if (block + _heapinfo[block].free.size == _heapinfo[block].free.next)
- {
- _heapinfo[block].free.size
- += _heapinfo[_heapinfo[block].free.next].free.size;
- _heapinfo[block].free.next
- = _heapinfo[_heapinfo[block].free.next].free.next;
- _heapinfo[_heapinfo[block].free.next].free.prev = block;
- --_chunks_free;
- }
-
- /* Now see if we can return stuff to the system. */
- blocks = _heapinfo[block].free.size;
- if (blocks >= FINAL_FREE_BLOCKS && block + blocks == _heaplimit
- && (*__morecore) (0) == ADDRESS (block + blocks))
- {
- register size_t bytes = blocks * BLOCKSIZE;
- _heaplimit -= blocks;
- (*__morecore) (-bytes);
- _heapinfo[_heapinfo[block].free.prev].free.next
- = _heapinfo[block].free.next;
- _heapinfo[_heapinfo[block].free.next].free.prev
- = _heapinfo[block].free.prev;
- block = _heapinfo[block].free.prev;
- --_chunks_free;
- _bytes_free -= bytes;
- }
-
- /* Set the next search to begin at this block. */
- _heapindex = block;
- break;
-
- default:
- /* Do some of the statistics. */
- --_chunks_used;
- _bytes_used -= 1 << type;
- ++_chunks_free;
- _bytes_free += 1 << type;
-
- /* Get the address of the first free fragment in this block. */
- prev = (struct list *) ((char *) ADDRESS (block) +
- (_heapinfo[block].busy.info.frag.first << type));
-
- if (_heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1)
- {
- /* If all fragments of this block are free, remove them
- from the fragment list and free the whole block. */
- next = prev;
- for (i = 1; i < (size_t) (BLOCKSIZE >> type); ++i)
- next = next->next;
- prev->prev->next = next;
- if (next != NULL)
- next->prev = prev->prev;
- _heapinfo[block].busy.type = 0;
- _heapinfo[block].busy.info.size = 1;
-
- /* Keep the statistics accurate. */
- ++_chunks_used;
- _bytes_used += BLOCKSIZE;
- _chunks_free -= BLOCKSIZE >> type;
- _bytes_free -= BLOCKSIZE;
-
- free (ADDRESS (block));
- }
- else if (_heapinfo[block].busy.info.frag.nfree != 0)
- {
- /* If some fragments of this block are free, link this
- fragment into the fragment list after the first free
- fragment of this block. */
- next = (struct list *) ptr;
- next->next = prev->next;
- next->prev = prev;
- prev->next = next;
- if (next->next != NULL)
- next->next->prev = next;
- ++_heapinfo[block].busy.info.frag.nfree;
- }
- else
- {
- /* No fragments of this block are free, so link this
- fragment into the fragment list and announce that
- it is the first free fragment of this block. */
- prev = (struct list *) ptr;
- _heapinfo[block].busy.info.frag.nfree = 1;
- _heapinfo[block].busy.info.frag.first = (unsigned long int)
- ((unsigned long int) ((char *) ptr - (char *) NULL)
- % BLOCKSIZE >> type);
- prev->next = _fraghead[type].next;
- prev->prev = &_fraghead[type];
- prev->prev->next = prev;
- if (prev->next != NULL)
- prev->next->prev = prev;
- }
- break;
- }
-}
-
-/* Return memory to the heap. */
-void
-free (ptr)
- __ptr_t ptr;
-{
- register struct alignlist *l;
-
- if (ptr == NULL)
- return;
-
- for (l = _aligned_blocks; l != NULL; l = l->next)
- if (l->aligned == ptr)
- {
- l->aligned = NULL; /* Mark the slot in the list as free. */
- ptr = l->exact;
- break;
- }
-
- if (__free_hook != NULL)
- (*__free_hook) (ptr);
- else
- _free_internal (ptr);
-}
diff --git a/gnu/lib/libmalloc/malloc.h b/gnu/lib/libmalloc/malloc.h
deleted file mode 100644
index 67e3ee7..0000000
--- a/gnu/lib/libmalloc/malloc.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Declarations for `malloc' and friends.
- Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
- Written May 1989 by Mike Haertel.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_H
-
-#define _MALLOC_H 1
-
-#ifdef _MALLOC_INTERNAL
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if defined(_LIBC) || defined(STDC_HEADERS) || defined(USG)
-#include <string.h>
-#else
-#ifndef memset
-#define memset(s, zero, n) bzero ((s), (n))
-#endif
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memmove
-#define memmove(d, s, n) bcopy ((s), (d), (n))
-#endif
-#endif
-
-#if defined(__GNU_LIBRARY__) || defined(__STDC__)
-#include <limits.h>
-#else
-#define CHAR_BIT 8
-#endif
-
-#endif /* _MALLOC_INTERNAL. */
-
-#include <sys/cdefs.h>
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-#undef __GNU_P
-#define __GNU_P(args) args
-#undef __ptr_t
-#define __ptr_t void *
-#else /* Not C++ or ANSI C. */
-#undef __GNU_P
-#define __GNU_P(args) ()
-#undef const
-#define const
-#undef __ptr_t
-#define __ptr_t char *
-#endif /* C++ or ANSI C. */
-
-#ifdef __STDC__
-#include <stddef.h>
-#else
-#undef size_t
-#define size_t unsigned int
-#undef ptrdiff_t
-#define ptrdiff_t int
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/* Allocate SIZE bytes of memory. */
-extern __ptr_t malloc __GNU_P ((size_t __size));
-/* Re-allocate the previously allocated block
- in __ptr_t, making the new block SIZE bytes long. */
-extern __ptr_t realloc __GNU_P ((__ptr_t __ptr, size_t __size));
-/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
-extern __ptr_t calloc __GNU_P ((size_t __nmemb, size_t __size));
-/* Free a block allocated by `malloc', `realloc' or `calloc'. */
-extern void free __GNU_P ((__ptr_t __ptr));
-
-/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
-extern __ptr_t memalign __GNU_P ((size_t __alignment, size_t __size));
-
-/* Allocate SIZE bytes on a page boundary. */
-extern __ptr_t valloc __GNU_P ((size_t __size));
-
-
-#ifdef _MALLOC_INTERNAL
-
-/* The allocator divides the heap into blocks of fixed size; large
- requests receive one or more whole blocks, and small requests
- receive a fragment of a block. Fragment sizes are powers of two,
- and all fragments of a block are the same size. When all the
- fragments in a block have been freed, the block itself is freed. */
-#define INT_BIT (CHAR_BIT * sizeof(int))
-#define BLOCKLOG (INT_BIT > 16 ? 12 : 9)
-#define BLOCKSIZE (1 << BLOCKLOG)
-#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE)
-
-/* Determine the amount of memory spanned by the initial heap table
- (not an absolute limit). */
-#define HEAP (INT_BIT > 16 ? 4194304 : 65536)
-
-/* Number of contiguous free blocks allowed to build up at the end of
- memory before they will be returned to the system. */
-#define FINAL_FREE_BLOCKS 8
-
-/* Data structure giving per-block information. */
-typedef union
- {
- /* Heap information for a busy block. */
- struct
- {
- /* Zero for a large block, or positive giving the
- logarithm to the base two of the fragment size. */
- int type;
- union
- {
- struct
- {
- size_t nfree; /* Free fragments in a fragmented block. */
- size_t first; /* First free fragment of the block. */
- } frag;
- /* Size (in blocks) of a large cluster. */
- size_t size;
- } info;
- } busy;
- /* Heap information for a free block
- (that may be the first of a free cluster). */
- struct
- {
- size_t size; /* Size (in blocks) of a free cluster. */
- size_t next; /* Index of next free cluster. */
- size_t prev; /* Index of previous free cluster. */
- } free;
- } malloc_info;
-
-/* Pointer to first block of the heap. */
-extern char *_heapbase;
-
-/* Table indexed by block number giving per-block information. */
-extern malloc_info *_heapinfo;
-
-/* Address to block number and vice versa. */
-#define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1)
-#define ADDRESS(B) ((__ptr_t) (((B) - 1) * BLOCKSIZE + _heapbase))
-
-/* Current search index for the heap table. */
-extern size_t _heapindex;
-
-/* Limit of valid info table indices. */
-extern size_t _heaplimit;
-
-/* Doubly linked lists of free fragments. */
-struct list
- {
- struct list *next;
- struct list *prev;
- };
-
-/* Free list headers for each fragment size. */
-extern struct list _fraghead[];
-
-/* List of blocks allocated with `memalign' (or `valloc'). */
-struct alignlist
- {
- struct alignlist *next;
- __ptr_t aligned; /* The address that memaligned returned. */
- __ptr_t exact; /* The address that malloc returned. */
- };
-extern struct alignlist *_aligned_blocks;
-
-/* Instrumentation. */
-extern size_t _chunks_used;
-extern size_t _bytes_used;
-extern size_t _chunks_free;
-extern size_t _bytes_free;
-
-/* Internal version of `free' used in `morecore' (malloc.c). */
-extern void _free_internal __GNU_P ((__ptr_t __ptr));
-
-#endif /* _MALLOC_INTERNAL. */
-
-/* Underlying allocation function; successive calls should
- return contiguous pieces of memory. */
-extern __ptr_t (*__morecore) __GNU_P ((ptrdiff_t __size));
-
-/* Default value of `__morecore'. */
-extern __ptr_t __default_morecore __GNU_P ((ptrdiff_t __size));
-
-/* If not NULL, this function is called after each time
- `__morecore' is called to increase the data size. */
-extern void (*__after_morecore_hook) __GNU_P ((void));
-
-/* Nonzero if `malloc' has been called and done its initialization. */
-extern int __malloc_initialized;
-
-/* Hooks for debugging versions. */
-extern void (*__free_hook) __GNU_P ((__ptr_t __ptr));
-extern __ptr_t (*__malloc_hook) __GNU_P ((size_t __size));
-extern __ptr_t (*__realloc_hook) __GNU_P ((__ptr_t __ptr, size_t __size));
-
-/* Activate a standard collection of debugging hooks. */
-extern int mcheck __GNU_P ((void (*__func) __GNU_P ((void))));
-
-/* Activate a standard collection of tracing hooks. */
-extern void mtrace __GNU_P ((void));
-
-/* Statistics available to the user. */
-struct mstats
- {
- size_t bytes_total; /* Total size of the heap. */
- size_t chunks_used; /* Chunks allocated by the user. */
- size_t bytes_used; /* Byte total of user-allocated chunks. */
- size_t chunks_free; /* Chunks in the free list. */
- size_t bytes_free; /* Byte total of chunks in the free list. */
- };
-
-/* Pick up the current statistics. */
-extern struct mstats mstats __GNU_P ((void));
-
-/* Call WARNFUN with a warning message when memory usage is high. */
-extern void memory_warnings __GNU_P ((__ptr_t __start,
- void (*__warnfun) __GNU_P ((__const char *))));
-
-
-/* Relocating allocator. */
-
-/* Allocate SIZE bytes, and store the address in *HANDLEPTR. */
-extern __ptr_t r_alloc __GNU_P ((__ptr_t *__handleptr, size_t __size));
-
-/* Free the storage allocated in HANDLEPTR. */
-extern void r_alloc_free __GNU_P ((__ptr_t *__handleptr));
-
-/* Adjust the block at HANDLEPTR to be SIZE bytes long. */
-extern __ptr_t r_re_alloc __GNU_P ((__ptr_t *__handleptr, size_t __size));
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* malloc.h */
diff --git a/gnu/lib/libmalloc/mcheck.c b/gnu/lib/libmalloc/mcheck.c
deleted file mode 100644
index f7d9d4f..0000000
--- a/gnu/lib/libmalloc/mcheck.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Standard debugging hooks for `malloc'.
- Copyright 1990, 1991, 1992, 1993 Free Software Foundation
- Written May 1989 by Mike Haertel.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-/* Old hook values. */
-static void (*old_free_hook) __P ((__ptr_t ptr));
-static __ptr_t (*old_malloc_hook) __P ((size_t size));
-static __ptr_t (*old_realloc_hook) __P ((__ptr_t ptr, size_t size));
-
-/* Function to call when something awful happens. */
-static void (*abortfunc) __P ((void));
-
-/* Arbitrary magical numbers. */
-#define MAGICWORD 0xfedabeeb
-#define MAGICBYTE ((char) 0xd7)
-
-struct hdr
- {
- size_t size; /* Exact size requested by user. */
- unsigned long int magic; /* Magic number to check header integrity. */
- };
-
-static void checkhdr __P ((const struct hdr *));
-static void
-checkhdr (hdr)
- const struct hdr *hdr;
-{
- if (hdr->magic != MAGICWORD || ((char *) &hdr[1])[hdr->size] != MAGICBYTE)
- (*abortfunc) ();
-}
-
-static void freehook __P ((__ptr_t));
-static void
-freehook (ptr)
- __ptr_t ptr;
-{
- struct hdr *hdr = ((struct hdr *) ptr) - 1;
- checkhdr (hdr);
- hdr->magic = 0;
- __free_hook = old_free_hook;
- free (hdr);
- __free_hook = freehook;
-}
-
-static __ptr_t mallochook __P ((size_t));
-static __ptr_t
-mallochook (size)
- size_t size;
-{
- struct hdr *hdr;
-
- __malloc_hook = old_malloc_hook;
- hdr = (struct hdr *) malloc (sizeof (struct hdr) + size + 1);
- __malloc_hook = mallochook;
- if (hdr == NULL)
- return NULL;
-
- hdr->size = size;
- hdr->magic = MAGICWORD;
- ((char *) &hdr[1])[size] = MAGICBYTE;
- return (__ptr_t) (hdr + 1);
-}
-
-static __ptr_t reallochook __P ((__ptr_t, size_t));
-static __ptr_t
-reallochook (ptr, size)
- __ptr_t ptr;
- size_t size;
-{
- struct hdr *hdr = ((struct hdr *) ptr) - 1;
-
- checkhdr (hdr);
- __free_hook = old_free_hook;
- __malloc_hook = old_malloc_hook;
- __realloc_hook = old_realloc_hook;
- hdr = (struct hdr *) realloc ((__ptr_t) hdr, sizeof (struct hdr) + size + 1);
- __free_hook = freehook;
- __malloc_hook = mallochook;
- __realloc_hook = reallochook;
- if (hdr == NULL)
- return NULL;
-
- hdr->size = size;
- ((char *) &hdr[1])[size] = MAGICBYTE;
- return (__ptr_t) (hdr + 1);
-}
-
-int
-mcheck (func)
- void (*func) __P ((void));
-{
- extern void abort __P ((void));
- static int mcheck_used = 0;
-
- abortfunc = (func != NULL) ? func : abort;
-
- /* These hooks may not be safely inserted if malloc is already in use. */
- if (!__malloc_initialized && !mcheck_used)
- {
- old_free_hook = __free_hook;
- __free_hook = freehook;
- old_malloc_hook = __malloc_hook;
- __malloc_hook = mallochook;
- old_realloc_hook = __realloc_hook;
- __realloc_hook = reallochook;
- mcheck_used = 1;
- }
-
- return mcheck_used ? 0 : -1;
-}
diff --git a/gnu/lib/libmalloc/mem-limits.h b/gnu/lib/libmalloc/mem-limits.h
deleted file mode 100644
index 6ad994f..0000000
--- a/gnu/lib/libmalloc/mem-limits.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Includes for memory limit warnings.
- Copyright (C) 1990, 1993 Free Software Foundation, Inc.
-
-
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#if defined(__osf__) && (defined(__mips) || defined(mips))
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
-#ifdef __bsdi__
-#define BSD4_2
-#endif
-
-#ifndef BSD4_2
-#ifndef USG
-#include <sys/vlimit.h>
-#endif /* not USG */
-#else /* if BSD4_2 */
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif /* BSD4_2 */
-
-#ifdef emacs
-/* The important properties of this type are that 1) it's a pointer, and
- 2) arithmetic on it should work as if the size of the object pointed
- to has a size of 1. */
-#ifdef __STDC__
-typedef void *POINTER;
-#else
-typedef char *POINTER;
-#endif
-
-typedef unsigned long SIZE;
-
-#ifdef NULL
-#undef NULL
-#endif
-#define NULL ((POINTER) 0)
-
-extern POINTER start_of_data ();
-#ifdef DATA_SEG_BITS
-#define EXCEEDS_LISP_PTR(ptr) \
- (((unsigned int) (ptr) & ~DATA_SEG_BITS) >> VALBITS)
-#else
-#define EXCEEDS_LISP_PTR(ptr) ((unsigned int) (ptr) >> VALBITS)
-#endif
-
-#ifdef BSD
-#ifndef DATA_SEG_BITS
-extern char etext;
-#define start_of_data() &etext
-#endif
-#endif
-
-#else /* Not emacs */
-extern char etext;
-#define start_of_data() &etext
-#endif /* Not emacs */
-
-
-
-/* start of data space; can be changed by calling malloc_init */
-static POINTER data_space_start;
-
-/* Number of bytes of writable memory we can expect to be able to get */
-static unsigned int lim_data;
-
-#ifdef USG
-
-static void
-get_lim_data ()
-{
- extern long ulimit ();
-
- lim_data = -1;
-
- /* Use the ulimit call, if we seem to have it. */
-#if !defined (ULIMIT_BREAK_VALUE) || defined (LINUX)
- lim_data = ulimit (3, 0);
-#endif
-
- /* If that didn't work, just use the macro's value. */
-#ifdef ULIMIT_BREAK_VALUE
- if (lim_data == -1)
- lim_data = ULIMIT_BREAK_VALUE;
-#endif
-
- lim_data -= (long) data_space_start;
-}
-
-#else /* not USG */
-#if !defined(BSD4_2) && !defined(__osf__)
-
-static void
-get_lim_data ()
-{
- lim_data = vlimit (LIM_DATA, -1);
-}
-
-#else /* BSD4_2 */
-
-static void
-get_lim_data ()
-{
- struct rlimit XXrlimit;
-
- getrlimit (RLIMIT_DATA, &XXrlimit);
-#ifdef RLIM_INFINITY
- lim_data = XXrlimit.rlim_cur & RLIM_INFINITY; /* soft limit */
-#else
- lim_data = XXrlimit.rlim_cur; /* soft limit */
-#endif
-}
-#endif /* BSD4_2 */
-#endif /* not USG */
diff --git a/gnu/lib/libmalloc/memalign.c b/gnu/lib/libmalloc/memalign.c
deleted file mode 100644
index f5ad17c..0000000
--- a/gnu/lib/libmalloc/memalign.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-__ptr_t
-memalign (alignment, size)
- size_t alignment;
- size_t size;
-{
- __ptr_t result;
- unsigned long int adj;
-
- size = ((size + alignment - 1) / alignment) * alignment;
-
- result = malloc (size);
- if (result == NULL)
- return NULL;
- adj = (unsigned long int) ((unsigned long int) ((char *) result -
- (char *) NULL)) % alignment;
- if (adj != 0)
- {
- struct alignlist *l;
- for (l = _aligned_blocks; l != NULL; l = l->next)
- if (l->aligned == NULL)
- /* This slot is free. Use it. */
- break;
- if (l == NULL)
- {
- l = (struct alignlist *) malloc (sizeof (struct alignlist));
- if (l == NULL)
- {
- free (result);
- return NULL;
- }
- }
- l->exact = result;
- result = l->aligned = (char *) result + alignment - adj;
- l->next = _aligned_blocks;
- _aligned_blocks = l;
- }
-
- return result;
-}
diff --git a/gnu/lib/libmalloc/morecore.c b/gnu/lib/libmalloc/morecore.c
deleted file mode 100644
index c9a9ca5..0000000
--- a/gnu/lib/libmalloc/morecore.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#ifndef __GNU_LIBRARY__
-#define __sbrk sbrk
-#endif
-
-extern __ptr_t __sbrk __P ((int increment));
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Allocate INCREMENT more bytes of data space,
- and return the start of data space, or NULL on errors.
- If INCREMENT is negative, shrink data space. */
-__ptr_t
-__default_morecore (increment)
- ptrdiff_t increment;
-{
- __ptr_t result = __sbrk ((int) increment);
- if (result == (__ptr_t) -1)
- return NULL;
- return result;
-}
diff --git a/gnu/lib/libmalloc/mstats.c b/gnu/lib/libmalloc/mstats.c
deleted file mode 100644
index 511cdad..0000000
--- a/gnu/lib/libmalloc/mstats.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Access the statistics maintained by `malloc'.
- Copyright 1990, 1991, 1992 Free Software Foundation
- Written May 1989 by Mike Haertel.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-struct mstats
-mstats ()
-{
- struct mstats result;
-
- result.bytes_total = (char *) (*__morecore) (0) - _heapbase;
- result.chunks_used = _chunks_used;
- result.bytes_used = _bytes_used;
- result.chunks_free = _chunks_free;
- result.bytes_free = _bytes_free;
- return result;
-}
diff --git a/gnu/lib/libmalloc/mtrace.awk b/gnu/lib/libmalloc/mtrace.awk
deleted file mode 100644
index d7689ce..0000000
--- a/gnu/lib/libmalloc/mtrace.awk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Awk program to analyze mtrace.c output.
-#
-$1 == "+" { if (allocated[$2] != "")
- print "+", $2, "Alloc", NR, "duplicate:", allocated[$2];
- else
- allocated[$2] = $3;
- }
-$1 == "-" { if (allocated[$2] != "") {
- allocated[$2] = "";
- if (allocated[$2] != "")
- print "DELETE FAILED", $2, allocated[$2];
- } else
- print "-", $2, "Free", NR, "was never alloc'd";
- }
-$1 == "<" { if (allocated[$2] != "")
- allocated[$2] = "";
- else
- print "-", $2, "Realloc", NR, "was never alloc'd";
- }
-$1 == ">" { if (allocated[$2] != "")
- print "+", $2, "Realloc", NR, "duplicate:", allocated[$2];
- else
- allocated[$2] = $3;
- }
-
-# Ignore "= Start"
-$1 == "=" { }
-# Ignore failed realloc attempts for now
-$1 == "!" { }
-
-
-END { for (x in allocated)
- if (allocated[x] != "")
- print "+", x, allocated[x];
- }
diff --git a/gnu/lib/libmalloc/mtrace.c b/gnu/lib/libmalloc/mtrace.c
deleted file mode 100644
index 5dae86a..0000000
--- a/gnu/lib/libmalloc/mtrace.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* More debugging hooks for `malloc'.
- Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
- Written April 2, 1991 by John Gilmore of Cygnus Support.
- Based on mcheck.c by Mike Haertel.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#include <stdio.h>
-
-#ifndef __GNU_LIBRARY__
-extern char *getenv ();
-#else
-#include <stdlib.h>
-#endif
-
-static FILE *mallstream;
-static char mallenv[]= "MALLOC_TRACE";
-static char mallbuf[BUFSIZ]; /* Buffer for the output. */
-
-/* Address to breakpoint on accesses to... */
-__ptr_t mallwatch;
-
-/* Old hook values. */
-static void (*tr_old_free_hook) __P ((__ptr_t ptr));
-static __ptr_t (*tr_old_malloc_hook) __P ((size_t size));
-static __ptr_t (*tr_old_realloc_hook) __P ((__ptr_t ptr, size_t size));
-
-/* This function is called when the block being alloc'd, realloc'd, or
- freed has an address matching the variable "mallwatch". In a debugger,
- set "mallwatch" to the address of interest, then put a breakpoint on
- tr_break. */
-
-void tr_break __P ((void));
-void
-tr_break ()
-{
-}
-
-static void tr_freehook __P ((__ptr_t));
-static void
-tr_freehook (ptr)
- __ptr_t ptr;
-{
- fprintf (mallstream, "- %p\n", ptr); /* Be sure to print it first. */
- if (ptr == mallwatch)
- tr_break ();
- __free_hook = tr_old_free_hook;
- free (ptr);
- __free_hook = tr_freehook;
-}
-
-static __ptr_t tr_mallochook __P ((size_t));
-static __ptr_t
-tr_mallochook (size)
- size_t size;
-{
- __ptr_t hdr;
-
- __malloc_hook = tr_old_malloc_hook;
- hdr = (__ptr_t) malloc (size);
- __malloc_hook = tr_mallochook;
-
- /* We could be printing a NULL here; that's OK. */
- fprintf (mallstream, "+ %p %x\n", hdr, size);
-
- if (hdr == mallwatch)
- tr_break ();
-
- return hdr;
-}
-
-static __ptr_t tr_reallochook __P ((__ptr_t, size_t));
-static __ptr_t
-tr_reallochook (ptr, size)
- __ptr_t ptr;
- size_t size;
-{
- __ptr_t hdr;
-
- if (ptr == mallwatch)
- tr_break ();
-
- __free_hook = tr_old_free_hook;
- __malloc_hook = tr_old_malloc_hook;
- __realloc_hook = tr_old_realloc_hook;
- hdr = (__ptr_t) realloc (ptr, size);
- __free_hook = tr_freehook;
- __malloc_hook = tr_mallochook;
- __realloc_hook = tr_reallochook;
- if (hdr == NULL)
- /* Failed realloc. */
- fprintf (mallstream, "! %p %x\n", ptr, size);
- else
- fprintf (mallstream, "< %p\n> %p %x\n", ptr, hdr, size);
-
- if (hdr == mallwatch)
- tr_break ();
-
- return hdr;
-}
-
-/* We enable tracing if either the environment variable MALLOC_TRACE
- is set, or if the variable mallwatch has been patched to an address
- that the debugging user wants us to stop on. When patching mallwatch,
- don't forget to set a breakpoint on tr_break! */
-
-void
-mtrace ()
-{
- char *mallfile;
-
- mallfile = getenv (mallenv);
- if (mallfile != NULL || mallwatch != NULL)
- {
- mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "w");
- if (mallstream != NULL)
- {
- /* Be sure it doesn't malloc its buffer! */
- setbuf (mallstream, mallbuf);
- fprintf (mallstream, "= Start\n");
- tr_old_free_hook = __free_hook;
- __free_hook = tr_freehook;
- tr_old_malloc_hook = __malloc_hook;
- __malloc_hook = tr_mallochook;
- tr_old_realloc_hook = __realloc_hook;
- __realloc_hook = tr_reallochook;
- }
- }
-}
diff --git a/gnu/lib/libmalloc/ralloc.c b/gnu/lib/libmalloc/ralloc.c
deleted file mode 100644
index 32094d2..0000000
--- a/gnu/lib/libmalloc/ralloc.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/* Block-relocating memory allocator.
- Copyright (C) 1993 Free Software Foundation, Inc.
-
-
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-/* NOTES:
-
- Only relocate the blocs neccessary for SIZE in r_alloc_sbrk,
- rather than all of them. This means allowing for a possible
- hole between the first bloc and the end of malloc storage. */
-
-#ifdef emacs
-
-#include "config.h"
-#include "lisp.h" /* Needed for VALBITS. */
-
-#undef NULL
-
-/* The important properties of this type are that 1) it's a pointer, and
- 2) arithmetic on it should work as if the size of the object pointed
- to has a size of 1. */
-#if 0 /* Arithmetic on void* is a GCC extension. */
-#ifdef __STDC__
-typedef void *POINTER;
-#else
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-typedef char *POINTER;
-
-#endif
-#endif /* 0 */
-
-/* Unconditionally use char * for this. */
-typedef char *POINTER;
-
-typedef unsigned long SIZE;
-
-/* Declared in dispnew.c, this version doesn't screw up if regions
- overlap. */
-extern void safe_bcopy ();
-
-#include "getpagesize.h"
-
-#else /* Not emacs. */
-
-#include <stddef.h>
-
-typedef size_t SIZE;
-typedef void *POINTER;
-
-#include <unistd.h>
-#include <malloc.h>
-#include <string.h>
-
-#define safe_bcopy(x, y, z) memmove (y, x, z)
-
-#endif /* emacs. */
-
-#define NIL ((POINTER) 0)
-
-/* A flag to indicate whether we have initialized ralloc yet. For
- Emacs's sake, please do not make this local to malloc_init; on some
- machines, the dumping procedure makes all static variables
- read-only. On these machines, the word static is #defined to be
- the empty string, meaning that r_alloc_initialized becomes an
- automatic variable, and loses its value each time Emacs is started up. */
-static int r_alloc_initialized = 0;
-
-static void r_alloc_init ();
-
-/* Declarations for working with the malloc, ralloc, and system breaks. */
-
-/* Function to set the real break value. */
-static POINTER (*real_morecore) ();
-
-/* The break value, as seen by malloc (). */
-static POINTER virtual_break_value;
-
-/* The break value, viewed by the relocatable blocs. */
-static POINTER break_value;
-
-/* The REAL (i.e., page aligned) break value of the process. */
-static POINTER page_break_value;
-
-/* This is the size of a page. We round memory requests to this boundary. */
-static int page_size;
-
-/* Whenever we get memory from the system, get this many extra bytes. This
- must be a multiple of page_size. */
-static int extra_bytes;
-
-/* Macros for rounding. Note that rounding to any value is possible
- by changing the definition of PAGE. */
-#define PAGE (getpagesize ())
-#define ALIGNED(addr) (((unsigned int) (addr) & (page_size - 1)) == 0)
-#define ROUNDUP(size) (((unsigned int) (size) + page_size - 1) & ~(page_size - 1))
-#define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))
-
-/* Functions to get and return memory from the system. */
-
-/* Obtain SIZE bytes of space. If enough space is not presently available
- in our process reserve, (i.e., (page_break_value - break_value)),
- this means getting more page-aligned space from the system.
-
- Return non-zero if all went well, or zero if we couldn't allocate
- the memory. */
-static int
-obtain (size)
- SIZE size;
-{
- SIZE already_available = page_break_value - break_value;
-
- if (already_available < size)
- {
- SIZE get = ROUNDUP (size - already_available);
- /* Get some extra, so we can come here less often. */
- get += extra_bytes;
-
- if ((*real_morecore) (get) == 0)
- return 0;
-
- page_break_value += get;
- }
-
- break_value += size;
-
- return 1;
-}
-
-/* Obtain SIZE bytes of space and return a pointer to the new area.
- If we could not allocate the space, return zero. */
-
-static POINTER
-get_more_space (size)
- SIZE size;
-{
- POINTER ptr = break_value;
- if (obtain (size))
- return ptr;
- else
- return 0;
-}
-
-/* Note that SIZE bytes of space have been relinquished by the process.
- If SIZE is more than a page, return the space to the system. */
-
-static void
-relinquish (size)
- SIZE size;
-{
- POINTER new_page_break;
- int excess;
-
- break_value -= size;
- new_page_break = (POINTER) ROUNDUP (break_value);
- excess = (char *) page_break_value - (char *) new_page_break;
-
- if (excess > extra_bytes * 2)
- {
- /* Keep extra_bytes worth of empty space.
- And don't free anything unless we can free at least extra_bytes. */
- if ((*real_morecore) (extra_bytes - excess) == 0)
- abort ();
-
- page_break_value += extra_bytes - excess;
- }
-
- /* Zero the space from the end of the "official" break to the actual
- break, so that bugs show up faster. */
- bzero (break_value, ((char *) page_break_value - (char *) break_value));
-}
-
-/* The meat - allocating, freeing, and relocating blocs. */
-
-/* These structures are allocated in the malloc arena.
- The linked list is kept in order of increasing '.data' members.
- The data blocks abut each other; if b->next is non-nil, then
- b->data + b->size == b->next->data. */
-typedef struct bp
-{
- struct bp *next;
- struct bp *prev;
- POINTER *variable;
- POINTER data;
- SIZE size;
-} *bloc_ptr;
-
-#define NIL_BLOC ((bloc_ptr) 0)
-#define BLOC_PTR_SIZE (sizeof (struct bp))
-
-/* Head and tail of the list of relocatable blocs. */
-static bloc_ptr first_bloc, last_bloc;
-
-/* Find the bloc referenced by the address in PTR. Returns a pointer
- to that block. */
-
-static bloc_ptr
-find_bloc (ptr)
- POINTER *ptr;
-{
- register bloc_ptr p = first_bloc;
-
- while (p != NIL_BLOC)
- {
- if (p->variable == ptr && p->data == *ptr)
- return p;
-
- p = p->next;
- }
-
- return p;
-}
-
-/* Allocate a bloc of SIZE bytes and append it to the chain of blocs.
- Returns a pointer to the new bloc, or zero if we couldn't allocate
- memory for the new block. */
-
-static bloc_ptr
-get_bloc (size)
- SIZE size;
-{
- register bloc_ptr new_bloc;
-
- if (! (new_bloc = (bloc_ptr) malloc (BLOC_PTR_SIZE))
- || ! (new_bloc->data = get_more_space (size)))
- {
- if (new_bloc)
- free (new_bloc);
-
- return 0;
- }
-
- new_bloc->size = size;
- new_bloc->next = NIL_BLOC;
- new_bloc->variable = (POINTER *) NIL;
-
- if (first_bloc)
- {
- new_bloc->prev = last_bloc;
- last_bloc->next = new_bloc;
- last_bloc = new_bloc;
- }
- else
- {
- first_bloc = last_bloc = new_bloc;
- new_bloc->prev = NIL_BLOC;
- }
-
- return new_bloc;
-}
-
-/* Relocate all blocs from BLOC on upward in the list to the zone
- indicated by ADDRESS. Direction of relocation is determined by
- the position of ADDRESS relative to BLOC->data.
-
- If BLOC is NIL_BLOC, nothing is done.
-
- Note that ordering of blocs is not affected by this function. */
-
-static void
-relocate_some_blocs (bloc, address)
- bloc_ptr bloc;
- POINTER address;
-{
- if (bloc != NIL_BLOC)
- {
- register SIZE offset = address - bloc->data;
- register SIZE data_size = 0;
- register bloc_ptr b;
-
- for (b = bloc; b != NIL_BLOC; b = b->next)
- {
- data_size += b->size;
- b->data += offset;
- *b->variable = b->data;
- }
-
- safe_bcopy (address - offset, address, data_size);
- }
-}
-
-
-/* Free BLOC from the chain of blocs, relocating any blocs above it
- and returning BLOC->size bytes to the free area. */
-
-static void
-free_bloc (bloc)
- bloc_ptr bloc;
-{
- if (bloc == first_bloc && bloc == last_bloc)
- {
- first_bloc = last_bloc = NIL_BLOC;
- }
- else if (bloc == last_bloc)
- {
- last_bloc = bloc->prev;
- last_bloc->next = NIL_BLOC;
- }
- else if (bloc == first_bloc)
- {
- first_bloc = bloc->next;
- first_bloc->prev = NIL_BLOC;
- }
- else
- {
- bloc->next->prev = bloc->prev;
- bloc->prev->next = bloc->next;
- }
-
- relocate_some_blocs (bloc->next, bloc->data);
- relinquish (bloc->size);
- free (bloc);
-}
-
-/* Interface routines. */
-
-static int use_relocatable_buffers;
-
-/* Obtain SIZE bytes of storage from the free pool, or the system, as
- necessary. If relocatable blocs are in use, this means relocating
- them. This function gets plugged into the GNU malloc's __morecore
- hook.
-
- We provide hysteresis, never relocating by less than extra_bytes.
-
- If we're out of memory, we should return zero, to imitate the other
- __morecore hook values - in particular, __default_morecore in the
- GNU malloc package. */
-
-POINTER
-r_alloc_sbrk (size)
- long size;
-{
- /* This is the first address not currently available for the heap. */
- POINTER top;
- /* Amount of empty space below that. */
- /* It is not correct to use SIZE here, because that is usually unsigned.
- ptrdiff_t would be okay, but is not always available.
- `long' will work in all cases, in practice. */
- long already_available;
- POINTER ptr;
-
- if (! use_relocatable_buffers)
- return (*real_morecore) (size);
-
- top = first_bloc ? first_bloc->data : page_break_value;
- already_available = (char *) top - (char *) virtual_break_value;
-
- /* Do we not have enough gap already? */
- if (size > 0 && already_available < size)
- {
- /* Get what we need, plus some extra so we can come here less often. */
- SIZE get = size - already_available + extra_bytes;
-
- if (! obtain (get))
- return 0;
-
- if (first_bloc)
- relocate_some_blocs (first_bloc, first_bloc->data + get);
-
- /* Zero out the space we just allocated, to help catch bugs
- quickly. */
- bzero (virtual_break_value, get);
- }
- /* Can we keep extra_bytes of gap while freeing at least extra_bytes? */
- else if (size < 0 && already_available - size > 2 * extra_bytes)
- {
- /* Ok, do so. This is how many to free. */
- SIZE give_back = already_available - size - extra_bytes;
-
- if (first_bloc)
- relocate_some_blocs (first_bloc, first_bloc->data - give_back);
- relinquish (give_back);
- }
-
- ptr = virtual_break_value;
- virtual_break_value += size;
-
- return ptr;
-}
-
-/* Allocate a relocatable bloc of storage of size SIZE. A pointer to
- the data is returned in *PTR. PTR is thus the address of some variable
- which will use the data area.
-
- If we can't allocate the necessary memory, set *PTR to zero, and
- return zero. */
-
-POINTER
-r_alloc (ptr, size)
- POINTER *ptr;
- SIZE size;
-{
- register bloc_ptr new_bloc;
-
- if (! r_alloc_initialized)
- r_alloc_init ();
-
- new_bloc = get_bloc (size);
- if (new_bloc)
- {
- new_bloc->variable = ptr;
- *ptr = new_bloc->data;
- }
- else
- *ptr = 0;
-
- return *ptr;
-}
-
-/* Free a bloc of relocatable storage whose data is pointed to by PTR.
- Store 0 in *PTR to show there's no block allocated. */
-
-void
-r_alloc_free (ptr)
- register POINTER *ptr;
-{
- register bloc_ptr dead_bloc;
-
- dead_bloc = find_bloc (ptr);
- if (dead_bloc == NIL_BLOC)
- abort ();
-
- free_bloc (dead_bloc);
- *ptr = 0;
-}
-
-/* Given a pointer at address PTR to relocatable data, resize it to SIZE.
- Do this by shifting all blocks above this one up in memory, unless
- SIZE is less than or equal to the current bloc size, in which case
- do nothing.
-
- Change *PTR to reflect the new bloc, and return this value.
-
- If more memory cannot be allocated, then leave *PTR unchanged, and
- return zero. */
-
-POINTER
-r_re_alloc (ptr, size)
- POINTER *ptr;
- SIZE size;
-{
- register bloc_ptr bloc;
-
- bloc = find_bloc (ptr);
- if (bloc == NIL_BLOC)
- abort ();
-
- if (size <= bloc->size)
- /* Wouldn't it be useful to actually resize the bloc here? */
- return *ptr;
-
- if (! obtain (size - bloc->size))
- return 0;
-
- relocate_some_blocs (bloc->next, bloc->data + size);
-
- /* Zero out the new space in the bloc, to help catch bugs faster. */
- bzero (bloc->data + bloc->size, size - bloc->size);
-
- /* Indicate that this block has a new size. */
- bloc->size = size;
-
- return *ptr;
-}
-
-/* The hook `malloc' uses for the function which gets more space
- from the system. */
-extern POINTER (*__morecore) ();
-
-/* Intialize various things for memory allocation. */
-
-static void
-r_alloc_init ()
-{
- if (r_alloc_initialized)
- return;
-
- r_alloc_initialized = 1;
- real_morecore = __morecore;
- __morecore = r_alloc_sbrk;
-
- virtual_break_value = break_value = (*real_morecore) (0);
- if (break_value == NIL)
- abort ();
-
- page_size = PAGE;
- extra_bytes = ROUNDUP (50000);
-
- page_break_value = (POINTER) ROUNDUP (break_value);
- /* Clear the rest of the last page; this memory is in our address space
- even though it is after the sbrk value. */
- bzero (break_value, (page_break_value - break_value));
- use_relocatable_buffers = 1;
-}
diff --git a/gnu/lib/libmalloc/valloc.c b/gnu/lib/libmalloc/valloc.c
deleted file mode 100644
index fcf1174..0000000
--- a/gnu/lib/libmalloc/valloc.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Allocate memory on a page boundary.
- Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-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; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.
-
- The author may be reached (Email) at the address mike@ai.mit.edu,
- or (US mail) as Mike Haertel c/o Free Software Foundation. */
-
-#ifndef _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#ifdef __GNU_LIBRARY__
-extern size_t __getpagesize __P ((void));
-#else
-#include "getpagesize.h"
-#define __getpagesize() getpagesize()
-#endif
-
-static size_t pagesize;
-
-__ptr_t
-valloc (size)
- size_t size;
-{
- if (pagesize == 0)
- pagesize = __getpagesize ();
-
- return memalign (pagesize, size);
-}
diff --git a/gnu/lib/libmalloc/vm-limit.c b/gnu/lib/libmalloc/vm-limit.c
deleted file mode 100644
index 06ea071..0000000
--- a/gnu/lib/libmalloc/vm-limit.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Functions for memory limit warnings.
- Copyright (C) 1990, 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. */
-
-#ifdef emacs
-#include "config.h"
-#include "lisp.h"
-#endif
-
-#ifndef emacs
-#include <stddef.h>
-typedef size_t SIZE;
-typedef void *POINTER;
-#define EXCEEDS_LISP_PTR(x) 0
-#endif
-
-#include "mem-limits.h"
-
-/*
- Level number of warnings already issued.
- 0 -- no warnings issued.
- 1 -- 75% warning already issued.
- 2 -- 85% warning already issued.
- 3 -- 95% warning issued; keep warning frequently.
-*/
-static int warnlevel;
-
-/* Function to call to issue a warning;
- 0 means don't issue them. */
-static void (*warn_function) ();
-
-/* Get more memory space, complaining if we're near the end. */
-
-static void
-check_memory_limits ()
-{
- extern POINTER (*__morecore) ();
-
- register POINTER cp;
- int five_percent;
- int data_size;
-
- if (lim_data == 0)
- get_lim_data ();
- five_percent = lim_data / 20;
-
- /* Find current end of memory and issue warning if getting near max */
- cp = (char *) (*__morecore) (0);
- data_size = (char *) cp - (char *) data_space_start;
-
- if (warn_function)
- switch (warnlevel)
- {
- case 0:
- if (data_size > five_percent * 15)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 75% of memory limit");
- }
- break;
-
- case 1:
- if (data_size > five_percent * 17)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 85% of memory limit");
- }
- break;
-
- case 2:
- if (data_size > five_percent * 19)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 95% of memory limit");
- }
- break;
-
- default:
- (*warn_function) ("Warning: past acceptable memory limits");
- break;
- }
-
- /* If we go down below 70% full, issue another 75% warning
- when we go up again. */
- if (data_size < five_percent * 14)
- warnlevel = 0;
- /* If we go down below 80% full, issue another 85% warning
- when we go up again. */
- else if (warnlevel > 1 && data_size < five_percent * 16)
- warnlevel = 1;
- /* If we go down below 90% full, issue another 95% warning
- when we go up again. */
- else if (warnlevel > 2 && data_size < five_percent * 18)
- warnlevel = 2;
-
- if (EXCEEDS_LISP_PTR (cp))
- (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
-}
-
-/* Cause reinitialization based on job parameters;
- also declare where the end of pure storage is. */
-
-void
-memory_warnings (start, warnfun)
- POINTER start;
- void (*warnfun) ();
-{
- extern void (* __after_morecore_hook) (); /* From gmalloc.c */
-
- if (start)
- data_space_start = start;
- else
- data_space_start = start_of_data ();
-
- warn_function = warnfun;
- __after_morecore_hook = check_memory_limits;
-}
OpenPOWER on IntegriCloud