Compare commits

..

2 Commits

Author SHA1 Message Date
Zachary Ware
8f590873d0 Import BSDDB 4.7.25 (as of svn r89086) 2017-09-04 13:40:25 -05:00
Zachary Ware
4b29e0458f Update README.md 2017-05-22 12:17:48 -07:00
5231 changed files with 2239479 additions and 145841 deletions

1327
ABOUT-NLS

File diff suppressed because it is too large Load Diff

27
AUTHORS
View File

@@ -1,27 +0,0 @@
Authors of XZ Utils
===================
XZ Utils is developed and maintained by Lasse Collin
<lasse.collin@tukaani.org>.
Major parts of liblzma are based on code written by Igor Pavlov,
specifically the LZMA SDK <http://7-zip.org/sdk.html>. Without
this code, XZ Utils wouldn't exist.
The SHA-256 implementation in liblzma is based on the code found from
7-Zip <http://7-zip.org/>, which has a modified version of the SHA-256
code found from Crypto++ <http://www.cryptopp.com/>. The SHA-256 code
in Crypto++ was written by Kevin Springle and Wei Dai.
Some scripts have been adapted from gzip. The original versions
were written by Jean-loup Gailly, Charles Levert, and Paul Eggert.
Andrew Dudman helped adapting the scripts and their man pages for
XZ Utils.
The GNU Autotools-based build system contains files from many authors,
which I'm not trying to list here.
Several people have contributed fixes or reported bugs. Most of them
are mentioned in the file THANKS.

65
COPYING
View File

@@ -1,65 +0,0 @@
XZ Utils Licensing
==================
Different licenses apply to different files in this package. Here
is a rough summary of which licenses apply to which parts of this
package (but check the individual files to be sure!):
- liblzma is in the public domain.
- xz, xzdec, and lzmadec command line tools are in the public
domain unless GNU getopt_long had to be compiled and linked
in from the lib directory. The getopt_long code is under
GNU LGPLv2.1+.
- The scripts to grep, diff, and view compressed files have been
adapted from gzip. These scripts and their documentation are
under GNU GPLv2+.
- All the documentation in the doc directory and most of the
XZ Utils specific documentation files in other directories
are in the public domain.
- Translated messages are in the public domain.
- The build system contains public domain files, and files that
are under GNU GPLv2+ or GNU GPLv3+. None of these files end up
in the binaries being built.
- Test files and test code in the tests directory, and debugging
utilities in the debug directory are in the public domain.
- The extra directory may contain public domain files, and files
that are under various free software licenses.
You can do whatever you want with the files that have been put into
the public domain. If you find public domain legally problematic,
take the previous sentence as a license grant. If you still find
the lack of copyright legally problematic, you have too many
lawyers.
As usual, this software is provided "as is", without any warranty.
If you copy significant amounts of public domain code from XZ Utils
into your project, acknowledging this somewhere in your software is
polite (especially if it is proprietary, non-free software), but
naturally it is not legally required. Here is an example of a good
notice to put into "about box" or into documentation:
This software includes code from XZ Utils <http://tukaani.org/xz/>.
The following license texts are included in the following files:
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
- COPYING.GPLv2: GNU General Public License version 2
- COPYING.GPLv3: GNU General Public License version 3
Note that the toolchain (compiler, linker etc.) may add some code
pieces that are copyrighted. Thus, it is possible that e.g. liblzma
binary wouldn't actually be in the public domain in its entirety
even though it contains no copyrighted code from the XZ Utils source
package.
If you have questions, don't hesitate to ask the author(s) for more
information.

View File

@@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, 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 software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, 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 redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
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 give any other recipients of the Program a copy of this License
along with the Program.
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 Program or any portion
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
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 Program, 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 Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) 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; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, 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 executable. 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.
If distribution of executable or 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 counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program 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.
5. 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 Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program 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.
7. 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 Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program 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 Program.
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.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program 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.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 Program
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 Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, 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
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state 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 program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,502 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
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 Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
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 other code 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.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
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, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser 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 combine 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) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) 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.
d) 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.
e) 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 materials to be 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 with
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 Lesser 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
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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!

14953
ChangeLog

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

554
INSTALL
View File

@@ -1,554 +0,0 @@
XZ Utils Installation
=====================
0. Preface
1. Supported platforms
1.1. Compilers
1.2. Platform-specific notes
1.2.1. AIX
1.2.2. IRIX
1.2.3. MINIX 3
1.2.4. OpenVMS
1.2.5. Solaris, OpenSolaris, and derivatives
1.2.6. Tru64
1.2.7. Windows
1.2.8. DOS
1.3. Adding support for new platforms
2. configure options
2.1. Static vs. dynamic linking of liblzma
2.2. Optimizing xzdec and lzmadec
3. xzgrep and other scripts
3.1. Dependencies
3.2. PATH
4. Troubleshooting
4.1. "No C99 compiler was found."
4.2. "No POSIX conforming shell (sh) was found."
4.3. configure works but build fails at crc32_x86.S
4.4. Lots of warnings about symbol visibility
4.5. "make check" fails
4.6. liblzma.so (or similar) not found when running xz
0. Preface
----------
If you aren't familiar with building packages that use GNU Autotools,
see the file INSTALL.generic for generic instructions before reading
further.
If you are going to build a package for distribution, see also the
file PACKAGERS. It contains information that should help making the
binary packages as good as possible, but the information isn't very
interesting to those making local builds for private use or for use
in special situations like embedded systems.
1. Supported platforms
----------------------
XZ Utils are developed on GNU/Linux, but they should work on many
POSIX-like operating systems like *BSDs and Solaris, and even on
a few non-POSIX operating systems.
1.1. Compilers
A C99 compiler is required to compile XZ Utils. If you use GCC, you
need at least version 3.x.x. GCC version 2.xx.x doesn't support some
C99 features used in XZ Utils source code, thus GCC 2 won't compile
XZ Utils.
XZ Utils takes advantage of some GNU C extensions when building
with GCC. Because these extensions are used only when building
with GCC, it should be possible to use any C99 compiler.
1.2. Platform-specific notes
1.2.1. AIX
If you use IBM XL C compiler, pass CC=xlc_r to configure. If
you use CC=xlc instead, you must disable threading support
with --disable-threads (usually not recommended).
1.2.2. IRIX
MIPSpro 7.4.4m has been reported to produce broken code if using
the -O2 optimization flag ("make check" fails). Using -O1 should
work.
A problem has been reported when using shared liblzma. Passing
--disable-shared to configure works around this. Alternatively,
putting "-64" to CFLAGS to build a 64-bit version might help too.
1.2.3. MINIX 3
The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
which doesn't support C99. Install GCC to compile XZ Utils.
MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
to be patched before XZ Utils can be compiled correctly. See
<http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
MINIX 3.2.0 and later use a different libc and aren't affected by
the above bug.
XZ Utils doesn't have code to detect the amount of physical RAM and
number of CPU cores on MINIX 3.
See section 4.4 in this file about symbol visibility warnings (you
may want to pass gl_cv_cc_visibility=no to configure).
1.2.4. OpenVMS
XZ Utils can be built for OpenVMS, but the build system files
are not included in the XZ Utils source package. The required
OpenVMS-specific files are maintained by Jouk Jansen and can be
downloaded here:
http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
1.2.5. Solaris, OpenSolaris, and derivatives
The following linker error has been reported on some x86 systems:
ld: fatal: relocation error: R_386_GOTOFF: ...
This can be worked around by passing gl_cv_cc_visibility=no
as an argument to the configure script.
test_scripts.sh in "make check" may fail if good enough tools are
missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). See sections
4.5 and 3.2 for more information.
1.2.6. Tru64
If you try to use the native C compiler on Tru64 (passing CC=cc to
configure), you may need the workaround mention in section 4.1 in
this file (pass also ac_cv_prog_cc_c99= to configure).
1.2.7. Windows
Building XZ Utils on Windows is supported under the following
environments:
- MinGW-w64 + MSYS (32-bit and 64-bit x86): This is used
for building the official binary packages for Windows.
There is windows/build.bash to ease packaging XZ Utils with
MinGW(-w64) + MSYS into a redistributable .zip or .7z file.
See windows/INSTALL-MinGW.txt for more information.
- MinGW + MSYS (32-bit x86): I haven't recently tested this.
- Cygwin 1.7.35 and later: NOTE that using XZ Utils >= 5.2.0
under Cygwin older than 1.7.35 can lead to DATA LOSS! If
you must use an old Cygwin version, stick to XZ Utils 5.0.x
which is safe under older Cygwin versions. You can check
the Cygwin version with the command "cygcheck -V".
- Microsoft Visual Studio 2013 update 2 or later (MSVC for short):
See windows/INSTALL-MSVC.txt for more information.
It may be possible to build liblzma with other toolchains too, but
that will probably require writing a separate makefile. Building
the command line tools with non-GNU toolchains will be harder than
building only liblzma.
Even if liblzma is built with MinGW(-w64), the resulting DLL can
be used by other compilers and linkers, including MSVC. See
windows/README-Windows.txt for details.
1.2.8. DOS
There is an experimental Makefile in the "dos" directory to build
XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
needed. See dos/README for more information.
GNU Autotools based build hasn't been tried on DOS. If you try, I
would like to hear if it worked.
1.3. Adding support for new platforms
If you have written patches to make XZ Utils to work on previously
unsupported platform, please send the patches to me! I will consider
including them to the official version. It's nice to minimize the
need of third-party patching.
One exception: Don't request or send patches to change the whole
source package to C89. I find C99 substantially nicer to write and
maintain. However, the public library headers must be in C89 to
avoid frustrating those who maintain programs, which are strictly
in C89 or C++.
2. configure options
--------------------
In most cases, the defaults are what you want. Many of the options
below are useful only when building a size-optimized version of
liblzma or command line tools.
--enable-encoders=LIST
--disable-encoders
Specify a comma-separated LIST of filter encoders to
build. See "./configure --help" for exact list of
available filter encoders. The default is to build all
supported encoders.
If LIST is empty or --disable-encoders is used, no filter
encoders will be built and also the code shared between
encoders will be omitted.
Disabling encoders will remove some symbols from the
liblzma ABI, so this option should be used only when it
is known to not cause problems.
--enable-decoders=LIST
--disable-decoders
This is like --enable-encoders but for decoders. The
default is to build all supported decoders.
--enable-match-finders=LIST
liblzma includes two categories of match finders:
hash chains and binary trees. Hash chains (hc3 and hc4)
are quite fast but they don't provide the best compression
ratio. Binary trees (bt2, bt3 and bt4) give excellent
compression ratio, but they are slower and need more
memory than hash chains.
You need to enable at least one match finder to build the
LZMA1 or LZMA2 filter encoders. Usually hash chains are
used only in the fast mode, while binary trees are used to
when the best compression ratio is wanted.
The default is to build all the match finders if LZMA1
or LZMA2 filter encoders are being built.
--enable-checks=LIST
liblzma support multiple integrity checks. CRC32 is
mandatory, and cannot be omitted. See "./configure --help"
for exact list of available integrity check types.
liblzma and the command line tools can decompress files
which use unsupported integrity check type, but naturally
the file integrity cannot be verified in that case.
Disabling integrity checks may remove some symbols from
the liblzma ABI, so this option should be used only when
it is known to not cause problems.
--disable-xz
--disable-xzdec
--disable-lzmadec
--disable-lzmainfo
Don't build and install the command line tool mentioned
in the option name.
NOTE: Disabling xz will skip some tests in "make check".
NOTE: If xzdec is disabled and lzmadec is left enabled,
a dangling man page symlink lzmadec.1 -> xzdec.1 is
created.
--disable-lzma-links
Don't create symlinks for LZMA Utils compatibility.
This includes lzma, unlzma, and lzcat. If scripts are
installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
lzmore, and lzless will be omitted if this option is used.
--disable-scripts
Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
and their symlinks.
--disable-doc
Don't install the documentation files to $docdir
(often /usr/doc/xz or /usr/local/doc/xz). Man pages
will still be installed. The $docdir can be changed
with --docdir=DIR.
--disable-assembler
liblzma includes some assembler optimizations. Currently
there is only assembler code for CRC32 and CRC64 for
32-bit x86.
All the assembler code in liblzma is position-independent
code, which is suitable for use in shared libraries and
position-independent executables. So far only i386
instructions are used, but the code is optimized for i686
class CPUs. If you are compiling liblzma exclusively for
pre-i686 systems, you may want to disable the assembler
code.
--enable-unaligned-access
Allow liblzma to use unaligned memory access for 16-bit
and 32-bit loads and stores. This should be enabled only
when the hardware supports this, i.e. when unaligned
access is fast. Some operating system kernels emulate
unaligned access, which is extremely slow. This option
shouldn't be used on systems that rely on such emulation.
Unaligned access is enabled by default on x86, x86-64,
and big endian PowerPC.
--enable-small
Reduce the size of liblzma by selecting smaller but
semantically equivalent version of some functions, and
omit precomputed lookup tables. This option tends to
make liblzma slightly slower.
Note that while omitting the precomputed tables makes
liblzma smaller on disk, the tables are still needed at
run time, and need to be computed at startup. This also
means that the RAM holding the tables won't be shared
between applications linked against shared liblzma.
This option doesn't modify CFLAGS to tell the compiler
to optimize for size. You need to add -Os or equivalent
flag(s) to CFLAGS manually.
--enable-assume-ram=SIZE
On the most common operating systems, XZ Utils is able to
detect the amount of physical memory on the system. This
information is used by the options --memlimit-compress,
--memlimit-decompress, and --memlimit when setting the
limit to a percentage of total RAM.
On some systems, there is no code to detect the amount of
RAM though. Using --enable-assume-ram one can set how much
memory to assume on these systems. SIZE is given as MiB.
The default is 128 MiB.
Feel free to send patches to add support for detecting
the amount of RAM on the operating system you use. See
src/common/tuklib_physmem.c for details.
--enable-threads=METHOD
Threading support is enabled by default so normally there
is no need to specify this option.
Supported values for METHOD:
yes Autodetect the threading method. If none
is found, configure will give an error.
posix Use POSIX pthreads. This is the default
except on Windows outside Cygwin.
win95 Use Windows 95 compatible threads. This
is compatible with Windows XP and later
too. This is the default for 32-bit x86
Windows builds. The `win95' threading is
incompatible with --enable-small.
vista Use Windows Vista compatible threads. The
resulting binaries won't run on Windows XP
or older. This is the default for Windows
excluding 32-bit x86 builds (that is, on
x86-64 the default is `vista').
no Disable threading support. This is the
same as using --disable-threads.
NOTE: If combined with --enable-small, the
resulting liblzma won't be thread safe,
that is, if a multi-threaded application
calls any liblzma functions from more than
one thread, something bad may happen.
--enable-symbol-versions
Use symbol versioning for liblzma. This is enabled by
default on GNU/Linux, other GNU-based systems, and
FreeBSD.
--enable-debug
This enables the assert() macro and possibly some other
run-time consistency checks. It makes the code slower, so
you normally don't want to have this enabled.
--enable-werror
If building with GCC, make all compiler warnings an error,
that abort the compilation. This may help catching bugs,
and should work on most systems. This has no effect on the
resulting binaries.
2.1. Static vs. dynamic linking of liblzma
On 32-bit x86, linking against static liblzma can give a minor
speed improvement. Static libraries on x86 are usually compiled as
position-dependent code (non-PIC) and shared libraries are built as
position-independent code (PIC). PIC wastes one register, which can
make the code slightly slower compared to a non-PIC version. (Note
that this doesn't apply to x86-64.)
If you want to link xz against static liblzma, the simplest way
is to pass --disable-shared to configure. If you want also shared
liblzma, run configure again and run "make install" only for
src/liblzma.
2.2. Optimizing xzdec and lzmadec
xzdec and lzmadec are intended to be relatively small instead of
optimizing for the best speed. Thus, it is a good idea to build
xzdec and lzmadec separately:
- To link the tools against static liblzma, pass --disable-shared
to configure.
- To select somewhat size-optimized variant of some things in
liblzma, pass --enable-small to configure.
- Tell the compiler to optimize for size instead of speed.
E.g. with GCC, put -Os into CFLAGS.
- xzdec and lzmadec will never use multithreading capabilities of
liblzma. You can avoid dependency on libpthread by passing
--disable-threads to configure.
- There are and will be no translated messages for xzdec and
lzmadec, so it is fine to pass also --disable-nls to configure.
- Only decoder code is needed, so you can speed up the build
slightly by passing --disable-encoders to configure. This
shouldn't affect the final size of the executables though,
because the linker is able to omit the encoder code anyway.
If you have no use for xzdec or lzmadec, you can disable them with
--disable-xzdec and --disable-lzmadec.
3. xzgrep and other scripts
---------------------------
3.1. Dependencies
POSIX shell (sh) and bunch of other standard POSIX tools are required
to run the scripts. The configure script tries to find a POSIX
compliant sh, but if it fails, you can force the shell by passing
gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
script.
xzdiff (xzcmp/lzdiff/lzcmp) may use mktemp if it is available. As
a fallback xzdiff will use mkdir to securely create a temporary
directory. Having mktemp available is still recommended since the
mkdir fallback method isn't as robust as mktemp is. The original
mktemp can be found from <http://www.mktemp.org/>. On GNU, most will
use the mktemp program from GNU coreutils instead of the original
implementation. Both mktemp versions are fine.
In addition to using xz to decompress .xz files, xzgrep and xzdiff
use gzip, bzip2, and lzop to support .gz, bz2, and .lzo files.
3.2. PATH
The scripts assume that the required tools (standard POSIX utilities,
mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
Some people like this while some think this is a bug. Those in the
latter group can easily patch the scripts before running the configure
script by taking advantage of a placeholder line in the scripts.
For example, to make the scripts prefix /usr/bin:/bin to PATH:
perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
src/scripts/xz*.in
4. Troubleshooting
------------------
4.1. "No C99 compiler was found."
You need a C99 compiler to build XZ Utils. If the configure script
cannot find a C99 compiler and you think you have such a compiler
installed, set the compiler command by passing CC=/path/to/c99 as
an argument to the configure script.
If you get this error even when you think your compiler supports C99,
you can override the test by passing ac_cv_prog_cc_c99= as an argument
to the configure script. The test for C99 compiler is not perfect (and
it is not as easy to make it perfect as it sounds), so sometimes this
may be needed. You will get a compile error if your compiler doesn't
support enough C99.
4.2. "No POSIX conforming shell (sh) was found."
xzgrep and other scripts need a shell that (roughly) conforms
to POSIX. The configure script tries to find such a shell. If
it fails, you can force the shell to be used by passing
gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
script. Alternatively you can omit the installation of scripts and
this error by passing --disable-scripts to configure.
4.3. configure works but build fails at crc32_x86.S
The easy fix is to pass --disable-assembler to the configure script.
The configure script determines if assembler code can be used by
looking at the configure triplet; there is currently no check if
the assembler code can actually actually be built. The x86 assembler
code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
Cygwin, and DJGPP. On other x86 systems, there may be problems and
the assembler code may need to be disabled with the configure option.
If you get this error when building for x86-64, you have specified or
the configure script has misguessed your architecture. Pass the
correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
(see INSTALL.generic).
4.4. Lots of warnings about symbol visibility
On some systems where symbol visibility isn't supported, GCC may
still accept the visibility options and attributes, which will make
configure think that visibility is supported. This will result in
many compiler warnings. You can avoid the warnings by forcing the
visibility support off by passing gl_cv_cc_visibility=no as an
argument to the configure script. This has no effect on the
resulting binaries, but fewer warnings looks nicer and may allow
using --enable-werror.
4.5. "make check" fails
If the other tests pass but test_scripts.sh fails, then the problem
is in the scripts in src/scripts. Comparing the contents of
tests/xzgrep_test_output to tests/xzgrep_expected_output might
give a good idea about problems in xzgrep. One possibility is that
some tools are missing from the current PATH or the tools lack
support for some POSIX features. This can happen at least on
Solaris where the tools in /bin may be ancient but good enough
tools are available in /usr/xpg4/bin or /usr/xpg6/bin. One fix
for this problem is described in section 3.2 of this file.
If tests other than test_scripts.sh fail, a likely reason is that
libtool links the test programs against an installed version of
liblzma instead of the version that was just built. This is
obviously a bug which seems to happen on some platforms.
A workaround is to uninstall the old liblzma versions first.
If the problem isn't any of those described above, then it's likely
a bug in XZ Utils or in the compiler. See the platform-specific
notes in this file for possible known problems. Please report
a bug if you cannot solve the problem. See README for contact
information.
4.6. liblzma.so (or similar) not found when running xz
If you installed the package with "make install" and get an error
about liblzma.so (or a similarly named file) being missing, try
running "ldconfig" to update the run-time linker cache (if your
operating system has such a command).

View File

@@ -1,365 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

130
LICENSE Normal file
View File

@@ -0,0 +1,130 @@
/*-
* $Id: LICENSE,v 12.9 2008/02/07 17:12:17 mark Exp $
*/
The following is the license that applies to this copy of the Berkeley DB
software. For a license to use the Berkeley DB software under conditions
other than those described here, or to purchase support for this software,
please contact Oracle at berkeleydb-info_us@oracle.com.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/*
* Copyright (c) 1990,2008 Oracle. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the DB software and any
* accompanying software that uses the DB software. The source code
* must either be included in the distribution or be available for no
* more than the cost of distribution plus a nominal fee, and must be
* freely redistributable under reasonable conditions. For an
* executable file, complete source code means the source code for all
* modules it contains. It does not include source code for modules or
* files that typically accompany the major components of the operating
* system on which the executable file runs.
*
* THIS SOFTWARE IS PROVIDED BY ORACLE ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1995, 1996
* The President and Fellows of Harvard University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY HARVARD AND ITS CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL HARVARD OR ITS CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2005 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

View File

@@ -1,109 +0,0 @@
##
## Author: Lasse Collin
##
## This file has been put into the public domain.
## You can do whatever you want with this file.
##
# Use -n to prevent gzip from adding a timestamp to the .gz headers.
GZIP_ENV = -9n
DIST_SUBDIRS = lib src po tests debug
SUBDIRS =
if COND_GNULIB
SUBDIRS += lib
endif
SUBDIRS += src po tests
if COND_DOC
dist_doc_DATA = \
AUTHORS \
COPYING \
COPYING.GPLv2 \
NEWS \
README \
THANKS \
TODO \
doc/faq.txt \
doc/history.txt \
doc/xz-file-format.txt \
doc/lzma-file-format.txt
examplesdir = $(docdir)/examples
dist_examples_DATA = \
doc/examples/00_README.txt \
doc/examples/01_compress_easy.c \
doc/examples/02_decompress.c \
doc/examples/03_compress_custom.c \
doc/examples/04_compress_easy_mt.c \
doc/examples/Makefile
examplesolddir = $(docdir)/examples_old
dist_examplesold_DATA = \
doc/examples_old/xz_pipe_comp.c \
doc/examples_old/xz_pipe_decomp.c
endif
EXTRA_DIST = \
extra \
dos \
windows \
macosx \
autogen.sh \
Doxyfile.in \
COPYING.GPLv2 \
COPYING.GPLv3 \
COPYING.LGPLv2.1 \
INSTALL.generic \
PACKAGERS \
build-aux/manconv.sh \
build-aux/version.sh
ACLOCAL_AMFLAGS = -I m4
# List of man pages to conver to PDF and plain text in the dist-hook target.
manfiles = \
src/xz/xz.1 \
src/xzdec/xzdec.1 \
src/lzmainfo/lzmainfo.1 \
src/scripts/xzdiff.1 \
src/scripts/xzgrep.1 \
src/scripts/xzless.1 \
src/scripts/xzmore.1
# Create ChangeLog from output of "git log --date=iso --stat".
# Convert the man pages to PDF and plain text (ASCII only) formats.
dist-hook:
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
( cd "$(srcdir)" && git log --date=iso --stat ) \
> "$(distdir)/ChangeLog"; \
fi
if type groff > /dev/null 2>&1 && type ps2pdf > /dev/null 2>&1; then \
dest="$(distdir)/doc/man" && \
$(MKDIR_P) "$$dest/pdf-a4" "$$dest/pdf-letter" "$$dest/txt" && \
for FILE in $(manfiles); do \
BASE=`basename $$FILE .1` && \
sh "$(srcdir)/build-aux/manconv.sh" pdf a4 \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-a4/$$BASE-a4.pdf" && \
sh "$(srcdir)/build-aux/manconv.sh" pdf letter \
< "$(srcdir)/$$FILE" \
> "$$dest/pdf-letter/$$BASE-letter.pdf" && \
sh "$(srcdir)/build-aux/manconv.sh" ascii \
< "$(srcdir)/$$FILE" \
> "$$dest/txt/$$BASE.txt"; \
done; \
fi
# This works with GNU tar and gives cleaner package than normal 'make dist'.
mydist:
sh "$(srcdir)/src/liblzma/validate_map.sh"
VERSION=$(VERSION); \
if test -d "$(srcdir)/.git" && type git > /dev/null 2>&1; then \
SNAPSHOT=`cd "$(srcdir)" && git describe --abbrev=4 | cut -b2-`; \
test -n "$$SNAPSHOT" && VERSION=$$SNAPSHOT; \
fi; \
TAR_OPTIONS='--owner=0 --group=0 --numeric-owner --mode=u+rw,go+r-w' \
$(MAKE) VERSION="$$VERSION" dist-gzip

File diff suppressed because it is too large Load Diff

505
NEWS
View File

@@ -1,505 +0,0 @@
XZ Utils Release Notes
======================
5.2.2 (2015-09-29)
* Fixed bugs in QNX-specific code.
* Omitted the use of pipe2() even if it is available to avoid
portability issues with some old Linux and glibc combinations.
* Updated German translation.
* Added project files to build static and shared liblzma (not the
whole XZ Utils) with Visual Studio 2013 update 2 or later.
* Documented that threaded decompression hasn't been implemented
yet. A 5.2.0 NEWS entry describing multi-threading support had
incorrectly said "decompression" when it should have said
"compression".
5.2.1 (2015-02-26)
* Fixed a compression-ratio regression in fast mode of LZMA1 and
LZMA2. The bug is present in 5.1.4beta and 5.2.0 releases.
* Fixed a portability problem in xz that affected at least OpenBSD.
* Fixed xzdiff to be compatible with FreeBSD's mktemp which differs
from most other mktemp implementations.
* Changed CPU core count detection to use cpuset_getaffinity() on
FreeBSD.
5.2.0 (2014-12-21)
Since 5.1.4beta:
* All fixes from 5.0.8
* liblzma: Fixed lzma_stream_encoder_mt_memusage() when a preset
was used.
* xzdiff: If mktemp isn't installed, mkdir will be used as
a fallback to create a temporary directory. Installing mktemp
is still recommended.
* Updated French, German, Italian, Polish, and Vietnamese
translations.
Summary of fixes and new features added in the 5.1.x development
releases:
* liblzma:
- Added support for multi-threaded compression. See the
lzma_mt structure, lzma_stream_encoder_mt(), and
lzma_stream_encoder_mt_memusage() in <lzma/container.h>,
lzma_get_progress() in <lzma/base.h>, and lzma_cputhreads()
in <lzma/hardware.h> for details.
- Made the uses of lzma_allocator const correct.
- Added lzma_block_uncomp_encode() to create uncompressed
.xz Blocks using LZMA2 uncompressed chunks.
- Added support for LZMA_IGNORE_CHECK.
- A few speed optimizations were made.
- Added support for symbol versioning. It is enabled by default
on GNU/Linux, other GNU-based systems, and FreeBSD.
- liblzma (not the whole XZ Utils) should now be buildable
with MSVC 2013 update 2 or later using windows/config.h.
* xz:
- Fixed a race condition in the signal handling. It was
possible that e.g. the first SIGINT didn't make xz exit
if reading or writing blocked and one had bad luck. The fix
is non-trivial, so as of writing it is unknown if it will be
backported to the v5.0 branch.
- Multi-threaded compression can be enabled with the
--threads (-T) option.
[Fixed: This originally said "decompression".]
- New command line options in xz: --single-stream,
--block-size=SIZE, --block-list=SIZES,
--flush-timeout=TIMEOUT, and --ignore-check.
- xz -lvv now shows the minimum xz version that is required to
decompress the file. Currently it is 5.0.0 for all supported
.xz files except files with empty LZMA2 streams require 5.0.2.
* xzdiff and xzgrep now support .lzo files if lzop is installed.
The .tzo suffix is also recognized as a shorthand for .tar.lzo.
5.1.4beta (2014-09-14)
* All fixes from 5.0.6
* liblzma: Fixed the use of presets in threaded encoder
initialization.
* xz --block-list and --block-size can now be used together
in single-threaded mode. Previously the combination only
worked in multi-threaded mode.
* Added support for LZMA_IGNORE_CHECK to liblzma and made it
available in xz as --ignore-check.
* liblzma speed optimizations:
- Initialization of a new LZMA1 or LZMA2 encoder has been
optimized. (The speed of reinitializing an already-allocated
encoder isn't affected.) This helps when compressing many
small buffers with lzma_stream_buffer_encode() and other
similar situations where an already-allocated encoder state
isn't reused. This speed-up is visible in xz too if one
compresses many small files one at a time instead running xz
once and giving all files as command-line arguments.
- Buffer comparisons are now much faster when unaligned access
is allowed (configured with --enable-unaligned-access). This
speeds up encoding significantly. There is arch-specific code
for 32-bit and 64-bit x86 (32-bit needs SSE2 for the best
results and there's no run-time CPU detection for now).
For other archs there is only generic code which probably
isn't as optimal as arch-specific solutions could be.
- A few speed optimizations were made to the SHA-256 code.
(Note that the builtin SHA-256 code isn't used on all
operating systems.)
* liblzma can now be built with MSVC 2013 update 2 or later
using windows/config.h.
* Vietnamese translation was added.
5.1.3alpha (2013-10-26)
* All fixes from 5.0.5
* liblzma:
- Fixed a deadlock in the threaded encoder.
- Made the uses of lzma_allocator const correct.
- Added lzma_block_uncomp_encode() to create uncompressed
.xz Blocks using LZMA2 uncompressed chunks.
- Added support for native threads on Windows and the ability
to detect the number of CPU cores.
* xz:
- Fixed a race condition in the signal handling. It was
possible that e.g. the first SIGINT didn't make xz exit
if reading or writing blocked and one had bad luck. The fix
is non-trivial, so as of writing it is unknown if it will be
backported to the v5.0 branch.
- Made the progress indicator work correctly in threaded mode.
- Threaded encoder now works together with --block-list=SIZES.
- Added preliminary support for --flush-timeout=TIMEOUT.
It can be useful for (somewhat) real-time streaming. For
now the decompression side has to be done with something
else than the xz tool due to how xz does buffering, but this
should be fixed.
5.1.2alpha (2012-07-04)
* All fixes from 5.0.3 and 5.0.4
* liblzma:
- Fixed a deadlock and an invalid free() in the threaded encoder.
- Added support for symbol versioning. It is enabled by default
on GNU/Linux, other GNU-based systems, and FreeBSD.
- Use SHA-256 implementation from the operating system if one is
available in libc, libmd, or libutil. liblzma won't use e.g.
OpenSSL or libgcrypt to avoid introducing new dependencies.
- Fixed liblzma.pc for static linking.
- Fixed a few portability bugs.
* xz --decompress --single-stream now fixes the input position after
successful decompression. Now the following works:
echo foo | xz > foo.xz
echo bar | xz >> foo.xz
( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz
Note that it doesn't work if the input is not seekable
or if there is Stream Padding between the concatenated
.xz Streams.
* xz -lvv now shows the minimum xz version that is required to
decompress the file. Currently it is 5.0.0 for all supported .xz
files except files with empty LZMA2 streams require 5.0.2.
* Added an *incomplete* implementation of --block-list=SIZES to xz.
It only works correctly in single-threaded mode and when
--block-size isn't used at the same time. --block-list allows
specifying the sizes of Blocks which can be useful e.g. when
creating files for random-access reading.
5.1.1alpha (2011-04-12)
* All fixes from 5.0.2
* liblzma fixes that will also be included in 5.0.3:
- A memory leak was fixed.
- lzma_stream_buffer_encode() no longer creates an empty .xz
Block if encoding an empty buffer. Such an empty Block with
LZMA2 data would trigger a bug in 5.0.1 and older (see the
first bullet point in 5.0.2 notes). When releasing 5.0.2,
I thought that no encoder creates this kind of files but
I was wrong.
- Validate function arguments better in a few functions. Most
importantly, specifying an unsupported integrity check to
lzma_stream_buffer_encode() no longer creates a corrupt .xz
file. Probably no application tries to do that, so this
shouldn't be a big problem in practice.
- Document that lzma_block_buffer_encode(),
lzma_easy_buffer_encode(), lzma_stream_encoder(), and
lzma_stream_buffer_encode() may return LZMA_UNSUPPORTED_CHECK.
- The return values of the _memusage() functions are now
documented better.
* Support for multithreaded compression was added using the simplest
method, which splits the input data into blocks and compresses
them independently. Other methods will be added in the future.
The current method has room for improvement, e.g. it is possible
to reduce the memory usage.
* Added the options --single-stream and --block-size=SIZE to xz.
* xzdiff and xzgrep now support .lzo files if lzop is installed.
The .tzo suffix is also recognized as a shorthand for .tar.lzo.
* Support for short 8.3 filenames under DOS was added to xz. It is
experimental and may change before it gets into a stable release.
5.0.8 (2014-12-21)
* Fixed an old bug in xzgrep that affected OpenBSD and probably
a few other operating systems too.
* Updated French and German translations.
* Added support for detecting the amount of RAM on AmigaOS/AROS.
* Minor build system updates.
5.0.7 (2014-09-20)
* Fix regressions introduced in 5.0.6:
- Fix building with non-GNU make.
- Fix invalid Libs.private value in liblzma.pc which broke
static linking against liblzma if the linker flags were
taken from pkg-config.
5.0.6 (2014-09-14)
* xzgrep now exits with status 0 if at least one file matched.
* A few minor portability and build system fixes
5.0.5 (2013-06-30)
* lzmadec and liblzma's lzma_alone_decoder(): Support decompressing
.lzma files that have less common settings in the headers
(dictionary size other than 2^n or 2^n + 2^(n-1), or uncompressed
size greater than 256 GiB). The limitations existed to avoid false
positives when detecting .lzma files. The lc + lp <= 4 limitation
still remains since liblzma's LZMA decoder has that limitation.
NOTE: xz's .lzma support or liblzma's lzma_auto_decoder() are NOT
affected by this change. They still consider uncommon .lzma headers
as not being in the .lzma format. Changing this would give way too
many false positives.
* xz:
- Interaction of preset and custom filter chain options was
made less illogical. This affects only certain less typical
uses cases so few people are expected to notice this change.
Now when a custom filter chain option (e.g. --lzma2) is
specified, all preset options (-0 ... -9, -e) earlier are on
the command line are completely forgotten. Similarly, when
a preset option is specified, all custom filter chain options
earlier on the command line are completely forgotten.
Example 1: "xz -9 --lzma2=preset=5 -e" is equivalent to "xz -e"
which is equivalent to "xz -6e". Earlier -e didn't put xz back
into preset mode and thus the example command was equivalent
to "xz --lzma2=preset=5".
Example 2: "xz -9e --lzma2=preset=5 -7" is equivalent to
"xz -7". Earlier a custom filter chain option didn't make
xz forget the -e option so the example was equivalent to
"xz -7e".
- Fixes and improvements to error handling.
- Various fixes to the man page.
* xzless: Fixed to work with "less" versions 448 and later.
* xzgrep: Made -h an alias for --no-filename.
* Include the previously missing debug/translation.bash which can
be useful for translators.
* Include a build script for Mac OS X. This has been in the Git
repository since 2010 but due to a mistake in Makefile.am the
script hasn't been included in a release tarball before.
5.0.4 (2012-06-22)
* liblzma:
- Fix lzma_index_init(). It could crash if memory allocation
failed.
- Fix the possibility of an incorrect LZMA_BUF_ERROR when a BCJ
filter is used and the application only provides exactly as
much output space as is the uncompressed size of the file.
- Fix a bug in doc/examples_old/xz_pipe_decompress.c. It didn't
check if the last call to lzma_code() really returned
LZMA_STREAM_END, which made the program think that truncated
files are valid.
- New example programs in doc/examples (old programs are now in
doc/examples_old). These have more comments and more detailed
error handling.
* Fix "xz -lvv foo.xz". It could crash on some corrupted files.
* Fix output of "xz --robot -lv" and "xz --robot -lvv" which
incorrectly printed the filename also in the "foo (x/x)" format.
* Fix exit status of "xzdiff foo.xz bar.xz".
* Fix exit status of "xzgrep foo binary_file".
* Fix portability to EBCDIC systems.
* Fix a configure issue on AIX with the XL C compiler. See INSTALL
for details.
* Update French, German, Italian, and Polish translations.
5.0.3 (2011-05-21)
* liblzma fixes:
- A memory leak was fixed.
- lzma_stream_buffer_encode() no longer creates an empty .xz
Block if encoding an empty buffer. Such an empty Block with
LZMA2 data would trigger a bug in 5.0.1 and older (see the
first bullet point in 5.0.2 notes). When releasing 5.0.2,
I thought that no encoder creates this kind of files but
I was wrong.
- Validate function arguments better in a few functions. Most
importantly, specifying an unsupported integrity check to
lzma_stream_buffer_encode() no longer creates a corrupt .xz
file. Probably no application tries to do that, so this
shouldn't be a big problem in practice.
- Document that lzma_block_buffer_encode(),
lzma_easy_buffer_encode(), lzma_stream_encoder(), and
lzma_stream_buffer_encode() may return LZMA_UNSUPPORTED_CHECK.
- The return values of the _memusage() functions are now
documented better.
* Fix command name detection in xzgrep. xzegrep and xzfgrep now
correctly use egrep and fgrep instead of grep.
* French translation was added.
5.0.2 (2011-04-01)
* LZMA2 decompressor now correctly accepts LZMA2 streams with no
uncompressed data. Previously it considered them corrupt. The
bug can affect applications that use raw LZMA2 streams. It is
very unlikely to affect .xz files because no compressor creates
.xz files with empty LZMA2 streams. (Empty .xz files are a
different thing than empty LZMA2 streams.)
* "xz --suffix=.foo filename.foo" now refuses to compress the
file due to it already having the suffix .foo. It was already
documented on the man page, but the code lacked the test.
* "xzgrep -l foo bar.xz" works now.
* Polish translation was added.
5.0.1 (2011-01-29)
* xz --force now (de)compresses files that have setuid, setgid,
or sticky bit set and files that have multiple hard links.
The man page had it documented this way already, but the code
had a bug.
* gzip and bzip2 support in xzdiff was fixed.
* Portability fixes
* Minor fix to Czech translation
5.0.0 (2010-10-23)
Only the most important changes compared to 4.999.9beta are listed
here. One change is especially important:
* The memory usage limit is now disabled by default. Some scripts
written before this change may have used --memory=max on xz command
line or in XZ_OPT. THESE USES OF --memory=max SHOULD BE REMOVED
NOW, because they interfere with user's ability to set the memory
usage limit himself. If user-specified limit causes problems to
your script, blame the user.
Other significant changes:
* Added support for XZ_DEFAULTS environment variable. This variable
allows users to set default options for xz, e.g. default memory
usage limit or default compression level. Scripts that use xz
must never set or unset XZ_DEFAULTS. Scripts should use XZ_OPT
instead if they need a way to pass options to xz via an
environment variable.
* The compression settings associated with the preset levels
-0 ... -9 have been changed. --extreme was changed a little too.
It is now less likely to make compression worse, but with some
files the new --extreme may compress slightly worse than the old
--extreme.
* If a preset level (-0 ... -9) is specified after a custom filter
chain options have been used (e.g. --lzma2), the custom filter
chain will be forgotten. Earlier the preset options were
completely ignored after custom filter chain options had been
seen.
* xz will create sparse files when decompressing if the uncompressed
data contains long sequences of binary zeros. This is done even
when writing to standard output that is connected to a regular
file and certain additional conditions are met to make it safe.
* Support for "xz --list" was added. Combine with --verbose or
--verbose --verbose (-vv) for detailed output.
* I had hoped that liblzma API would have been stable after
4.999.9beta, but there have been a couple of changes in the
advanced features, which don't affect most applications:
- Index handling code was revised. If you were using the old
API, you will get a compiler error (so it's easy to notice).
- A subtle but important change was made to the Block handling
API. lzma_block.version has to be initialized even for
lzma_block_header_decode(). Code that doesn't do it will work
for now, but might break in the future, which makes this API
change easy to miss.
* The major soname has been bumped to 5.0.0. liblzma API and ABI
are now stable, so the need to recompile programs linking against
liblzma shouldn't arise soon.

231
PACKAGERS
View File

@@ -1,231 +0,0 @@
Information to packagers of XZ Utils
====================================
0. Preface
1. Package naming
2. Package description
3. License
4. configure options
5. Additional documentation
6. Extra files
7. Installing XZ Utils and LZMA Utils in parallel
8. Example
0. Preface
----------
This document is meant for people who create and maintain XZ Utils
packages for operating system distributions. The focus is on GNU/Linux
systems, but most things apply to other systems too.
While the standard "configure && make DESTDIR=$PKG install" should
give a pretty good package, there are some details which packagers
may want to tweak.
Packagers should also read the INSTALL file.
1. Package naming
-----------------
The preferred name for the XZ Utils package is "xz", because that's
the name of the upstream tarball. Naturally you may have good reasons
to use some other name; I won't get angry about it. ;-) It's just nice
to be able to point people to the correct package name without asking
what distro they have.
If your distro policy is to split things into small pieces, here is
one suggestion:
xz xz, xzdec, scripts (xzdiff, xzgrep, etc.), docs
xz-lzma lzma, unlzma, lzcat, lzgrep etc. symlinks and
lzmadec binary for compatibility with LZMA Utils
liblzma liblzma.so.*
liblzma-devel liblzma.so, liblzma.a, API headers
2. Package description
----------------------
Here is a suggestion which you may use as the package description.
If you can use only one-line description, pick only the first line.
Naturally, feel free to use some other description if you find it
better, and maybe send it to me too.
Library and command line tools for XZ and LZMA compressed files
XZ Utils provide a general purpose data compression library
and command line tools. The native file format is the .xz
format, but also the legacy .lzma format is supported. The .xz
format supports multiple compression algorithms, of which LZMA2
is currently the primary algorithm. With typical files, XZ Utils
create about 30 % smaller files than gzip.
If you are splitting XZ Utils into multiple packages, here are some
suggestions for package descriptions:
xz:
Command line tools for XZ and LZMA compressed files
This package includes the xz compression tool and other command
line tools from XZ Utils. xz has command line syntax similar to
that of gzip. The native file format is the .xz format, but also
the legacy .lzma format is supported. The .xz format supports
multiple compression algorithms, of which LZMA2 is currently the
primary algorithm. With typical files, XZ Utils create about 30 %
smaller files than gzip.
Note that this package doesn't include the files needed for
LZMA Utils 4.32.x compatibility. Install also the xz-lzma
package to make XZ Utils emulate LZMA Utils 4.32.x.
xz-lzma:
LZMA Utils emulation with XZ Utils
This package includes executables and symlinks to make
XZ Utils emulate lzma, unlzma, lzcat, and other command
line tools found from the legacy LZMA Utils 4.32.x package.
liblzma:
Library for XZ and LZMA compressed files
liblzma is a general purpose data compression library with
an API similar to that of zlib. liblzma supports multiple
algorithms, of which LZMA2 is currently the primary algorithm.
The native file format is .xz, but also the legacy .lzma
format and raw streams (no headers at all) are supported.
This package includes the shared library.
liblzma-devel:
Library for XZ and LZMA compressed files
This package includes the API headers, static library, and
other development files related to liblzma.
3. License
----------
If the package manager supports a license field, you probably should
put GPLv2+ there (GNU GPL v2 or later). The interesting parts of
XZ Utils are in the public domain, but some less important files
ending up into the binary package are under GPLv2+. So it is simplest
to just say GPLv2+ if you cannot specify "public domain and GPLv2+".
If you split XZ Utils into multiple packages as described earlier
in this file, liblzma and liblzma-dev packages will contain only
public domain code (from XZ Utils at least; compiler or linker may
add some third-party code, which may be copyrighted).
4. configure options
--------------------
Unless you are building a package for a distribution that is meant
only for embedded systems, don't use the following configure options:
--enable-debug
--enable-encoders (*)
--enable-decoders
--enable-match-finders
--enable-checks
--enable-small (*)
--disable-threads (*)
(*) These are OK when building xzdec and lzmadec as described
in INSTALL.
xzdec and lzmadec don't provide any functionality that isn't already
available in the xz tool. Shipping xzdec and lzmadec without size
optimization and statically-linked liblzma isn't very useful. Doing
that would give users the xzdec man page, which may make it easier
for people to find out that such tools exists, but the executables
wouldn't have any advantage over the full-featured xz.
5. Additional documentation
---------------------------
"make install" copies some additional documentation to $docdir
(--docdir in configure). There is a copy of the GNU GPL v2, which
can be replaced with a symlink if your distro ships with shared
copies of the common license texts.
liblzma API is currently only documented using Doxygen tags in the
API headers. It hasn't been tested much how good results Doxygen
is able to make from the tags (e.g. Doxyfile might need tweaking,
the tagging may need to be improved etc.), so it might be simpler
to just let people read docs directly from the .h files for now,
and also save quite a bit in package size at the same time.
6. Extra files
--------------
The "extra" directory contains some small extra tools or other files.
The exact set of extra files can vary between XZ Utils releases. The
extra files have only limited use or they are too dangerous to be
put directly to $bindir (7z2lzma.sh is a good example, since it can
silently create corrupt output if certain conditions are not met).
If you feel like it, you may copy the extra directory under the doc
directory (e.g. /usr/share/doc/xz/extra). Maybe some people will find
them useful. However, most people needing these tools probably are
able to find them from the source package too.
The "debug" directory contains some tools that are useful only when
hacking on XZ Utils. Don't package these tools.
7. Installing XZ Utils and LZMA Utils in parallel
-------------------------------------------------
XZ Utils and LZMA Utils 4.32.x can be installed in parallel by
omitting the compatibility symlinks (lzma, unlzma, lzcat, lzgrep etc.)
from the XZ Utils package. It's probably a good idea to still package
the symlinks into a separate package so that users may choose if they
want to use XZ Utils or LZMA Utils for handling .lzma files.
8. Example
----------
Here is an example for i686 GNU/Linux that
- links xz and lzmainfo against shared liblzma;
- links size-optimized xzdec and lzmadec against static liblzma
while avoiding libpthread dependency;
- includes only shared liblzma in the final package; and
- copies also the "extra" directory to the package.
PKG=/tmp/xz-pkg
tar xf xz-x.y.z.tar.gz
cd xz-x.y.z
./configure \
--prefix=/usr \
--disable-static \
--disable-xzdec \
--disable-lzmadec \
CFLAGS='-march=i686 -mtune=generic -O2'
make
make DESTDIR=$PKG install-strip
make clean
./configure \
--prefix=/usr \
--disable-shared \
--disable-nls \
--disable-encoders \
--enable-small \
--disable-threads \
CFLAGS='-march=i686 -mtune=generic -Os'
make -C src/liblzma
make -C src/xzdec
make -C src/xzdec DESTDIR=$PKG install-strip
cp -a extra $PKG/usr/share/doc/xz

313
README
View File

@@ -1,308 +1,5 @@
XZ Utils
========
0. Overview
1. Documentation
1.1. Overall documentation
1.2. Documentation for command-line tools
1.3. Documentation for liblzma
2. Version numbering
3. Reporting bugs
4. Translating the xz tool
5. Other implementations of the .xz format
6. Contact information
0. Overview
-----------
XZ Utils provide a general-purpose data-compression library plus
command-line tools. The native file format is the .xz format, but
also the legacy .lzma format is supported. The .xz format supports
multiple compression algorithms, which are called "filters" in the
context of XZ Utils. The primary filter is currently LZMA2. With
typical files, XZ Utils create about 30 % smaller files than gzip.
To ease adapting support for the .xz format into existing applications
and scripts, the API of liblzma is somewhat similar to the API of the
popular zlib library. For the same reason, the command-line tool xz
has a command-line syntax similar to that of gzip.
When aiming for the highest compression ratio, the LZMA2 encoder uses
a lot of CPU time and may use, depending on the settings, even
hundreds of megabytes of RAM. However, in fast modes, the LZMA2 encoder
competes with bzip2 in compression speed, RAM usage, and compression
ratio.
LZMA2 is reasonably fast to decompress. It is a little slower than
gzip, but a lot faster than bzip2. Being fast to decompress means
that the .xz format is especially nice when the same file will be
decompressed very many times (usually on different computers), which
is the case e.g. when distributing software packages. In such
situations, it's not too bad if the compression takes some time,
since that needs to be done only once to benefit many people.
With some file types, combining (or "chaining") LZMA2 with an
additional filter can improve the compression ratio. A filter chain may
contain up to four filters, although usually only one or two are used.
For example, putting a BCJ (Branch/Call/Jump) filter before LZMA2
in the filter chain can improve compression ratio of executable files.
Since the .xz format allows adding new filter IDs, it is possible that
some day there will be a filter that is, for example, much faster to
compress than LZMA2 (but probably with worse compression ratio).
Similarly, it is possible that some day there is a filter that will
compress better than LZMA2.
XZ Utils doesn't support multithreaded compression or decompression
yet. It has been planned though and taken into account when designing
the .xz file format.
1. Documentation
----------------
1.1. Overall documentation
README This file
INSTALL.generic Generic install instructions for those not familiar
with packages using GNU Autotools
INSTALL Installation instructions specific to XZ Utils
PACKAGERS Information to packagers of XZ Utils
COPYING XZ Utils copyright and license information
COPYING.GPLv2 GNU General Public License version 2
COPYING.GPLv3 GNU General Public License version 3
COPYING.LGPLv2.1 GNU Lesser General Public License version 2.1
AUTHORS The main authors of XZ Utils
THANKS Incomplete list of people who have helped making
this software
NEWS User-visible changes between XZ Utils releases
ChangeLog Detailed list of changes (commit log)
TODO Known bugs and some sort of to-do list
Note that only some of the above files are included in binary
packages.
1.2. Documentation for command-line tools
The command-line tools are documented as man pages. In source code
releases (and possibly also in some binary packages), the man pages
are also provided in plain text (ASCII only) and PDF formats in the
directory "doc/man" to make the man pages more accessible to those
whose operating system doesn't provide an easy way to view man pages.
1.3. Documentation for liblzma
The liblzma API headers include short docs about each function
and data type as Doxygen tags. These docs should be quite OK as
a quick reference.
I have planned to write a bunch of very well documented example
programs, which (due to comments) should work as a tutorial to
various features of liblzma. No such example programs have been
written yet.
For now, if you have never used liblzma, libbzip2, or zlib, I
recommend learning the *basics* of the zlib API. Once you know that,
it should be easier to learn liblzma.
http://zlib.net/manual.html
http://zlib.net/zlib_how.html
2. Version numbering
--------------------
The version number format of XZ Utils is X.Y.ZS:
- X is the major version. When this is incremented, the library
API and ABI break.
- Y is the minor version. It is incremented when new features
are added without breaking the existing API or ABI. An even Y
indicates a stable release and an odd Y indicates unstable
(alpha or beta version).
- Z is the revision. This has a different meaning for stable and
unstable releases:
* Stable: Z is incremented when bugs get fixed without adding
any new features. This is intended to be convenient for
downstream distributors that want bug fixes but don't want
any new features to minimize the risk of introducing new bugs.
* Unstable: Z is just a counter. API or ABI of features added
in earlier unstable releases having the same X.Y may break.
- S indicates stability of the release. It is missing from the
stable releases, where Y is an even number. When Y is odd, S
is either "alpha" or "beta" to make it very clear that such
versions are not stable releases. The same X.Y.Z combination is
not used for more than one stability level, i.e. after X.Y.Zalpha,
the next version can be X.Y.(Z+1)beta but not X.Y.Zbeta.
3. Reporting bugs
-----------------
Naturally it is easiest for me if you already know what causes the
unexpected behavior. Even better if you have a patch to propose.
However, quite often the reason for unexpected behavior is unknown,
so here are a few things to do before sending a bug report:
1. Try to create a small example how to reproduce the issue.
2. Compile XZ Utils with debugging code using configure switches
--enable-debug and, if possible, --disable-shared. If you are
using GCC, use CFLAGS='-O0 -ggdb3'. Don't strip the resulting
binaries.
3. Turn on core dumps. The exact command depends on your shell;
for example in GNU bash it is done with "ulimit -c unlimited",
and in tcsh with "limit coredumpsize unlimited".
4. Try to reproduce the suspected bug. If you get "assertion failed"
message, be sure to include the complete message in your bug
report. If the application leaves a coredump, get a backtrace
using gdb:
$ gdb /path/to/app-binary # Load the app to the debugger.
(gdb) core core # Open the coredump.
(gdb) bt # Print the backtrace. Copy & paste to bug report.
(gdb) quit # Quit gdb.
Report your bug via email or IRC (see Contact information below).
Don't send core dump files or any executables. If you have a small
example file(s) (total size less than 256 KiB), please include
it/them as an attachment. If you have bigger test files, put them
online somewhere and include a URL to the file(s) in the bug report.
Always include the exact version number of XZ Utils in the bug report.
If you are using a snapshot from the git repository, use "git describe"
to get the exact snapshot version. If you are using XZ Utils shipped
in an operating system distribution, mention the distribution name,
distribution version, and exact xz package version; if you cannot
repeat the bug with the code compiled from unpatched source code,
you probably need to report a bug to your distribution's bug tracking
system.
4. Translating the xz tool
--------------------------
The messages from the xz tool have been translated into a few
languages. Before starting to translate into a new language, ask
the author whether someone else hasn't already started working on it.
Test your translation. Testing includes comparing the translated
output to the original English version by running the same commands
in both your target locale and with LC_ALL=C. Ask someone to
proof-read and test the translation.
Testing can be done e.g. by installing xz into a temporary directory:
./configure --disable-shared --prefix=/tmp/xz-test
# <Edit the .po file in the po directory.>
make -C po update-po
make install
bash debug/translation.bash | less
bash debug/translation.bash | less -S # For --list outputs
Repeat the above as needed (no need to re-run configure though).
Note especially the following:
- The output of --help and --long-help must look nice on
an 80-column terminal. It's OK to add extra lines if needed.
- In contrast, don't add extra lines to error messages and such.
They are often preceded with e.g. a filename on the same line,
so you have no way to predict where to put a \n. Let the terminal
do the wrapping even if it looks ugly. Adding new lines will be
even uglier in the generic case even if it looks nice in a few
limited examples.
- Be careful with column alignment in tables and table-like output
(--list, --list --verbose --verbose, --info-memory, --help, and
--long-help):
* All descriptions of options in --help should start in the
same column (but it doesn't need to be the same column as
in the English messages; just be consistent if you change it).
Check that both --help and --long-help look OK, since they
share several strings.
* --list --verbose and --info-memory print lines that have
the format "Description: %s". If you need a longer
description, you can put extra space between the colon
and %s. Then you may need to add extra space to other
strings too so that the result as a whole looks good (all
values start at the same column).
* The columns of the actual tables in --list --verbose --verbose
should be aligned properly. Abbreviate if necessary. It might
be good to keep at least 2 or 3 spaces between column headings
and avoid spaces in the headings so that the columns stand out
better, but this is a matter of opinion. Do what you think
looks best.
- Be careful to put a period at the end of a sentence when the
original version has it, and don't put it when the original
doesn't have it. Similarly, be careful with \n characters
at the beginning and end of the strings.
- Read the TRANSLATORS comments that have been extracted from the
source code and included in xz.pot. If they suggest testing the
translation with some type of command, do it. If testing needs
input files, use e.g. tests/files/good-*.xz.
- When updating the translation, read the fuzzy (modified) strings
carefully, and don't mark them as updated before you actually
have updated them. Reading through the unchanged messages can be
good too; sometimes you may find a better wording for them.
- If you find language problems in the original English strings,
feel free to suggest improvements. Ask if something is unclear.
- The translated messages should be understandable (sometimes this
may be a problem with the original English messages too). Don't
make a direct word-by-word translation from English especially if
the result doesn't sound good in your language.
In short, take your time and pay attention to the details. Making
a good translation is not a quick and trivial thing to do. The
translated xz should look as polished as the English version.
5. Other implementations of the .xz format
------------------------------------------
7-Zip and the p7zip port of 7-Zip support the .xz format starting
from the version 9.00alpha.
http://7-zip.org/
http://p7zip.sourceforge.net/
XZ Embedded is a limited implementation written for use in the Linux
kernel, but it is also suitable for other embedded use.
http://tukaani.org/xz/embedded.html
6. Contact information
----------------------
If you have questions, bug reports, patches etc. related to XZ Utils,
contact Lasse Collin <lasse.collin@tukaani.org> (in Finnish or English).
I'm sometimes slow at replying. If you haven't got a reply within two
weeks, assume that your email has got lost and resend it or use IRC.
You can find me also from #tukaani on Freenode; my nick is Larhzu.
The channel tends to be pretty quiet, so just ask your question and
someone may wake up.
Berkeley DB 4.7.25: (May 15, 2008)
This is version 4.7.25 of Berkeley DB from Oracle. To view release and
installation documentation, load the distribution file docs/index.html
into your web browser.

View File

@@ -1,2 +0,0 @@
# cpython-source-deps
Source for packages that the cpython build process depends on

116
THANKS
View File

@@ -1,116 +0,0 @@
Thanks
======
Some people have helped more, some less, but nevertheless everyone's help
has been important. :-) In alphabetical order:
- Mark Adler
- H. Peter Anvin
- Jeff Bastian
- Nelson H. F. Beebe
- Karl Berry
- Anders F. Björklund
- Emmanuel Blot
- Martin Blumenstingl
- Jakub Bogusz
- Maarten Bosmans
- Trent W. Buck
- James Buren
- David Burklund
- Daniel Mealha Cabrita
- Milo Casagrande
- Marek Černocký
- Tomer Chachamu
- Gabi Davar
- Chris Donawa
- Andrew Dudman
- Markus Duft
- İsmail Dönmez
- Robert Elz
- Gilles Espinasse
- Denis Excoffier
- Michael Felt
- Michael Fox
- Mike Frysinger
- Daniel Richard G.
- Bill Glessner
- Jason Gorski
- Juan Manuel Guerrero
- Diederik de Haas
- Joachim Henke
- Christian Hesse
- Vincenzo Innocente
- Peter Ivanov
- Jouk Jansen
- Jun I Jin
- Per Øyvind Karlsen
- Thomas Klausner
- Richard Koch
- Ville Koskinen
- Jan Kratochvil
- Christian Kujau
- Stephan Kulow
- Peter Lawler
- James M Leddy
- Hin-Tak Leung
- Andraž 'ruskie' Levstik
- Cary Lewis
- Wim Lewis
- Lorenzo De Liso
- Bela Lubkin
- Gregory Margo
- Jim Meyering
- Arkadiusz Miskiewicz
- Conley Moorhous
- Rafał Mużyło
- Adrien Nader
- Hongbo Ni
- Jonathan Nieder
- Andre Noll
- Peter O'Gorman
- Peter Pallinger
- Rui Paulo
- Igor Pavlov
- Diego Elio Pettenò
- Elbert Pol
- Mikko Pouru
- Trần Ngọc Quân
- Pavel Raiskup
- Ole André Vadla Ravnås
- Robert Readman
- Bernhard Reutner-Fischer
- Eric S. Raymond
- Cristian Rodríguez
- Christian von Roques
- Torsten Rupp
- Jukka Salmi
- Alexandre Sauvé
- Benno Schulenberg
- Andreas Schwab
- Dan Shechter
- Stuart Shelton
- Brad Smith
- Jonathan Stott
- Dan Stromberg
- Vincent Torri
- Paul Townsend
- Mohammed Adnène Trojette
- Alexey Tourbin
- Patrick J. Volkerding
- Martin Väth
- Adam Walling
- Christian Weisgerber
- Bert Wesarg
- Fredrik Wikstrom
- Ralf Wildenhues
- Charles Wilson
- Lars Wirzenius
- Pilorz Wojciech
- Ryan Young
- Andreas Zieringer
Also thanks to all the people who have participated in the Tukaani project.
I have probably forgot to add some names to the above list. Sorry about
that and thanks for your help.

111
TODO
View File

@@ -1,111 +0,0 @@
XZ Utils To-Do List
===================
Known bugs
----------
The test suite is too incomplete.
If the memory usage limit is less than about 13 MiB, xz is unable to
automatically scale down the compression settings enough even though
it would be possible by switching from BT2/BT3/BT4 match finder to
HC3/HC4.
XZ Utils compress some files significantly worse than LZMA Utils.
This is due to faster compression presets used by XZ Utils, and
can often be worked around by using "xz --extreme". With some files
--extreme isn't enough though: it's most likely with files that
compress extremely well, so going from compression ratio of 0.003
to 0.004 means big relative increase in the compressed file size.
xz doesn't quote unprintable characters when it displays file names
given on the command line.
tuklib_exit() doesn't block signals => EINTR is possible.
SIGTSTP is not handled. If xz is stopped, the estimated remaining
time and calculated (de)compression speed won't make sense in the
progress indicator (xz --verbose).
If liblzma has created threads and fork() gets called, liblzma
code will break in the child process unless it calls exec() and
doesn't touch liblzma.
Missing features
----------------
Add support for storing metadata in .xz files. A preliminary
idea is to create a new Stream type for metadata. When both
metadata and data are wanted in the same .xz file, two or more
Streams would be concatenated.
The state stored in lzma_stream should be cloneable, which would
be mostly useful when using a preset dictionary in LZMA2, but
it may have other uses too. Compare to deflateCopy() in zlib.
Support LZMA_FINISH in raw decoder to indicate end of LZMA1 and
other streams that don't have an end of payload marker.
Adjust dictionary size when the input file size is known.
Maybe do this only if an option is given.
xz doesn't support copying extended attributes, access control
lists etc. from source to target file.
Multithreaded compression:
- Reduce memory usage of the current method.
- Implement threaded match finders.
- Implement pigz-style threading in LZMA2.
Multithreaded decompression
Buffer-to-buffer coding could use less RAM (especially when
decompressing LZMA1 or LZMA2).
I/O library is not implemented (similar to gzopen() in zlib).
It will be a separate library that supports uncompressed, .gz,
.bz2, .lzma, and .xz files.
Support changing lzma_options_lzma.mode with lzma_filters_update().
Support LZMA_FULL_FLUSH for lzma_stream_decoder() to stop at
Block and Stream boundaries.
lzma_strerror() to convert lzma_ret to human readable form?
This is tricky, because the same error codes are used with
slightly different meanings, and this cannot be fixed anymore.
Make it possible to adjust LZMA2 options in the middle of a Block
so that the encoding speed vs. compression ratio can be optimized
when the compressed data is streamed over network.
Improved BCJ filters. The current filters are small but they aren't
so great when compressing binary packages that contain various file
types. Specifically, they make things worse if there are static
libraries or Linux kernel modules. The filtering could also be
more effective (without getting overly complex), for example,
streamable variant BCJ2 from 7-Zip could be implemented.
Filter that autodetects specific data types in the input stream
and applies appropriate filters for the corrects parts of the input.
Perhaps combine this with the BCJ filter improvement point above.
Long-range LZ77 method as a separate filter or as a new LZMA2
match finder.
Documentation
-------------
More tutorial programs are needed for liblzma.
Document the LZMA1 and LZMA2 algorithms.
Miscellaneous
------------
Try to get the media type for .xz registered at IANA.

1228
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +0,0 @@
#!/bin/sh
###############################################################################
#
# Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
###############################################################################
# The result of using "autoreconf -fi" should be identical to using this
# script. I'm leaving this script here just in case someone finds it useful.
set -e -x
${AUTOPOINT:-autopoint} -f
${LIBTOOLIZE:-libtoolize} -c -f || glibtoolize -c -f
${ACLOCAL:-aclocal} -I m4
${AUTOCONF:-autoconf}
${AUTOHEADER:-autoheader}
${AUTOMAKE:-automake} -acf --foreign

2526
btree/bt_compact.c Normal file

File diff suppressed because it is too large Load Diff

213
btree/bt_compare.c Normal file
View File

@@ -0,0 +1,213 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_compare.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
/*
* __bam_cmp --
* Compare a key to a given record.
*
* PUBLIC: int __bam_cmp __P((DB *, DB_THREAD_INFO *,
* PUBLIC: DB_TXN *, const DBT *, PAGE *, u_int32_t,
* PUBLIC: int (*)(DB *, const DBT *, const DBT *), int *));
*/
int
__bam_cmp(dbp, ip, txn, dbt, h, indx, func, cmpp)
DB *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
const DBT *dbt;
PAGE *h;
u_int32_t indx;
int (*func)__P((DB *, const DBT *, const DBT *));
int *cmpp;
{
BINTERNAL *bi;
BKEYDATA *bk;
BOVERFLOW *bo;
DBT pg_dbt;
/*
* Returns:
* < 0 if dbt is < page record
* = 0 if dbt is = page record
* > 0 if dbt is > page record
*
* !!!
* We do not clear the pg_dbt DBT even though it's likely to contain
* random bits. That should be okay, because the app's comparison
* routine had better not be looking at fields other than data, size
* and app_data. We don't clear it because we go through this path a
* lot and it's expensive.
*/
switch (TYPE(h)) {
case P_LBTREE:
case P_LDUP:
case P_LRECNO:
bk = GET_BKEYDATA(dbp, h, indx);
if (B_TYPE(bk->type) == B_OVERFLOW)
bo = (BOVERFLOW *)bk;
else {
pg_dbt.app_data = NULL;
pg_dbt.data = bk->data;
pg_dbt.size = bk->len;
*cmpp = func(dbp, dbt, &pg_dbt);
return (0);
}
break;
case P_IBTREE:
/*
* The following code guarantees that the left-most key on an
* internal page at any place in the tree sorts less than any
* user-specified key. The reason is that if we have reached
* this internal page, we know the user key must sort greater
* than the key we're storing for this page in any internal
* pages at levels above us in the tree. It then follows that
* any user-specified key cannot sort less than the first page
* which we reference, and so there's no reason to call the
* comparison routine. While this may save us a comparison
* routine call or two, the real reason for this is because
* we don't maintain a copy of the smallest key in the tree,
* so that we don't have to update all the levels of the tree
* should the application store a new smallest key. And, so,
* we may not have a key to compare, which makes doing the
* comparison difficult and error prone.
*/
if (indx == 0) {
*cmpp = 1;
return (0);
}
bi = GET_BINTERNAL(dbp, h, indx);
if (B_TYPE(bi->type) == B_OVERFLOW)
bo = (BOVERFLOW *)(bi->data);
else {
pg_dbt.app_data = NULL;
pg_dbt.data = bi->data;
pg_dbt.size = bi->len;
*cmpp = func(dbp, dbt, &pg_dbt);
return (0);
}
break;
default:
return (__db_pgfmt(dbp->env, PGNO(h)));
}
/*
* Overflow.
*/
return (__db_moff(dbp, ip, txn, dbt,
bo->pgno, bo->tlen, func == __bam_defcmp ? NULL : func, cmpp));
}
/*
* __bam_defcmp --
* Default comparison routine.
*
* PUBLIC: int __bam_defcmp __P((DB *, const DBT *, const DBT *));
*/
int
__bam_defcmp(dbp, a, b)
DB *dbp;
const DBT *a, *b;
{
size_t len;
u_int8_t *p1, *p2;
COMPQUIET(dbp, NULL);
/*
* Returns:
* < 0 if a is < b
* = 0 if a is = b
* > 0 if a is > b
*
* XXX
* If a size_t doesn't fit into a long, or if the difference between
* any two characters doesn't fit into an int, this routine can lose.
* What we need is a signed integral type that's guaranteed to be at
* least as large as a size_t, and there is no such thing.
*/
len = a->size > b->size ? b->size : a->size;
for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2)
if (*p1 != *p2)
return ((long)*p1 - (long)*p2);
return ((long)a->size - (long)b->size);
}
/*
* __bam_defpfx --
* Default prefix routine.
*
* PUBLIC: size_t __bam_defpfx __P((DB *, const DBT *, const DBT *));
*/
size_t
__bam_defpfx(dbp, a, b)
DB *dbp;
const DBT *a, *b;
{
size_t cnt, len;
u_int8_t *p1, *p2;
COMPQUIET(dbp, NULL);
cnt = 1;
len = a->size > b->size ? b->size : a->size;
for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2, ++cnt)
if (*p1 != *p2)
return (cnt);
/*
* They match up to the smaller of the two sizes.
* Collate the longer after the shorter.
*/
if (a->size < b->size)
return (a->size + 1);
if (b->size < a->size)
return (b->size + 1);
return (b->size);
}

95
btree/bt_conv.c Normal file
View File

@@ -0,0 +1,95 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: bt_conv.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/db_swap.h"
#include "dbinc/btree.h"
/*
* __bam_pgin --
* Convert host-specific page layout from the host-independent format
* stored on disk.
*
* PUBLIC: int __bam_pgin __P((DB *, db_pgno_t, void *, DBT *));
*/
int
__bam_pgin(dbp, pg, pp, cookie)
DB *dbp;
db_pgno_t pg;
void *pp;
DBT *cookie;
{
DB_PGINFO *pginfo;
PAGE *h;
pginfo = (DB_PGINFO *)cookie->data;
if (!F_ISSET(pginfo, DB_AM_SWAP))
return (0);
h = pp;
return (TYPE(h) == P_BTREEMETA ? __bam_mswap(dbp->env, pp) :
__db_byteswap(dbp, pg, pp, pginfo->db_pagesize, 1));
}
/*
* __bam_pgout --
* Convert host-specific page layout to the host-independent format
* stored on disk.
*
* PUBLIC: int __bam_pgout __P((DB *, db_pgno_t, void *, DBT *));
*/
int
__bam_pgout(dbp, pg, pp, cookie)
DB *dbp;
db_pgno_t pg;
void *pp;
DBT *cookie;
{
DB_PGINFO *pginfo;
PAGE *h;
pginfo = (DB_PGINFO *)cookie->data;
if (!F_ISSET(pginfo, DB_AM_SWAP))
return (0);
h = pp;
return (TYPE(h) == P_BTREEMETA ? __bam_mswap(dbp->env, pp) :
__db_byteswap(dbp, pg, pp, pginfo->db_pagesize, 0));
}
/*
* __bam_mswap --
* Swap the bytes on the btree metadata page.
*
* PUBLIC: int __bam_mswap __P((ENV *, PAGE *));
*/
int
__bam_mswap(env, pg)
ENV *env;
PAGE *pg;
{
u_int8_t *p;
COMPQUIET(env, NULL);
__db_metaswap(pg);
p = (u_int8_t *)pg + sizeof(DBMETA);
p += sizeof(u_int32_t); /* unused */
SWAP32(p); /* minkey */
SWAP32(p); /* re_len */
SWAP32(p); /* re_pad */
SWAP32(p); /* root */
p += 92 * sizeof(u_int32_t); /* unused */
SWAP32(p); /* crypto_magic */
return (0);
}

596
btree/bt_curadj.c Normal file
View File

@@ -0,0 +1,596 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: bt_curadj.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/mp.h"
static int __bam_opd_cursor __P((DB *, DBC *, db_pgno_t, u_int32_t, u_int32_t));
/*
* Cursor adjustments are logged if they are for subtransactions. This is
* because it's possible for a subtransaction to adjust cursors which will
* still be active after the subtransaction aborts, and so which must be
* restored to their previous locations. Cursors that can be both affected
* by our cursor adjustments and active after our transaction aborts can
* only be found in our parent transaction -- cursors in other transactions,
* including other child transactions of our parent, must have conflicting
* locker IDs, and so cannot be affected by adjustments in this transaction.
*/
/*
* __bam_ca_delete --
* Update the cursors when items are deleted and when already deleted
* items are overwritten. Return the number of relevant cursors found.
*
* PUBLIC: int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, int, int *));
*/
int
__bam_ca_delete(dbp, pgno, indx, delete, countp)
DB *dbp;
db_pgno_t pgno;
u_int32_t indx;
int delete, *countp;
{
BTREE_CURSOR *cp;
DB *ldbp;
DBC *dbc;
ENV *env;
int count; /* !!!: Has to contain max number of cursors. */
env = dbp->env;
/*
* Adjust the cursors. We have the page write locked, so the
* only other cursors that can be pointing at a page are
* those in the same thread of control. Unfortunately, we don't
* know that they're using the same DB handle, so traverse
* all matching DB handles in the same ENV, then all cursors
* on each matching DB handle.
*
* Each cursor is single-threaded, so we only need to lock the
* list of DBs and then the list of cursors in each DB.
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (count = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
cp = (BTREE_CURSOR *)dbc->internal;
if (cp->pgno == pgno && cp->indx == indx &&
!MVCC_SKIP_CURADJ(dbc, pgno)) {
/*
* [#8032] This assert is checking
* for possible race conditions where we
* hold a cursor position without a lock.
* Unfortunately, there are paths in the
* Btree code that do not satisfy these
* conditions. None of them are known to
* be a problem, but this assert should
* be re-activated when the Btree stack
* code is re-written.
DB_ASSERT(env, !STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
if (delete)
F_SET(cp, C_DELETED);
else
F_CLR(cp, C_DELETED);
++count;
}
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
if (countp != NULL)
*countp = count;
return (0);
}
/*
* __ram_ca_delete --
* Return if any relevant cursors found.
*
* PUBLIC: int __ram_ca_delete __P((DB *, db_pgno_t, int *));
*/
int
__ram_ca_delete(dbp, root_pgno, foundp)
DB *dbp;
db_pgno_t root_pgno;
int *foundp;
{
DB *ldbp;
DBC *dbc;
ENV *env;
int found;
env = dbp->env;
/*
* Review the cursors. See the comment in __bam_ca_delete().
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (found = 0;
found == 0 && ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links)
if (dbc->internal->root == root_pgno &&
!MVCC_SKIP_CURADJ(dbc, root_pgno)) {
found = 1;
break;
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
*foundp = found;
return (0);
}
/*
* __bam_ca_di --
* Adjust the cursors during a delete or insert.
*
* PUBLIC: int __bam_ca_di __P((DBC *, db_pgno_t, u_int32_t, int));
*/
int
__bam_ca_di(my_dbc, pgno, indx, adjust)
DBC *my_dbc;
db_pgno_t pgno;
u_int32_t indx;
int adjust;
{
DB *dbp, *ldbp;
DBC *dbc;
DBC_INTERNAL *cp;
DB_LSN lsn;
DB_TXN *my_txn;
ENV *env;
int found, ret;
dbp = my_dbc->dbp;
env = dbp->env;
my_txn = IS_SUBTRANSACTION(my_dbc->txn) ? my_dbc->txn : NULL;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (found = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
if (dbc->dbtype == DB_RECNO)
continue;
cp = dbc->internal;
if (cp->pgno == pgno && cp->indx >= indx &&
(dbc == my_dbc || !MVCC_SKIP_CURADJ(dbc, pgno))) {
/* Cursor indices should never be negative. */
DB_ASSERT(env, cp->indx != 0 || adjust > 0);
/* [#8032]
DB_ASSERT(env, !STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
cp->indx += adjust;
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
}
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
if (found != 0 && DBC_LOGGING(my_dbc)) {
if ((ret = __bam_curadj_log(dbp, my_dbc->txn, &lsn, 0,
DB_CA_DI, pgno, 0, 0, (u_int32_t)adjust, indx, 0)) != 0)
return (ret);
}
return (0);
}
/*
* __bam_opd_cursor -- create a new opd cursor.
*/
static int
__bam_opd_cursor(dbp, dbc, first, tpgno, ti)
DB *dbp;
DBC *dbc;
db_pgno_t tpgno;
u_int32_t first, ti;
{
BTREE_CURSOR *cp, *orig_cp;
DBC *dbc_nopd;
int ret;
orig_cp = (BTREE_CURSOR *)dbc->internal;
dbc_nopd = NULL;
/*
* Allocate a new cursor and create the stack. If duplicates
* are sorted, we've just created an off-page duplicate Btree.
* If duplicates aren't sorted, we've just created a Recno tree.
*
* Note that in order to get here at all, there shouldn't be
* an old off-page dup cursor--to augment the checking dbc_newopd
* will do, assert this.
*/
DB_ASSERT(dbp->env, orig_cp->opd == NULL);
if ((ret = __dbc_newopd(dbc, tpgno, orig_cp->opd, &dbc_nopd)) != 0)
return (ret);
cp = (BTREE_CURSOR *)dbc_nopd->internal;
cp->pgno = tpgno;
cp->indx = ti;
if (dbp->dup_compare == NULL) {
/*
* Converting to off-page Recno trees is tricky. The
* record number for the cursor is the index + 1 (to
* convert to 1-based record numbers).
*/
cp->recno = ti + 1;
}
/*
* Transfer the deleted flag from the top-level cursor to the
* created one.
*/
if (F_ISSET(orig_cp, C_DELETED)) {
F_SET(cp, C_DELETED);
F_CLR(orig_cp, C_DELETED);
}
/* Stack the cursors and reset the initial cursor's index. */
orig_cp->opd = dbc_nopd;
orig_cp->indx = first;
return (0);
}
/*
* __bam_ca_dup --
* Adjust the cursors when moving items from a leaf page to a duplicates
* page.
*
* PUBLIC: int __bam_ca_dup __P((DBC *,
* PUBLIC: u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, u_int32_t));
*/
int
__bam_ca_dup(my_dbc, first, fpgno, fi, tpgno, ti)
DBC *my_dbc;
db_pgno_t fpgno, tpgno;
u_int32_t first, fi, ti;
{
BTREE_CURSOR *orig_cp;
DB *dbp, *ldbp;
DBC *dbc;
DB_LSN lsn;
DB_TXN *my_txn;
ENV *env;
int found, ret, t_ret;
dbp = my_dbc->dbp;
env = dbp->env;
my_txn = IS_SUBTRANSACTION(my_dbc->txn) ? my_dbc->txn : NULL;
ret = 0;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (found = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
loop: MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
/* Find cursors pointing to this record. */
orig_cp = (BTREE_CURSOR *)dbc->internal;
if (orig_cp->pgno != fpgno || orig_cp->indx != fi ||
MVCC_SKIP_CURADJ(dbc, fpgno))
continue;
/*
* Since we rescan the list see if this is already
* converted.
*/
if (orig_cp->opd != NULL)
continue;
MUTEX_UNLOCK(env, dbp->mutex);
/* [#8032]
DB_ASSERT(env, !STD_LOCKING(dbc) ||
orig_cp->lock_mode != DB_LOCK_NG);
*/
if ((ret = __bam_opd_cursor(dbp,
dbc, first, tpgno, ti)) != 0)
goto err;
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
/* We released the mutex to get a cursor, start over. */
goto loop;
}
MUTEX_UNLOCK(env, dbp->mutex);
}
err: MUTEX_UNLOCK(env, env->mtx_dblist);
if (found != 0 && DBC_LOGGING(my_dbc)) {
if ((t_ret = __bam_curadj_log(dbp, my_dbc->txn,
&lsn, 0, DB_CA_DUP, fpgno, tpgno, 0, first, fi, ti)) != 0 &&
ret == 0)
ret = t_ret;
}
return (ret);
}
/*
* __bam_ca_undodup --
* Adjust the cursors when returning items to a leaf page
* from a duplicate page.
* Called only during undo processing.
*
* PUBLIC: int __bam_ca_undodup __P((DB *,
* PUBLIC: u_int32_t, db_pgno_t, u_int32_t, u_int32_t));
*/
int
__bam_ca_undodup(dbp, first, fpgno, fi, ti)
DB *dbp;
db_pgno_t fpgno;
u_int32_t first, fi, ti;
{
BTREE_CURSOR *orig_cp;
DB *ldbp;
DBC *dbc;
ENV *env;
int ret;
env = dbp->env;
ret = 0;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
loop: MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
orig_cp = (BTREE_CURSOR *)dbc->internal;
/*
* A note on the orig_cp->opd != NULL requirement here:
* it's possible that there's a cursor that refers to
* the same duplicate set, but which has no opd cursor,
* because it refers to a different item and we took
* care of it while processing a previous record.
*/
if (orig_cp->pgno != fpgno ||
orig_cp->indx != first ||
orig_cp->opd == NULL || ((BTREE_CURSOR *)
orig_cp->opd->internal)->indx != ti ||
MVCC_SKIP_CURADJ(dbc, fpgno))
continue;
MUTEX_UNLOCK(env, dbp->mutex);
if ((ret = __dbc_close(orig_cp->opd)) != 0)
goto err;
orig_cp->opd = NULL;
orig_cp->indx = fi;
/*
* We released the mutex to free a cursor,
* start over.
*/
goto loop;
}
MUTEX_UNLOCK(env, dbp->mutex);
}
err: MUTEX_UNLOCK(env, env->mtx_dblist);
return (ret);
}
/*
* __bam_ca_rsplit --
* Adjust the cursors when doing reverse splits.
*
* PUBLIC: int __bam_ca_rsplit __P((DBC *, db_pgno_t, db_pgno_t));
*/
int
__bam_ca_rsplit(my_dbc, fpgno, tpgno)
DBC* my_dbc;
db_pgno_t fpgno, tpgno;
{
DB *dbp, *ldbp;
DBC *dbc;
DB_LSN lsn;
DB_TXN *my_txn;
ENV *env;
int found, ret;
dbp = my_dbc->dbp;
env = dbp->env;
my_txn = IS_SUBTRANSACTION(my_dbc->txn) ? my_dbc->txn : NULL;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (found = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
if (dbc->dbtype == DB_RECNO)
continue;
if (dbc->internal->pgno == fpgno &&
!MVCC_SKIP_CURADJ(dbc, fpgno)) {
dbc->internal->pgno = tpgno;
/* [#8032]
DB_ASSERT(env, !STD_LOCKING(dbc) ||
dbc->internal->lock_mode != DB_LOCK_NG);
*/
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
}
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
if (found != 0 && DBC_LOGGING(my_dbc)) {
if ((ret = __bam_curadj_log(dbp, my_dbc->txn,
&lsn, 0, DB_CA_RSPLIT, fpgno, tpgno, 0, 0, 0, 0)) != 0)
return (ret);
}
return (0);
}
/*
* __bam_ca_split --
* Adjust the cursors when splitting a page.
*
* PUBLIC: int __bam_ca_split __P((DBC *,
* PUBLIC: db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int));
*/
int
__bam_ca_split(my_dbc, ppgno, lpgno, rpgno, split_indx, cleft)
DBC *my_dbc;
db_pgno_t ppgno, lpgno, rpgno;
u_int32_t split_indx;
int cleft;
{
DB *dbp, *ldbp;
DBC *dbc;
DBC_INTERNAL *cp;
DB_LSN lsn;
DB_TXN *my_txn;
ENV *env;
int found, ret;
dbp = my_dbc->dbp;
env = dbp->env;
my_txn = IS_SUBTRANSACTION(my_dbc->txn) ? my_dbc->txn : NULL;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*
* If splitting the page that a cursor was on, the cursor has to be
* adjusted to point to the same record as before the split. Most
* of the time we don't adjust pointers to the left page, because
* we're going to copy its contents back over the original page. If
* the cursor is on the right page, it is decremented by the number of
* records split to the left page.
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (found = 0;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
if (dbc->dbtype == DB_RECNO)
continue;
cp = dbc->internal;
if (cp->pgno == ppgno &&
!MVCC_SKIP_CURADJ(dbc, ppgno)) {
/* [#8032]
DB_ASSERT(env, !STD_LOCKING(dbc) ||
cp->lock_mode != DB_LOCK_NG);
*/
if (my_txn != NULL && dbc->txn != my_txn)
found = 1;
if (cp->indx < split_indx) {
if (cleft)
cp->pgno = lpgno;
} else {
cp->pgno = rpgno;
cp->indx -= split_indx;
}
}
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
if (found != 0 && DBC_LOGGING(my_dbc)) {
if ((ret = __bam_curadj_log(dbp,
my_dbc->txn, &lsn, 0, DB_CA_SPLIT, ppgno, rpgno,
cleft ? lpgno : PGNO_INVALID, 0, split_indx, 0)) != 0)
return (ret);
}
return (0);
}
/*
* __bam_ca_undosplit --
* Adjust the cursors when undoing a split of a page.
* If we grew a level we will execute this for both the
* left and the right pages.
* Called only during undo processing.
*
* PUBLIC: int __bam_ca_undosplit __P((DB *,
* PUBLIC: db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t));
*/
int
__bam_ca_undosplit(dbp, frompgno, topgno, lpgno, split_indx)
DB *dbp;
db_pgno_t frompgno, topgno, lpgno;
u_int32_t split_indx;
{
DB *ldbp;
DBC *dbc;
DBC_INTERNAL *cp;
ENV *env;
env = dbp->env;
/*
* Adjust the cursors. See the comment in __bam_ca_delete().
*
* When backing out a split, we move the cursor back
* to the original offset and bump it by the split_indx.
*/
MUTEX_LOCK(env, env->mtx_dblist);
FIND_FIRST_DB_MATCH(env, dbp, ldbp);
for (;
ldbp != NULL && ldbp->adj_fileid == dbp->adj_fileid;
ldbp = TAILQ_NEXT(ldbp, dblistlinks)) {
MUTEX_LOCK(env, dbp->mutex);
TAILQ_FOREACH(dbc, &ldbp->active_queue, links) {
if (dbc->dbtype == DB_RECNO)
continue;
cp = dbc->internal;
if (cp->pgno == topgno &&
!MVCC_SKIP_CURADJ(dbc, topgno)) {
cp->pgno = frompgno;
cp->indx += split_indx;
} else if (cp->pgno == lpgno &&
!MVCC_SKIP_CURADJ(dbc, lpgno))
cp->pgno = frompgno;
}
MUTEX_UNLOCK(env, dbp->mutex);
}
MUTEX_UNLOCK(env, env->mtx_dblist);
return (0);
}

2749
btree/bt_cursor.c Normal file

File diff suppressed because it is too large Load Diff

644
btree/bt_delete.c Normal file
View File

@@ -0,0 +1,644 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_delete.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_ditem --
* Delete one or more entries from a page.
*
* PUBLIC: int __bam_ditem __P((DBC *, PAGE *, u_int32_t));
*/
int
__bam_ditem(dbc, h, indx)
DBC *dbc;
PAGE *h;
u_int32_t indx;
{
BINTERNAL *bi;
BKEYDATA *bk;
DB *dbp;
u_int32_t nbytes;
int ret;
db_indx_t *inp;
dbp = dbc->dbp;
inp = P_INP(dbp, h);
/* The page should already have been dirtied by our caller. */
DB_ASSERT(dbp->env, IS_DIRTY(h));
switch (TYPE(h)) {
case P_IBTREE:
bi = GET_BINTERNAL(dbp, h, indx);
switch (B_TYPE(bi->type)) {
case B_DUPLICATE:
case B_KEYDATA:
nbytes = BINTERNAL_SIZE(bi->len);
break;
case B_OVERFLOW:
nbytes = BINTERNAL_SIZE(bi->len);
if ((ret =
__db_doff(dbc, ((BOVERFLOW *)bi->data)->pgno)) != 0)
return (ret);
break;
default:
return (__db_pgfmt(dbp->env, PGNO(h)));
}
break;
case P_IRECNO:
nbytes = RINTERNAL_SIZE;
break;
case P_LBTREE:
/*
* If it's a duplicate key, discard the index and don't touch
* the actual page item.
*
* !!!
* This works because no data item can have an index matching
* any other index so even if the data item is in a key "slot",
* it won't match any other index.
*/
if ((indx % 2) == 0) {
/*
* Check for a duplicate after us on the page. NOTE:
* we have to delete the key item before deleting the
* data item, otherwise the "indx + P_INDX" calculation
* won't work!
*/
if (indx + P_INDX < (u_int32_t)NUM_ENT(h) &&
inp[indx] == inp[indx + P_INDX])
return (__bam_adjindx(dbc,
h, indx, indx + O_INDX, 0));
/*
* Check for a duplicate before us on the page. It
* doesn't matter if we delete the key item before or
* after the data item for the purposes of this one.
*/
if (indx > 0 && inp[indx] == inp[indx - P_INDX])
return (__bam_adjindx(dbc,
h, indx, indx - P_INDX, 0));
}
/* FALLTHROUGH */
case P_LDUP:
case P_LRECNO:
bk = GET_BKEYDATA(dbp, h, indx);
switch (B_TYPE(bk->type)) {
case B_DUPLICATE:
nbytes = BOVERFLOW_SIZE;
break;
case B_OVERFLOW:
nbytes = BOVERFLOW_SIZE;
if ((ret = __db_doff(
dbc, (GET_BOVERFLOW(dbp, h, indx))->pgno)) != 0)
return (ret);
break;
case B_KEYDATA:
nbytes = BKEYDATA_SIZE(bk->len);
break;
default:
return (__db_pgfmt(dbp->env, PGNO(h)));
}
break;
default:
return (__db_pgfmt(dbp->env, PGNO(h)));
}
/* Delete the item and mark the page dirty. */
if ((ret = __db_ditem(dbc, h, indx, nbytes)) != 0)
return (ret);
return (0);
}
/*
* __bam_adjindx --
* Adjust an index on the page.
*
* PUBLIC: int __bam_adjindx __P((DBC *, PAGE *, u_int32_t, u_int32_t, int));
*/
int
__bam_adjindx(dbc, h, indx, indx_copy, is_insert)
DBC *dbc;
PAGE *h;
u_int32_t indx, indx_copy;
int is_insert;
{
DB *dbp;
db_indx_t copy, *inp;
int ret;
dbp = dbc->dbp;
inp = P_INP(dbp, h);
/* Log the change. */
if (DBC_LOGGING(dbc)) {
if ((ret = __bam_adj_log(dbp, dbc->txn, &LSN(h), 0,
PGNO(h), &LSN(h), indx, indx_copy, (u_int32_t)is_insert)) != 0)
return (ret);
} else
LSN_NOT_LOGGED(LSN(h));
/* Shuffle the indices and mark the page dirty. */
if (is_insert) {
copy = inp[indx_copy];
if (indx != NUM_ENT(h))
memmove(&inp[indx + O_INDX], &inp[indx],
sizeof(db_indx_t) * (NUM_ENT(h) - indx));
inp[indx] = copy;
++NUM_ENT(h);
} else {
--NUM_ENT(h);
if (indx != NUM_ENT(h))
memmove(&inp[indx], &inp[indx + O_INDX],
sizeof(db_indx_t) * (NUM_ENT(h) - indx));
}
return (0);
}
/*
* __bam_dpages --
* Delete a set of locked pages.
*
* PUBLIC: int __bam_dpages __P((DBC *, int, int));
*/
int
__bam_dpages(dbc, use_top, update)
DBC *dbc;
int use_top;
int update;
{
BINTERNAL *bi;
BTREE_CURSOR *cp;
DB *dbp;
DBT a, b;
DB_LOCK c_lock, p_lock;
DB_MPOOLFILE *mpf;
EPG *epg, *save_sp, *stack_epg;
PAGE *child, *parent;
db_indx_t nitems;
db_pgno_t pgno, root_pgno;
db_recno_t rcnt;
int done, ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
nitems = 0;
pgno = PGNO_INVALID;
/*
* We have the entire stack of deletable pages locked.
*
* Btree calls us with the first page in the stack is to have a
* single item deleted, and the rest of the pages are to be removed.
*
* Recno always has a stack to the root and __bam_merge operations
* may have unneeded items in the sack. We find the lowest page
* in the stack that has more than one record in it and start there.
*/
ret = 0;
if (use_top)
stack_epg = cp->sp;
else
for (stack_epg = cp->csp; stack_epg > cp->sp; --stack_epg)
if (NUM_ENT(stack_epg->page) > 1)
break;
epg = stack_epg;
/*
* !!!
* There is an interesting deadlock situation here. We have to relink
* the leaf page chain around the leaf page being deleted. Consider
* a cursor walking through the leaf pages, that has the previous page
* read-locked and is waiting on a lock for the page we're deleting.
* It will deadlock here. Before we unlink the subtree, we relink the
* leaf page chain.
*/
if (LEVEL(cp->csp->page) == 1 &&
(ret = __bam_relink(dbc, cp->csp->page, PGNO_INVALID)) != 0)
goto discard;
/*
* Delete the last item that references the underlying pages that are
* to be deleted, and adjust cursors that reference that page. Then,
* save that page's page number and item count and release it. If
* the application isn't retaining locks because it's running without
* transactions, this lets the rest of the tree get back to business
* immediately.
*/
if ((ret = __memp_dirty(mpf,
&epg->page, dbc->thread_info, dbc->txn, dbc->priority, 0)) != 0)
goto discard;
if ((ret = __bam_ditem(dbc, epg->page, epg->indx)) != 0)
goto discard;
if ((ret = __bam_ca_di(dbc, PGNO(epg->page), epg->indx, -1)) != 0)
goto discard;
if (update && epg->indx == 0) {
save_sp = cp->csp;
cp->csp = epg;
ret = __bam_pupdate(dbc, epg->page);
cp->csp = save_sp;
if (ret != 0)
goto discard;
}
pgno = PGNO(epg->page);
nitems = NUM_ENT(epg->page);
ret = __memp_fput(mpf, dbc->thread_info, epg->page, dbc->priority);
epg->page = NULL;
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err_inc;
/* Then, discard any pages that we don't care about. */
discard: for (epg = cp->sp; epg < stack_epg; ++epg) {
if ((t_ret = __memp_fput(mpf, dbc->thread_info,
epg->page, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
epg->page = NULL;
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
}
if (ret != 0)
goto err;
/* Free the rest of the pages in the stack. */
while (++epg <= cp->csp) {
if ((ret = __memp_dirty(mpf, &epg->page,
dbc->thread_info, dbc->txn, dbc->priority, 0)) != 0)
goto err;
/*
* Delete page entries so they will be restored as part of
* recovery. We don't need to do cursor adjustment here as
* the pages are being emptied by definition and so cannot
* be referenced by a cursor.
*/
if (NUM_ENT(epg->page) != 0) {
DB_ASSERT(dbp->env, LEVEL(epg->page) != 1);
if ((ret = __bam_ditem(dbc, epg->page, epg->indx)) != 0)
goto err;
/*
* Sheer paranoia: if we find any pages that aren't
* emptied by the delete, someone else added an item
* while we were walking the tree, and we discontinue
* the delete. Shouldn't be possible, but we check
* regardless.
*/
if (NUM_ENT(epg->page) != 0)
goto err;
}
ret = __db_free(dbc, epg->page);
if (cp->page == epg->page)
cp->page = NULL;
epg->page = NULL;
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err_inc;
}
if (0) {
err_inc: ++epg;
err: for (; epg <= cp->csp; ++epg) {
if (epg->page != NULL) {
(void)__memp_fput(mpf, dbc->thread_info,
epg->page, dbc->priority);
epg->page = NULL;
}
(void)__TLPUT(dbc, epg->lock);
}
BT_STK_CLR(cp);
return (ret);
}
BT_STK_CLR(cp);
/*
* If we just deleted the next-to-last item from the root page, the
* tree can collapse one or more levels. While there remains only a
* single item on the root page, write lock the last page referenced
* by the root page and copy it over the root page.
*/
root_pgno = cp->root;
if (pgno != root_pgno || nitems != 1)
return (0);
for (done = 0; !done;) {
/* Initialize. */
parent = child = NULL;
LOCK_INIT(p_lock);
LOCK_INIT(c_lock);
/* Lock the root. */
pgno = root_pgno;
if ((ret =
__db_lget(dbc, 0, pgno, DB_LOCK_WRITE, 0, &p_lock)) != 0)
goto stop;
if ((ret = __memp_fget(mpf, &pgno, dbc->thread_info, dbc->txn,
DB_MPOOL_DIRTY, &parent)) != 0)
goto stop;
if (NUM_ENT(parent) != 1)
goto stop;
switch (TYPE(parent)) {
case P_IBTREE:
/*
* If this is overflow, then try to delete it.
* The child may or may not still point at it.
*/
bi = GET_BINTERNAL(dbp, parent, 0);
if (B_TYPE(bi->type) == B_OVERFLOW)
if ((ret = __db_doff(dbc,
((BOVERFLOW *)bi->data)->pgno)) != 0)
goto stop;
pgno = bi->pgno;
break;
case P_IRECNO:
pgno = GET_RINTERNAL(dbp, parent, 0)->pgno;
break;
default:
goto stop;
}
/* Lock the child page. */
if ((ret =
__db_lget(dbc, 0, pgno, DB_LOCK_WRITE, 0, &c_lock)) != 0)
goto stop;
if ((ret = __memp_fget(mpf, &pgno, dbc->thread_info, dbc->txn,
DB_MPOOL_DIRTY, &child)) != 0)
goto stop;
/* Log the change. */
if (DBC_LOGGING(dbc)) {
memset(&a, 0, sizeof(a));
a.data = child;
a.size = dbp->pgsize;
memset(&b, 0, sizeof(b));
b.data = P_ENTRY(dbp, parent, 0);
b.size = TYPE(parent) == P_IRECNO ? RINTERNAL_SIZE :
BINTERNAL_SIZE(((BINTERNAL *)b.data)->len);
if ((ret = __bam_rsplit_log(dbp, dbc->txn,
&child->lsn, 0, PGNO(child), &a, PGNO(parent),
RE_NREC(parent), &b, &parent->lsn)) != 0)
goto stop;
} else
LSN_NOT_LOGGED(child->lsn);
/*
* Make the switch.
*
* One fixup -- internal pages below the top level do not store
* a record count, so we have to preserve it if we're not
* converting to a leaf page. Note also that we are about to
* overwrite the parent page, including its LSN. This is OK
* because the log message we wrote describing this update
* stores its LSN on the child page. When the child is copied
* onto the parent, the correct LSN is copied into place.
*/
COMPQUIET(rcnt, 0);
if (F_ISSET(cp, C_RECNUM) && LEVEL(child) > LEAFLEVEL)
rcnt = RE_NREC(parent);
memcpy(parent, child, dbp->pgsize);
PGNO(parent) = root_pgno;
if (F_ISSET(cp, C_RECNUM) && LEVEL(child) > LEAFLEVEL)
RE_NREC_SET(parent, rcnt);
/* Adjust the cursors. */
if ((ret = __bam_ca_rsplit(dbc, PGNO(child), root_pgno)) != 0)
goto stop;
/*
* Free the page copied onto the root page and discard its
* lock. (The call to __db_free() discards our reference
* to the page.)
*/
if ((ret = __db_free(dbc, child)) != 0) {
child = NULL;
goto stop;
}
child = NULL;
if (0) {
stop: done = 1;
}
if ((t_ret = __TLPUT(dbc, p_lock)) != 0 && ret == 0)
ret = t_ret;
if (parent != NULL &&
(t_ret = __memp_fput(mpf, dbc->thread_info,
parent, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, c_lock)) != 0 && ret == 0)
ret = t_ret;
if (child != NULL &&
(t_ret = __memp_fput(mpf, dbc->thread_info,
child, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
}
return (ret);
}
/*
* __bam_relink --
* Relink around a deleted page.
*
* PUBLIC: int __bam_relink __P((DBC *, PAGE *, db_pgno_t));
*/
int
__bam_relink(dbc, pagep, new_pgno)
DBC *dbc;
PAGE *pagep;
db_pgno_t new_pgno;
{
DB *dbp;
DB_LOCK npl, ppl;
DB_LSN *nlsnp, *plsnp, ret_lsn;
DB_MPOOLFILE *mpf;
PAGE *np, *pp;
int ret, t_ret;
dbp = dbc->dbp;
np = pp = NULL;
LOCK_INIT(npl);
LOCK_INIT(ppl);
nlsnp = plsnp = NULL;
mpf = dbp->mpf;
ret = 0;
/*
* Retrieve and lock the one/two pages. For a remove, we may need
* two pages (the before and after). For an add, we only need one
* because, the split took care of the prev.
*/
if (pagep->next_pgno != PGNO_INVALID) {
if ((ret = __db_lget(dbc,
0, pagep->next_pgno, DB_LOCK_WRITE, 0, &npl)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pagep->next_pgno,
dbc->thread_info, dbc->txn, DB_MPOOL_DIRTY, &np)) != 0) {
ret = __db_pgerr(dbp, pagep->next_pgno, ret);
goto err;
}
nlsnp = &np->lsn;
}
if (pagep->prev_pgno != PGNO_INVALID) {
if ((ret = __db_lget(dbc,
0, pagep->prev_pgno, DB_LOCK_WRITE, 0, &ppl)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pagep->prev_pgno,
dbc->thread_info, dbc->txn, DB_MPOOL_DIRTY, &pp)) != 0) {
ret = __db_pgerr(dbp, pagep->prev_pgno, ret);
goto err;
}
plsnp = &pp->lsn;
}
/* Log the change. */
if (DBC_LOGGING(dbc)) {
if ((ret = __bam_relink_log(dbp, dbc->txn, &ret_lsn, 0,
pagep->pgno, new_pgno, pagep->prev_pgno, plsnp,
pagep->next_pgno, nlsnp)) != 0)
goto err;
} else
LSN_NOT_LOGGED(ret_lsn);
if (np != NULL)
np->lsn = ret_lsn;
if (pp != NULL)
pp->lsn = ret_lsn;
/*
* Modify and release the two pages.
*/
if (np != NULL) {
if (new_pgno == PGNO_INVALID)
np->prev_pgno = pagep->prev_pgno;
else
np->prev_pgno = new_pgno;
ret = __memp_fput(mpf, dbc->thread_info, np, dbc->priority);
if ((t_ret = __TLPUT(dbc, npl)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
}
if (pp != NULL) {
if (new_pgno == PGNO_INVALID)
pp->next_pgno = pagep->next_pgno;
else
pp->next_pgno = new_pgno;
ret = __memp_fput(mpf, dbc->thread_info, pp, dbc->priority);
if ((t_ret = __TLPUT(dbc, ppl)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
}
return (0);
err: if (np != NULL)
(void)__memp_fput(mpf, dbc->thread_info, np, dbc->priority);
(void)__TLPUT(dbc, npl);
if (pp != NULL)
(void)__memp_fput(mpf, dbc->thread_info, pp, dbc->priority);
(void)__TLPUT(dbc, ppl);
return (ret);
}
/*
* __bam_pupdate --
* Update parent key pointers up the tree.
*
* PUBLIC: int __bam_pupdate __P((DBC *, PAGE *));
*/
int
__bam_pupdate(dbc, lpg)
DBC *dbc;
PAGE *lpg;
{
BTREE_CURSOR *cp;
ENV *env;
EPG *epg;
int ret;
env = dbc->env;
cp = (BTREE_CURSOR *)dbc->internal;
ret = 0;
/*
* Update the parents up the tree. __bam_pinsert only looks at the
* left child if is a leaf page, so we don't need to change it. We
* just do a delete and insert; a replace is possible but reusing
* pinsert is better.
*/
for (epg = &cp->csp[-1]; epg >= cp->sp; epg--) {
if ((ret = __memp_dirty(dbc->dbp->mpf, &epg->page,
dbc->thread_info, dbc->txn, dbc->priority, 0)) != 0)
return (ret);
if ((ret = __bam_ditem(dbc, epg->page, epg->indx)) != 0)
return (ret);
epg->indx--;
if ((ret = __bam_pinsert(dbc, epg, 0,
lpg, epg[1].page, BPI_NORECNUM)) != 0) {
if (ret == DB_NEEDSPLIT) {
/* This should not happen. */
__db_errx(env,
"Not enough room in parent: %s: page %lu",
dbc->dbp->fname, (u_long)PGNO(epg->page));
ret = __env_panic(env, EINVAL);
}
return (ret);
}
}
return (ret);
}

509
btree/bt_method.c Normal file
View File

@@ -0,0 +1,509 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1999,2008 Oracle. All rights reserved.
*
* $Id: bt_method.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/qam.h"
static int __bam_set_bt_minkey __P((DB *, u_int32_t));
static int __bam_set_bt_prefix
__P((DB *, size_t(*)(DB *, const DBT *, const DBT *)));
static int __ram_get_re_delim __P((DB *, int *));
static int __ram_set_re_delim __P((DB *, int));
static int __ram_set_re_len __P((DB *, u_int32_t));
static int __ram_set_re_pad __P((DB *, int));
static int __ram_get_re_source __P((DB *, const char **));
static int __ram_set_re_source __P((DB *, const char *));
/*
* __bam_db_create --
* Btree specific initialization of the DB structure.
*
* PUBLIC: int __bam_db_create __P((DB *));
*/
int
__bam_db_create(dbp)
DB *dbp;
{
BTREE *t;
int ret;
/* Allocate and initialize the private btree structure. */
if ((ret = __os_calloc(dbp->env, 1, sizeof(BTREE), &t)) != 0)
return (ret);
dbp->bt_internal = t;
t->bt_minkey = DEFMINKEYPAGE; /* Btree */
t->bt_compare = __bam_defcmp;
t->bt_prefix = __bam_defpfx;
dbp->set_bt_compare = __bam_set_bt_compare;
dbp->get_bt_minkey = __bam_get_bt_minkey;
dbp->set_bt_minkey = __bam_set_bt_minkey;
dbp->set_bt_prefix = __bam_set_bt_prefix;
t->re_pad = ' '; /* Recno */
t->re_delim = '\n';
t->re_eof = 1;
dbp->get_re_delim = __ram_get_re_delim;
dbp->set_re_delim = __ram_set_re_delim;
dbp->get_re_len = __ram_get_re_len;
dbp->set_re_len = __ram_set_re_len;
dbp->get_re_pad = __ram_get_re_pad;
dbp->set_re_pad = __ram_set_re_pad;
dbp->get_re_source = __ram_get_re_source;
dbp->set_re_source = __ram_set_re_source;
return (0);
}
/*
* __bam_db_close --
* Btree specific discard of the DB structure.
*
* PUBLIC: int __bam_db_close __P((DB *));
*/
int
__bam_db_close(dbp)
DB *dbp;
{
BTREE *t;
if ((t = dbp->bt_internal) == NULL)
return (0);
/* Recno */
/* Close any backing source file descriptor. */
if (t->re_fp != NULL)
(void)fclose(t->re_fp);
/* Free any backing source file name. */
if (t->re_source != NULL)
__os_free(dbp->env, t->re_source);
__os_free(dbp->env, t);
dbp->bt_internal = NULL;
return (0);
}
/*
* __bam_map_flags --
* Map Btree specific flags from public to the internal values.
*
* PUBLIC: void __bam_map_flags __P((DB *, u_int32_t *, u_int32_t *));
*/
void
__bam_map_flags(dbp, inflagsp, outflagsp)
DB *dbp;
u_int32_t *inflagsp, *outflagsp;
{
COMPQUIET(dbp, NULL);
if (FLD_ISSET(*inflagsp, DB_DUP)) {
FLD_SET(*outflagsp, DB_AM_DUP);
FLD_CLR(*inflagsp, DB_DUP);
}
if (FLD_ISSET(*inflagsp, DB_DUPSORT)) {
FLD_SET(*outflagsp, DB_AM_DUP | DB_AM_DUPSORT);
FLD_CLR(*inflagsp, DB_DUPSORT);
}
if (FLD_ISSET(*inflagsp, DB_RECNUM)) {
FLD_SET(*outflagsp, DB_AM_RECNUM);
FLD_CLR(*inflagsp, DB_RECNUM);
}
if (FLD_ISSET(*inflagsp, DB_REVSPLITOFF)) {
FLD_SET(*outflagsp, DB_AM_REVSPLITOFF);
FLD_CLR(*inflagsp, DB_REVSPLITOFF);
}
}
/*
* __bam_set_flags --
* Set Btree specific flags.
*
* PUBLIC: int __bam_set_flags __P((DB *, u_int32_t *flagsp));
*/
int
__bam_set_flags(dbp, flagsp)
DB *dbp;
u_int32_t *flagsp;
{
u_int32_t flags;
flags = *flagsp;
if (LF_ISSET(DB_DUP | DB_DUPSORT | DB_RECNUM | DB_REVSPLITOFF))
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_flags");
/*
* The DB_DUP and DB_DUPSORT flags are shared by the Hash
* and Btree access methods.
*/
if (LF_ISSET(DB_DUP | DB_DUPSORT))
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE | DB_OK_HASH);
if (LF_ISSET(DB_RECNUM | DB_REVSPLITOFF))
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
/* DB_DUP/DB_DUPSORT is incompatible with DB_RECNUM. */
if (LF_ISSET(DB_DUP | DB_DUPSORT) && F_ISSET(dbp, DB_AM_RECNUM))
goto incompat;
/* DB_RECNUM is incompatible with DB_DUP/DB_DUPSORT. */
if (LF_ISSET(DB_RECNUM) && F_ISSET(dbp, DB_AM_DUP))
goto incompat;
if (LF_ISSET(DB_DUPSORT) && dbp->dup_compare == NULL)
dbp->dup_compare = __bam_defcmp;
__bam_map_flags(dbp, flagsp, &dbp->flags);
return (0);
incompat:
return (__db_ferr(dbp->env, "DB->set_flags", 1));
}
/*
* __bam_set_bt_compare --
* Set the comparison function.
*
* PUBLIC: int __bam_set_bt_compare
* PUBLIC: __P((DB *, int (*)(DB *, const DBT *, const DBT *)));
*/
int
__bam_set_bt_compare(dbp, func)
DB *dbp;
int (*func) __P((DB *, const DBT *, const DBT *));
{
BTREE *t;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_bt_compare");
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
t = dbp->bt_internal;
/*
* Can't default the prefix routine if the user supplies a comparison
* routine; shortening the keys can break their comparison algorithm.
*/
t->bt_compare = func;
if (t->bt_prefix == __bam_defpfx)
t->bt_prefix = NULL;
return (0);
}
/*
* __db_get_bt_minkey --
* Get the minimum keys per page.
*
* PUBLIC: int __bam_get_bt_minkey __P((DB *, u_int32_t *));
*/
int
__bam_get_bt_minkey(dbp, bt_minkeyp)
DB *dbp;
u_int32_t *bt_minkeyp;
{
BTREE *t;
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
t = dbp->bt_internal;
*bt_minkeyp = t->bt_minkey;
return (0);
}
/*
* __bam_set_bt_minkey --
* Set the minimum keys per page.
*/
static int
__bam_set_bt_minkey(dbp, bt_minkey)
DB *dbp;
u_int32_t bt_minkey;
{
BTREE *t;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_bt_minkey");
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
t = dbp->bt_internal;
if (bt_minkey < 2) {
__db_errx(dbp->env, "minimum bt_minkey value is 2");
return (EINVAL);
}
t->bt_minkey = bt_minkey;
return (0);
}
/*
* __bam_set_bt_prefix --
* Set the prefix function.
*/
static int
__bam_set_bt_prefix(dbp, func)
DB *dbp;
size_t (*func) __P((DB *, const DBT *, const DBT *));
{
BTREE *t;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_bt_prefix");
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
t = dbp->bt_internal;
t->bt_prefix = func;
return (0);
}
/*
* __ram_map_flags --
* Map Recno specific flags from public to the internal values.
*
* PUBLIC: void __ram_map_flags __P((DB *, u_int32_t *, u_int32_t *));
*/
void
__ram_map_flags(dbp, inflagsp, outflagsp)
DB *dbp;
u_int32_t *inflagsp, *outflagsp;
{
COMPQUIET(dbp, NULL);
if (FLD_ISSET(*inflagsp, DB_RENUMBER)) {
FLD_SET(*outflagsp, DB_AM_RENUMBER);
FLD_CLR(*inflagsp, DB_RENUMBER);
}
if (FLD_ISSET(*inflagsp, DB_SNAPSHOT)) {
FLD_SET(*outflagsp, DB_AM_SNAPSHOT);
FLD_CLR(*inflagsp, DB_SNAPSHOT);
}
}
/*
* __ram_set_flags --
* Set Recno specific flags.
*
* PUBLIC: int __ram_set_flags __P((DB *, u_int32_t *flagsp));
*/
int
__ram_set_flags(dbp, flagsp)
DB *dbp;
u_int32_t *flagsp;
{
u_int32_t flags;
flags = *flagsp;
if (LF_ISSET(DB_RENUMBER | DB_SNAPSHOT)) {
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_flags");
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
}
__ram_map_flags(dbp, flagsp, &dbp->flags);
return (0);
}
/*
* __db_get_re_delim --
* Get the variable-length input record delimiter.
*/
static int
__ram_get_re_delim(dbp, re_delimp)
DB *dbp;
int *re_delimp;
{
BTREE *t;
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
t = dbp->bt_internal;
*re_delimp = t->re_delim;
return (0);
}
/*
* __ram_set_re_delim --
* Set the variable-length input record delimiter.
*/
static int
__ram_set_re_delim(dbp, re_delim)
DB *dbp;
int re_delim;
{
BTREE *t;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_re_delim");
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
t = dbp->bt_internal;
t->re_delim = re_delim;
F_SET(dbp, DB_AM_DELIMITER);
return (0);
}
/*
* __db_get_re_len --
* Get the variable-length input record length.
*
* PUBLIC: int __ram_get_re_len __P((DB *, u_int32_t *));
*/
int
__ram_get_re_len(dbp, re_lenp)
DB *dbp;
u_int32_t *re_lenp;
{
BTREE *t;
QUEUE *q;
DB_ILLEGAL_METHOD(dbp, DB_OK_QUEUE | DB_OK_RECNO);
/*
* This has to work for all access methods, before or after opening the
* database. When the record length is set with __ram_set_re_len, the
* value in both the BTREE and QUEUE structs will be correct.
* Otherwise, this only makes sense after the database in opened, in
* which case we know the type.
*/
if (dbp->type == DB_QUEUE) {
q = dbp->q_internal;
*re_lenp = q->re_len;
} else {
t = dbp->bt_internal;
*re_lenp = t->re_len;
}
return (0);
}
/*
* __ram_set_re_len --
* Set the variable-length input record length.
*/
static int
__ram_set_re_len(dbp, re_len)
DB *dbp;
u_int32_t re_len;
{
BTREE *t;
QUEUE *q;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_re_len");
DB_ILLEGAL_METHOD(dbp, DB_OK_QUEUE | DB_OK_RECNO);
t = dbp->bt_internal;
t->re_len = re_len;
q = dbp->q_internal;
q->re_len = re_len;
F_SET(dbp, DB_AM_FIXEDLEN);
return (0);
}
/*
* __db_get_re_pad --
* Get the fixed-length record pad character.
*
* PUBLIC: int __ram_get_re_pad __P((DB *, int *));
*/
int
__ram_get_re_pad(dbp, re_padp)
DB *dbp;
int *re_padp;
{
BTREE *t;
QUEUE *q;
DB_ILLEGAL_METHOD(dbp, DB_OK_QUEUE | DB_OK_RECNO);
/*
* This has to work for all access methods, before or after opening the
* database. When the record length is set with __ram_set_re_pad, the
* value in both the BTREE and QUEUE structs will be correct.
* Otherwise, this only makes sense after the database in opened, in
* which case we know the type.
*/
if (dbp->type == DB_QUEUE) {
q = dbp->q_internal;
*re_padp = q->re_pad;
} else {
t = dbp->bt_internal;
*re_padp = t->re_pad;
}
return (0);
}
/*
* __ram_set_re_pad --
* Set the fixed-length record pad character.
*/
static int
__ram_set_re_pad(dbp, re_pad)
DB *dbp;
int re_pad;
{
BTREE *t;
QUEUE *q;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_re_pad");
DB_ILLEGAL_METHOD(dbp, DB_OK_QUEUE | DB_OK_RECNO);
t = dbp->bt_internal;
t->re_pad = re_pad;
q = dbp->q_internal;
q->re_pad = re_pad;
F_SET(dbp, DB_AM_PAD);
return (0);
}
/*
* __db_get_re_source --
* Get the backing source file name.
*/
static int
__ram_get_re_source(dbp, re_sourcep)
DB *dbp;
const char **re_sourcep;
{
BTREE *t;
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
t = dbp->bt_internal;
*re_sourcep = t->re_source;
return (0);
}
/*
* __ram_set_re_source --
* Set the backing source file name.
*/
static int
__ram_set_re_source(dbp, re_source)
DB *dbp;
const char *re_source;
{
BTREE *t;
DB_ILLEGAL_AFTER_OPEN(dbp, "DB->set_re_source");
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
t = dbp->bt_internal;
return (__os_strdup(dbp->env, re_source, &t->re_source));
}

621
btree/bt_open.c Normal file
View File

@@ -0,0 +1,621 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_open.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/crypto.h"
#include "dbinc/db_page.h"
#include "dbinc/db_swap.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/log.h"
#include "dbinc/mp.h"
#include "dbinc/fop.h"
static void __bam_init_meta __P((DB *, BTMETA *, db_pgno_t, DB_LSN *));
/*
* __bam_open --
* Open a btree.
*
* PUBLIC: int __bam_open __P((DB *, DB_THREAD_INFO *,
* PUBLIC: DB_TXN *, const char *, db_pgno_t, u_int32_t));
*/
int
__bam_open(dbp, ip, txn, name, base_pgno, flags)
DB *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
const char *name;
db_pgno_t base_pgno;
u_int32_t flags;
{
BTREE *t;
COMPQUIET(name, NULL);
t = dbp->bt_internal;
/*
* We don't permit the user to specify a prefix routine if they didn't
* also specify a comparison routine, they can't know enough about our
* comparison routine to get it right.
*/
if (t->bt_compare == __bam_defcmp && t->bt_prefix != __bam_defpfx) {
__db_errx(dbp->env,
"prefix comparison may not be specified for default comparison routine");
return (EINVAL);
}
/*
* Verify that the bt_minkey value specified won't cause the
* calculation of ovflsize to underflow [#2406] for this pagesize.
*/
if (B_MINKEY_TO_OVFLSIZE(dbp, t->bt_minkey, dbp->pgsize) >
B_MINKEY_TO_OVFLSIZE(dbp, DEFMINKEYPAGE, dbp->pgsize)) {
__db_errx(dbp->env,
"bt_minkey value of %lu too high for page size of %lu",
(u_long)t->bt_minkey, (u_long)dbp->pgsize);
return (EINVAL);
}
/* Start up the tree. */
return (__bam_read_root(dbp, ip, txn, base_pgno, flags));
}
/*
* __bam_metachk --
*
* PUBLIC: int __bam_metachk __P((DB *, const char *, BTMETA *));
*/
int
__bam_metachk(dbp, name, btm)
DB *dbp;
const char *name;
BTMETA *btm;
{
ENV *env;
u_int32_t vers;
int ret;
env = dbp->env;
/*
* At this point, all we know is that the magic number is for a Btree.
* Check the version, the database may be out of date.
*/
vers = btm->dbmeta.version;
if (F_ISSET(dbp, DB_AM_SWAP))
M_32_SWAP(vers);
switch (vers) {
case 6:
case 7:
__db_errx(env,
"%s: btree version %lu requires a version upgrade",
name, (u_long)vers);
return (DB_OLD_VERSION);
case 8:
case 9:
break;
default:
__db_errx(env,
"%s: unsupported btree version: %lu", name, (u_long)vers);
return (EINVAL);
}
/* Swap the page if we need to. */
if (F_ISSET(dbp, DB_AM_SWAP) &&
(ret = __bam_mswap(env, (PAGE *)btm)) != 0)
return (ret);
/*
* Check application info against metadata info, and set info, flags,
* and type based on metadata info.
*/
if ((ret =
__db_fchk(env, "DB->open", btm->dbmeta.flags, BTM_MASK)) != 0)
return (ret);
if (F_ISSET(&btm->dbmeta, BTM_RECNO)) {
if (dbp->type == DB_BTREE)
goto wrong_type;
dbp->type = DB_RECNO;
DB_ILLEGAL_METHOD(dbp, DB_OK_RECNO);
} else {
if (dbp->type == DB_RECNO)
goto wrong_type;
dbp->type = DB_BTREE;
DB_ILLEGAL_METHOD(dbp, DB_OK_BTREE);
}
if (F_ISSET(&btm->dbmeta, BTM_DUP))
F_SET(dbp, DB_AM_DUP);
else
if (F_ISSET(dbp, DB_AM_DUP)) {
__db_errx(env,
"%s: DB_DUP specified to open method but not set in database",
name);
return (EINVAL);
}
if (F_ISSET(&btm->dbmeta, BTM_RECNUM)) {
if (dbp->type != DB_BTREE)
goto wrong_type;
F_SET(dbp, DB_AM_RECNUM);
if ((ret = __db_fcchk(env,
"DB->open", dbp->flags, DB_AM_DUP, DB_AM_RECNUM)) != 0)
return (ret);
} else
if (F_ISSET(dbp, DB_AM_RECNUM)) {
__db_errx(env,
"%s: DB_RECNUM specified to open method but not set in database",
name);
return (EINVAL);
}
if (F_ISSET(&btm->dbmeta, BTM_FIXEDLEN)) {
if (dbp->type != DB_RECNO)
goto wrong_type;
F_SET(dbp, DB_AM_FIXEDLEN);
} else
if (F_ISSET(dbp, DB_AM_FIXEDLEN)) {
__db_errx(env,
"%s: DB_FIXEDLEN specified to open method but not set in database",
name);
return (EINVAL);
}
if (F_ISSET(&btm->dbmeta, BTM_RENUMBER)) {
if (dbp->type != DB_RECNO)
goto wrong_type;
F_SET(dbp, DB_AM_RENUMBER);
} else
if (F_ISSET(dbp, DB_AM_RENUMBER)) {
__db_errx(env,
"%s: DB_RENUMBER specified to open method but not set in database",
name);
return (EINVAL);
}
if (F_ISSET(&btm->dbmeta, BTM_SUBDB))
F_SET(dbp, DB_AM_SUBDB);
else
if (F_ISSET(dbp, DB_AM_SUBDB)) {
__db_errx(env,
"%s: multiple databases specified but not supported by file",
name);
return (EINVAL);
}
if (F_ISSET(&btm->dbmeta, BTM_DUPSORT)) {
if (dbp->dup_compare == NULL)
dbp->dup_compare = __bam_defcmp;
F_SET(dbp, DB_AM_DUPSORT);
} else
if (dbp->dup_compare != NULL) {
__db_errx(env,
"%s: duplicate sort specified but not supported in database",
name);
return (EINVAL);
}
/* Set the page size. */
dbp->pgsize = btm->dbmeta.pagesize;
/* Copy the file's ID. */
memcpy(dbp->fileid, btm->dbmeta.uid, DB_FILE_ID_LEN);
return (0);
wrong_type:
if (dbp->type == DB_BTREE)
__db_errx(env,
"open method type is Btree, database type is Recno");
else
__db_errx(env,
"open method type is Recno, database type is Btree");
return (EINVAL);
}
/*
* __bam_read_root --
* Read the root page and check a tree.
*
* PUBLIC: int __bam_read_root __P((DB *,
* PUBLIC: DB_THREAD_INFO *, DB_TXN *, db_pgno_t, u_int32_t));
*/
int
__bam_read_root(dbp, ip, txn, base_pgno, flags)
DB *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
db_pgno_t base_pgno;
u_int32_t flags;
{
BTMETA *meta;
BTREE *t;
DBC *dbc;
DB_LOCK metalock;
DB_MPOOLFILE *mpf;
int ret, t_ret;
COMPQUIET(flags, 0);
meta = NULL;
t = dbp->bt_internal;
LOCK_INIT(metalock);
mpf = dbp->mpf;
ret = 0;
/* Get a cursor. */
if ((ret = __db_cursor(dbp, ip, txn, &dbc, 0)) != 0)
return (ret);
/* Get the metadata page. */
if ((ret =
__db_lget(dbc, 0, base_pgno, DB_LOCK_READ, 0, &metalock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &base_pgno, ip, dbc->txn, 0, &meta)) != 0)
goto err;
/*
* If the magic number is set, the tree has been created. Correct
* any fields that may not be right. Note, all of the local flags
* were set by DB->open.
*
* Otherwise, we'd better be in recovery or abort, in which case the
* metadata page will be created/initialized elsewhere.
*/
if (meta->dbmeta.magic == DB_BTREEMAGIC) {
t->bt_minkey = meta->minkey;
t->re_pad = (int)meta->re_pad;
t->re_len = meta->re_len;
t->bt_meta = base_pgno;
t->bt_root = meta->root;
if (PGNO(meta) == PGNO_BASE_MD && !F_ISSET(dbp, DB_AM_RECOVER))
__memp_set_last_pgno(mpf, meta->dbmeta.last_pgno);
} else {
DB_ASSERT(dbp->env,
IS_RECOVERING(dbp->env) || F_ISSET(dbp, DB_AM_RECOVER));
}
/*
* !!!
* If creating a subdatabase, we've already done an insert when
* we put the subdatabase's entry into the master database, so
* our last-page-inserted value is wrongly initialized for the
* master database, not the subdatabase we're creating. I'm not
* sure where the *right* place to clear this value is, it's not
* intuitively obvious that it belongs here.
*/
t->bt_lpgno = PGNO_INVALID;
err: /* Put the metadata page back. */
if (meta != NULL && (t_ret = __memp_fput(mpf,
ip, meta, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __dbc_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*
* __bam_init_meta --
*
* Initialize a btree meta-data page. The following fields may need
* to be updated later: last_pgno, root.
*/
static void
__bam_init_meta(dbp, meta, pgno, lsnp)
DB *dbp;
BTMETA *meta;
db_pgno_t pgno;
DB_LSN *lsnp;
{
BTREE *t;
ENV *env;
env = dbp->env;
t = dbp->bt_internal;
memset(meta, 0, sizeof(BTMETA));
meta->dbmeta.lsn = *lsnp;
meta->dbmeta.pgno = pgno;
meta->dbmeta.magic = DB_BTREEMAGIC;
meta->dbmeta.version = DB_BTREEVERSION;
meta->dbmeta.pagesize = dbp->pgsize;
if (F_ISSET(dbp, DB_AM_CHKSUM))
FLD_SET(meta->dbmeta.metaflags, DBMETA_CHKSUM);
if (F_ISSET(dbp, DB_AM_ENCRYPT)) {
meta->dbmeta.encrypt_alg = env->crypto_handle->alg;
DB_ASSERT(env, meta->dbmeta.encrypt_alg != 0);
meta->crypto_magic = meta->dbmeta.magic;
}
meta->dbmeta.type = P_BTREEMETA;
meta->dbmeta.free = PGNO_INVALID;
meta->dbmeta.last_pgno = pgno;
if (F_ISSET(dbp, DB_AM_DUP))
F_SET(&meta->dbmeta, BTM_DUP);
if (F_ISSET(dbp, DB_AM_FIXEDLEN))
F_SET(&meta->dbmeta, BTM_FIXEDLEN);
if (F_ISSET(dbp, DB_AM_RECNUM))
F_SET(&meta->dbmeta, BTM_RECNUM);
if (F_ISSET(dbp, DB_AM_RENUMBER))
F_SET(&meta->dbmeta, BTM_RENUMBER);
if (F_ISSET(dbp, DB_AM_SUBDB))
F_SET(&meta->dbmeta, BTM_SUBDB);
if (dbp->dup_compare != NULL)
F_SET(&meta->dbmeta, BTM_DUPSORT);
if (dbp->type == DB_RECNO)
F_SET(&meta->dbmeta, BTM_RECNO);
memcpy(meta->dbmeta.uid, dbp->fileid, DB_FILE_ID_LEN);
meta->minkey = t->bt_minkey;
meta->re_len = t->re_len;
meta->re_pad = (u_int32_t)t->re_pad;
}
/*
* __bam_new_file --
* Create the necessary pages to begin a new database file.
*
* This code appears more complex than it is because of the two cases (named
* and unnamed). The way to read the code is that for each page being created,
* there are three parts: 1) a "get page" chunk (which either uses malloc'd
* memory or calls __memp_fget), 2) the initialization, and 3) the "put page"
* chunk which either does a fop write or an __memp_fput.
*
* PUBLIC: int __bam_new_file __P((DB *,
* PUBLIC: DB_THREAD_INFO *, DB_TXN *, DB_FH *, const char *));
*/
int
__bam_new_file(dbp, ip, txn, fhp, name)
DB *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
DB_FH *fhp;
const char *name;
{
BTMETA *meta;
DBT pdbt;
DB_LSN lsn;
DB_MPOOLFILE *mpf;
DB_PGINFO pginfo;
ENV *env;
PAGE *root;
db_pgno_t pgno;
int ret, t_ret;
void *buf;
env = dbp->env;
mpf = dbp->mpf;
root = NULL;
meta = NULL;
buf = NULL;
if (F_ISSET(dbp, DB_AM_INMEM)) {
/* Build the meta-data page. */
pgno = PGNO_BASE_MD;
if ((ret = __memp_fget(mpf, &pgno, ip, txn,
DB_MPOOL_CREATE | DB_MPOOL_DIRTY, &meta)) != 0)
return (ret);
LSN_NOT_LOGGED(lsn);
__bam_init_meta(dbp, meta, PGNO_BASE_MD, &lsn);
meta->root = 1;
meta->dbmeta.last_pgno = 1;
if ((ret =
__db_log_page(dbp, txn, &lsn, pgno, (PAGE *)meta)) != 0)
goto err;
ret = __memp_fput(mpf, ip, meta, dbp->priority);
meta = NULL;
if (ret != 0)
goto err;
/* Build the root page. */
pgno = 1;
if ((ret = __memp_fget(mpf, &pgno,
ip, txn, DB_MPOOL_CREATE, &root)) != 0)
goto err;
P_INIT(root, dbp->pgsize, 1, PGNO_INVALID, PGNO_INVALID,
LEAFLEVEL, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE);
LSN_NOT_LOGGED(root->lsn);
if ((ret =
__db_log_page(dbp, txn, &root->lsn, pgno, root)) != 0)
goto err;
ret = __memp_fput(mpf, ip, root, dbp->priority);
root = NULL;
if (ret != 0)
goto err;
} else {
memset(&pdbt, 0, sizeof(pdbt));
/* Build the meta-data page. */
pginfo.db_pagesize = dbp->pgsize;
pginfo.flags =
F_ISSET(dbp, (DB_AM_CHKSUM | DB_AM_ENCRYPT | DB_AM_SWAP));
pginfo.type = dbp->type;
pdbt.data = &pginfo;
pdbt.size = sizeof(pginfo);
if ((ret = __os_calloc(env, 1, dbp->pgsize, &buf)) != 0)
return (ret);
meta = (BTMETA *)buf;
LSN_NOT_LOGGED(lsn);
__bam_init_meta(dbp, meta, PGNO_BASE_MD, &lsn);
meta->root = 1;
meta->dbmeta.last_pgno = 1;
if ((ret = __db_pgout(
dbp->dbenv, PGNO_BASE_MD, meta, &pdbt)) != 0)
goto err;
if ((ret = __fop_write(env, txn, name, DB_APP_DATA, fhp,
dbp->pgsize, 0, 0, buf, dbp->pgsize, 1, F_ISSET(
dbp, DB_AM_NOT_DURABLE) ? DB_LOG_NOT_DURABLE : 0)) != 0)
goto err;
meta = NULL;
/* Build the root page. */
#ifdef DIAGNOSTIC
memset(buf, CLEAR_BYTE, dbp->pgsize);
#endif
root = (PAGE *)buf;
P_INIT(root, dbp->pgsize, 1, PGNO_INVALID, PGNO_INVALID,
LEAFLEVEL, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE);
LSN_NOT_LOGGED(root->lsn);
if ((ret =
__db_pgout(dbp->dbenv, root->pgno, root, &pdbt)) != 0)
goto err;
if ((ret = __fop_write(env, txn, name, DB_APP_DATA, fhp,
dbp->pgsize, 1, 0, buf, dbp->pgsize, 1, F_ISSET(
dbp, DB_AM_NOT_DURABLE) ? DB_LOG_NOT_DURABLE : 0)) != 0)
goto err;
root = NULL;
}
err: if (buf != NULL)
__os_free(env, buf);
else {
if (meta != NULL &&
(t_ret = __memp_fput(mpf, ip,
meta, dbp->priority)) != 0 && ret == 0)
ret = t_ret;
if (root != NULL &&
(t_ret = __memp_fput(mpf, ip,
root, dbp->priority)) != 0 && ret == 0)
ret = t_ret;
}
return (ret);
}
/*
* __bam_new_subdb --
* Create a metadata page and a root page for a new btree.
*
* PUBLIC: int __bam_new_subdb __P((DB *, DB *, DB_THREAD_INFO *, DB_TXN *));
*/
int
__bam_new_subdb(mdbp, dbp, ip, txn)
DB *mdbp, *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
{
BTMETA *meta;
DBC *dbc;
DB_LOCK metalock;
DB_LSN lsn;
DB_MPOOLFILE *mpf;
ENV *env;
PAGE *root;
int ret, t_ret;
env = mdbp->env;
mpf = mdbp->mpf;
dbc = NULL;
meta = NULL;
root = NULL;
if ((ret = __db_cursor(mdbp, ip, txn,
&dbc, CDB_LOCKING(env) ? DB_WRITECURSOR : 0)) != 0)
return (ret);
/* Get, and optionally create the metadata page. */
if ((ret = __db_lget(dbc,
0, dbp->meta_pgno, DB_LOCK_WRITE, 0, &metalock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &dbp->meta_pgno,
ip, txn, DB_MPOOL_CREATE, &meta)) != 0)
goto err;
/* Build meta-data page. */
lsn = meta->dbmeta.lsn;
__bam_init_meta(dbp, meta, dbp->meta_pgno, &lsn);
if ((ret = __db_log_page(mdbp,
txn, &meta->dbmeta.lsn, dbp->meta_pgno, (PAGE *)meta)) != 0)
goto err;
/* Create and initialize a root page. */
if ((ret = __db_new(dbc,
dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE, &root)) != 0)
goto err;
root->level = LEAFLEVEL;
if (DBENV_LOGGING(env) &&
#if !defined(DEBUG_WOP)
txn != NULL &&
#endif
(ret = __bam_root_log(mdbp, txn, &meta->dbmeta.lsn, 0,
meta->dbmeta.pgno, root->pgno, &meta->dbmeta.lsn)) != 0)
goto err;
meta->root = root->pgno;
if ((ret =
__db_log_page(mdbp, txn, &root->lsn, root->pgno, root)) != 0)
goto err;
/* Release the metadata and root pages. */
if ((ret = __memp_fput(mpf, ip, meta, dbc->priority)) != 0)
goto err;
meta = NULL;
if ((ret = __memp_fput(mpf, ip, root, dbc->priority)) != 0)
goto err;
root = NULL;
err:
if (meta != NULL)
if ((t_ret = __memp_fput(mpf, ip,
meta, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if (root != NULL)
if ((t_ret = __memp_fput(mpf, ip,
root, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if (dbc != NULL)
if ((t_ret = __dbc_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}

916
btree/bt_put.c Normal file
View File

@@ -0,0 +1,916 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_put.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/mp.h"
static int __bam_build
__P((DBC *, u_int32_t, DBT *, PAGE *, u_int32_t, u_int32_t));
static int __bam_dup_check __P((DBC *, u_int32_t,
PAGE *, u_int32_t, u_int32_t, db_indx_t *));
static int __bam_dup_convert __P((DBC *, PAGE *, u_int32_t, u_int32_t));
static int __bam_ovput
__P((DBC *, u_int32_t, db_pgno_t, PAGE *, u_int32_t, DBT *));
static u_int32_t
__bam_partsize __P((DB *, u_int32_t, DBT *, PAGE *, u_int32_t));
/*
* __bam_iitem --
* Insert an item into the tree.
*
* PUBLIC: int __bam_iitem __P((DBC *, DBT *, DBT *, u_int32_t, u_int32_t));
*/
int
__bam_iitem(dbc, key, data, op, flags)
DBC *dbc;
DBT *key, *data;
u_int32_t op, flags;
{
BKEYDATA *bk, bk_tmp;
BTREE *t;
BTREE_CURSOR *cp;
DB *dbp;
DBT bk_hdr, tdbt;
DB_MPOOLFILE *mpf;
ENV *env;
PAGE *h;
db_indx_t cnt, indx;
u_int32_t data_size, have_bytes, need_bytes, needed, pages, pagespace;
int cmp, bigkey, bigdata, del, dupadjust;
int padrec, replace, ret, t_ret, was_deleted;
COMPQUIET(cnt, 0);
dbp = dbc->dbp;
env = dbp->env;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
t = dbp->bt_internal;
h = cp->page;
indx = cp->indx;
del = dupadjust = replace = was_deleted = 0;
/*
* Fixed-length records with partial puts: it's an error to specify
* anything other simple overwrite.
*/
if (F_ISSET(dbp, DB_AM_FIXEDLEN) &&
F_ISSET(data, DB_DBT_PARTIAL) && data->size != data->dlen)
return (__db_rec_repl(env, data->size, data->dlen));
/*
* Figure out how much space the data will take, including if it's a
* partial record.
*
* Fixed-length records: it's an error to specify a record that's
* longer than the fixed-length, and we never require less than
* the fixed-length record size.
*/
data_size = F_ISSET(data, DB_DBT_PARTIAL) ?
__bam_partsize(dbp, op, data, h, indx) : data->size;
padrec = 0;
if (F_ISSET(dbp, DB_AM_FIXEDLEN)) {
if (data_size > t->re_len)
return (__db_rec_toobig(env, data_size, t->re_len));
/* Records that are deleted anyway needn't be padded out. */
if (!LF_ISSET(BI_DELETED) && data_size < t->re_len) {
padrec = 1;
data_size = t->re_len;
}
}
/*
* Handle partial puts or short fixed-length records: build the
* real record.
*/
if (padrec || F_ISSET(data, DB_DBT_PARTIAL)) {
tdbt = *data;
if ((ret =
__bam_build(dbc, op, &tdbt, h, indx, data_size)) != 0)
return (ret);
data = &tdbt;
}
/*
* If the user has specified a duplicate comparison function, return
* an error if DB_CURRENT was specified and the replacement data
* doesn't compare equal to the current data. This stops apps from
* screwing up the duplicate sort order. We have to do this after
* we build the real record so that we're comparing the real items.
*/
if (op == DB_CURRENT && dbp->dup_compare != NULL) {
if ((ret = __bam_cmp(dbp, dbc->thread_info, dbc->txn, data, h,
indx + (TYPE(h) == P_LBTREE ? O_INDX : 0),
dbp->dup_compare, &cmp)) != 0)
return (ret);
if (cmp != 0) {
__db_errx(env,
"Existing data sorts differently from put data");
return (EINVAL);
}
}
/*
* If the key or data item won't fit on a page, we'll have to store
* them on overflow pages.
*/
needed = 0;
bigdata = data_size > cp->ovflsize;
switch (op) {
case DB_KEYFIRST:
/* We're adding a new key and data pair. */
bigkey = key->size > cp->ovflsize;
if (bigkey)
needed += BOVERFLOW_PSIZE;
else
needed += BKEYDATA_PSIZE(key->size);
if (bigdata)
needed += BOVERFLOW_PSIZE;
else
needed += BKEYDATA_PSIZE(data_size);
break;
case DB_AFTER:
case DB_BEFORE:
case DB_CURRENT:
/*
* We're either overwriting the data item of a key/data pair
* or we're creating a new on-page duplicate and only adding
* a data item.
*
* !!!
* We're not currently correcting for space reclaimed from
* already deleted items, but I don't think it's worth the
* complexity.
*/
bigkey = 0;
if (op == DB_CURRENT) {
bk = GET_BKEYDATA(dbp, h,
indx + (TYPE(h) == P_LBTREE ? O_INDX : 0));
if (B_TYPE(bk->type) == B_KEYDATA)
have_bytes = BKEYDATA_PSIZE(bk->len);
else
have_bytes = BOVERFLOW_PSIZE;
need_bytes = 0;
} else {
have_bytes = 0;
need_bytes = sizeof(db_indx_t);
}
if (bigdata)
need_bytes += BOVERFLOW_PSIZE;
else
need_bytes += BKEYDATA_PSIZE(data_size);
if (have_bytes < need_bytes)
needed += need_bytes - have_bytes;
break;
default:
return (__db_unknown_flag(env, "DB->put", op));
}
/* Split the page if there's not enough room. */
if (P_FREESPACE(dbp, h) < needed)
return (DB_NEEDSPLIT);
/*
* Check to see if we will convert to off page duplicates -- if
* so, we'll need a page.
*/
if (F_ISSET(dbp, DB_AM_DUP) &&
TYPE(h) == P_LBTREE && op != DB_KEYFIRST &&
P_FREESPACE(dbp, h) - needed <= dbp->pgsize / 2 &&
__bam_dup_check(dbc, op, h, indx, needed, &cnt)) {
pages = 1;
dupadjust = 1;
} else
pages = 0;
/*
* If we are not using transactions and there is a page limit
* set on the file, then figure out if things will fit before
* taking action.
*/
if (dbc->txn == NULL && mpf->mfp->maxpgno != 0) {
pagespace = P_MAXSPACE(dbp, dbp->pgsize);
if (bigdata)
pages += ((data_size - 1) / pagespace) + 1;
if (bigkey)
pages += ((key->size - 1) / pagespace) + 1;
if (pages > (mpf->mfp->maxpgno - mpf->mfp->last_pgno))
return (__db_space_err(dbp));
}
if ((ret = __memp_dirty(mpf, &h,
dbc->thread_info, dbc->txn, dbc->priority, 0)) != 0)
return (ret);
if (cp->csp->page == cp->page)
cp->csp->page = h;
cp->page = h;
/*
* The code breaks it up into five cases:
*
* 1. Insert a new key/data pair.
* 2. Append a new data item (a new duplicate).
* 3. Insert a new data item (a new duplicate).
* 4. Delete and re-add the data item (overflow item).
* 5. Overwrite the data item.
*/
switch (op) {
case DB_KEYFIRST: /* 1. Insert a new key/data pair. */
if (bigkey) {
if ((ret = __bam_ovput(dbc,
B_OVERFLOW, PGNO_INVALID, h, indx, key)) != 0)
return (ret);
} else
if ((ret = __db_pitem(dbc, h, indx,
BKEYDATA_SIZE(key->size), NULL, key)) != 0)
return (ret);
if ((ret = __bam_ca_di(dbc, PGNO(h), indx, 1)) != 0)
return (ret);
++indx;
break;
case DB_AFTER: /* 2. Append a new data item. */
if (TYPE(h) == P_LBTREE) {
/* Copy the key for the duplicate and adjust cursors. */
if ((ret =
__bam_adjindx(dbc, h, indx + P_INDX, indx, 1)) != 0)
return (ret);
if ((ret =
__bam_ca_di(dbc, PGNO(h), indx + P_INDX, 1)) != 0)
return (ret);
indx += 3;
cp->indx += 2;
} else {
++indx;
cp->indx += 1;
}
break;
case DB_BEFORE: /* 3. Insert a new data item. */
if (TYPE(h) == P_LBTREE) {
/* Copy the key for the duplicate and adjust cursors. */
if ((ret = __bam_adjindx(dbc, h, indx, indx, 1)) != 0)
return (ret);
if ((ret = __bam_ca_di(dbc, PGNO(h), indx, 1)) != 0)
return (ret);
++indx;
}
break;
case DB_CURRENT:
/*
* Clear the cursor's deleted flag. The problem is that if
* we deadlock or fail while deleting the overflow item or
* replacing the non-overflow item, a subsequent cursor close
* will try and remove the item because the cursor's delete
* flag is set.
*/
if ((ret = __bam_ca_delete(dbp, PGNO(h), indx, 0, NULL)) != 0)
return (ret);
if (TYPE(h) == P_LBTREE)
++indx;
bk = GET_BKEYDATA(dbp, h, indx);
/*
* In a Btree deleted records aren't counted (deleted records
* are counted in a Recno because all accesses are based on
* record number). If it's a Btree and it's a DB_CURRENT
* operation overwriting a previously deleted record, increment
* the record count.
*/
if (TYPE(h) == P_LBTREE || TYPE(h) == P_LDUP)
was_deleted = B_DISSET(bk->type);
/*
* 4. Delete and re-add the data item.
*
* If we're changing the type of the on-page structure, or we
* are referencing offpage items, we have to delete and then
* re-add the item. We do not do any cursor adjustments here
* because we're going to immediately re-add the item into the
* same slot.
*/
if (bigdata || B_TYPE(bk->type) != B_KEYDATA) {
if ((ret = __bam_ditem(dbc, h, indx)) != 0)
return (ret);
del = 1;
break;
}
/* 5. Overwrite the data item. */
replace = 1;
break;
default:
return (__db_unknown_flag(env, "DB->put", op));
}
/* Add the data. */
if (bigdata) {
/*
* We do not have to handle deleted (BI_DELETED) records
* in this case; the actual records should never be created.
*/
DB_ASSERT(env, !LF_ISSET(BI_DELETED));
ret = __bam_ovput(dbc,
B_OVERFLOW, PGNO_INVALID, h, indx, data);
} else {
if (LF_ISSET(BI_DELETED)) {
B_TSET_DELETED(bk_tmp.type, B_KEYDATA);
bk_tmp.len = data->size;
bk_hdr.data = &bk_tmp;
bk_hdr.size = SSZA(BKEYDATA, data);
ret = __db_pitem(dbc, h, indx,
BKEYDATA_SIZE(data->size), &bk_hdr, data);
} else if (replace)
ret = __bam_ritem(dbc, h, indx, data);
else
ret = __db_pitem(dbc, h, indx,
BKEYDATA_SIZE(data->size), NULL, data);
}
if (ret != 0) {
if (del == 1 && (t_ret =
__bam_ca_di(dbc, PGNO(h), indx + 1, -1)) != 0) {
__db_err(env, t_ret,
"cursor adjustment after delete failed");
return (__env_panic(env, t_ret));
}
return (ret);
}
/*
* Re-position the cursors if necessary and reset the current cursor
* to point to the new item.
*/
if (op != DB_CURRENT) {
if ((ret = __bam_ca_di(dbc, PGNO(h), indx, 1)) != 0)
return (ret);
cp->indx = TYPE(h) == P_LBTREE ? indx - O_INDX : indx;
}
/*
* If we've changed the record count, update the tree. There's no
* need to adjust the count if the operation not performed on the
* current record or when the current record was previously deleted.
*/
if (F_ISSET(cp, C_RECNUM) && (op != DB_CURRENT || was_deleted))
if ((ret = __bam_adjust(dbc, 1)) != 0)
return (ret);
/*
* If a Btree leaf page is at least 50% full and we may have added or
* modified a duplicate data item, see if the set of duplicates takes
* up at least 25% of the space on the page. If it does, move it onto
* its own page.
*/
if (dupadjust &&
(ret = __bam_dup_convert(dbc, h, indx - O_INDX, cnt)) != 0)
return (ret);
/* If we've modified a recno file, set the flag. */
if (dbc->dbtype == DB_RECNO)
t->re_modified = 1;
return (ret);
}
/*
* __bam_partsize --
* Figure out how much space a partial data item is in total.
*/
static u_int32_t
__bam_partsize(dbp, op, data, h, indx)
DB *dbp;
u_int32_t op, indx;
DBT *data;
PAGE *h;
{
BKEYDATA *bk;
u_int32_t nbytes;
/*
* If the record doesn't already exist, it's simply the data we're
* provided.
*/
if (op != DB_CURRENT)
return (data->doff + data->size);
/*
* Otherwise, it's the data provided plus any already existing data
* that we're not replacing.
*/
bk = GET_BKEYDATA(dbp, h, indx + (TYPE(h) == P_LBTREE ? O_INDX : 0));
nbytes =
B_TYPE(bk->type) == B_OVERFLOW ? ((BOVERFLOW *)bk)->tlen : bk->len;
return (__db_partsize(nbytes, data));
}
/*
* __bam_build --
* Build the real record for a partial put, or short fixed-length record.
*/
static int
__bam_build(dbc, op, dbt, h, indx, nbytes)
DBC *dbc;
u_int32_t op, indx, nbytes;
DBT *dbt;
PAGE *h;
{
BKEYDATA *bk, tbk;
BOVERFLOW *bo;
BTREE *t;
DB *dbp;
DBT copy, *rdata;
u_int32_t len, tlen;
u_int8_t *p;
int ret;
COMPQUIET(bo, NULL);
dbp = dbc->dbp;
t = dbp->bt_internal;
/* We use the record data return memory, it's only a short-term use. */
rdata = &dbc->my_rdata;
if (rdata->ulen < nbytes) {
if ((ret = __os_realloc(dbp->env,
nbytes, &rdata->data)) != 0) {
rdata->ulen = 0;
rdata->data = NULL;
return (ret);
}
rdata->ulen = nbytes;
}
/*
* We use nul or pad bytes for any part of the record that isn't
* specified; get it over with.
*/
memset(rdata->data,
F_ISSET(dbp, DB_AM_FIXEDLEN) ? t->re_pad : 0, nbytes);
/*
* In the next clauses, we need to do three things: a) set p to point
* to the place at which to copy the user's data, b) set tlen to the
* total length of the record, not including the bytes contributed by
* the user, and c) copy any valid data from an existing record. If
* it's not a partial put (this code is called for both partial puts
* and fixed-length record padding) or it's a new key, we can cut to
* the chase.
*/
if (!F_ISSET(dbt, DB_DBT_PARTIAL) || op != DB_CURRENT) {
p = (u_int8_t *)rdata->data + dbt->doff;
tlen = dbt->doff;
goto user_copy;
}
/* Find the current record. */
if (indx < NUM_ENT(h)) {
bk = GET_BKEYDATA(dbp, h, indx + (TYPE(h) == P_LBTREE ?
O_INDX : 0));
bo = (BOVERFLOW *)bk;
} else {
bk = &tbk;
B_TSET(bk->type, B_KEYDATA);
bk->len = 0;
}
if (B_TYPE(bk->type) == B_OVERFLOW) {
/*
* In the case of an overflow record, we shift things around
* in the current record rather than allocate a separate copy.
*/
memset(&copy, 0, sizeof(copy));
if ((ret = __db_goff(dbp, dbc->thread_info, dbc->txn, &copy,
bo->tlen, bo->pgno, &rdata->data, &rdata->ulen)) != 0)
return (ret);
/* Skip any leading data from the original record. */
tlen = dbt->doff;
p = (u_int8_t *)rdata->data + dbt->doff;
/*
* Copy in any trailing data from the original record.
*
* If the original record was larger than the original offset
* plus the bytes being deleted, there is trailing data in the
* original record we need to preserve. If we aren't deleting
* the same number of bytes as we're inserting, copy it up or
* down, into place.
*
* Use memmove(), the regions may overlap.
*/
if (bo->tlen > dbt->doff + dbt->dlen) {
len = bo->tlen - (dbt->doff + dbt->dlen);
if (dbt->dlen != dbt->size)
memmove(p + dbt->size, p + dbt->dlen, len);
tlen += len;
}
} else {
/* Copy in any leading data from the original record. */
memcpy(rdata->data,
bk->data, dbt->doff > bk->len ? bk->len : dbt->doff);
tlen = dbt->doff;
p = (u_int8_t *)rdata->data + dbt->doff;
/* Copy in any trailing data from the original record. */
len = dbt->doff + dbt->dlen;
if (bk->len > len) {
memcpy(p + dbt->size, bk->data + len, bk->len - len);
tlen += bk->len - len;
}
}
user_copy:
/*
* Copy in the application provided data -- p and tlen must have been
* initialized above.
*/
memcpy(p, dbt->data, dbt->size);
tlen += dbt->size;
/* Set the DBT to reference our new record. */
rdata->size = F_ISSET(dbp, DB_AM_FIXEDLEN) ? t->re_len : tlen;
rdata->dlen = 0;
rdata->doff = 0;
rdata->flags = 0;
*dbt = *rdata;
return (0);
}
/*
* __bam_ritem --
* Replace an item on a page.
*
* PUBLIC: int __bam_ritem __P((DBC *, PAGE *, u_int32_t, DBT *));
*/
int
__bam_ritem(dbc, h, indx, data)
DBC *dbc;
PAGE *h;
u_int32_t indx;
DBT *data;
{
BKEYDATA *bk;
DB *dbp;
DBT orig, repl;
db_indx_t cnt, lo, ln, min, off, prefix, suffix;
int32_t nbytes;
int ret;
db_indx_t *inp;
u_int8_t *p, *t;
dbp = dbc->dbp;
/*
* Replace a single item onto a page. The logic figuring out where
* to insert and whether it fits is handled in the caller. All we do
* here is manage the page shuffling.
*/
bk = GET_BKEYDATA(dbp, h, indx);
/* Log the change. */
if (DBC_LOGGING(dbc)) {
/*
* We might as well check to see if the two data items share
* a common prefix and suffix -- it can save us a lot of log
* message if they're large.
*/
min = data->size < bk->len ? data->size : bk->len;
for (prefix = 0,
p = bk->data, t = data->data;
prefix < min && *p == *t; ++prefix, ++p, ++t)
;
min -= prefix;
for (suffix = 0,
p = (u_int8_t *)bk->data + bk->len - 1,
t = (u_int8_t *)data->data + data->size - 1;
suffix < min && *p == *t; ++suffix, --p, --t)
;
/* We only log the parts of the keys that have changed. */
orig.data = (u_int8_t *)bk->data + prefix;
orig.size = bk->len - (prefix + suffix);
repl.data = (u_int8_t *)data->data + prefix;
repl.size = data->size - (prefix + suffix);
if ((ret = __bam_repl_log(dbp, dbc->txn, &LSN(h), 0, PGNO(h),
&LSN(h), (u_int32_t)indx, (u_int32_t)B_DISSET(bk->type),
&orig, &repl, (u_int32_t)prefix, (u_int32_t)suffix)) != 0)
return (ret);
} else
LSN_NOT_LOGGED(LSN(h));
/*
* Set references to the first in-use byte on the page and the
* first byte of the item being replaced.
*/
inp = P_INP(dbp, h);
p = (u_int8_t *)h + HOFFSET(h);
t = (u_int8_t *)bk;
/*
* If the entry is growing in size, shift the beginning of the data
* part of the page down. If the entry is shrinking in size, shift
* the beginning of the data part of the page up. Use memmove(3),
* the regions overlap.
*/
lo = BKEYDATA_SIZE(bk->len);
ln = (db_indx_t)BKEYDATA_SIZE(data->size);
if (lo != ln) {
nbytes = lo - ln; /* Signed difference. */
if (p == t) /* First index is fast. */
inp[indx] += nbytes;
else { /* Else, shift the page. */
memmove(p + nbytes, p, (size_t)(t - p));
/* Adjust the indices' offsets. */
off = inp[indx];
for (cnt = 0; cnt < NUM_ENT(h); ++cnt)
if (inp[cnt] <= off)
inp[cnt] += nbytes;
}
/* Clean up the page and adjust the item's reference. */
HOFFSET(h) += nbytes;
t += nbytes;
}
/* Copy the new item onto the page. */
bk = (BKEYDATA *)t;
B_TSET(bk->type, B_KEYDATA);
bk->len = data->size;
memcpy(bk->data, data->data, data->size);
return (0);
}
/*
* __bam_dup_check --
* Check to see if the duplicate set at indx should have its own page.
*/
static int
__bam_dup_check(dbc, op, h, indx, sz, cntp)
DBC *dbc;
u_int32_t op;
PAGE *h;
u_int32_t indx, sz;
db_indx_t *cntp;
{
BKEYDATA *bk;
DB *dbp;
db_indx_t cnt, first, *inp;
dbp = dbc->dbp;
inp = P_INP(dbp, h);
/*
* Count the duplicate records and calculate how much room they're
* using on the page.
*/
while (indx > 0 && inp[indx] == inp[indx - P_INDX])
indx -= P_INDX;
/* Count the key once. */
bk = GET_BKEYDATA(dbp, h, indx);
sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
/* Sum up all the data items. */
first = indx;
/*
* Account for the record being inserted. If we are replacing it,
* don't count it twice.
*
* We execute the loop with first == indx to get the size of the
* first record.
*/
cnt = op == DB_CURRENT ? 0 : 1;
for (first = indx;
indx < NUM_ENT(h) && inp[first] == inp[indx];
++cnt, indx += P_INDX) {
bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
sz += B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE;
}
/*
* We have to do these checks when the user is replacing the cursor's
* data item -- if the application replaces a duplicate item with a
* larger data item, it can increase the amount of space used by the
* duplicates, requiring this check. But that means we may have done
* this check when it wasn't a duplicate item after all.
*/
if (cnt == 1)
return (0);
/*
* If this set of duplicates is using more than 25% of the page, move
* them off. The choice of 25% is a WAG, but the value must be small
* enough that we can always split a page without putting duplicates
* on two different pages.
*/
if (sz < dbp->pgsize / 4)
return (0);
*cntp = cnt;
return (1);
}
/*
* __bam_dup_convert --
* Move a set of duplicates off-page and into their own tree.
*/
static int
__bam_dup_convert(dbc, h, indx, cnt)
DBC *dbc;
PAGE *h;
u_int32_t indx, cnt;
{
BKEYDATA *bk;
DB *dbp;
DBT hdr;
DB_MPOOLFILE *mpf;
PAGE *dp;
db_indx_t cpindx, dindx, first, *inp;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
inp = P_INP(dbp, h);
/* Move to the beginning of the dup set. */
while (indx > 0 && inp[indx] == inp[indx - P_INDX])
indx -= P_INDX;
/* Get a new page. */
if ((ret = __db_new(dbc,
dbp->dup_compare == NULL ? P_LRECNO : P_LDUP, &dp)) != 0)
return (ret);
P_INIT(dp, dbp->pgsize, dp->pgno,
PGNO_INVALID, PGNO_INVALID, LEAFLEVEL, TYPE(dp));
/*
* Move this set of duplicates off the page. First points to the first
* key of the first duplicate key/data pair, cnt is the number of pairs
* we're dealing with.
*/
memset(&hdr, 0, sizeof(hdr));
first = indx;
dindx = indx;
cpindx = 0;
do {
/* Move cursors referencing the old entry to the new entry. */
if ((ret = __bam_ca_dup(dbc, first,
PGNO(h), indx, PGNO(dp), cpindx)) != 0)
goto err;
/*
* Copy the entry to the new page. If the off-duplicate page
* If the off-duplicate page is a Btree page (i.e. dup_compare
* will be non-NULL, we use Btree pages for sorted dups,
* and Recno pages for unsorted dups), move all entries
* normally, even deleted ones. If it's a Recno page,
* deleted entries are discarded (if the deleted entry is
* overflow, then free up those pages).
*/
bk = GET_BKEYDATA(dbp, h, dindx + 1);
hdr.data = bk;
hdr.size = B_TYPE(bk->type) == B_KEYDATA ?
BKEYDATA_SIZE(bk->len) : BOVERFLOW_SIZE;
if (dbp->dup_compare == NULL && B_DISSET(bk->type)) {
/*
* Unsorted dups, i.e. recno page, and we have
* a deleted entry, don't move it, but if it was
* an overflow entry, we need to free those pages.
*/
if (B_TYPE(bk->type) == B_OVERFLOW &&
(ret = __db_doff(dbc,
(GET_BOVERFLOW(dbp, h, dindx + 1))->pgno)) != 0)
goto err;
} else {
if ((ret = __db_pitem(
dbc, dp, cpindx, hdr.size, &hdr, NULL)) != 0)
goto err;
++cpindx;
}
/* Delete all but the last reference to the key. */
if (cnt != 1) {
if ((ret = __bam_adjindx(dbc,
h, dindx, first + 1, 0)) != 0)
goto err;
} else
dindx++;
/* Delete the data item. */
if ((ret = __db_ditem(dbc, h, dindx, hdr.size)) != 0)
goto err;
indx += P_INDX;
} while (--cnt);
/* Put in a new data item that points to the duplicates page. */
if ((ret = __bam_ovput(dbc,
B_DUPLICATE, dp->pgno, h, first + 1, NULL)) != 0)
goto err;
/* Adjust cursors for all the above movements. */
ret = __bam_ca_di(dbc,
PGNO(h), first + P_INDX, (int)(first + P_INDX - indx));
err: if ((t_ret = __memp_fput(mpf,
dbc->thread_info, dp, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*
* __bam_ovput --
* Build an item for an off-page duplicates page or overflow page and
* insert it on the page.
*/
static int
__bam_ovput(dbc, type, pgno, h, indx, item)
DBC *dbc;
u_int32_t type, indx;
db_pgno_t pgno;
PAGE *h;
DBT *item;
{
BOVERFLOW bo;
DBT hdr;
int ret;
UMRW_SET(bo.unused1);
B_TSET(bo.type, type);
UMRW_SET(bo.unused2);
/*
* If we're creating an overflow item, do so and acquire the page
* number for it. If we're creating an off-page duplicates tree,
* we are giving the page number as an argument.
*/
if (type == B_OVERFLOW) {
if ((ret = __db_poff(dbc, item, &bo.pgno)) != 0)
return (ret);
bo.tlen = item->size;
} else {
bo.pgno = pgno;
bo.tlen = 0;
}
/* Store the new record on the page. */
memset(&hdr, 0, sizeof(hdr));
hdr.data = &bo;
hdr.size = BOVERFLOW_SIZE;
return (__db_pitem(dbc, h, indx, BOVERFLOW_SIZE, &hdr, NULL));
}

1663
btree/bt_rec.c Normal file

File diff suppressed because it is too large Load Diff

82
btree/bt_reclaim.c Normal file
View File

@@ -0,0 +1,82 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1998,2008 Oracle. All rights reserved.
*
* $Id: bt_reclaim.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
/*
* __bam_reclaim --
* Free a database.
*
* PUBLIC: int __bam_reclaim __P((DB *, DB_THREAD_INFO *, DB_TXN *));
*/
int
__bam_reclaim(dbp, ip, txn)
DB *dbp;
DB_THREAD_INFO *ip;
DB_TXN *txn;
{
DBC *dbc;
DB_LOCK meta_lock;
int ret, t_ret;
/* Acquire a cursor. */
if ((ret = __db_cursor(dbp, ip, txn, &dbc, 0)) != 0)
return (ret);
/* Write lock the metapage for deallocations. */
if ((ret = __db_lget(dbc,
0, PGNO_BASE_MD, DB_LOCK_WRITE, 0, &meta_lock)) != 0)
goto err;
/* Avoid locking every page, we have the handle locked exclusive. */
F_SET(dbc, DBC_DONTLOCK);
/* Walk the tree, freeing pages. */
ret = __bam_traverse(dbc,
DB_LOCK_WRITE, dbc->internal->root, __db_reclaim_callback, NULL);
if ((t_ret = __TLPUT(dbc, meta_lock)) != 0 && ret == 0)
ret = t_ret;
/* Discard the cursor. */
err: if ((t_ret = __dbc_close(dbc)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*
* __bam_truncate --
* Truncate a database.
*
* PUBLIC: int __bam_truncate __P((DBC *, u_int32_t *));
*/
int
__bam_truncate(dbc, countp)
DBC *dbc;
u_int32_t *countp;
{
u_int32_t count;
int ret;
count = 0;
/* Walk the tree, freeing pages. */
ret = __bam_traverse(dbc,
DB_LOCK_WRITE, dbc->internal->root, __db_truncate_callback, &count);
if (countp != NULL)
*countp = count;
return (ret);
}

1356
btree/bt_recno.c Normal file

File diff suppressed because it is too large Load Diff

433
btree/bt_rsearch.c Normal file
View File

@@ -0,0 +1,433 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_rsearch.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_rsearch --
* Search a btree for a record number.
*
* PUBLIC: int __bam_rsearch __P((DBC *, db_recno_t *, u_int32_t, int, int *));
*/
int
__bam_rsearch(dbc, recnop, flags, stop, exactp)
DBC *dbc;
db_recno_t *recnop;
u_int32_t flags;
int stop, *exactp;
{
BINTERNAL *bi;
BTREE_CURSOR *cp;
DB *dbp;
DB_LOCK lock;
DB_MPOOLFILE *mpf;
PAGE *h;
RINTERNAL *ri;
db_indx_t adjust, deloffset, indx, top;
db_lockmode_t lock_mode;
db_pgno_t pg;
db_recno_t recno, t_recno, total;
int ret, stack, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
h = NULL;
BT_STK_CLR(cp);
/*
* There are several ways we search a btree tree. The flags argument
* specifies if we're acquiring read or write locks and if we are
* locking pairs of pages. In addition, if we're adding or deleting
* an item, we have to lock the entire tree, regardless. See btree.h
* for more details.
*
* If write-locking pages, we need to know whether or not to acquire a
* write lock on a page before getting it. This depends on how deep it
* is in tree, which we don't know until we acquire the root page. So,
* if we need to lock the root page we may have to upgrade it later,
* because we won't get the correct lock initially.
*
* Retrieve the root page.
*/
if ((ret = __bam_get_root(dbc, cp->root, stop, flags, &stack)) != 0)
return (ret);
lock_mode = cp->csp->lock_mode;
lock = cp->csp->lock;
h = cp->csp->page;
BT_STK_CLR(cp);
/*
* If appending to the tree, set the record number now -- we have the
* root page locked.
*
* Delete only deletes exact matches, read only returns exact matches.
* Note, this is different from __bam_search(), which returns non-exact
* matches for read.
*
* The record may not exist. We can only return the correct location
* for the record immediately after the last record in the tree, so do
* a fast check now.
*/
total = RE_NREC(h);
if (LF_ISSET(SR_APPEND)) {
*exactp = 0;
*recnop = recno = total + 1;
} else {
recno = *recnop;
if (recno <= total)
*exactp = 1;
else {
*exactp = 0;
if (!LF_ISSET(SR_PAST_EOF) || recno > total + 1) {
/*
* Keep the page locked for serializability.
*
* XXX
* This leaves the root page locked, which will
* eliminate any concurrency. A possible fix
* would be to lock the last leaf page instead.
*/
ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority);
if ((t_ret =
__TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
return (ret == 0 ? DB_NOTFOUND : ret);
}
}
}
/*
* !!!
* Record numbers in the tree are 0-based, but the recno is
* 1-based. All of the calculations below have to take this
* into account.
*/
for (total = 0;;) {
switch (TYPE(h)) {
case P_LBTREE:
case P_LDUP:
recno -= total;
/*
* There may be logically deleted records on the page.
* If there are enough, the record may not exist.
*/
if (TYPE(h) == P_LBTREE) {
adjust = P_INDX;
deloffset = O_INDX;
} else {
adjust = O_INDX;
deloffset = 0;
}
for (t_recno = 0, indx = 0;; indx += adjust) {
if (indx >= NUM_ENT(h)) {
*exactp = 0;
if (!LF_ISSET(SR_PAST_EOF) ||
recno > t_recno + 1) {
ret = __memp_fput(mpf,
dbc->thread_info,
h, dbc->priority);
h = NULL;
if ((t_ret = __TLPUT(dbc,
lock)) != 0 && ret == 0)
ret = t_ret;
if (ret == 0)
ret = DB_NOTFOUND;
goto err;
}
}
if (!B_DISSET(GET_BKEYDATA(dbp, h,
indx + deloffset)->type) &&
++t_recno == recno)
break;
}
/* Correct from 1-based to 0-based for a page offset. */
BT_STK_ENTER(dbp->env,
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
return (0);
case P_IBTREE:
for (indx = 0, top = NUM_ENT(h);;) {
bi = GET_BINTERNAL(dbp, h, indx);
if (++indx == top || total + bi->nrecs >= recno)
break;
total += bi->nrecs;
}
pg = bi->pgno;
break;
case P_LRECNO:
recno -= total;
/* Correct from 1-based to 0-based for a page offset. */
--recno;
BT_STK_ENTER(dbp->env,
cp, h, recno, lock, lock_mode, ret);
if (ret != 0)
goto err;
return (0);
case P_IRECNO:
for (indx = 0, top = NUM_ENT(h);;) {
ri = GET_RINTERNAL(dbp, h, indx);
if (++indx == top || total + ri->nrecs >= recno)
break;
total += ri->nrecs;
}
pg = ri->pgno;
break;
default:
return (__db_pgfmt(dbp->env, h->pgno));
}
--indx;
/* Return if this is the lowest page wanted. */
if (stop == LEVEL(h)) {
BT_STK_ENTER(dbp->env,
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
return (0);
}
if (stack) {
BT_STK_PUSH(dbp->env,
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
h = NULL;
lock_mode = DB_LOCK_WRITE;
if ((ret =
__db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
goto err;
} else {
/*
* Decide if we want to return a pointer to the next
* page in the stack. If we do, write lock it and
* never unlock it.
*/
if ((LF_ISSET(SR_PARENT) &&
(u_int8_t)(stop + 1) >= (u_int8_t)(LEVEL(h) - 1)) ||
(LEVEL(h) - 1) == LEAFLEVEL)
stack = 1;
if ((ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0)
goto err;
h = NULL;
lock_mode = stack &&
LF_ISSET(SR_WRITE) ? DB_LOCK_WRITE : DB_LOCK_READ;
if ((ret = __db_lget(dbc,
LCK_COUPLE_ALWAYS, pg, lock_mode, 0, &lock)) != 0) {
/*
* If we fail, discard the lock we held. This
* is OK because this only happens when we are
* descending the tree holding read-locks.
*/
(void)__LPUT(dbc, lock);
goto err;
}
}
if ((ret = __memp_fget(mpf, &pg,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
goto err;
}
/* NOTREACHED */
err: if (h != NULL && (t_ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
BT_STK_POP(cp);
__bam_stkrel(dbc, 0);
return (ret);
}
/*
* __bam_adjust --
* Adjust the tree after adding or deleting a record.
*
* PUBLIC: int __bam_adjust __P((DBC *, int32_t));
*/
int
__bam_adjust(dbc, adjust)
DBC *dbc;
int32_t adjust;
{
BTREE_CURSOR *cp;
DB *dbp;
DB_MPOOLFILE *mpf;
EPG *epg;
PAGE *h;
db_pgno_t root_pgno;
int ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
root_pgno = cp->root;
/* Update the record counts for the tree. */
for (epg = cp->sp; epg <= cp->csp; ++epg) {
h = epg->page;
if (TYPE(h) == P_IBTREE || TYPE(h) == P_IRECNO) {
if ((ret = __memp_dirty(mpf, &h,
dbc->thread_info, dbc->txn, dbc->priority, 0)) != 0)
return (ret);
epg->page = h;
if (DBC_LOGGING(dbc)) {
if ((ret = __bam_cadjust_log(dbp, dbc->txn,
&LSN(h), 0, PGNO(h), &LSN(h),
(u_int32_t)epg->indx, adjust,
PGNO(h) == root_pgno ?
CAD_UPDATEROOT : 0)) != 0)
return (ret);
} else
LSN_NOT_LOGGED(LSN(h));
if (TYPE(h) == P_IBTREE)
GET_BINTERNAL(dbp, h, epg->indx)->nrecs +=
adjust;
else
GET_RINTERNAL(dbp, h, epg->indx)->nrecs +=
adjust;
if (PGNO(h) == root_pgno)
RE_NREC_ADJ(h, adjust);
}
}
return (0);
}
/*
* __bam_nrecs --
* Return the number of records in the tree.
*
* PUBLIC: int __bam_nrecs __P((DBC *, db_recno_t *));
*/
int
__bam_nrecs(dbc, rep)
DBC *dbc;
db_recno_t *rep;
{
DB *dbp;
DB_LOCK lock;
DB_MPOOLFILE *mpf;
PAGE *h;
db_pgno_t pgno;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
pgno = dbc->internal->root;
if ((ret = __db_lget(dbc, 0, pgno, DB_LOCK_READ, 0, &lock)) != 0)
return (ret);
if ((ret = __memp_fget(mpf, &pgno,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
return (ret);
*rep = RE_NREC(h);
ret = __memp_fput(mpf, dbc->thread_info, h, dbc->priority);
if ((t_ret = __TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
/*
* __bam_total --
* Return the number of records below a page.
*
* PUBLIC: db_recno_t __bam_total __P((DB *, PAGE *));
*/
db_recno_t
__bam_total(dbp, h)
DB *dbp;
PAGE *h;
{
db_recno_t nrecs;
db_indx_t indx, top;
nrecs = 0;
top = NUM_ENT(h);
switch (TYPE(h)) {
case P_LBTREE:
/* Check for logically deleted records. */
for (indx = 0; indx < top; indx += P_INDX)
if (!B_DISSET(
GET_BKEYDATA(dbp, h, indx + O_INDX)->type))
++nrecs;
break;
case P_LDUP:
/* Check for logically deleted records. */
for (indx = 0; indx < top; indx += O_INDX)
if (!B_DISSET(GET_BKEYDATA(dbp, h, indx)->type))
++nrecs;
break;
case P_IBTREE:
for (indx = 0; indx < top; indx += O_INDX)
nrecs += GET_BINTERNAL(dbp, h, indx)->nrecs;
break;
case P_LRECNO:
nrecs = NUM_ENT(h);
break;
case P_IRECNO:
for (indx = 0; indx < top; indx += O_INDX)
nrecs += GET_RINTERNAL(dbp, h, indx)->nrecs;
break;
}
return (nrecs);
}

715
btree/bt_search.c Normal file
View File

@@ -0,0 +1,715 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995, 1996
* Keith Bostic. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Olson.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bt_search.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
/*
* __bam_get_root --
* Fetch the root of a tree and see if we want to keep
* it in the stack.
*
* PUBLIC: int __bam_get_root __P((DBC *, db_pgno_t, int, u_int32_t, int *));
*/
int
__bam_get_root(dbc, pg, slevel, flags, stack)
DBC *dbc;
db_pgno_t pg;
int slevel;
u_int32_t flags;
int *stack;
{
BTREE_CURSOR *cp;
DB *dbp;
DB_LOCK lock;
DB_MPOOLFILE *mpf;
PAGE *h;
db_lockmode_t lock_mode;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
/*
* If write-locking pages, we need to know whether or not to acquire a
* write lock on a page before getting it. This depends on how deep it
* is in tree, which we don't know until we acquire the root page. So,
* if we need to lock the root page we may have to upgrade it later,
* because we won't get the correct lock initially.
*
* Retrieve the root page.
*/
try_again:
*stack = LF_ISSET(SR_STACK) &&
(dbc->dbtype == DB_RECNO || F_ISSET(cp, C_RECNUM));
lock_mode = DB_LOCK_READ;
if (*stack ||
LF_ISSET(SR_DEL) || (LF_ISSET(SR_NEXT) && LF_ISSET(SR_WRITE)))
lock_mode = DB_LOCK_WRITE;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = __memp_fget(mpf, &pg,
dbc->thread_info, dbc->txn, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
}
/*
* Decide if we need to save this page; if we do, write lock it.
* We deliberately don't lock-couple on this call. If the tree
* is tiny, i.e., one page, and two threads are busily updating
* the root page, we're almost guaranteed deadlocks galore, as
* each one gets a read lock and then blocks the other's attempt
* for a write lock.
*/
if (!*stack &&
((LF_ISSET(SR_PARENT) && (u_int8_t)(slevel + 1) >= LEVEL(h)) ||
(LF_ISSET(SR_WRITE) && LEVEL(h) == LEAFLEVEL) ||
(LF_ISSET(SR_START) && slevel == LEVEL(h)))) {
if (!STD_LOCKING(dbc))
goto no_relock;
ret = __memp_fput(mpf, dbc->thread_info, h, dbc->priority);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
return (ret);
lock_mode = DB_LOCK_WRITE;
if ((ret = __db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
return (ret);
if ((ret = __memp_fget(mpf, &pg,
dbc->thread_info, dbc->txn, 0, &h)) != 0) {
/* Did not read it, so we can release the lock */
(void)__LPUT(dbc, lock);
return (ret);
}
if (!((LF_ISSET(SR_PARENT) &&
(u_int8_t)(slevel + 1) >= LEVEL(h)) ||
(LF_ISSET(SR_WRITE) && LEVEL(h) == LEAFLEVEL) ||
(LF_ISSET(SR_START) && slevel == LEVEL(h)))) {
/* Someone else split the root, start over. */
ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
return (ret);
goto try_again;
}
no_relock: *stack = 1;
}
BT_STK_ENTER(dbp->env, cp, h, 0, lock, lock_mode, ret);
return (ret);
}
/*
* __bam_search --
* Search a btree for a key.
*
* PUBLIC: int __bam_search __P((DBC *, db_pgno_t,
* PUBLIC: const DBT *, u_int32_t, int, db_recno_t *, int *));
*/
int
__bam_search(dbc, root_pgno, key, flags, slevel, recnop, exactp)
DBC *dbc;
db_pgno_t root_pgno;
const DBT *key;
u_int32_t flags;
int slevel, *exactp;
db_recno_t *recnop;
{
BTREE *t;
BTREE_CURSOR *cp;
DB *dbp;
DB_LOCK lock;
DB_MPOOLFILE *mpf;
ENV *env;
PAGE *h;
db_indx_t base, i, indx, *inp, lim;
db_lockmode_t lock_mode;
db_pgno_t pg;
db_recno_t recno;
int adjust, cmp, deloffset, ret, set_stack, stack, t_ret;
int (*func) __P((DB *, const DBT *, const DBT *));
dbp = dbc->dbp;
env = dbp->env;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
h = NULL;
t = dbp->bt_internal;
recno = 0;
set_stack = 0;
BT_STK_CLR(cp);
/*
* There are several ways we search a btree tree. The flags argument
* specifies if we're acquiring read or write locks, if we position
* to the first or last item in a set of duplicates, if we return
* deleted items, and if we are locking pairs of pages. In addition,
* if we're modifying record numbers, we have to lock the entire tree
* regardless. See btree.h for more details.
*/
if (root_pgno == PGNO_INVALID)
root_pgno = cp->root;
if ((ret = __bam_get_root(dbc, root_pgno, slevel, flags, &stack)) != 0)
return (ret);
lock_mode = cp->csp->lock_mode;
lock = cp->csp->lock;
h = cp->csp->page;
BT_STK_CLR(cp);
/* Choose a comparison function. */
func = F_ISSET(dbc, DBC_OPD) ?
(dbp->dup_compare == NULL ? __bam_defcmp : dbp->dup_compare) :
t->bt_compare;
for (;;) {
inp = P_INP(dbp, h);
adjust = TYPE(h) == P_LBTREE ? P_INDX : O_INDX;
if (LF_ISSET(SR_MIN | SR_MAX)) {
if (LF_ISSET(SR_MIN) || NUM_ENT(h) == 0)
indx = 0;
else if (TYPE(h) == P_LBTREE)
indx = NUM_ENT(h) - 2;
else
indx = NUM_ENT(h) - 1;
if (LEVEL(h) == LEAFLEVEL ||
(!LF_ISSET(SR_START) && LEVEL(h) == slevel)) {
if (LF_ISSET(SR_NEXT))
goto get_next;
goto found;
}
goto next;
}
/*
* Do a binary search on the current page. If we're searching
* a Btree leaf page, we have to walk the indices in groups of
* two. If we're searching an internal page or a off-page dup
* page, they're an index per page item. If we find an exact
* match on a leaf page, we're done.
*/
DB_BINARY_SEARCH_FOR(base, lim, h, adjust) {
DB_BINARY_SEARCH_INCR(indx, base, lim, adjust);
if ((ret = __bam_cmp(dbp, dbc->thread_info,
dbc->txn, key, h, indx, func, &cmp)) != 0)
goto err;
if (cmp == 0) {
if (LEVEL(h) == LEAFLEVEL ||
(!LF_ISSET(SR_START) &&
LEVEL(h) == slevel)) {
if (LF_ISSET(SR_NEXT))
goto get_next;
goto found;
}
goto next;
}
if (cmp > 0)
DB_BINARY_SEARCH_SHIFT_BASE(indx, base,
lim, adjust);
}
/*
* No match found. Base is the smallest index greater than
* key and may be zero or a last + O_INDX index.
*
* If it's a leaf page or the stopping point,
* return base as the "found" value.
* Delete only deletes exact matches.
*/
if (LEVEL(h) == LEAFLEVEL ||
(!LF_ISSET(SR_START) && LEVEL(h) == slevel)) {
*exactp = 0;
if (LF_ISSET(SR_EXACT)) {
ret = DB_NOTFOUND;
goto err;
}
if (LF_ISSET(SR_STK_ONLY)) {
BT_STK_NUM(env, cp, h, base, ret);
if ((t_ret =
__LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __memp_fput(mpf, dbc->thread_info,
h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
if (LF_ISSET(SR_NEXT)) {
get_next: /*
* The caller could have asked for a NEXT
* at the root if the tree recently collapsed.
*/
if (PGNO(h) == root_pgno) {
ret = DB_NOTFOUND;
goto err;
}
/*
* Save the root of the subtree
* and drop the rest of the subtree
* and search down again starting at
* the next child.
*/
if ((ret = __LPUT(dbc, lock)) != 0)
goto err;
if ((ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0)
goto err;
h = NULL;
LF_SET(SR_MIN);
LF_CLR(SR_NEXT);
indx = cp->sp->indx + 1;
if (indx == NUM_ENT(cp->sp->page)) {
ret = DB_NOTFOUND;
cp->csp++;
goto err;
}
h = cp->sp->page;
cp->sp->page = NULL;
lock = cp->sp->lock;
LOCK_INIT(cp->sp->lock);
if ((ret = __bam_stkrel(dbc, STK_NOLOCK)) != 0)
goto err;
stack = 1;
goto next;
}
/*
* !!!
* Possibly returning a deleted record -- DB_SET_RANGE,
* DB_KEYFIRST and DB_KEYLAST don't require an exact
* match, and we don't want to walk multiple pages here
* to find an undeleted record. This is handled by the
* calling routine.
*/
if (LF_ISSET(SR_DEL) && cp->csp == cp->sp)
cp->csp++;
BT_STK_ENTER(env, cp, h, base, lock, lock_mode, ret);
if (ret != 0)
goto err;
return (0);
}
/*
* If it's not a leaf page, record the internal page (which is
* a parent page for the key). Decrement the base by 1 if it's
* non-zero so that if a split later occurs, the inserted page
* will be to the right of the saved page.
*/
indx = base > 0 ? base - O_INDX : base;
/*
* If we're trying to calculate the record number, sum up
* all the record numbers on this page up to the indx point.
*/
next: if (recnop != NULL)
for (i = 0; i < indx; ++i)
recno += GET_BINTERNAL(dbp, h, i)->nrecs;
pg = GET_BINTERNAL(dbp, h, indx)->pgno;
/* See if we are at the level to start stacking. */
if (LF_ISSET(SR_START) && slevel == LEVEL(h))
stack = 1;
if (LF_ISSET(SR_STK_ONLY)) {
if (slevel == LEVEL(h)) {
BT_STK_NUM(env, cp, h, indx, ret);
if ((t_ret =
__LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __memp_fput(mpf, dbc->thread_info,
h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}
BT_STK_NUMPUSH(env, cp, h, indx, ret);
(void)__memp_fput(mpf,
dbc->thread_info, h, dbc->priority);
h = NULL;
if ((ret = __db_lget(dbc,
LCK_COUPLE_ALWAYS, pg, lock_mode, 0, &lock)) != 0) {
/*
* Discard our lock and return on failure. This
* is OK because it only happens when descending
* the tree holding read-locks.
*/
(void)__LPUT(dbc, lock);
return (ret);
}
} else if (stack) {
/* Return if this is the lowest page wanted. */
if (LF_ISSET(SR_PARENT) && slevel == LEVEL(h)) {
BT_STK_ENTER(env,
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
return (0);
}
if (LF_ISSET(SR_DEL) && NUM_ENT(h) > 1) {
/*
* There was a page with a singleton pointer
* to a non-empty subtree.
*/
cp->csp--;
if ((ret = __bam_stkrel(dbc, STK_NOLOCK)) != 0)
goto err;
set_stack = stack = 0;
goto do_del;
}
BT_STK_PUSH(env,
cp, h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
h = NULL;
lock_mode = DB_LOCK_WRITE;
if ((ret =
__db_lget(dbc, 0, pg, lock_mode, 0, &lock)) != 0)
goto err;
} else {
/*
* Decide if we want to return a reference to the next
* page in the return stack. If so, lock it and never
* unlock it. We will want to stack things on the
* next iteration. The stack variable cannot be
* set until we leave this clause.
*/
if ((LF_ISSET(SR_PARENT) &&
(u_int8_t)(slevel + 1) >= (LEVEL(h) - 1)) ||
(LEVEL(h) - 1) == LEAFLEVEL)
set_stack = 1;
/*
* Returning a subtree. See if we have hit the start
* point if so save the parent and set stack.
* Otherwise free the parent and temporarily
* save this one.
* For SR_DEL we need to find a page with 1 entry.
* For SR_NEXT we want find the minimal subtree
* that contains the key and the next page.
* We save pages as long as we are at the right
* edge of the subtree. When we leave the right
* edge, then drop the subtree.
*/
if (!LF_ISSET(SR_DEL | SR_NEXT)) {
if ((ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0)
goto err;
goto lock_next;
}
if ((LF_ISSET(SR_DEL) && NUM_ENT(h) == 1)) {
/*
* We are pushing the things on the stack,
* set the stack variable now to indicate this
* has happened.
*/
stack = set_stack = 1;
LF_SET(SR_WRITE);
/* Push the parent. */
cp->csp++;
/* Push this node. */
BT_STK_PUSH(env, cp, h,
indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
LOCK_INIT(lock);
} else {
/*
* See if we want to save the tree so far.
* If we are looking for the next key,
* then we must save this node if we are
* at the end of the page. If not then
* discard anything we have saved so far.
* For delete only keep one node until
* we find a singleton.
*/
do_del: if (cp->csp->page != NULL) {
if (LF_ISSET(SR_NEXT) &&
indx == NUM_ENT(h) - 1)
cp->csp++;
else if ((ret =
__bam_stkrel(dbc, STK_NOLOCK)) != 0)
goto err;
}
/* Save this node. */
BT_STK_ENTER(env, cp,
h, indx, lock, lock_mode, ret);
if (ret != 0)
goto err;
LOCK_INIT(lock);
}
lock_next: h = NULL;
if (set_stack && LF_ISSET(SR_WRITE))
lock_mode = DB_LOCK_WRITE;
if ((ret = __db_lget(dbc,
LCK_COUPLE_ALWAYS, pg, lock_mode, 0, &lock)) != 0) {
/*
* If we fail, discard the lock we held. This
* is OK because this only happens when we are
* descending the tree holding read-locks.
*/
(void)__LPUT(dbc, lock);
if (LF_ISSET(SR_DEL | SR_NEXT) && !stack)
cp->csp++;
goto err;
}
stack = set_stack;
}
if ((ret = __memp_fget(mpf, &pg,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
goto err;
}
/* NOTREACHED */
found: *exactp = 1;
/*
* If we got here, we know that we have a Btree leaf or off-page
* duplicates page. If it's a Btree leaf page, we have to handle
* on-page duplicates.
*
* If there are duplicates, go to the first/last one. This is
* safe because we know that we're not going to leave the page,
* all duplicate sets that are not on overflow pages exist on a
* single leaf page.
*/
if (TYPE(h) == P_LBTREE && NUM_ENT(h) > P_INDX) {
if (LF_ISSET(SR_DUPLAST))
while (indx < (db_indx_t)(NUM_ENT(h) - P_INDX) &&
inp[indx] == inp[indx + P_INDX])
indx += P_INDX;
else if (LF_ISSET(SR_DUPFIRST))
while (indx > 0 &&
inp[indx] == inp[indx - P_INDX])
indx -= P_INDX;
}
/*
* Now check if we are allowed to return deleted items; if not, then
* find the next (or previous) non-deleted duplicate entry. (We do
* not move from the original found key on the basis of the SR_DELNO
* flag.)
*/
DB_ASSERT(env, recnop == NULL || LF_ISSET(SR_DELNO));
if (LF_ISSET(SR_DELNO)) {
deloffset = TYPE(h) == P_LBTREE ? O_INDX : 0;
if (LF_ISSET(SR_DUPLAST))
while (B_DISSET(GET_BKEYDATA(dbp,
h, indx + deloffset)->type) && indx > 0 &&
inp[indx] == inp[indx - adjust])
indx -= adjust;
else
while (B_DISSET(GET_BKEYDATA(dbp,
h, indx + deloffset)->type) &&
indx < (db_indx_t)(NUM_ENT(h) - adjust) &&
inp[indx] == inp[indx + adjust])
indx += adjust;
/*
* If we weren't able to find a non-deleted duplicate, return
* DB_NOTFOUND.
*/
if (B_DISSET(GET_BKEYDATA(dbp, h, indx + deloffset)->type)) {
ret = DB_NOTFOUND;
goto err;
}
/*
* Increment the record counter to point to the found element.
* Ignore any deleted key/data pairs. There doesn't need to
* be any correction for duplicates, as Btree doesn't support
* duplicates and record numbers in the same tree.
*/
if (recnop != NULL) {
DB_ASSERT(env, TYPE(h) == P_LBTREE);
for (i = 0; i < indx; i += P_INDX)
if (!B_DISSET(
GET_BKEYDATA(dbp, h, i + O_INDX)->type))
++recno;
/* Correct the number for a 0-base. */
*recnop = recno + 1;
}
}
if (LF_ISSET(SR_STK_ONLY)) {
BT_STK_NUM(env, cp, h, indx, ret);
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
} else {
if (LF_ISSET(SR_DEL) && cp->csp == cp->sp)
cp->csp++;
BT_STK_ENTER(env, cp, h, indx, lock, lock_mode, ret);
}
if (ret != 0)
goto err;
return (0);
err: if (h != NULL && (t_ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
/* Keep any not-found page locked for serializability. */
if ((t_ret = __TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
BT_STK_POP(cp);
__bam_stkrel(dbc, 0);
return (ret);
}
/*
* __bam_stkrel --
* Release all pages currently held in the stack.
*
* PUBLIC: int __bam_stkrel __P((DBC *, u_int32_t));
*/
int
__bam_stkrel(dbc, flags)
DBC *dbc;
u_int32_t flags;
{
BTREE_CURSOR *cp;
DB *dbp;
DB_MPOOLFILE *mpf;
EPG *epg;
int ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
cp = (BTREE_CURSOR *)dbc->internal;
/*
* Release inner pages first.
*
* The caller must be sure that setting STK_NOLOCK will not effect
* either serializability or recoverability.
*/
for (ret = 0, epg = cp->sp; epg <= cp->csp; ++epg) {
if (epg->page != NULL) {
if (LF_ISSET(STK_CLRDBC) && cp->page == epg->page) {
cp->page = NULL;
LOCK_INIT(cp->lock);
}
if ((t_ret = __memp_fput(mpf, dbc->thread_info,
epg->page, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
/*
* XXX
* Temporary fix for #3243 -- under certain deadlock
* conditions we call here again and re-free the page.
* The correct fix is to never release a stack that
* doesn't hold items.
*/
epg->page = NULL;
}
/*
* We set this if we need to release our pins,
* but are not logically ready to have the pages
* visible.
*/
if (LF_ISSET(STK_PGONLY))
continue;
if (LF_ISSET(STK_NOLOCK)) {
if ((t_ret = __LPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
} else
if ((t_ret = __TLPUT(dbc, epg->lock)) != 0 && ret == 0)
ret = t_ret;
}
/* Clear the stack, all pages have been released. */
if (!LF_ISSET(STK_PGONLY))
BT_STK_CLR(cp);
return (ret);
}
/*
* __bam_stkgrow --
* Grow the stack.
*
* PUBLIC: int __bam_stkgrow __P((ENV *, BTREE_CURSOR *));
*/
int
__bam_stkgrow(env, cp)
ENV *env;
BTREE_CURSOR *cp;
{
EPG *p;
size_t entries;
int ret;
entries = cp->esp - cp->sp;
if ((ret = __os_calloc(env, entries * 2, sizeof(EPG), &p)) != 0)
return (ret);
memcpy(p, cp->sp, entries * sizeof(EPG));
if (cp->sp != cp->stack)
__os_free(env, cp->sp);
cp->sp = p;
cp->csp = p + entries;
cp->esp = p + entries * 2;
return (0);
}

1228
btree/bt_split.c Normal file

File diff suppressed because it is too large Load Diff

656
btree/bt_stat.c Normal file
View File

@@ -0,0 +1,656 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: bt_stat.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/lock.h"
#include "dbinc/mp.h"
#ifdef HAVE_STATISTICS
/*
* __bam_stat --
* Gather/print the btree statistics
*
* PUBLIC: int __bam_stat __P((DBC *, void *, u_int32_t));
*/
int
__bam_stat(dbc, spp, flags)
DBC *dbc;
void *spp;
u_int32_t flags;
{
BTMETA *meta;
BTREE *t;
BTREE_CURSOR *cp;
DB *dbp;
DB_BTREE_STAT *sp;
DB_LOCK lock, metalock;
DB_MPOOLFILE *mpf;
ENV *env;
PAGE *h;
db_pgno_t pgno;
int ret, t_ret, write_meta;
dbp = dbc->dbp;
env = dbp->env;
meta = NULL;
t = dbp->bt_internal;
sp = NULL;
LOCK_INIT(metalock);
LOCK_INIT(lock);
mpf = dbp->mpf;
h = NULL;
ret = write_meta = 0;
cp = (BTREE_CURSOR *)dbc->internal;
/* Allocate and clear the structure. */
if ((ret = __os_umalloc(env, sizeof(*sp), &sp)) != 0)
goto err;
memset(sp, 0, sizeof(*sp));
/* Get the metadata page for the entire database. */
pgno = PGNO_BASE_MD;
if ((ret = __db_lget(dbc, 0, pgno, DB_LOCK_READ, 0, &metalock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pgno,
dbc->thread_info, dbc->txn, 0, &meta)) != 0)
goto err;
if (flags == DB_FAST_STAT)
goto meta_only;
/* Walk the metadata free list, counting pages. */
for (sp->bt_free = 0, pgno = meta->dbmeta.free; pgno != PGNO_INVALID;) {
++sp->bt_free;
if ((ret = __memp_fget(mpf, &pgno,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
goto err;
pgno = h->next_pgno;
if ((ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0)
goto err;
h = NULL;
}
/* Get the root page. */
pgno = cp->root;
if ((ret = __db_lget(dbc, 0, pgno, DB_LOCK_READ, 0, &lock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &pgno,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
goto err;
/* Get the levels from the root page. */
sp->bt_levels = h->level;
/* Discard the root page. */
ret = __memp_fput(mpf, dbc->thread_info, h, dbc->priority);
h = NULL;
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
/* Walk the tree. */
if ((ret = __bam_traverse(dbc,
DB_LOCK_READ, cp->root, __bam_stat_callback, sp)) != 0)
goto err;
/*
* Get the subdatabase metadata page if it's not the same as the
* one we already have.
*/
write_meta = !F_ISSET(dbp, DB_AM_RDONLY) &&
(!MULTIVERSION(dbp) || dbc->txn != NULL);
meta_only:
if (t->bt_meta != PGNO_BASE_MD || write_meta) {
ret = __memp_fput(mpf, dbc->thread_info, meta, dbc->priority);
meta = NULL;
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0)
goto err;
if ((ret = __db_lget(dbc,
0, t->bt_meta, write_meta ? DB_LOCK_WRITE : DB_LOCK_READ,
0, &metalock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &t->bt_meta,
dbc->thread_info, dbc->txn,
write_meta ? DB_MPOOL_DIRTY : 0, &meta)) != 0)
goto err;
}
if (flags == DB_FAST_STAT) {
if (dbp->type == DB_RECNO ||
(dbp->type == DB_BTREE && F_ISSET(dbp, DB_AM_RECNUM))) {
if ((ret = __db_lget(dbc, 0,
cp->root, DB_LOCK_READ, 0, &lock)) != 0)
goto err;
if ((ret = __memp_fget(mpf, &cp->root,
dbc->thread_info, dbc->txn, 0, &h)) != 0)
goto err;
sp->bt_nkeys = RE_NREC(h);
} else
sp->bt_nkeys = meta->dbmeta.key_count;
sp->bt_ndata = dbp->type == DB_RECNO ?
sp->bt_nkeys : meta->dbmeta.record_count;
}
/* Get metadata page statistics. */
sp->bt_metaflags = meta->dbmeta.flags;
sp->bt_minkey = meta->minkey;
sp->bt_re_len = meta->re_len;
sp->bt_re_pad = meta->re_pad;
/*
* Don't take the page number from the meta-data page -- that value is
* only maintained in the primary database, we may have been called on
* a subdatabase. (Yes, I read the primary database meta-data page
* earlier in this function, but I'm asking the underlying cache so the
* code for the Hash and Btree methods is the same.)
*/
if ((ret = __memp_get_last_pgno(dbp->mpf, &pgno)) != 0)
goto err;
sp->bt_pagecnt = pgno + 1;
sp->bt_pagesize = meta->dbmeta.pagesize;
sp->bt_magic = meta->dbmeta.magic;
sp->bt_version = meta->dbmeta.version;
if (write_meta != 0) {
meta->dbmeta.key_count = sp->bt_nkeys;
meta->dbmeta.record_count = sp->bt_ndata;
}
*(DB_BTREE_STAT **)spp = sp;
err: /* Discard the second page. */
if ((t_ret = __LPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
if (h != NULL && (t_ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
/* Discard the metadata page. */
if ((t_ret = __LPUT(dbc, metalock)) != 0 && ret == 0)
ret = t_ret;
if (meta != NULL && (t_ret = __memp_fput(mpf,
dbc->thread_info, meta, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if (ret != 0 && sp != NULL) {
__os_ufree(env, sp);
*(DB_BTREE_STAT **)spp = NULL;
}
return (ret);
}
/*
* __bam_stat_print --
* Display btree/recno statistics.
*
* PUBLIC: int __bam_stat_print __P((DBC *, u_int32_t));
*/
int
__bam_stat_print(dbc, flags)
DBC *dbc;
u_int32_t flags;
{
static const FN fn[] = {
{ BTM_DUP, "duplicates" },
{ BTM_RECNO, "recno" },
{ BTM_RECNUM, "record-numbers" },
{ BTM_FIXEDLEN, "fixed-length" },
{ BTM_RENUMBER, "renumber" },
{ BTM_SUBDB, "multiple-databases" },
{ BTM_DUPSORT, "sorted duplicates" },
{ 0, NULL }
};
DB *dbp;
DB_BTREE_STAT *sp;
ENV *env;
int lorder, ret;
const char *s;
dbp = dbc->dbp;
env = dbp->env;
if ((ret = __bam_stat(dbc, &sp, LF_ISSET(DB_FAST_STAT))) != 0)
return (ret);
if (LF_ISSET(DB_STAT_ALL)) {
__db_msg(env, "%s", DB_GLOBAL(db_line));
__db_msg(env, "Default Btree/Recno database information:");
}
__db_msg(env, "%lx\tBtree magic number", (u_long)sp->bt_magic);
__db_msg(env, "%lu\tBtree version number", (u_long)sp->bt_version);
(void)__db_get_lorder(dbp, &lorder);
switch (lorder) {
case 1234:
s = "Little-endian";
break;
case 4321:
s = "Big-endian";
break;
default:
s = "Unrecognized byte order";
break;
}
__db_msg(env, "%s\tByte order", s);
__db_prflags(env, NULL, sp->bt_metaflags, fn, NULL, "\tFlags");
if (dbp->type == DB_BTREE)
__db_dl(env, "Minimum keys per-page", (u_long)sp->bt_minkey);
if (dbp->type == DB_RECNO) {
__db_dl(env,
"Fixed-length record size", (u_long)sp->bt_re_len);
__db_msg(env,
"%#x\tFixed-length record pad", (u_int)sp->bt_re_pad);
}
__db_dl(env,
"Underlying database page size", (u_long)sp->bt_pagesize);
if (dbp->type == DB_BTREE)
__db_dl(env, "Overflow key/data size",
((BTREE_CURSOR *)dbc->internal)->ovflsize);
__db_dl(env, "Number of levels in the tree", (u_long)sp->bt_levels);
__db_dl(env, dbp->type == DB_BTREE ?
"Number of unique keys in the tree" :
"Number of records in the tree", (u_long)sp->bt_nkeys);
__db_dl(env,
"Number of data items in the tree", (u_long)sp->bt_ndata);
__db_dl(env,
"Number of tree internal pages", (u_long)sp->bt_int_pg);
__db_dl_pct(env,
"Number of bytes free in tree internal pages",
(u_long)sp->bt_int_pgfree,
DB_PCT_PG(sp->bt_int_pgfree, sp->bt_int_pg, sp->bt_pagesize), "ff");
__db_dl(env,
"Number of tree leaf pages", (u_long)sp->bt_leaf_pg);
__db_dl_pct(env, "Number of bytes free in tree leaf pages",
(u_long)sp->bt_leaf_pgfree, DB_PCT_PG(
sp->bt_leaf_pgfree, sp->bt_leaf_pg, sp->bt_pagesize), "ff");
__db_dl(env,
"Number of tree duplicate pages", (u_long)sp->bt_dup_pg);
__db_dl_pct(env,
"Number of bytes free in tree duplicate pages",
(u_long)sp->bt_dup_pgfree,
DB_PCT_PG(sp->bt_dup_pgfree, sp->bt_dup_pg, sp->bt_pagesize), "ff");
__db_dl(env,
"Number of tree overflow pages", (u_long)sp->bt_over_pg);
__db_dl_pct(env, "Number of bytes free in tree overflow pages",
(u_long)sp->bt_over_pgfree, DB_PCT_PG(
sp->bt_over_pgfree, sp->bt_over_pg, sp->bt_pagesize), "ff");
__db_dl(env, "Number of empty pages", (u_long)sp->bt_empty_pg);
__db_dl(env, "Number of pages on the free list", (u_long)sp->bt_free);
__os_ufree(env, sp);
return (0);
}
/*
* __bam_stat_callback --
* Statistics callback.
*
* PUBLIC: int __bam_stat_callback __P((DBC *, PAGE *, void *, int *));
*/
int
__bam_stat_callback(dbc, h, cookie, putp)
DBC *dbc;
PAGE *h;
void *cookie;
int *putp;
{
DB *dbp;
DB_BTREE_STAT *sp;
db_indx_t indx, *inp, top;
u_int8_t type;
dbp = dbc->dbp;
sp = cookie;
*putp = 0;
top = NUM_ENT(h);
inp = P_INP(dbp, h);
switch (TYPE(h)) {
case P_IBTREE:
case P_IRECNO:
++sp->bt_int_pg;
sp->bt_int_pgfree += P_FREESPACE(dbp, h);
break;
case P_LBTREE:
if (top == 0)
++sp->bt_empty_pg;
/* Correct for on-page duplicates and deleted items. */
for (indx = 0; indx < top; indx += P_INDX) {
type = GET_BKEYDATA(dbp, h, indx + O_INDX)->type;
/* Ignore deleted items. */
if (B_DISSET(type))
continue;
/* Ignore duplicate keys. */
if (indx + P_INDX >= top ||
inp[indx] != inp[indx + P_INDX])
++sp->bt_nkeys;
/* Ignore off-page duplicates. */
if (B_TYPE(type) != B_DUPLICATE)
++sp->bt_ndata;
}
++sp->bt_leaf_pg;
sp->bt_leaf_pgfree += P_FREESPACE(dbp, h);
break;
case P_LRECNO:
if (top == 0)
++sp->bt_empty_pg;
/*
* If walking a recno tree, then each of these items is a key.
* Otherwise, we're walking an off-page duplicate set.
*/
if (dbp->type == DB_RECNO) {
/*
* Correct for deleted items in non-renumbering Recno
* databases.
*/
if (F_ISSET(dbp, DB_AM_RENUMBER)) {
sp->bt_nkeys += top;
sp->bt_ndata += top;
} else
for (indx = 0; indx < top; indx += O_INDX) {
type = GET_BKEYDATA(dbp, h, indx)->type;
if (!B_DISSET(type)) {
++sp->bt_ndata;
++sp->bt_nkeys;
}
}
++sp->bt_leaf_pg;
sp->bt_leaf_pgfree += P_FREESPACE(dbp, h);
} else {
sp->bt_ndata += top;
++sp->bt_dup_pg;
sp->bt_dup_pgfree += P_FREESPACE(dbp, h);
}
break;
case P_LDUP:
if (top == 0)
++sp->bt_empty_pg;
/* Correct for deleted items. */
for (indx = 0; indx < top; indx += O_INDX)
if (!B_DISSET(GET_BKEYDATA(dbp, h, indx)->type))
++sp->bt_ndata;
++sp->bt_dup_pg;
sp->bt_dup_pgfree += P_FREESPACE(dbp, h);
break;
case P_OVERFLOW:
++sp->bt_over_pg;
sp->bt_over_pgfree += P_OVFLSPACE(dbp, dbp->pgsize, h);
break;
default:
return (__db_pgfmt(dbp->env, h->pgno));
}
return (0);
}
/*
* __bam_print_cursor --
* Display the current internal cursor.
*
* PUBLIC: void __bam_print_cursor __P((DBC *));
*/
void
__bam_print_cursor(dbc)
DBC *dbc;
{
static const FN fn[] = {
{ C_DELETED, "C_DELETED" },
{ C_RECNUM, "C_RECNUM" },
{ C_RENUMBER, "C_RENUMBER" },
{ 0, NULL }
};
ENV *env;
BTREE_CURSOR *cp;
env = dbc->env;
cp = (BTREE_CURSOR *)dbc->internal;
STAT_ULONG("Overflow size", cp->ovflsize);
if (dbc->dbtype == DB_RECNO)
STAT_ULONG("Recno", cp->recno);
STAT_ULONG("Order", cp->order);
__db_prflags(env, NULL, cp->flags, fn, NULL, "\tInternal Flags");
}
#else /* !HAVE_STATISTICS */
int
__bam_stat(dbc, spp, flags)
DBC *dbc;
void *spp;
u_int32_t flags;
{
COMPQUIET(spp, NULL);
COMPQUIET(flags, 0);
return (__db_stat_not_built(dbc->env));
}
int
__bam_stat_print(dbc, flags)
DBC *dbc;
u_int32_t flags;
{
COMPQUIET(flags, 0);
return (__db_stat_not_built(dbc->env));
}
#endif
#ifndef HAVE_BREW
/*
* __bam_key_range --
* Return proportion of keys relative to given key. The numbers are
* slightly skewed due to on page duplicates.
*
* PUBLIC: int __bam_key_range __P((DBC *, DBT *, DB_KEY_RANGE *, u_int32_t));
*/
int
__bam_key_range(dbc, dbt, kp, flags)
DBC *dbc;
DBT *dbt;
DB_KEY_RANGE *kp;
u_int32_t flags;
{
BTREE_CURSOR *cp;
EPG *sp;
double factor;
int exact, ret;
COMPQUIET(flags, 0);
if ((ret = __bam_search(dbc, PGNO_INVALID,
dbt, SR_STK_ONLY, 1, NULL, &exact)) != 0)
return (ret);
cp = (BTREE_CURSOR *)dbc->internal;
kp->less = kp->greater = 0.0;
factor = 1.0;
/* Correct the leaf page. */
cp->csp->entries /= 2;
cp->csp->indx /= 2;
for (sp = cp->sp; sp <= cp->csp; ++sp) {
/*
* At each level we know that pages greater than indx contain
* keys greater than what we are looking for and those less
* than indx are less than. The one pointed to by indx may
* have some less, some greater or even equal. If indx is
* equal to the number of entries, then the key is out of range
* and everything is less.
*/
if (sp->indx == 0)
kp->greater += factor * (sp->entries - 1)/sp->entries;
else if (sp->indx == sp->entries)
kp->less += factor;
else {
kp->less += factor * sp->indx / sp->entries;
kp->greater += factor *
((sp->entries - sp->indx) - 1) / sp->entries;
}
factor *= 1.0/sp->entries;
}
/*
* If there was an exact match then assign 1 n'th to the key itself.
* Otherwise that factor belongs to those greater than the key, unless
* the key was out of range.
*/
if (exact)
kp->equal = factor;
else {
if (kp->less != 1)
kp->greater += factor;
kp->equal = 0;
}
BT_STK_CLR(cp);
return (0);
}
#endif
/*
* __bam_traverse --
* Walk a Btree database.
*
* PUBLIC: int __bam_traverse __P((DBC *, db_lockmode_t,
* PUBLIC: db_pgno_t, int (*)(DBC *, PAGE *, void *, int *), void *));
*/
int
__bam_traverse(dbc, mode, root_pgno, callback, cookie)
DBC *dbc;
db_lockmode_t mode;
db_pgno_t root_pgno;
int (*callback)__P((DBC *, PAGE *, void *, int *));
void *cookie;
{
BINTERNAL *bi;
BKEYDATA *bk;
DB *dbp;
DB_LOCK lock;
DB_MPOOLFILE *mpf;
PAGE *h;
RINTERNAL *ri;
db_indx_t indx, *inp;
int already_put, ret, t_ret;
dbp = dbc->dbp;
mpf = dbp->mpf;
already_put = 0;
if ((ret = __db_lget(dbc, 0, root_pgno, mode, 0, &lock)) != 0)
return (ret);
if ((ret = __memp_fget(mpf, &root_pgno,
dbc->thread_info, dbc->txn, 0, &h)) != 0) {
(void)__TLPUT(dbc, lock);
return (ret);
}
switch (TYPE(h)) {
case P_IBTREE:
for (indx = 0; indx < NUM_ENT(h); indx += O_INDX) {
bi = GET_BINTERNAL(dbp, h, indx);
if (B_TYPE(bi->type) == B_OVERFLOW &&
(ret = __db_traverse_big(dbc,
((BOVERFLOW *)bi->data)->pgno,
callback, cookie)) != 0)
goto err;
if ((ret = __bam_traverse(
dbc, mode, bi->pgno, callback, cookie)) != 0)
goto err;
}
break;
case P_IRECNO:
for (indx = 0; indx < NUM_ENT(h); indx += O_INDX) {
ri = GET_RINTERNAL(dbp, h, indx);
if ((ret = __bam_traverse(
dbc, mode, ri->pgno, callback, cookie)) != 0)
goto err;
}
break;
case P_LBTREE:
inp = P_INP(dbp, h);
for (indx = 0; indx < NUM_ENT(h); indx += P_INDX) {
bk = GET_BKEYDATA(dbp, h, indx);
if (B_TYPE(bk->type) == B_OVERFLOW &&
(indx + P_INDX >= NUM_ENT(h) ||
inp[indx] != inp[indx + P_INDX])) {
if ((ret = __db_traverse_big(dbc,
GET_BOVERFLOW(dbp, h, indx)->pgno,
callback, cookie)) != 0)
goto err;
}
bk = GET_BKEYDATA(dbp, h, indx + O_INDX);
if (B_TYPE(bk->type) == B_DUPLICATE &&
(ret = __bam_traverse(dbc, mode,
GET_BOVERFLOW(dbp, h, indx + O_INDX)->pgno,
callback, cookie)) != 0)
goto err;
if (B_TYPE(bk->type) == B_OVERFLOW &&
(ret = __db_traverse_big(dbc,
GET_BOVERFLOW(dbp, h, indx + O_INDX)->pgno,
callback, cookie)) != 0)
goto err;
}
break;
case P_LDUP:
case P_LRECNO:
for (indx = 0; indx < NUM_ENT(h); indx += O_INDX) {
bk = GET_BKEYDATA(dbp, h, indx);
if (B_TYPE(bk->type) == B_OVERFLOW &&
(ret = __db_traverse_big(dbc,
GET_BOVERFLOW(dbp, h, indx)->pgno,
callback, cookie)) != 0)
goto err;
}
break;
default:
return (__db_pgfmt(dbp->env, h->pgno));
}
ret = callback(dbc, h, cookie, &already_put);
err: if (!already_put && (t_ret = __memp_fput(mpf,
dbc->thread_info, h, dbc->priority)) != 0 && ret == 0)
ret = t_ret;
if ((t_ret = __TLPUT(dbc, lock)) != 0 && ret == 0)
ret = t_ret;
return (ret);
}

153
btree/bt_upgrade.c Normal file
View File

@@ -0,0 +1,153 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: bt_upgrade.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/db_upgrade.h"
#include "dbinc/btree.h"
/*
* __bam_30_btreemeta --
* Upgrade the metadata pages from version 6 to version 7.
*
* PUBLIC: int __bam_30_btreemeta __P((DB *, char *, u_int8_t *));
*/
int
__bam_30_btreemeta(dbp, real_name, buf)
DB *dbp;
char *real_name;
u_int8_t *buf;
{
BTMETA2X *oldmeta;
BTMETA30 *newmeta;
ENV *env;
int ret;
env = dbp->env;
newmeta = (BTMETA30 *)buf;
oldmeta = (BTMETA2X *)buf;
/*
* Move things from the end up, so we do not overwrite things.
* We are going to create a new uid, so we can move the stuff
* at the end of the structure first, overwriting the uid.
*/
newmeta->re_pad = oldmeta->re_pad;
newmeta->re_len = oldmeta->re_len;
newmeta->minkey = oldmeta->minkey;
newmeta->maxkey = oldmeta->maxkey;
newmeta->dbmeta.free = oldmeta->free;
newmeta->dbmeta.flags = oldmeta->flags;
newmeta->dbmeta.type = P_BTREEMETA;
newmeta->dbmeta.version = 7;
/* Replace the unique ID. */
if ((ret = __os_fileid(env, real_name, 1, buf + 36)) != 0)
return (ret);
newmeta->root = 1;
return (0);
}
/*
* __bam_31_btreemeta --
* Upgrade the database from version 7 to version 8.
*
* PUBLIC: int __bam_31_btreemeta
* PUBLIC: __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *));
*/
int
__bam_31_btreemeta(dbp, real_name, flags, fhp, h, dirtyp)
DB *dbp;
char *real_name;
u_int32_t flags;
DB_FH *fhp;
PAGE *h;
int *dirtyp;
{
BTMETA30 *oldmeta;
BTMETA31 *newmeta;
COMPQUIET(dbp, NULL);
COMPQUIET(real_name, NULL);
COMPQUIET(fhp, NULL);
newmeta = (BTMETA31 *)h;
oldmeta = (BTMETA30 *)h;
/*
* Copy the effected fields down the page.
* The fields may overlap each other so we
* start at the bottom and use memmove.
*/
newmeta->root = oldmeta->root;
newmeta->re_pad = oldmeta->re_pad;
newmeta->re_len = oldmeta->re_len;
newmeta->minkey = oldmeta->minkey;
newmeta->maxkey = oldmeta->maxkey;
memmove(newmeta->dbmeta.uid,
oldmeta->dbmeta.uid, sizeof(oldmeta->dbmeta.uid));
newmeta->dbmeta.flags = oldmeta->dbmeta.flags;
newmeta->dbmeta.record_count = 0;
newmeta->dbmeta.key_count = 0;
ZERO_LSN(newmeta->dbmeta.unused3);
/* Set the version number. */
newmeta->dbmeta.version = 8;
/* Upgrade the flags. */
if (LF_ISSET(DB_DUPSORT))
F_SET(&newmeta->dbmeta, BTM_DUPSORT);
*dirtyp = 1;
return (0);
}
/*
* __bam_31_lbtree --
* Upgrade the database btree leaf pages.
*
* PUBLIC: int __bam_31_lbtree
* PUBLIC: __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *));
*/
int
__bam_31_lbtree(dbp, real_name, flags, fhp, h, dirtyp)
DB *dbp;
char *real_name;
u_int32_t flags;
DB_FH *fhp;
PAGE *h;
int *dirtyp;
{
BKEYDATA *bk;
db_pgno_t pgno;
db_indx_t indx;
int ret;
ret = 0;
for (indx = O_INDX; indx < NUM_ENT(h); indx += P_INDX) {
bk = GET_BKEYDATA(dbp, h, indx);
if (B_TYPE(bk->type) == B_DUPLICATE) {
pgno = GET_BOVERFLOW(dbp, h, indx)->pgno;
if ((ret = __db_31_offdup(dbp, real_name, fhp,
LF_ISSET(DB_DUPSORT) ? 1 : 0, &pgno)) != 0)
break;
if (pgno != GET_BOVERFLOW(dbp, h, indx)->pgno) {
*dirtyp = 1;
GET_BOVERFLOW(dbp, h, indx)->pgno = pgno;
}
}
}
return (ret);
}

2546
btree/bt_verify.c Normal file

File diff suppressed because it is too large Load Diff

271
btree/btree.src Normal file
View File

@@ -0,0 +1,271 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: btree.src,v 12.16 2008/02/11 04:22:02 mjc Exp $
*/
DBPRIVATE
PREFIX __bam
INCLUDE #include "db_int.h"
INCLUDE #include "dbinc/crypto.h"
INCLUDE #include "dbinc/db_page.h"
INCLUDE #include "dbinc/db_am.h"
INCLUDE #include "dbinc/btree.h"
INCLUDE #include "dbinc/log.h"
INCLUDE #include "dbinc/txn.h"
INCLUDE
/*
* BTREE-split: used to log a page split.
*
* left: the page number for the low-order contents.
* llsn: the left page's original LSN.
* right: the page number for the high-order contents.
* rlsn: the right page's original LSN.
* indx: the number of entries that went to the left page.
* npgno: the next page number
* nlsn: the next page's original LSN (or 0 if no next page).
* root_pgno: the root page number
* pg: the split page's contents before the split.
* opflags: SPL_NRECS: if splitting a tree that maintains a record count.
*/
BEGIN split 42 62
DB fileid int32_t ld
ARG left db_pgno_t lu
POINTER llsn DB_LSN * lu
ARG right db_pgno_t lu
POINTER rlsn DB_LSN * lu
ARG indx u_int32_t lu
ARG npgno db_pgno_t lu
POINTER nlsn DB_LSN * lu
ARG root_pgno db_pgno_t lu
PGDBT pg DBT s
ARG opflags u_int32_t lu
END
/*
* BTREE-rsplit: used to log a reverse-split
*
* pgno: the page number of the page copied over the root.
* pgdbt: the page being copied on the root page.
* root_pgno: the root page number.
* nrec: the tree's record count.
* rootent: last entry on the root page.
* rootlsn: the root page's original lsn.
*/
BEGIN rsplit 42 63
DB fileid int32_t ld
ARG pgno db_pgno_t lu
PGDBT pgdbt DBT s
ARG root_pgno db_pgno_t lu
ARG nrec db_pgno_t lu
DBT rootent DBT s
POINTER rootlsn DB_LSN * lu
END
/*
* BTREE-adj: used to log the adjustment of an index.
*
* pgno: the page modified.
* lsn: the page's original lsn.
* indx: the index adjusted.
* indx_copy: the index to copy if inserting.
* is_insert: 0 if a delete, 1 if an insert.
*/
BEGIN adj 42 55
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG indx_copy u_int32_t lu
ARG is_insert u_int32_t lu
END
/*
* BTREE-cadjust: used to adjust the count change in an internal page.
*
* pgno: the page modified.
* lsn: the page's original lsn.
* indx: the index to be adjusted.
* adjust: the signed adjustment.
* opflags: CAD_UPDATEROOT: if root page count was adjusted.
*/
BEGIN cadjust 42 56
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG adjust int32_t ld
ARG opflags u_int32_t lu
END
/*
* BTREE-cdel: used to log the intent-to-delete of a cursor record.
*
* pgno: the page modified.
* lsn: the page's original lsn.
* indx: the index to be deleted.
*/
BEGIN cdel 42 57
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
END
/*
* BTREE-repl: used to log the replacement of an item.
*
* pgno: the page modified.
* lsn: the page's original lsn.
* indx: the index to be replaced.
* isdeleted: set if the record was previously deleted.
* orig: the original data.
* repl: the replacement data.
* prefix: the prefix of the replacement that matches the original.
* suffix: the suffix of the replacement that matches the original.
*/
BEGIN repl 42 58
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG isdeleted u_int32_t lu
DBT orig DBT s
DBT repl DBT s
ARG prefix u_int32_t lu
ARG suffix u_int32_t lu
END
/*
* BTREE-root: log the assignment of a root btree page.
*/
BEGIN root 42 59
DB fileid int32_t ld
ARG meta_pgno db_pgno_t lu
ARG root_pgno db_pgno_t lu
POINTER meta_lsn DB_LSN * lu
END
/*
* BTREE-curadj: undo cursor adjustments on txn abort.
* Should only be processed during DB_TXN_ABORT.
* NOTE: the first_indx field gets used to hold
* signed index adjustment in one case.
* care should be taken if its size is changed.
*/
BEGIN curadj 42 64
/* Fileid of db affected. */
DB fileid int32_t ld
/* Which adjustment. */
ARG mode db_ca_mode ld
/* Page entry is from. */
ARG from_pgno db_pgno_t lu
/* Page entry went to. */
ARG to_pgno db_pgno_t lu
/* Left page of root split. */
ARG left_pgno db_pgno_t lu
/* First index of dup set. Also used as adjustment. */
ARG first_indx u_int32_t lu
/* Index entry is from. */
ARG from_indx u_int32_t lu
/* Index where entry went. */
ARG to_indx u_int32_t lu
END
/*
* BTREE-rcuradj: undo cursor adjustments on txn abort in
* renumbering recno trees.
* Should only be processed during DB_TXN_ABORT.
*/
BEGIN rcuradj 42 65
/* Fileid of db affected. */
DB fileid int32_t ld
/* Which adjustment. */
ARG mode ca_recno_arg ld
/* Root page number. */
ARG root db_pgno_t ld
/* Recno of the adjustment. */
ARG recno db_recno_t ld
/* Order number of the adjustment. */
ARG order u_int32_t lu
END
/*
* BTREE-relink -- Handles relinking around a deleted leaf page.
*
*/
BEGIN_COMPAT relink 43 147
/* Fileid of db affected. */
DB fileid int32_t ld
/* The page being removed. */
ARG pgno db_pgno_t lu
/* The page's original lsn. */
POINTER lsn DB_LSN * lu
/* The previous page. */
ARG prev db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_prev DB_LSN * lu
/* The next page. */
ARG next db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_next DB_LSN * lu
END
BEGIN relink 44 147
/* Fileid of db affected. */
DB fileid int32_t ld
/* The page being removed. */
ARG pgno db_pgno_t lu
/* The new page number, if any. */
ARG new_pgno db_pgno_t lu
/* The previous page. */
ARG prev db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_prev DB_LSN * lu
/* The next page. */
ARG next db_pgno_t lu
/* The previous page's original lsn. */
POINTER lsn_next DB_LSN * lu
END
/*
* BTREE-merge -- Handles merging of pages during a compaction.
*/
BEGIN_COMPAT merge 44 148
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG npgno db_pgno_t lu
POINTER nlsn DB_LSN * lu
DBT hdr DBT s
DBT data DBT s
DBT ind DBT s
END
BEGIN merge 47 148
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG npgno db_pgno_t lu
POINTER nlsn DB_LSN * lu
PGDBT hdr DBT s
PGDDBT data DBT s
ARG pg_copy int32_t lu
END
/*
* BTREE-pgno -- Handles replacing a page number in the record
* reference on pgno by indx.
*/
BEGIN pgno 44 149
DB fileid int32_t ld
ARG pgno db_pgno_t lu
POINTER lsn DB_LSN * lu
ARG indx u_int32_t lu
ARG opgno db_pgno_t lu
ARG npgno db_pgno_t lu
END

3398
btree/btree_auto.c Normal file

File diff suppressed because it is too large Load Diff

697
btree/btree_autop.c Normal file
View File

@@ -0,0 +1,697 @@
/* Do not edit: automatically built by gen_rec.awk. */
#include "db_config.h"
#include "db_int.h"
#include "dbinc/crypto.h"
#include "dbinc/db_page.h"
#include "dbinc/db_am.h"
#include "dbinc/btree.h"
#include "dbinc/log.h"
#include "dbinc/txn.h"
/*
* PUBLIC: int __bam_split_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_split_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_split_args *argp;
u_int32_t i;
int ch;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_split_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_split%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tleft: %lu\n", (u_long)argp->left);
(void)printf("\tllsn: [%lu][%lu]\n",
(u_long)argp->llsn.file, (u_long)argp->llsn.offset);
(void)printf("\tright: %lu\n", (u_long)argp->right);
(void)printf("\trlsn: [%lu][%lu]\n",
(u_long)argp->rlsn.file, (u_long)argp->rlsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
(void)printf("\tnlsn: [%lu][%lu]\n",
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
(void)printf("\tpg: ");
for (i = 0; i < argp->pg.size; i++) {
ch = ((u_int8_t *)argp->pg.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_rsplit_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_rsplit_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_rsplit_args *argp;
u_int32_t i;
int ch;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_rsplit_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_rsplit%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tpgdbt: ");
for (i = 0; i < argp->pgdbt.size; i++) {
ch = ((u_int8_t *)argp->pgdbt.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
(void)printf("\tnrec: %lu\n", (u_long)argp->nrec);
(void)printf("\trootent: ");
for (i = 0; i < argp->rootent.size; i++) {
ch = ((u_int8_t *)argp->rootent.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\trootlsn: [%lu][%lu]\n",
(u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_adj_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_adj_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_adj_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_adj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_adj%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy);
(void)printf("\tis_insert: %lu\n", (u_long)argp->is_insert);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_cadjust_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_cadjust_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_cadjust_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_cadjust_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_cadjust%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\tadjust: %ld\n", (long)argp->adjust);
(void)printf("\topflags: %lu\n", (u_long)argp->opflags);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_cdel_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_cdel_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_cdel_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_cdel_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_cdel%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_repl_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_repl_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_repl_args *argp;
u_int32_t i;
int ch;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_repl_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_repl%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\tisdeleted: %lu\n", (u_long)argp->isdeleted);
(void)printf("\torig: ");
for (i = 0; i < argp->orig.size; i++) {
ch = ((u_int8_t *)argp->orig.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\trepl: ");
for (i = 0; i < argp->repl.size; i++) {
ch = ((u_int8_t *)argp->repl.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\tprefix: %lu\n", (u_long)argp->prefix);
(void)printf("\tsuffix: %lu\n", (u_long)argp->suffix);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_root_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_root_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_root_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_root_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_root%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tmeta_pgno: %lu\n", (u_long)argp->meta_pgno);
(void)printf("\troot_pgno: %lu\n", (u_long)argp->root_pgno);
(void)printf("\tmeta_lsn: [%lu][%lu]\n",
(u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_curadj_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_curadj_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_curadj_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_curadj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_curadj%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tmode: %ld\n", (long)argp->mode);
(void)printf("\tfrom_pgno: %lu\n", (u_long)argp->from_pgno);
(void)printf("\tto_pgno: %lu\n", (u_long)argp->to_pgno);
(void)printf("\tleft_pgno: %lu\n", (u_long)argp->left_pgno);
(void)printf("\tfirst_indx: %lu\n", (u_long)argp->first_indx);
(void)printf("\tfrom_indx: %lu\n", (u_long)argp->from_indx);
(void)printf("\tto_indx: %lu\n", (u_long)argp->to_indx);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_rcuradj_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_rcuradj_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_rcuradj_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_rcuradj_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_rcuradj%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tmode: %ld\n", (long)argp->mode);
(void)printf("\troot: %ld\n", (long)argp->root);
(void)printf("\trecno: %ld\n", (long)argp->recno);
(void)printf("\torder: %lu\n", (u_long)argp->order);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_relink_43_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_relink_43_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_relink_43_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_relink_43_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_relink_43%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tprev: %lu\n", (u_long)argp->prev);
(void)printf("\tlsn_prev: [%lu][%lu]\n",
(u_long)argp->lsn_prev.file, (u_long)argp->lsn_prev.offset);
(void)printf("\tnext: %lu\n", (u_long)argp->next);
(void)printf("\tlsn_next: [%lu][%lu]\n",
(u_long)argp->lsn_next.file, (u_long)argp->lsn_next.offset);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_relink_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_relink_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_relink_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_relink_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_relink%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tnew_pgno: %lu\n", (u_long)argp->new_pgno);
(void)printf("\tprev: %lu\n", (u_long)argp->prev);
(void)printf("\tlsn_prev: [%lu][%lu]\n",
(u_long)argp->lsn_prev.file, (u_long)argp->lsn_prev.offset);
(void)printf("\tnext: %lu\n", (u_long)argp->next);
(void)printf("\tlsn_next: [%lu][%lu]\n",
(u_long)argp->lsn_next.file, (u_long)argp->lsn_next.offset);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_merge_44_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_merge_44_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_merge_44_args *argp;
u_int32_t i;
int ch;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_merge_44_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_merge_44%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
(void)printf("\tnlsn: [%lu][%lu]\n",
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
(void)printf("\thdr: ");
for (i = 0; i < argp->hdr.size; i++) {
ch = ((u_int8_t *)argp->hdr.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\tdata: ");
for (i = 0; i < argp->data.size; i++) {
ch = ((u_int8_t *)argp->data.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\tind: ");
for (i = 0; i < argp->ind.size; i++) {
ch = ((u_int8_t *)argp->ind.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_merge_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_merge_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_merge_args *argp;
u_int32_t i;
int ch;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_merge_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_merge%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
(void)printf("\tnlsn: [%lu][%lu]\n",
(u_long)argp->nlsn.file, (u_long)argp->nlsn.offset);
(void)printf("\thdr: ");
for (i = 0; i < argp->hdr.size; i++) {
ch = ((u_int8_t *)argp->hdr.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\tdata: ");
for (i = 0; i < argp->data.size; i++) {
ch = ((u_int8_t *)argp->data.data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
(void)printf("\n");
(void)printf("\tpg_copy: %lu\n", (u_long)argp->pg_copy);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_pgno_print __P((ENV *, DBT *, DB_LSN *,
* PUBLIC: db_recops, void *));
*/
int
__bam_pgno_print(env, dbtp, lsnp, notused2, notused3)
ENV *env;
DBT *dbtp;
DB_LSN *lsnp;
db_recops notused2;
void *notused3;
{
__bam_pgno_args *argp;
int ret;
notused2 = DB_TXN_PRINT;
notused3 = NULL;
if ((ret =
__bam_pgno_read(env, NULL, NULL, dbtp->data, &argp)) != 0)
return (ret);
(void)printf(
"[%lu][%lu]__bam_pgno%s: rec: %lu txnp %lx prevlsn [%lu][%lu]\n",
(u_long)lsnp->file, (u_long)lsnp->offset,
(argp->type & DB_debug_FLAG) ? "_debug" : "",
(u_long)argp->type,
(u_long)argp->txnp->txnid,
(u_long)argp->prev_lsn.file, (u_long)argp->prev_lsn.offset);
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
(void)printf("\tlsn: [%lu][%lu]\n",
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
(void)printf("\tindx: %lu\n", (u_long)argp->indx);
(void)printf("\topgno: %lu\n", (u_long)argp->opgno);
(void)printf("\tnpgno: %lu\n", (u_long)argp->npgno);
(void)printf("\n");
__os_free(env, argp);
return (0);
}
/*
* PUBLIC: int __bam_init_print __P((ENV *, DB_DISTAB *));
*/
int
__bam_init_print(env, dtabp)
ENV *env;
DB_DISTAB *dtabp;
{
int ret;
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_split_print, DB___bam_split)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_rsplit_print, DB___bam_rsplit)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_adj_print, DB___bam_adj)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_cadjust_print, DB___bam_cadjust)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_cdel_print, DB___bam_cdel)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_repl_print, DB___bam_repl)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_root_print, DB___bam_root)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_curadj_print, DB___bam_curadj)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_rcuradj_print, DB___bam_rcuradj)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_relink_print, DB___bam_relink)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_merge_print, DB___bam_merge)) != 0)
return (ret);
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_pgno_print, DB___bam_pgno)) != 0)
return (ret);
return (0);
}

View File

@@ -1,347 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1421
build-aux/config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,672 +0,0 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2010 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's _LT_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix[4-9]*)
library_names_spec='$libname$shrext'
;;
amigaos*)
library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd1*)
;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
esac
;;
gnu*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

View File

@@ -1,791 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,501 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@@ -1,58 +0,0 @@
#!/bin/sh
#
###############################################################################
#
# Wrapper for GNU groff to convert man pages to a few formats
#
# Usage: manconv.sh FORMAT [PAPER_SIZE] < in.1 > out.suffix
#
# FORMAT can be ascii, utf8, ps, or pdf. PAPER_SIZE can be anything that
# groff accepts, e.g. a4 or letter. See groff_font(5). PAPER_SIZE defaults
# to a4 and is used only when FORMAT is ps (PostScript) or pdf.
#
# Multiple man pages can be given at once e.g. to create a single PDF file
# with continuous page numbering.
#
###############################################################################
#
# Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
###############################################################################
FORMAT=$1
PAPER=${2-a4}
# Make PostScript and PDF output more readable:
# - Use 11 pt font instead of the default 10 pt.
# - Use larger paragraph spacing than the default 0.4v (man(7) only).
FONT=11
PD=0.8
SED_PD="
/^\\.TH /s/\$/\\
.PD $PD/
s/^\\.PD\$/.PD $PD/"
case $FORMAT in
ascii)
groff -t -mandoc -Tascii | col -bx
;;
utf8)
groff -t -mandoc -Tutf8 | col -bx
;;
ps)
sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
-rC1 -rS$FONT -Tps -P-p$PAPER
;;
pdf)
sed "$SED_PD" | groff -dpaper=$PAPER -t -mandoc \
-rC1 -rS$FONT -Tps -P-p$PAPER | ps2pdf - -
;;
*)
echo 'Invalid arguments' >&2
exit 1
;;
esac

View File

@@ -1,215 +0,0 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program 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.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,24 +0,0 @@
#!/bin/sh
#
#############################################################################
#
# Get the version string from version.h and print it out without
# trailing newline. This makes it suitable for use in configure.ac.
#
#############################################################################
#
# Author: Lasse Collin
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
#############################################################################
sed -n 's/LZMA_VERSION_STABILITY_ALPHA/alpha/
s/LZMA_VERSION_STABILITY_BETA/beta/
s/LZMA_VERSION_STABILITY_STABLE//
s/^#define LZMA_VERSION_[MPS][AIT][AJNT][A-Z]* //p' \
src/liblzma/api/lzma/version.h \
| tr '\n' '|' \
| sed 's/|/./; s/|/./; s/|//g' \
| tr -d '\r\n'

628
build_brew/bdb_brew.dsp Normal file
View File

@@ -0,0 +1,628 @@
# Microsoft Developer Studio Project File - Name="bdb_brew" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=bdb_brew - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "bdb_brew.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "bdb_brew.mak" CFG="bdb_brew - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bdb_brew - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "bdb_brew - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "bdb_brew - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release/bdb_brew"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release/bdb_brew"
# PROP Target_Dir ""
LINK32=link.exe
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /I "$(BREWDIR)\inc" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD BASE RSC /l 0xc09
# ADD RSC /l 0xc09
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "bdb_brew - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug/bdb_brew"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug/bdb_brew"
# PROP Target_Dir ""
LINK32=link.exe
# ADD BASE CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I ".." /D "DIAGNOSTIC" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /X /I "." /I ".." /I "$(BREWDIR)\inc" /D "DIAGNOSTIC" /D "UNICODE" /D "_UNICODE" /D "_DEBUG" /D "AEE_SIMULATOR" /D "__NO_SYSTEM_INCLUDES" /FR /FD /c
# ADD BASE RSC /l 0xc09
# ADD RSC /l 0xc09
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "bdb_brew - Win32 Release"
# Name "bdb_brew - Win32 Debug"
# Begin Group "header_files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\brew_db.h
# End Source File
# Begin Source File
SOURCE=.\clib_port.h
# End Source File
# Begin Source File
SOURCE=.\db.h
# End Source File
# Begin Source File
SOURCE=.\db_config.h
# End Source File
# Begin Source File
SOURCE=.\db_int.h
# End Source File
# Begin Source File
SOURCE=.\errno.h
# End Source File
# End Group
# Begin Group "source_files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\btree\bt_compact.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_compare.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_conv.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_curadj.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_cursor.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_delete.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_method.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_open.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_put.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_rec.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_reclaim.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_recno.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_rsearch.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_search.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_split.c
# End Source File
# Begin Source File
SOURCE=..\btree\bt_stat.c
# End Source File
# Begin Source File
SOURCE=..\btree\btree_auto.c
# End Source File
# Begin Source File
SOURCE=..\clib\atol.c
# End Source File
# Begin Source File
SOURCE=..\clib\isalpha.c
# End Source File
# Begin Source File
SOURCE=..\clib\isdigit.c
# End Source File
# Begin Source File
SOURCE=..\clib\isprint.c
# End Source File
# Begin Source File
SOURCE=..\clib\isspace.c
# End Source File
# Begin Source File
SOURCE=..\clib\printf.c
# End Source File
# Begin Source File
SOURCE=..\clib\qsort.c
# End Source File
# Begin Source File
SOURCE=..\clib\rand.c
# End Source File
# Begin Source File
SOURCE=..\clib\strcasecmp.c
# End Source File
# Begin Source File
SOURCE=..\clib\strerror.c
# End Source File
# Begin Source File
SOURCE=..\clib\strncat.c
# End Source File
# Begin Source File
SOURCE=..\clib\strsep.c
# End Source File
# Begin Source File
SOURCE=..\clib\strtol.c
# End Source File
# Begin Source File
SOURCE=..\clib\time.c
# End Source File
# Begin Source File
SOURCE=..\common\crypto_stub.c
# End Source File
# Begin Source File
SOURCE=..\common\db_byteorder.c
# End Source File
# Begin Source File
SOURCE=..\common\db_err.c
# End Source File
# Begin Source File
SOURCE=..\common\db_getlong.c
# End Source File
# Begin Source File
SOURCE=..\common\db_idspace.c
# End Source File
# Begin Source File
SOURCE=..\common\db_log2.c
# End Source File
# Begin Source File
SOURCE=..\common\db_shash.c
# End Source File
# Begin Source File
SOURCE=..\common\dbt.c
# End Source File
# Begin Source File
SOURCE=..\common\mkpath.c
# End Source File
# Begin Source File
SOURCE=..\common\zerofill.c
# End Source File
# Begin Source File
SOURCE=..\db\crdel_auto.c
# End Source File
# Begin Source File
SOURCE=..\db\crdel_rec.c
# End Source File
# Begin Source File
SOURCE=..\db\db.c
# End Source File
# Begin Source File
SOURCE=..\db\db_am.c
# End Source File
# Begin Source File
SOURCE=..\db\db_auto.c
# End Source File
# Begin Source File
SOURCE=..\db\db_cam.c
# End Source File
# Begin Source File
SOURCE=..\db\db_cds.c
# End Source File
# Begin Source File
SOURCE=..\db\db_conv.c
# End Source File
# Begin Source File
SOURCE=..\db\db_dispatch.c
# End Source File
# Begin Source File
SOURCE=..\db\db_dup.c
# End Source File
# Begin Source File
SOURCE=..\db\db_iface.c
# End Source File
# Begin Source File
SOURCE=..\db\db_join.c
# End Source File
# Begin Source File
SOURCE=..\db\db_meta.c
# End Source File
# Begin Source File
SOURCE=..\db\db_method.c
# End Source File
# Begin Source File
SOURCE=..\db\db_open.c
# End Source File
# Begin Source File
SOURCE=..\db\db_overflow.c
# End Source File
# Begin Source File
SOURCE=..\db\db_pr.c
# End Source File
# Begin Source File
SOURCE=..\db\db_rec.c
# End Source File
# Begin Source File
SOURCE=..\db\db_reclaim.c
# End Source File
# Begin Source File
SOURCE=..\db\db_remove.c
# End Source File
# Begin Source File
SOURCE=..\db\db_rename.c
# End Source File
# Begin Source File
SOURCE=..\db\db_ret.c
# End Source File
# Begin Source File
SOURCE=..\db\db_setid.c
# End Source File
# Begin Source File
SOURCE=..\db\db_setlsn.c
# End Source File
# Begin Source File
SOURCE=..\db\db_stati.c
# End Source File
# Begin Source File
SOURCE=..\db\db_truncate.c
# End Source File
# Begin Source File
SOURCE=..\db\db_upg.c
# End Source File
# Begin Source File
SOURCE=..\db\db_vrfy_stub.c
# End Source File
# Begin Source File
SOURCE=..\dbreg\dbreg.c
# End Source File
# Begin Source File
SOURCE=..\dbreg\dbreg_auto.c
# End Source File
# Begin Source File
SOURCE=..\dbreg\dbreg_rec.c
# End Source File
# Begin Source File
SOURCE=..\dbreg\dbreg_stat.c
# End Source File
# Begin Source File
SOURCE=..\dbreg\dbreg_util.c
# End Source File
# Begin Source File
SOURCE=..\env\env_alloc.c
# End Source File
# Begin Source File
SOURCE=..\env\env_config.c
# End Source File
# Begin Source File
SOURCE=..\env\env_failchk.c
# End Source File
# Begin Source File
SOURCE=..\env\env_file.c
# End Source File
# Begin Source File
SOURCE=..\env\env_method.c
# End Source File
# Begin Source File
SOURCE=..\env\env_name.c
# End Source File
# Begin Source File
SOURCE=..\env\env_open.c
# End Source File
# Begin Source File
SOURCE=..\env\env_recover.c
# End Source File
# Begin Source File
SOURCE=..\env\env_region.c
# End Source File
# Begin Source File
SOURCE=..\env\env_register.c
# End Source File
# Begin Source File
SOURCE=..\env\env_sig.c
# End Source File
# Begin Source File
SOURCE=..\env\env_stat.c
# End Source File
# Begin Source File
SOURCE=..\fileops\fileops_auto.c
# End Source File
# Begin Source File
SOURCE=..\fileops\fop_basic.c
# End Source File
# Begin Source File
SOURCE=..\fileops\fop_rec.c
# End Source File
# Begin Source File
SOURCE=..\fileops\fop_util.c
# End Source File
# Begin Source File
SOURCE=..\hash\hash_func.c
# End Source File
# Begin Source File
SOURCE=..\hash\hash_stub.c
# End Source File
# Begin Source File
SOURCE=..\hmac\hmac.c
# End Source File
# Begin Source File
SOURCE=..\hmac\sha1.c
# End Source File
# Begin Source File
SOURCE=..\lock\lock_stub.c
# End Source File
# Begin Source File
SOURCE=..\log\log.c
# End Source File
# Begin Source File
SOURCE=..\log\log_archive.c
# End Source File
# Begin Source File
SOURCE=..\log\log_compare.c
# End Source File
# Begin Source File
SOURCE=..\log\log_debug.c
# End Source File
# Begin Source File
SOURCE=..\log\log_get.c
# End Source File
# Begin Source File
SOURCE=..\log\log_method.c
# End Source File
# Begin Source File
SOURCE=..\log\log_put.c
# End Source File
# Begin Source File
SOURCE=..\log\log_stat.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_alloc.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_bh.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_fget.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_fmethod.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_fopen.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_fput.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_fset.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_method.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_mvcc.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_region.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_register.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_resize.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_stat.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_sync.c
# End Source File
# Begin Source File
SOURCE=..\mp\mp_trickle.c
# End Source File
# Begin Source File
SOURCE=..\mutex\mut_stub.c
# End Source File
# Begin Source File
SOURCE=..\os\os_alloc.c
# End Source File
# Begin Source File
SOURCE=..\os\os_cpu.c
# End Source File
# Begin Source File
SOURCE=..\os\os_fid.c
# End Source File
# Begin Source File
SOURCE=..\os\os_flock.c
# End Source File
# Begin Source File
SOURCE=..\os\os_getenv.c
# End Source File
# Begin Source File
SOURCE=..\os\os_map.c
# End Source File
# Begin Source File
SOURCE=..\os\os_root.c
# End Source File
# Begin Source File
SOURCE=..\os\os_rpath.c
# End Source File
# Begin Source File
SOURCE=..\os\os_stack.c
# End Source File
# Begin Source File
SOURCE=..\os\os_tmpdir.c
# End Source File
# Begin Source File
SOURCE=..\os\os_uid.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\ctime.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\fclose.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\fgetc.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\fgets.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\fopen.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\fwrite.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\getcwd.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\globals.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\localtime.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_abort.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_abs.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_clock.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_config.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_dir.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_errno.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_handle.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_mkdir.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_open.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_pid.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_rename.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_rw.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_seek.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_stat.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_truncate.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_unlink.c
# End Source File
# Begin Source File
SOURCE=..\os_brew\os_yield.c
# End Source File
# Begin Source File
SOURCE=..\qam\qam_stub.c
# End Source File
# Begin Source File
SOURCE=..\rep\rep_stub.c
# End Source File
# Begin Source File
SOURCE=..\repmgr\repmgr_stub.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_auto.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_chkpt.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_failchk.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_method.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_rec.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_recover.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_region.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_stat.c
# End Source File
# Begin Source File
SOURCE=..\txn\txn_util.c
# End Source File
# Begin Source File
SOURCE=..\xa\xa_stub.c
# End Source File
# End Group
# End Target
# End Project

29
build_brew/bdb_brew.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "bdb_brew"=.\bdb_brew.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

588
build_brew/bdbread.mak Normal file
View File

@@ -0,0 +1,588 @@
#============================================================================
# Name:
# $(TARGET).MAK
#
# Description:
# Makefile to build the $(TARGET) downloadable module.
#
# The following nmake targets are available in this makefile:
#
# all - make .elf and .mod image files (default)
# clean - delete object directory and image files
# filename.o - make object file
#
# The above targets can be made with the following command:
#
# nmake /f $(TARGET).mak [target]
#
# Assumptions:
# 1. The environment variable ADSHOME is set to the root directory of the
# arm tools.
# 2. The version of ADS is 1.2 or above.
#
# Notes:
# None.
#
#
# Copyright <20> 2000-2003 QUALCOMM Incorporated.
# All Rights Reserved.
# QUALCOMM Proprietary/GTDR
#
#----------------------------------------------------------------------------
#============================================================================
BREW_HOME =$(BREWDIR)
ARM_HOME =$(ARMHOME)
TARGET =D:\DB7588~1.BRE\BUILD_~1\bdb_brew
OBJS =bdbread.o AEEModGen.o AEEAppGen.o bt_compact.o bt_compare.o bt_conv.o bt_curadj.o bt_cursor.o bt_delete.o bt_method.o bt_open.o bt_put.o bt_rec.o bt_reclaim.o bt_recno.o bt_rsearch.o bt_search.o bt_split.o bt_stat.o btree_auto.o atol.o isalpha.o isdigit.o isprint.o isspace.o printf.o qsort.o rand.o strcasecmp.o strerror.o strncat.o strsep.o strtol.o time.o crypto_stub.o db_byteorder.o db_err.o db_getlong.o db_idspace.o db_log2.o db_shash.o dbt.o mkpath.o zerofill.o crdel_auto.o crdel_rec.o db.o db_am.o db_auto.o db_cam.o db_cds.o db_conv.o db_dispatch.o db_dup.o db_iface.o db_join.o db_meta.o db_method.o db_open.o db_overflow.o db_pr.o db_rec.o db_reclaim.o db_remove.o db_rename.o db_ret.o db_setid.o db_setlsn.o db_stati.o db_truncate.o db_upg.o db_vrfy_stub.o dbreg.o dbreg_auto.o dbreg_rec.o dbreg_stat.o dbreg_util.o env_alloc.o env_config.o env_failchk.o env_file.o env_method.o env_name.o env_open.o env_recover.o env_region.o env_register.o env_sig.o env_stat.o fileops_auto.o fop_basic.o fop_rec.o fop_util.o hash_func.o hash_stub.o hmac.o sha1.o lock_stub.o log.o log_archive.o log_compare.o log_debug.o log_get.o log_method.o log_put.o log_stat.o mp_alloc.o mp_bh.o mp_fget.o mp_fmethod.o mp_fopen.o mp_fput.o mp_fset.o mp_method.o mp_mvcc.o mp_region.o mp_register.o mp_resize.o mp_stat.o mp_sync.o mp_trickle.o mut_stub.o os_alloc.o os_cpu.o os_fid.o os_flock.o os_getenv.o os_map.o os_root.o os_rpath.o os_stack.o os_tmpdir.o os_uid.o ctime.o fclose.o fgetc.o fgets.o fopen.o fwrite.o getcwd.o globals.o localtime.o os_abort.o os_abs.o os_clock.o os_config.o os_dir.o os_errno.o os_handle.o os_mkdir.o os_open.o os_pid.o os_rename.o os_rw.o os_seek.o os_stat.o os_truncate.o os_unlink.o os_yield.o qam_stub.o rep_stub.o repmgr_stub.o txn.o txn_auto.o txn_chkpt.o txn_failchk.o txn_method.o txn_rec.o txn_recover.o txn_region.o txn_stat.o txn_util.o xa_stub.o
APP_INCLUDES = -I ..\build_brew -I ..
#-------------------------------------------------------------------------------
# Target file name and type definitions
#-------------------------------------------------------------------------------
EXETYPE = elf # Target image file format
MODULE = mod # Downloadable module extension
#-------------------------------------------------------------------------------
# Target compile time symbol definitions
#
# Tells the SDK source stuffs that we're building a dynamic app.
#-------------------------------------------------------------------------------
DYNAPP = -DDYNAMIC_APP
#-------------------------------------------------------------------------------
# Software tool and environment definitions
#-------------------------------------------------------------------------------
AEESRCPATH = $(BREW_HOME)\src
AEEINCPATH = $(BREW_HOME)\inc
ARMBIN = $(ARM_HOME)\bin # ARM ADS application directory
ARMINC = $(ARM_HOME)\include # ARM ADS include file directory
ARMLIB = $(ARM_HOME)\lib # ARM ADS library directory
ARMCC = $(ARMBIN)\armcc # ARM ADS ARM 32-bit inst. set ANSI C compiler
LD = $(ARMBIN)\armlink # ARM ADS linker
HEXTOOL = $(ARMBIN)\fromelf # ARM ADS utility to create hex file from image
OBJ_CMD = -o # Command line option to specify output filename
#-------------------------------------------------------------------------------
# Processor architecture options
#-------------------------------------------------------------------------------
CPU = -cpu ARM7TDMI # ARM7TDMI target processor
#-------------------------------------------------------------------------------
# ARM Procedure Call Standard (APCS) options
#-------------------------------------------------------------------------------
ROPI = ropi # Read-Only(code) Position independence
INTERWRK = interwork # Allow ARM-Thumb interworking
APCS = -apcs /$(ROPI)/$(INTERWRK)/norwpi
#-------------------------------------------------------------------------------
# Additional compile time error checking options
#-------------------------------------------------------------------------------
CHK = -fa # Check for data flow anomolies
#-------------------------------------------------------------------------------
# Compiler output options
#-------------------------------------------------------------------------------
OUT = -c # Object file output only
#-------------------------------------------------------------------------------
# Compiler/assembler debug options
#-------------------------------------------------------------------------------
DBG = -g # Enable debug
#-------------------------------------------------------------------------------
# Compiler optimization options
#-------------------------------------------------------------------------------
OPT = -Ospace -O2 # Full compiler optimization for space
#-------------------------------------------------------------------------------
# Compiler code generation options
#-------------------------------------------------------------------------------
END = -littleend # Compile for little endian memory architecture
ZA = -zo # LDR may only access 32-bit aligned addresses
CODE = $(END) $(ZA)
#-------------------------------------------------------------------------------
# Include file search path options
#-------------------------------------------------------------------------------
INC = -I. -I$(AEEINCPATH) $(APP_INCLUDES)
#-------------------------------------------------------------------------------
# Compiler pragma emulation options
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Linker options
#-------------------------------------------------------------------------------
LINK_CMD = -o #Command line option to specify output file
#on linking
ROPILINK = -ropi #Link image as Read-Only Position Independent
LINK_ORDER = -first AEEMod_Load
#-------------------------------------------------------------------------------
# HEXTOOL options
#-------------------------------------------------------------------------------
BINFORMAT = -bin
#-------------------------------------------------------------------------------
# Compiler flag definitions
#-------------------------------------------------------------------------------
NO_WARNING= -W
CFLAGS0 = $(OUT) $(DYNAPP) $(CPU) $(APCS) $(CODE) $(CHK) $(DBG)
CFLAGS = $(NO_WARNING) $(CFLAGS0) $(OPT)
#-------------------------------------------------------------------------------
# Linker flag definitions
#-------------------------------------------------------------------------------
# the -entry flag is not really needed, but it keeps the linker from reporting
# warning L6305W (no entry point). The address
LFLAGS = $(ROPILINK) -rwpi -entry 0x8000#
#----------------------------------------------------------------------------
# Default target
#----------------------------------------------------------------------------
all : $(TARGET).$(MODULE)
#----------------------------------------------------------------------------
# Clean target
#----------------------------------------------------------------------------
# The object subdirectory, target image file, and target hex file are deleted.
clean :
@echo ---------------------------------------------------------------
@echo CLEAN
-del /f $(OBJS)
-del /f $(TARGET).$(EXETYPE)
-del /f $(TARGET).$(MODULE)
@echo ---------------------------------------------------------------
#============================================================================
# DEFAULT SUFFIX RULES
#============================================================================
# The following are the default suffix rules used to compile all objects that
# are not specifically included in one of the module specific rules defined
# in the next section.
# The following macros are used to specify the output object file, MSG_FILE
# symbol definition and input source file on the compile line in the rules
# defined below.
SRC_FILE = $(@F:.o=.c) # Input source file specification
OBJ_FILE = $(OBJ_CMD) $(@F) # Output object file specification
.SUFFIXES :
.SUFFIXES : .o .dep .c
#--------------------------------------------------------------------------
# C code inference rules
#----------------------------------------------------------------------------
.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(SRC_FILE)
@echo ---------------------------------------------------------------
.c.mix:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) -S -fs $(CFLAGS) $(INC) $(OBJ_FILE) $<
@echo ---------------------------------------------------------------
{$(AEESRCPATH)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(AEESRCPATH)\$(SRC_FILE)
@echo ---------------------------------------------------------------
#===============================================================================
# MODULE SPECIFIC RULES
#===============================================================================
APP_OBJS = $(OBJS)
#----------------------------------------------------------------------------
# Lib file targets
#----------------------------------------------------------------------------
$(TARGET).$(MODULE) : $(TARGET).$(EXETYPE)
@echo ---------------------------------------------------------------
@echo TARGET $@
$(HEXTOOL) $(TARGET).$(EXETYPE) $(BINFORMAT) $(TARGET).$(MODULE)
$(TARGET).$(EXETYPE) : $(APP_OBJS)
@echo ---------------------------------------------------------------
@echo TARGET $@
$(LD) $(LINK_CMD) $(TARGET).$(EXETYPE) $(LFLAGS) $(APP_OBJS) $(LINK_ORDER)
#----------------------------------------------------------------------------
# Applet Specific Rules
#----------------------------------------------------------------------------
RULE1 = ..\clib
{$(RULE1)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE1)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE2 = ..\btree
{$(RULE2)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE2)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE3 = ..\db
{$(RULE3)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE3)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE4 = ..\common
{$(RULE4)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE4)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE5 = ..\os_brew
{$(RULE5)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE5)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE6 = ..\env
{$(RULE6)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE6)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE7 = ..\dbreg
{$(RULE7)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE7)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE8 = ..\fileops
{$(RULE8)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE8)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE9 = ..\hash
{$(RULE9)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE9)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE10 = ..\hmac
{$(RULE10)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE10)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE11 = ..\lock
{$(RULE11)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE11)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE12 = ..\log
{$(RULE12)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE12)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE13 = ..\mp
{$(RULE13)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE13)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE14 = ..\mutex
{$(RULE14)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE14)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE15 = ..\os
{$(RULE15)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE15)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE16 = ..\qam
{$(RULE16)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE16)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE17 = ..\rep
{$(RULE17)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE17)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE18 = ..\txn
{$(RULE18)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE18)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE19 = ..\xa
{$(RULE19)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE19)\$(SRC_FILE)
@echo ---------------------------------------------------------------
RULE20 = ..\bdbread
{$(RULE20)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
$(ARMCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(RULE20)\$(SRC_FILE)
@echo ---------------------------------------------------------------
# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------
bdbread.o : ..\bdbread\bdbread.c
AEEModGen.o : ..\bdbread\AEEModGen.c
AEEAppGen.o : ..\bdbread\AEEAppGen.c
bt_compact.o: ..\btree\bt_compact.c
bt_compare.o: ..\btree\bt_compare.c
bt_conv.o: ..\btree\bt_conv.c
bt_curadj.o: ..\btree\bt_curadj.c
bt_cursor.o: ..\btree\bt_cursor.c
bt_delete.o: ..\btree\bt_delete.c
bt_method.o: ..\btree\bt_method.c
bt_open.o: ..\btree\bt_open.c
bt_put.o: ..\btree\bt_put.c
bt_rec.o: ..\btree\bt_rec.c
bt_reclaim.o: ..\btree\bt_reclaim.c
bt_recno.o: ..\btree\bt_recno.c
bt_rsearch.o: ..\btree\bt_rsearch.c
bt_search.o: ..\btree\bt_search.c
bt_split.o: ..\btree\bt_split.c
bt_stat.o: ..\btree\bt_stat.c
btree_auto.o: ..\btree\btree_auto.c
atol.o: ..\clib\atol.c
isalpha.o: ..\clib\isalpha.c
isdigit.o: ..\clib\isdigit.c
isprint.o: ..\clib\isprint.c
isspace.o: ..\clib\isspace.c
printf.o: ..\clib\printf.c
qsort.o: ..\clib\qsort.c
rand.o: ..\clib\rand.c
strcasecmp.o: ..\clib\strcasecmp.c
strerror.o: ..\clib\strerror.c
strncat.o: ..\clib\strncat.c
strsep.o: ..\clib\strsep.c
strtol.o: ..\clib\strtol.c
time.o: ..\clib\time.c
crypto_stub.o: ..\common\crypto_stub.c
db_byteorder.o: ..\common\db_byteorder.c
db_err.o: ..\common\db_err.c
db_getlong.o: ..\common\db_getlong.c
db_idspace.o: ..\common\db_idspace.c
db_log2.o: ..\common\db_log2.c
db_shash.o: ..\common\db_shash.c
dbt.o: ..\common\dbt.c
mkpath.o: ..\common\mkpath.c
zerofill.o: ..\common\zerofill.c
crdel_auto.o: ..\db\crdel_auto.c
crdel_rec.o: ..\db\crdel_rec.c
db.o: ..\db\db.c
db_am.o: ..\db\db_am.c
db_auto.o: ..\db\db_auto.c
db_cam.o: ..\db\db_cam.c
db_cds.o: ..\db\db_cds.c
db_conv.o: ..\db\db_conv.c
db_dispatch.o: ..\db\db_dispatch.c
db_dup.o: ..\db\db_dup.c
db_iface.o: ..\db\db_iface.c
db_join.o: ..\db\db_join.c
db_meta.o: ..\db\db_meta.c
db_method.o: ..\db\db_method.c
db_open.o: ..\db\db_open.c
db_overflow.o: ..\db\db_overflow.c
db_pr.o: ..\db\db_pr.c
db_rec.o: ..\db\db_rec.c
db_reclaim.o: ..\db\db_reclaim.c
db_remove.o: ..\db\db_remove.c
db_rename.o: ..\db\db_rename.c
db_ret.o: ..\db\db_ret.c
db_setid.o: ..\db\db_setid.c
db_setlsn.o: ..\db\db_setlsn.c
db_stati.o: ..\db\db_stati.c
db_truncate.o: ..\db\db_truncate.c
db_upg.o: ..\db\db_upg.c
db_vrfy_stub.o: ..\db\db_vrfy_stub.c
dbreg.o: ..\dbreg\dbreg.c
dbreg_auto.o: ..\dbreg\dbreg_auto.c
dbreg_rec.o: ..\dbreg\dbreg_rec.c
dbreg_stat.o: ..\dbreg\dbreg_stat.c
dbreg_util.o: ..\dbreg\dbreg_util.c
env_alloc.o: ..\env\env_alloc.c
env_config.o: ..\env\env_config.c
env_failchk.o: ..\env\env_failchk.c
env_file.o: ..\env\env_file.c
env_method.o: ..\env\env_method.c
env_name.o: ..\env\env_name.c
env_open.o: ..\env\env_open.c
env_recover.o: ..\env\env_recover.c
env_region.o: ..\env\env_region.c
env_register.o: ..\env\env_register.c
env_sig.o: ..\env\env_sig.c
env_stat.o: ..\env\env_stat.c
fileops_auto.o: ..\fileops\fileops_auto.c
fop_basic.o: ..\fileops\fop_basic.c
fop_rec.o: ..\fileops\fop_rec.c
fop_util.o: ..\fileops\fop_util.c
hash_func.o: ..\hash\hash_func.c
hash_stub.o: ..\hash\hash_stub.c
hmac.o: ..\hmac\hmac.c
sha1.o: ..\hmac\sha1.c
lock_stub.o: ..\lock\lock_stub.c
log.o: ..\log\log.c
log_archive.o: ..\log\log_archive.c
log_compare.o: ..\log\log_compare.c
log_debug.o: ..\log\log_debug.c
log_get.o: ..\log\log_get.c
log_method.o: ..\log\log_method.c
log_put.o: ..\log\log_put.c
log_stat.o: ..\log\log_stat.c
mp_alloc.o: ..\mp\mp_alloc.c
mp_bh.o: ..\mp\mp_bh.c
mp_fget.o: ..\mp\mp_fget.c
mp_fmethod.o: ..\mp\mp_fmethod.c
mp_fopen.o: ..\mp\mp_fopen.c
mp_fput.o: ..\mp\mp_fput.c
mp_fset.o: ..\mp\mp_fset.c
mp_method.o: ..\mp\mp_method.c
mp_mvcc.o: ..\mp\mp_mvcc.c
mp_region.o: ..\mp\mp_region.c
mp_register.o: ..\mp\mp_register.c
mp_resize.o: ..\mp\mp_resize.c
mp_stat.o: ..\mp\mp_stat.c
mp_sync.o: ..\mp\mp_sync.c
mp_trickle.o: ..\mp\mp_trickle.c
mut_stub.o: ..\mutex\mut_stub.c
os_alloc.o: ..\os\os_alloc.c
os_cpu.o: ..\os\os_cpu.c
os_fid.o: ..\os\os_fid.c
os_flock.o: ..\os\os_flock.c
os_getenv.o: ..\os\os_getenv.c
os_map.o: ..\os\os_map.c
os_root.o: ..\os\os_root.c
os_rpath.o: ..\os\os_rpath.c
os_stack.o: ..\os\os_stack.c
os_tmpdir.o: ..\os\os_tmpdir.c
os_uid.o: ..\os\os_uid.c
ctime.o: ..\os_brew\ctime.c
fclose.o: ..\os_brew\fclose.c
fgetc.o: ..\os_brew\fgetc.c
fgets.o: ..\os_brew\fgets.c
fopen.o: ..\os_brew\fopen.c
fwrite.o: ..\os_brew\fwrite.c
getcwd.o: ..\os_brew\getcwd.c
globals.o: ..\os_brew\globals.c
localtime.o: ..\os_brew\localtime.c
os_abort.o: ..\os_brew\os_abort.c
os_abs.o: ..\os_brew\os_abs.c
os_clock.o: ..\os_brew\os_clock.c
os_config.o: ..\os_brew\os_config.c
os_dir.o: ..\os_brew\os_dir.c
os_errno.o: ..\os_brew\os_errno.c
os_handle.o: ..\os_brew\os_handle.c
os_mkdir.o: ..\os_brew\os_mkdir.c
os_open.o: ..\os_brew\os_open.c
os_pid.o: ..\os_brew\os_pid.c
os_rename.o: ..\os_brew\os_rename.c
os_rw.o: ..\os_brew\os_rw.c
os_seek.o: ..\os_brew\os_seek.c
os_stat.o: ..\os_brew\os_stat.c
os_truncate.o: ..\os_brew\os_truncate.c
os_unlink.o: ..\os_brew\os_unlink.c
os_yield.o: ..\os_brew\os_yield.c
qam_stub.o: ..\qam\qam_stub.c
rep_stub.o: ..\rep\rep_stub.c
repmgr_stub.o: ..\repmgr\repmgr_stub.c
txn.o: ..\txn\txn.c
txn_auto.o: ..\txn\txn_auto.c
txn_chkpt.o: ..\txn\txn_chkpt.c
txn_failchk.o: ..\txn\txn_failchk.c
txn_method.o: ..\txn\txn_method.c
txn_rec.o: ..\txn\txn_rec.c
txn_recover.o: ..\txn\txn_recover.c
txn_region.o: ..\txn\txn_region.c
txn_stat.o: ..\txn\txn_stat.c
txn_util.o: ..\txn\txn_util.c
xa_stub.o: ..\xa\xa_stub.c

150
build_brew/brew_db.h Normal file
View File

@@ -0,0 +1,150 @@
/*-
* $Id: brew_db.h 63573 2008-05-23 21:43:21Z trent.nelson $
*
* The following provides the information necessary to build Berkeley DB
* on BREW.
*/
#include <AEEAppGen.h>
#include <AEEShell.h>
#include <AEEFile.h>
#include <AEEStdLib.h>
#include "errno.h"
#include "db.h"
#include "clib_port.h"
/*
* BREW doesn't have stdio.
*/
#define EOF (-1) /* Declare stdio's EOF. */
#define stderr ((IFile *)1) /* Flag to call DBGPRINTF. */
#define stdout ((IFile *)1)
/*
* POSIX time structure/function compatibility.
*
* !!!
* This is likely wrong, we should probably move all Berkeley DB time-specific
* functionality into os/.
*/
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
/*
* We don't provide tm_zone or tm_gmtoff because BREW doesn't
* provide them.
*/
};
/*
* The ctime() function converts the time pointed to by clock, representing
* time in seconds since the Epoch to local time in the form of a string.
*
* Berkeley DB uses POSIX time values internally.
*
* The POSIX time function returns seconds since the Epoch, which was
* 1970/01/01 00:00:00 UTC.
*
* BREW's GETUTCSECONDS() returns the number of seconds since
* 1980/01/06 00:00:00 UTC.
*
* To convert from BREW to POSIX, add the seconds between 1970 and 1980 plus
* 6 more days.
*/
#define BREW_EPOCH_OFFSET (315964800L)
/*
* Map ANSI C library functions to BREW specific APIs.
*/
#define atoi(a) ATOI(a)
#define free(a) FREE(a)
#define malloc(a) MALLOC(a)
#define memcmp(a, b, c) MEMCMP(a, b, c)
#define memmove(a, b, c) MEMMOVE(a, b, c)
#define memset(a, b, c) MEMSET(a, b, c)
#define realloc(a, b) REALLOC(a, b)
#define snprintf SNPRINTF
#define sprintf SPRINTF
#define strcat(a, b) STRCAT(a, b)
#define strchr(a, b) STRCHR(a, b)
#define strcmp(a, b) STRCMP(a, b)
#define strcpy(a, b) STRCPY(a, b)
#define strdup(a) STRDUP(a)
#define strlen(a) STRLEN(a)
#define strncmp(a, b, c) STRNCMP(a, b, c)
#define strncpy(a, b, c) STRNCPY(a, b, c)
#define strrchr(a, b) STRRCHR(a, b)
#define strtoul(a, b, c) STRTOUL(a, b, c)
#define vsnprintf(a, b, c, d) VSNPRINTF(a, b, c, d)
/*
* !!!
* Don't #define memcpy to MEMCPY, even though it exists, because that results
* in a C pre-processor loop and compile failure.
*
* Don't #define memcpy to MEMMOVE directly, that results in failure as well.
*/
#define memcpy memmove
/*
* BREW does not have concept of 'sync'.
*
* It depends on the implementation of the BREW on various platforms, but
* Mobilus confirms the version of BREW that ships to North America in 3G
* models has sync features guaranteeing safe physical writes whenever a
* write is performed using BREW API. Therefore, the issue is not on the
* applications running top of BREW, but the implementation of BREW itself
* that has to be checked in order to provide durability.
*/
#define __os_fsync(a, b) (0)
#define fflush(a) (0)
/*
* The ANSI C library functions for which we wrote local versions.
*/
int fclose(FILE *);
int fgetc(FILE *);
char *fgets(char *, int, FILE *);
FILE *fopen(const char *, const char *);
size_t fwrite(const void *, size_t, size_t, FILE *);
char *getcwd(char *, size_t);
struct tm *localtime(const time_t *);
time_t time(time_t *);
/*
* FILE_MANAGER_CREATE --
* Instantiate file manager instance.
*/
#define FILE_MANAGER_CREATE(dbenv, mgr, ret) do { \
AEEApplet *__app = (AEEApplet *)GETAPPINSTANCE(); \
int __ret; \
if ((__ret = ISHELL_CreateInstance(__app->m_pIShell, \
AEECLSID_FILEMGR, (void **)&(mgr))) == SUCCESS) \
ret = 0; \
else { \
__db_syserr(dbenv, __ret, "ISHELL_CreateInstance"); \
ret = __os_posix_err(__ret); \
} \
} while (0)
/*
* FILE_MANAGER_ERR --
* Handle file manager method error.
*/
#define FILE_MANAGER_ERR(dbenv, mgr, name, op, ret) do { \
int __ret; \
__ret = IFILEMGR_GetLastError(mgr); \
if ((name) == NULL) \
__db_syserr(dbenv, __ret, "%s", op); \
else \
__db_syserr(dbenv, __ret, "%s: %s", name, op); \
(ret) = __os_posix_err(__ret); \
} while (0)

274
build_brew/clib_port.h Normal file
View File

@@ -0,0 +1,274 @@
/* DO NOT EDIT: automatically built from dist/clib_port.in. */
/*
* Minimum/maximum values for various types.
*/
#ifndef UINT16_MAX /* Maximum 16-bit unsigned. */
#define UINT16_MAX 65535
#endif
#ifndef UINT32_MAX /* Maximum 32-bit unsigned. */
#define UINT32_MAX 4294967295U
#endif
#ifndef INT_MAX
#if SIZEOF_INT == 4
#define INT_MAX 2147483647
#endif
#if SIZEOF_INT == 8
#define INT_MAX 9223372036854775807
#endif
#endif
#ifndef INT_MIN /* minimum (signed) int value */
#define INT_MIN (-INT_MAX-1)
#endif
#ifndef UINT_MAX /* maximum (signed) int value */
#if SIZEOF_INT == 4
#define UINT_MAX 4294967295U
#endif
#if SIZEOF_INT == 8
#define UINT_MAX 18446744073709551615U
#endif
#endif
#ifndef LONG_MAX /* maximum (signed) long value */
#if SIZEOF_LONG == 4
#define LONG_MAX 2147483647
#endif
#if SIZEOF_LONG == 8
#define LONG_MAX 9223372036854775807L
#endif
#endif
#ifndef LONG_MIN /* minimum (signed) long value */
#define LONG_MIN (-LONG_MAX-1)
#endif
#ifndef ULONG_MAX /* maximum (unsigned) long value */
#if SIZEOF_LONG == 4
#define ULONG_MAX 4294967295U
#endif
#if SIZEOF_LONG == 8
#define ULONG_MAX 18446744073709551615UL
#endif
#endif
#if defined(HAVE_64BIT_TYPES)
/*
* Override the system's 64-bit min/max constants. AIX's 32-bit compiler can
* handle 64-bit values, but the system's constants don't include the LL/ULL
* suffix, and so can't be compiled using the 32-bit compiler.
*/
#undef INT64_MAX
#undef INT64_MIN
#undef UINT64_MAX
#ifdef DB_WIN32
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
#define UINT64_MAX _UI64_MAX
#else
#define INT64_MAX 9223372036854775807LL
#define INT64_MIN (-INT64_MAX-1)
#define UINT64_MAX 18446744073709551615ULL
#endif /* DB_WIN32 */
#endif /* HAVE_64BIT_TYPES */
/*
* Exit success/failure macros.
*/
#ifndef HAVE_EXIT_SUCCESS
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif
/*
* File modes.
*/
#ifdef DB_WIN32
#ifndef S_IREAD /* WinCE doesn't have S_IREAD. */
#define S_IREAD 0
#endif
#ifndef S_IWRITE /* WinCE doesn't have S_IWRITE. */
#define S_IWRITE 0
#endif
#ifndef S_IRUSR
#define S_IRUSR S_IREAD /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0 /* X for other */
#endif
#else /* !DB_WIN32 */
#ifndef S_IRUSR
#define S_IRUSR 0000400 /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR 0000200 /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0000100 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0000040 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0000020 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0000010 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0000004 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0000002 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0000001 /* X for other */
#endif
#endif /* !DB_WIN32 */
/*
* Don't step on the namespace. Other libraries may have their own
* implementations of these functions, we don't want to use their
* implementations or force them to use ours based on the load order.
*/
#ifndef HAVE_ATOI
#define atoi __db_Catoi
#endif
#ifndef HAVE_ATOL
#define atol __db_Catol
#endif
#ifndef HAVE_FCLOSE
#define fclose __db_Cfclose
#endif
#ifndef HAVE_FGETC
#define fgetc __db_Cfgetc
#endif
#ifndef HAVE_FGETS
#define fgets __db_Cfgets
#endif
#ifndef HAVE_FOPEN
#define fopen __db_Cfopen
#endif
#ifndef HAVE_FWRITE
#define fwrite __db_Cfwrite
#endif
#ifndef HAVE_GETADDRINFO
#define freeaddrinfo(a) __db_Cfreeaddrinfo(a)
#define getaddrinfo(a, b, c, d) __db_Cgetaddrinfo(a, b, c, d)
#endif
#ifndef HAVE_GETCWD
#define getcwd __db_Cgetcwd
#endif
#ifndef HAVE_GETOPT
#define getopt __db_Cgetopt
#define optarg __db_Coptarg
#define opterr __db_Copterr
#define optind __db_Coptind
#define optopt __db_Coptopt
#define optreset __db_Coptreset
#endif
#ifndef HAVE_ISALPHA
#define isalpha __db_Cisalpha
#endif
#ifndef HAVE_ISDIGIT
#define isdigit __db_Cisdigit
#endif
#ifndef HAVE_ISPRINT
#define isprint __db_Cisprint
#endif
#ifndef HAVE_ISSPACE
#define isspace __db_Cisspace
#endif
#ifndef HAVE_LOCALTIME
#define localtime __db_Clocaltime
#endif
#ifndef HAVE_MEMCMP
#define memcmp __db_Cmemcmp
#endif
#ifndef HAVE_MEMCPY
#define memcpy __db_Cmemcpy
#endif
#ifndef HAVE_MEMMOVE
#define memmove __db_Cmemmove
#endif
#ifndef HAVE_PRINTF
#define printf __db_Cprintf
#define fprintf __db_Cfprintf
#endif
#ifndef HAVE_QSORT
#define qsort __db_Cqsort
#endif
#ifndef HAVE_RAISE
#define raise __db_Craise
#endif
#ifndef HAVE_RAND
#define rand __db_Crand
#define srand __db_Csrand
#endif
#ifndef HAVE_SNPRINTF
#define snprintf __db_Csnprintf
#endif
#ifndef HAVE_STRCASECMP
#define strcasecmp __db_Cstrcasecmp
#define strncasecmp __db_Cstrncasecmp
#endif
#ifndef HAVE_STRCAT
#define strcat __db_Cstrcat
#endif
#ifndef HAVE_STRCHR
#define strchr __db_Cstrchr
#endif
#ifndef HAVE_STRDUP
#define strdup __db_Cstrdup
#endif
#ifndef HAVE_STRERROR
#define strerror __db_Cstrerror
#endif
#ifndef HAVE_STRNCAT
#define strncat __db_Cstrncat
#endif
#ifndef HAVE_STRNCMP
#define strncmp __db_Cstrncmp
#endif
#ifndef HAVE_STRRCHR
#define strrchr __db_Cstrrchr
#endif
#ifndef HAVE_STRSEP
#define strsep __db_Cstrsep
#endif
#ifndef HAVE_STRTOL
#define strtol __db_Cstrtol
#endif
#ifndef HAVE_STRTOUL
#define strtoul __db_Cstrtoul
#endif
#ifndef HAVE_TIME
#define time __db_Ctime
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf __db_Cvsnprintf
#endif

2491
build_brew/db.h Normal file

File diff suppressed because it is too large Load Diff

573
build_brew/db_config.h Normal file
View File

@@ -0,0 +1,573 @@
/* DO NOT EDIT: automatically built by dist/s_brew. */
/* Define to 1 if you want to build a version for running the test suite. */
/* #undef CONFIG_TEST */
/* We use DB_WIN32 much as one would use _WIN32 -- to specify that we're using
an operating system environment that supports Win32 calls and semantics. We
don't use _WIN32 because Cygwin/GCC also defines _WIN32, even though
Cygwin/GCC closely emulates the Unix environment. */
/* #undef DB_WIN32 */
/* Define to 1 if you want a debugging version. */
#if defined(_DEBUG)
#if !defined(DEBUG)
#define DEBUG 1
#endif
#endif
/* Define to 1 if you want a version that logs read operations. */
/* #undef DEBUG_ROP */
/* Define to 1 if you want a version that logs write operations. */
/* #undef DEBUG_WOP */
/* Define to 1 if you want a version with run-time diagnostic checking. */
/* #undef DIAGNOSTIC */
/* Define to 1 if 64-bit types are available. */
/* #undef HAVE_64BIT_TYPES */
/* Define to 1 if you have the `abort' function. */
/* #undef HAVE_ABORT */
/* Define to 1 if you have the `atoi' function. */
#define HAVE_ATOI 1
/* Define to 1 if you have the `atol' function. */
/* #undef HAVE_ATOL */
/* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */
/* Define to 1 if you have the `backtrace_symbols' function. */
/* #undef HAVE_BACKTRACE_SYMBOLS */
/* Define to 1 if building BREW. */
#define HAVE_BREW 1
/* Define to 1 if building on BREW (SDK2). */
#define HAVE_BREW_SDK2 1
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if clock_gettime supports CLOCK_MONOTONIC. */
/* #undef HAVE_CLOCK_MONOTONIC */
/* Define to 1 if Berkeley DB release includes strong cryptography. */
/* #undef HAVE_CRYPTO */
/* Define to 1 if you have the `ctime_r' function. */
/* #undef HAVE_CTIME_R */
/* Define to 1 if ctime_r takes a buffer length as a third argument. */
/* #undef HAVE_CTIME_R_3ARG */
/* Define to 1 if you have the `directio' function. */
/* #undef HAVE_DIRECTIO */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_DIRENT_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */
#define HAVE_EXIT_SUCCESS 1
/* Define to 1 if you have the `fchmod' function. */
/* #undef HAVE_FCHMOD */
/* Define to 1 if you have the `fclose' function. */
/* #undef HAVE_FCLOSE */
/* Define to 1 if you have the `fcntl' function. */
/* #undef HAVE_FCNTL */
/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */
/* #undef HAVE_FCNTL_F_SETFD */
/* Define to 1 if you have the `fdatasync' function. */
/* #undef HAVE_FDATASYNC */
/* Define to 1 if you have the `fgetc' function. */
/* #undef HAVE_FGETC */
/* Define to 1 if you have the `fgets' function. */
/* #undef HAVE_FGETS */
/* Define to 1 if allocated filesystem blocks are not zeroed. */
#define HAVE_FILESYSTEM_NOTZERO 1
/* Define to 1 if you have the `fopen' function. */
/* #undef HAVE_FOPEN */
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `fwrite' function. */
/* #undef HAVE_FWRITE */
/* Define to 1 if you have the `getaddrinfo' function. */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `getcwd' function. */
/* #undef HAVE_GETCWD */
/* Define to 1 if you have the `getenv' function. */
/* #undef HAVE_GETENV */
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getopt' function. */
/* #undef HAVE_GETOPT */
/* Define to 1 if getopt supports the optreset variable. */
/* #undef HAVE_GETOPT_OPTRESET */
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have the `getuid' function. */
/* #undef HAVE_GETUID */
/* Define to 1 if building Hash access method. */
/* #undef HAVE_HASH */
/* Define to 1 if you have the `hstrerror' function. */
/* #undef HAVE_HSTRERROR */
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
/* Define to 1 if you have the `isspace' function. */
/* #undef HAVE_ISALPHA */
/* Define to 1 if you have the `isspace' function. */
/* #undef HAVE_ISDIGIT */
/* Define to 1 if you have the `isspace' function. */
/* #undef HAVE_ISPRINT */
/* Define to 1 if you have the `isspace' function. */
/* #undef HAVE_ISSPACE */
/* Define to 1 if you have the `localtime' function. */
/* #undef HAVE_LOCALTIME */
/* Define to 1 if you have the `memcmp' function. */
#define HAVE_MEMCMP 1
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define to 1 if you have the `mlock' function. */
/* #undef HAVE_MLOCK */
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Define to 1 if you have the `munlock' function. */
/* #undef HAVE_MUNLOCK */
/* Define to 1 if you have the `munmap' function. */
/* #undef HAVE_MUNMAP */
/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */
/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */
/* Define to 1 to use the AIX _check_lock mutexes. */
/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */
/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */
/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */
/* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
/* #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY */
/* Define to 1 to use the UNIX fcntl system call mutexes. */
/* #undef HAVE_MUTEX_FCNTL */
/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes.
*/
/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on HP-UX. */
/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */
/* Define to 1 to use test-and-set mutexes with blocking mutexes. */
/* #undef HAVE_MUTEX_HYBRID */
/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */
/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes. */
/* #undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */
/* #undef HAVE_MUTEX_MSEM_INIT */
/* Define to 1 to use the GCC compiler and PowerPC assembly language mutexes.
*/
/* #undef HAVE_MUTEX_PPC_GCC_ASSEMBLY */
/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */
/* #undef HAVE_MUTEX_PTHREADS */
/* Define to 1 to use Reliant UNIX initspin mutexes. */
/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */
/* Define to 1 to use the IBM C compiler and S/390 assembly language mutexes.
*/
/* #undef HAVE_MUTEX_S390_CC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */
/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */
/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */
/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */
/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */
/* #undef HAVE_MUTEX_SEMA_INIT */
/* Define to 1 to use the SGI XXX_lock mutexes. */
/* #undef HAVE_MUTEX_SGI_INIT_LOCK */
/* Define to 1 to use the Solaris _lock_XXX mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */
/* Define to 1 to use the Solaris lwp threads mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LWP */
/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */
/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */
/* Define to 1 if the Berkeley DB library should support mutexes. */
/* #undef HAVE_MUTEX_SUPPORT */
/* Define to 1 if mutexes hold system resources. */
/* #undef HAVE_MUTEX_SYSTEM_RESOURCES */
/* Define to 1 to configure mutexes intra-process only. */
/* #undef HAVE_MUTEX_THREAD_ONLY */
/* Define to 1 to use the CC compiler and Tru64 assembly language mutexes. */
/* #undef HAVE_MUTEX_TRU64_CC_ASSEMBLY */
/* Define to 1 to use the UNIX International mutexes. */
/* #undef HAVE_MUTEX_UI_THREADS */
/* Define to 1 to use the UTS compiler and assembly language mutexes. */
/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */
/* Define to 1 to use VMS mutexes. */
/* #undef HAVE_MUTEX_VMS */
/* Define to 1 to use VxWorks mutexes. */
/* #undef HAVE_MUTEX_VXWORKS */
/* Define to 1 to use the MSVC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32 */
/* Define to 1 to use the GCC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32_GCC */
/* Define to 1 to use the GCC compiler and 64-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and 32-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the O_DIRECT flag. */
/* #undef HAVE_O_DIRECT */
/* Define to 1 if you have the `pread' function. */
/* #undef HAVE_PREAD */
/* Define to 1 if you have the `printf' function. */
/* #undef HAVE_PRINTF */
/* Define to 1 if you have the `pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define to 1 to configure Berkeley DB for POSIX pthread API. */
/* #undef HAVE_PTHREAD_API */
/* Define to 1 if you have the `pthread_yield' function. */
/* #undef HAVE_PTHREAD_YIELD */
/* Define to 1 if you have the `pwrite' function. */
/* #undef HAVE_PWRITE */
/* Define to 1 if building on QNX. */
/* #undef HAVE_QNX */
/* Define to 1 if you have the `qsort' function. */
/* #undef HAVE_QSORT */
/* Define to 1 if building Queue access method. */
/* #undef HAVE_QUEUE */
/* Define to 1 if you have the `raise' function. */
/* #undef HAVE_RAISE */
/* Define to 1 if you have the `rand' function. */
/* #undef HAVE_RAND */
/* Define to 1 if building replication support. */
/* #undef HAVE_REPLICATION */
/* Define to 1 if building the Berkeley DB replication framework. */
/* #undef HAVE_REPLICATION_THREADS */
/* Define to 1 if building RPC client/server. */
/* #undef HAVE_RPC */
/* Define to 1 if building on S60. */
/* #undef HAVE_S60 */
/* Define to 1 if you have the `sched_yield' function. */
/* #undef HAVE_SCHED_YIELD */
/* Define to 1 if you have the `select' function. */
/* #undef HAVE_SELECT */
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if shmctl/SHM_LOCK locks down shared memory segments. */
/* #undef HAVE_SHMCTL_SHM_LOCK */
/* Define to 1 if you have the `shmget' function. */
/* #undef HAVE_SHMGET */
/* Define to 1 if you have the `sigaction' function. */
/* #undef HAVE_SIGACTION */
/* Define to 1 if thread identifier type db_threadid_t is integral. */
/* #undef HAVE_SIMPLE_THREAD_TYPE */
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `stat' function. */
/* #undef HAVE_STAT */
/* Define to 1 if building statistics support. */
/* #undef HAVE_STATISTICS */
/* Define to 1 if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdlib.h> header file. */
/* #undef HAVE_STDLIB_H */
/* Define to 1 if you have the `strcasecmp' function. */
/* #undef HAVE_STRCASECMP */
/* Define to 1 if you have the `strcat' function. */
#define HAVE_STRCAT 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
/* #undef HAVE_STRERROR */
/* Define to 1 if you have the `strftime' function. */
/* #undef HAVE_STRFTIME */
/* Define to 1 if you have the <strings.h> header file. */
/* #undef HAVE_STRINGS_H */
/* Define to 1 if you have the <string.h> header file. */
/* #undef HAVE_STRING_H */
/* Define to 1 if you have the `strncat' function. */
/* #undef HAVE_STRNCAT */
/* Define to 1 if you have the `strncmp' function. */
#define HAVE_STRNCMP 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strsep' function. */
/* #undef HAVE_STRSEP */
/* Define to 1 if you have the `strtol' function. */
/* #undef HAVE_STRTOL */
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if `st_blksize' is member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */
/* Define to 1 if you have the `sysconf' function. */
/* #undef HAVE_SYSCONF */
/* Define to 1 if port includes files in the Berkeley DB source code. */
/* #undef HAVE_SYSTEM_INCLUDE_FILES */
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define to 1 if you have the <sys/types.h> header file. */
/* #undef HAVE_SYS_TYPES_H 1*/
/* Define to 1 if you have the `time' function. */
/* #undef HAVE_TIME */
/* Define to 1 if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Define to 1 if unlink of file with open file descriptors will fail. */
/* #undef HAVE_UNLINK_WITH_OPEN_FAILURE */
/* Define to 1 if port includes historic database upgrade support. */
/* #undef HAVE_UPGRADE_SUPPORT */
/* Define to 1 if building access method verification support. */
/* #undef HAVE_VERIFY */
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if building VxWorks. */
/* #undef HAVE_VXWORKS */
/* Define to 1 if you have the `yield' function. */
/* #undef HAVE_YIELD */
/* Define to 1 if you have the `_fstati64' function. */
/* #undef HAVE__FSTATI64 1*/
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "support@sleepycat.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Berkeley DB"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Berkeley DB 4.7.25"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "db-4.7.25"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.7.25"
/* The size of a `char', as computed by sizeof. */
#define SIZEOF_CHAR 1
/* The size of a `char *', as computed by sizeof. */
#define SIZEOF_CHAR_P 4
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of a `long long', as computed by sizeof. */
/* #undef SIZEOF_LONG_LONG */
/* The size of a `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of a `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of a `unsigned char', as computed by sizeof. */
#define SIZEOF_UNSIGNED_CHAR 1
/* The size of a `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* The size of a `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 4
/* The size of a `unsigned long long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG_LONG */
/* The size of a `unsigned short', as computed by sizeof. */
#define SIZEOF_UNSIGNED_SHORT 2
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define to 1 to mask harmless uninitialized memory read/writes. */
/* #undef UMRW */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline
#endif
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */

914
build_brew/db_int.h Normal file
View File

@@ -0,0 +1,914 @@
/* DO NOT EDIT: automatically built by dist/s_brew. */
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_int.h 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#ifndef _DB_INT_H_
#define _DB_INT_H_
/*******************************************************
* Berkeley DB ANSI/POSIX include files.
*******************************************************/
#ifdef HAVE_SYSTEM_INCLUDE_FILES
#include <sys/types.h>
#ifdef DIAG_MVCC
#include <sys/mman.h>
#endif
#include <sys/stat.h>
#if defined(__INCLUDE_SELECT_H)
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_VXWORKS
#include <selectLib.h>
#endif
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_VXWORKS
#include <net/uio.h>
#else
#include <sys/uio.h>
#endif
#if defined(__INCLUDE_NETWORKING)
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#endif
#if defined(STDC_HEADERS) || defined(__cplusplus)
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#if defined(__INCLUDE_DIRECTORY)
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#endif /* __INCLUDE_DIRECTORY */
#endif /* !HAVE_SYSTEM_INCLUDE_FILES */
#include "brew_db.h"
#ifdef DB_WIN32
#include "dbinc/win_db.h"
#endif
#include "db.h"
#include "clib_port.h"
#include "dbinc/queue.h"
#include "dbinc/shqueue.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************
* Forward structure declarations.
*******************************************************/
struct __db_reginfo_t; typedef struct __db_reginfo_t REGINFO;
struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD;
struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST;
struct __vrfy_childinfo;typedef struct __vrfy_childinfo VRFY_CHILDINFO;
struct __vrfy_dbinfo; typedef struct __vrfy_dbinfo VRFY_DBINFO;
struct __vrfy_pageinfo; typedef struct __vrfy_pageinfo VRFY_PAGEINFO;
typedef SH_TAILQ_HEAD(__hash_head) DB_HASHTAB;
/*******************************************************
* General purpose constants and macros.
*******************************************************/
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE (!FALSE)
#define MEGABYTE 1048576
#define GIGABYTE 1073741824
#define NS_PER_MS 1000000 /* Nanoseconds in a millisecond */
#define NS_PER_US 1000 /* Nanoseconds in a microsecond */
#define NS_PER_SEC 1000000000 /* Nanoseconds in a second */
#define US_PER_MS 1000 /* Microseconds in a millisecond */
#define US_PER_SEC 1000000 /* Microseconds in a second */
#define MS_PER_SEC 1000 /* Milliseconds in a second */
#define RECNO_OOB 0 /* Illegal record number. */
/* Test for a power-of-two (tests true for zero, which doesn't matter here). */
#define POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
/* Test for valid page sizes. */
#define DB_MIN_PGSIZE 0x000200 /* Minimum page size (512). */
#define DB_MAX_PGSIZE 0x010000 /* Maximum page size (65536). */
#define IS_VALID_PAGESIZE(x) \
(POWER_OF_TWO(x) && (x) >= DB_MIN_PGSIZE && ((x) <= DB_MAX_PGSIZE))
/* Minimum number of pages cached, by default. */
#define DB_MINPAGECACHE 16
/*
* If we are unable to determine the underlying filesystem block size, use
* 8K on the grounds that most OS's use less than 8K for a VM page size.
*/
#define DB_DEF_IOSIZE (8 * 1024)
/* Align an integer to a specific boundary. */
#undef DB_ALIGN
#define DB_ALIGN(v, bound) \
(((v) + (bound) - 1) & ~(((uintmax_t)(bound)) - 1))
/* Increment a pointer to a specific boundary. */
#undef ALIGNP_INC
#define ALIGNP_INC(p, bound) \
(void *)(((uintptr_t)(p) + (bound) - 1) & ~(((uintptr_t)(bound)) - 1))
/*
* Print an address as a u_long (a u_long is the largest type we can print
* portably). Most 64-bit systems have made longs 64-bits, so this should
* work.
*/
#define P_TO_ULONG(p) ((u_long)(uintptr_t)(p))
/*
* Convert a pointer to a small integral value.
*
* The (u_int16_t)(uintptr_t) cast avoids warnings: the (uintptr_t) cast
* converts the value to an integral type, and the (u_int16_t) cast converts
* it to a small integral type so we don't get complaints when we assign the
* final result to an integral type smaller than uintptr_t.
*/
#define P_TO_UINT32(p) ((u_int32_t)(uintptr_t)(p))
#define P_TO_UINT16(p) ((u_int16_t)(uintptr_t)(p))
/*
* There are several on-page structures that are declared to have a number of
* fields followed by a variable length array of items. The structure size
* without including the variable length array or the address of the first of
* those elements can be found using SSZ.
*
* This macro can also be used to find the offset of a structure element in a
* structure. This is used in various places to copy structure elements from
* unaligned memory references, e.g., pointers into a packed page.
*
* There are two versions because compilers object if you take the address of
* an array.
*/
#undef SSZ
#define SSZ(name, field) P_TO_UINT16(&(((name *)0)->field))
#undef SSZA
#define SSZA(name, field) P_TO_UINT16(&(((name *)0)->field[0]))
/* Structure used to print flag values. */
typedef struct __fn {
u_int32_t mask; /* Flag value. */
const char *name; /* Flag name. */
} FN;
/* Set, clear and test flags. */
#define FLD_CLR(fld, f) (fld) &= ~(f)
#define FLD_ISSET(fld, f) ((fld) & (f))
#define FLD_SET(fld, f) (fld) |= (f)
#define F_CLR(p, f) (p)->flags &= ~(f)
#define F_ISSET(p, f) ((p)->flags & (f))
#define F_SET(p, f) (p)->flags |= (f)
#define LF_CLR(f) ((flags) &= ~(f))
#define LF_ISSET(f) ((flags) & (f))
#define LF_SET(f) ((flags) |= (f))
/*
* Calculate a percentage. The values can overflow 32-bit integer arithmetic
* so we use floating point.
*
* When calculating a bytes-vs-page size percentage, we're getting the inverse
* of the percentage in all cases, that is, we want 100 minus the percentage we
* calculate.
*/
#define DB_PCT(v, total) \
((int)((total) == 0 ? 0 : ((double)(v) * 100) / (total)))
#define DB_PCT_PG(v, total, pgsize) \
((int)((total) == 0 ? 0 : \
100 - ((double)(v) * 100) / (((double)total) * (pgsize))))
/*
* Statistics update shared memory and so are expensive -- don't update the
* values unless we're going to display the results.
*/
#undef STAT
#ifdef HAVE_STATISTICS
#define STAT(x) x
#else
#define STAT(x)
#endif
/*
* Structure used for callback message aggregation.
*
* Display values in XXX_stat_print calls.
*/
typedef struct __db_msgbuf {
char *buf; /* Heap allocated buffer. */
char *cur; /* Current end of message. */
size_t len; /* Allocated length of buffer. */
} DB_MSGBUF;
#define DB_MSGBUF_INIT(a) do { \
(a)->buf = (a)->cur = NULL; \
(a)->len = 0; \
} while (0)
#define DB_MSGBUF_FLUSH(env, a) do { \
if ((a)->buf != NULL) { \
if ((a)->cur != (a)->buf) \
__db_msg(env, "%s", (a)->buf); \
__os_free(env, (a)->buf); \
DB_MSGBUF_INIT(a); \
} \
} while (0)
#define STAT_FMT(msg, fmt, type, v) do { \
DB_MSGBUF __mb; \
DB_MSGBUF_INIT(&__mb); \
__db_msgadd(env, &__mb, fmt, (type)(v)); \
__db_msgadd(env, &__mb, "\t%s", msg); \
DB_MSGBUF_FLUSH(env, &__mb); \
} while (0)
#define STAT_HEX(msg, v) \
__db_msg(env, "%#lx\t%s", (u_long)(v), msg)
#define STAT_ISSET(msg, p) \
__db_msg(env, "%sSet\t%s", (p) == NULL ? "!" : " ", msg)
#define STAT_LONG(msg, v) \
__db_msg(env, "%ld\t%s", (long)(v), msg)
#define STAT_LSN(msg, lsnp) \
__db_msg(env, "%lu/%lu\t%s", \
(u_long)(lsnp)->file, (u_long)(lsnp)->offset, msg)
#define STAT_POINTER(msg, v) \
__db_msg(env, "%#lx\t%s", P_TO_ULONG(v), msg)
#define STAT_STRING(msg, p) do { \
const char *__p = p; /* p may be a function call. */ \
__db_msg(env, "%s\t%s", __p == NULL ? "!Set" : __p, msg); \
} while (0)
#define STAT_ULONG(msg, v) \
__db_msg(env, "%lu\t%s", (u_long)(v), msg)
/*
* There are quite a few places in Berkeley DB where we want to initialize
* a DBT from a string or other random pointer type, using a length typed
* to size_t in most cases. This macro avoids a lot of casting. The macro
* comes in two flavors because we often want to clear the DBT first.
*/
#define DB_SET_DBT(dbt, d, s) do { \
(dbt).data = (void *)(d); \
(dbt).size = (u_int32_t)(s); \
} while (0)
#define DB_INIT_DBT(dbt, d, s) do { \
memset(&(dbt), 0, sizeof(dbt)); \
DB_SET_DBT(dbt, d, s); \
} while (0)
/*******************************************************
* API return values
*******************************************************/
/*
* Return values that are OK for each different call. Most calls have a
* standard 'return of 0 is only OK value', but some, like db->get have
* DB_NOTFOUND as a return value, but it really isn't an error.
*/
#define DB_RETOK_STD(ret) ((ret) == 0)
#define DB_RETOK_DBCDEL(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCGET(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBDEL(ret) DB_RETOK_DBCDEL(ret)
#define DB_RETOK_DBGET(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_DBPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST)
#define DB_RETOK_EXISTS(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_LGGET(ret) ((ret) == 0 || (ret) == DB_NOTFOUND)
#define DB_RETOK_MPGET(ret) ((ret) == 0 || (ret) == DB_PAGE_NOTFOUND)
#define DB_RETOK_REPPMSG(ret) ((ret) == 0 || \
(ret) == DB_REP_IGNORE || \
(ret) == DB_REP_ISPERM || \
(ret) == DB_REP_NEWMASTER || \
(ret) == DB_REP_NEWSITE || \
(ret) == DB_REP_NOTPERM)
/* Find a reasonable operation-not-supported error. */
#ifdef EOPNOTSUPP
#define DB_OPNOTSUP EOPNOTSUPP
#else
#ifdef ENOTSUP
#define DB_OPNOTSUP ENOTSUP
#else
#define DB_OPNOTSUP EINVAL
#endif
#endif
/*******************************************************
* Files.
*******************************************************/
/*
* We use 1024 as the maximum path length. It's too hard to figure out what
* the real path length is, as it was traditionally stored in <sys/param.h>,
* and that file isn't always available.
*/
#define DB_MAXPATHLEN 1024
#define PATH_DOT "." /* Current working directory. */
/* Path separator character(s). */
#define PATH_SEPARATOR "\\/:"
/*******************************************************
* Environment.
*******************************************************/
/* Type passed to __db_appname(). */
typedef enum {
DB_APP_NONE=0, /* No type (region). */
DB_APP_DATA, /* Data file. */
DB_APP_LOG, /* Log file. */
DB_APP_TMP /* Temporary file. */
} APPNAME;
/*
* A set of macros to check if various functionality has been configured.
*
* ALIVE_ON The is_alive function is configured.
* CDB_LOCKING CDB product locking.
* CRYPTO_ON Security has been configured.
* LOCKING_ON Locking has been configured.
* LOGGING_ON Logging has been configured.
* MUTEX_ON Mutexes have been configured.
* MPOOL_ON Memory pool has been configured.
* REP_ON Replication has been configured.
* RPC_ON RPC has been configured.
* TXN_ON Transactions have been configured.
*
* REP_ON is more complex than most: if the BDB library was compiled without
* replication support, ENV->rep_handle will be NULL; if the BDB library has
* replication support, but it was not configured, the region reference will
* be NULL.
*/
#define ALIVE_ON(env) ((env)->dbenv->is_alive != NULL)
#define CDB_LOCKING(env) F_ISSET(env, ENV_CDB)
#define CRYPTO_ON(env) ((env)->crypto_handle != NULL)
#define LOCKING_ON(env) ((env)->lk_handle != NULL)
#define LOGGING_ON(env) ((env)->lg_handle != NULL)
#define MPOOL_ON(env) ((env)->mp_handle != NULL)
#define MUTEX_ON(env) ((env)->mutex_handle != NULL)
#define REP_ON(env) \
((env)->rep_handle != NULL && (env)->rep_handle->region != NULL)
#define RPC_ON(dbenv) ((dbenv)->cl_handle != NULL)
#define TXN_ON(env) ((env)->tx_handle != NULL)
/*
* STD_LOCKING Standard locking, that is, locking was configured and CDB
* was not. We do not do locking in off-page duplicate trees,
* so we check for that in the cursor first.
*/
#define STD_LOCKING(dbc) \
(!F_ISSET(dbc, DBC_OPD) && \
!CDB_LOCKING((dbc)->env) && LOCKING_ON((dbc)->env))
/*
* IS_RECOVERING: The system is running recovery.
*/
#define IS_RECOVERING(env) \
(LOGGING_ON(env) && F_ISSET((env)->lg_handle, DBLOG_RECOVER))
/* Initialization methods are often illegal before/after open is called. */
#define ENV_ILLEGAL_AFTER_OPEN(env, name) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 1));
#define ENV_ILLEGAL_BEFORE_OPEN(env, name) \
if (!F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 0));
/* We're not actually user hostile, honest. */
#define ENV_REQUIRES_CONFIG(env, handle, i, flags) \
if (handle == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_REQUIRES_CONFIG_XX(env, handle, i, flags) \
if ((env)->handle->region == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_NOT_CONFIGURED(env, handle, i, flags) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
ENV_REQUIRES_CONFIG(env, handle, i, flags)
#define ENV_ENTER(env, ip) do { \
int __ret; \
PANIC_CHECK(env); \
if ((env)->thr_hashtab == NULL) \
ip = NULL; \
else { \
if ((__ret = \
__env_set_state(env, &(ip), THREAD_ACTIVE)) != 0) \
return (__ret); \
} \
} while (0)
#define ENV_GET_THREAD_INFO(env, ip) ENV_ENTER(env, ip)
#ifdef DIAGNOSTIC
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) { \
DB_ASSERT(env, (ip)->dbth_state == THREAD_ACTIVE); \
(ip)->dbth_state = THREAD_OUT; \
} \
} while (0)
#else
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) \
(ip)->dbth_state = THREAD_OUT; \
} while (0)
#endif
#ifdef DIAGNOSTIC
#define CHECK_THREAD(env) do { \
if ((env)->thr_hashtab != NULL) \
(void)__env_set_state(env, NULL, THREAD_VERIFY); \
} while (0)
#ifdef HAVE_STATISTICS
#define CHECK_MTX_THREAD(env, mtx) do { \
if (mtx->alloc_id != MTX_MUTEX_REGION && \
mtx->alloc_id != MTX_ENV_REGION && \
mtx->alloc_id != MTX_APPLICATION) \
CHECK_THREAD(env); \
} while (0)
#else
#define CHECK_MTX_THREAD(env, mtx)
#endif
#else
#define CHECK_THREAD(env)
#define CHECK_MTX_THREAD(env, mtx)
#endif
typedef enum {
THREAD_SLOT_NOT_IN_USE=0,
THREAD_OUT,
THREAD_ACTIVE,
THREAD_BLOCKED,
THREAD_BLOCKED_DEAD
#ifdef DIAGNOSTIC
, THREAD_VERIFY
#endif
} DB_THREAD_STATE;
typedef struct __pin_list {
roff_t b_ref; /* offset to buffer. */
int region; /* region containing buffer. */
} PIN_LIST;
#define PINMAX 4
struct __db_thread_info {
pid_t dbth_pid;
db_threadid_t dbth_tid;
DB_THREAD_STATE dbth_state;
SH_TAILQ_ENTRY dbth_links;
/*
* The following fields track which buffers this thread of
* control has pinned in the mpool buffer cache.
*/
u_int16_t dbth_pincount; /* Number of pins for this thread. */
u_int16_t dbth_pinmax; /* Number of slots allocated. */
roff_t dbth_pinlist; /* List of pins. */
PIN_LIST dbth_pinarray[PINMAX]; /* Initial array of slots. */
};
typedef struct __env_thread_info {
u_int32_t thr_count;
u_int32_t thr_max;
u_int32_t thr_nbucket;
roff_t thr_hashoff;
} THREAD_INFO;
#define DB_EVENT(env, e, einfo) do { \
DB_ENV *__dbenv = (env)->dbenv; \
if (__dbenv->db_event_func != NULL) \
__dbenv->db_event_func(__dbenv, e, einfo); \
} while (0)
typedef struct __flag_map {
u_int32_t inflag, outflag;
} FLAG_MAP;
/*
* Internal database environment structure.
*
* This is the private database environment handle. The public environment
* handle is the DB_ENV structure. The library owns this structure, the user
* owns the DB_ENV structure. The reason there are two structures is because
* the user's configuration outlives any particular DB_ENV->open call, and
* separate structures allows us to easily discard internal information without
* discarding the user's configuration.
*/
struct __env {
DB_ENV *dbenv; /* Linked DB_ENV structure */
/*
* The ENV structure can be used concurrently, so field access is
* protected.
*/
db_mutex_t mtx_env; /* ENV structure mutex */
/*
* Some fields are included in the ENV structure rather than in the
* DB_ENV structure because they are only set as arguments to the
* DB_ENV->open method. In other words, because of the historic API,
* not for any rational reason.
*
* Arguments to DB_ENV->open.
*/
char *db_home; /* Database home */
u_int32_t open_flags; /* Flags */
int db_mode; /* Default open permissions */
pid_t pid_cache; /* Cached process ID */
DB_FH *lockfhp; /* fcntl(2) locking file handle */
DB_LOCKER *env_lref; /* Locker in non-threaded handles */
DB_DISTAB recover_dtab; /* Dispatch table for recover funcs */
int dir_mode; /* Intermediate directory perms. */
/* Thread tracking */
u_int32_t thr_nbucket; /* Number of hash buckets */
DB_HASHTAB *thr_hashtab; /* Hash table of DB_THREAD_INFO */
/* Mutex allocation */
struct {
int alloc_id; /* Allocation ID argument */
u_int32_t flags; /* Flags argument */
} *mutex_iq; /* Initial mutexes queue */
u_int mutex_iq_next; /* Count of initial mutexes */
u_int mutex_iq_max; /* Maximum initial mutexes */
/*
* List of open DB handles for this ENV, used for cursor
* adjustment. Must be protected for multi-threaded support.
*/
db_mutex_t mtx_dblist;
int db_ref; /* DB handle reference count */
TAILQ_HEAD(__dblist, __db) dblist;
/*
* XA support.
*/
int xa_rmid; /* XA Resource Manager ID */
TAILQ_ENTRY(__env) links; /* XA environments */
TAILQ_HEAD(__xa_txn, __db_txn) xa_txn; /* XA active transactions */
/*
* List of open file handles for this ENV. Must be protected
* for multi-threaded support.
*/
TAILQ_HEAD(__fdlist, __fh_t) fdlist;
db_mutex_t mtx_mt; /* Mersenne Twister mutex */
int mti; /* Mersenne Twister index */
u_long *mt; /* Mersenne Twister state vector */
DB_CIPHER *crypto_handle; /* Crypto handle */
DB_LOCKTAB *lk_handle; /* Lock handle */
DB_LOG *lg_handle; /* Log handle */
DB_MPOOL *mp_handle; /* Mpool handle */
DB_MUTEXMGR *mutex_handle; /* Mutex handle */
DB_REP *rep_handle; /* Replication handle */
DB_TXNMGR *tx_handle; /* Txn handle */
/* Application callback to copy data to/from a custom data source */
#define DB_USERCOPY_GETDATA 0x0001
#define DB_USERCOPY_SETDATA 0x0002
int (*dbt_usercopy)
__P((DBT *, u_int32_t, void *, u_int32_t, u_int32_t));
REGINFO *reginfo; /* REGINFO structure reference */
#define DB_TEST_ELECTINIT 1 /* after __rep_elect_init */
#define DB_TEST_ELECTVOTE1 2 /* after sending VOTE1 */
#define DB_TEST_POSTDESTROY 3 /* after destroy op */
#define DB_TEST_POSTLOG 4 /* after logging all pages */
#define DB_TEST_POSTLOGMETA 5 /* after logging meta in btree */
#define DB_TEST_POSTOPEN 6 /* after __os_open */
#define DB_TEST_POSTSYNC 7 /* after syncing the log */
#define DB_TEST_PREDESTROY 8 /* before destroy op */
#define DB_TEST_PREOPEN 9 /* before __os_open */
#define DB_TEST_SUBDB_LOCKS 10 /* subdb locking tests */
int test_abort; /* Abort value for testing */
int test_check; /* Checkpoint value for testing */
int test_copy; /* Copy value for testing */
#define ENV_CDB 0x00000001 /* DB_INIT_CDB */
#define ENV_DBLOCAL 0x00000002 /* Environment for a private DB */
#define ENV_LITTLEENDIAN 0x00000004 /* Little endian system. */
#define ENV_LOCKDOWN 0x00000008 /* DB_LOCKDOWN set */
#define ENV_NO_OUTPUT_SET 0x00000010 /* No output channel set */
#define ENV_OPEN_CALLED 0x00000020 /* DB_ENV->open called */
#define ENV_PRIVATE 0x00000040 /* DB_PRIVATE set */
#define ENV_RECOVER_FATAL 0x00000080 /* Doing fatal recovery in env */
#define ENV_REF_COUNTED 0x00000100 /* Region references this handle */
#define ENV_SYSTEM_MEM 0x00000200 /* DB_SYSTEM_MEM set */
#define ENV_THREAD 0x00000400 /* DB_THREAD set */
u_int32_t flags;
};
/*******************************************************
* Database Access Methods.
*******************************************************/
/*
* DB_IS_THREADED --
* The database handle is free-threaded (was opened with DB_THREAD).
*/
#define DB_IS_THREADED(dbp) \
((dbp)->mutex != MUTEX_INVALID)
/* Initialization methods are often illegal before/after open is called. */
#define DB_ILLEGAL_AFTER_OPEN(dbp, name) \
if (F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 1));
#define DB_ILLEGAL_BEFORE_OPEN(dbp, name) \
if (!F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 0));
/* Some initialization methods are illegal if environment isn't local. */
#define DB_ILLEGAL_IN_ENV(dbp, name) \
if (!F_ISSET((dbp)->env, ENV_DBLOCAL)) \
return (__db_mi_env((dbp)->env, name));
#define DB_ILLEGAL_METHOD(dbp, flags) { \
int __ret; \
if ((__ret = __dbh_am_chk(dbp, flags)) != 0) \
return (__ret); \
}
/*
* Common DBC->internal fields. Each access method adds additional fields
* to this list, but the initial fields are common.
*/
#define __DBC_INTERNAL \
DBC *opd; /* Off-page duplicate cursor. */\
\
void *page; /* Referenced page. */ \
db_pgno_t root; /* Tree root. */ \
db_pgno_t pgno; /* Referenced page number. */ \
db_indx_t indx; /* Referenced key item index. */\
\
DB_LOCK lock; /* Cursor lock. */ \
db_lockmode_t lock_mode; /* Lock mode. */
struct __dbc_internal {
__DBC_INTERNAL
};
/* Actions that __db_master_update can take. */
typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action;
/*
* Access-method-common macro for determining whether a cursor
* has been initialized.
*/
#define IS_INITIALIZED(dbc) ((dbc)->internal->pgno != PGNO_INVALID)
/* Free the callback-allocated buffer, if necessary, hanging off of a DBT. */
#define FREE_IF_NEEDED(env, dbt) \
if (F_ISSET((dbt), DB_DBT_APPMALLOC)) { \
__os_ufree((env), (dbt)->data); \
F_CLR((dbt), DB_DBT_APPMALLOC); \
}
/*
* Use memory belonging to object "owner" to return the results of
* any no-DBT-flag get ops on cursor "dbc".
*/
#define SET_RET_MEM(dbc, owner) \
do { \
(dbc)->rskey = &(owner)->my_rskey; \
(dbc)->rkey = &(owner)->my_rkey; \
(dbc)->rdata = &(owner)->my_rdata; \
} while (0)
/* Use the return-data memory src is currently set to use in dest as well. */
#define COPY_RET_MEM(src, dest) \
do { \
(dest)->rskey = (src)->rskey; \
(dest)->rkey = (src)->rkey; \
(dest)->rdata = (src)->rdata; \
} while (0)
/* Reset the returned-memory pointers to their defaults. */
#define RESET_RET_MEM(dbc) \
do { \
(dbc)->rskey = &(dbc)->my_rskey; \
(dbc)->rkey = &(dbc)->my_rkey; \
(dbc)->rdata = &(dbc)->my_rdata; \
} while (0)
/*******************************************************
* Mpool.
*******************************************************/
/*
* File types for DB access methods. Negative numbers are reserved to DB.
*/
#define DB_FTYPE_SET -1 /* Call pgin/pgout functions. */
#define DB_FTYPE_NOTSET 0 /* Don't call... */
#define DB_LSN_OFF_NOTSET -1 /* Not yet set. */
#define DB_CLEARLEN_NOTSET UINT32_MAX /* Not yet set. */
/* Structure used as the DB pgin/pgout pgcookie. */
typedef struct __dbpginfo {
size_t db_pagesize; /* Underlying page size. */
u_int32_t flags; /* Some DB_AM flags needed. */
DBTYPE type; /* DB type */
} DB_PGINFO;
/*******************************************************
* Log.
*******************************************************/
/* Initialize an LSN to 'zero'. */
#define ZERO_LSN(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 0; \
} while (0)
#define IS_ZERO_LSN(LSN) ((LSN).file == 0 && (LSN).offset == 0)
#define IS_INIT_LSN(LSN) ((LSN).file == 1 && (LSN).offset == 0)
#define INIT_LSN(LSN) do { \
(LSN).file = 1; \
(LSN).offset = 0; \
} while (0)
#define MAX_LSN(LSN) do { \
(LSN).file = UINT32_MAX; \
(LSN).offset = UINT32_MAX; \
} while (0)
#define IS_MAX_LSN(LSN) \
((LSN).file == UINT32_MAX && (LSN).offset == UINT32_MAX)
/* If logging is turned off, smash the lsn. */
#define LSN_NOT_LOGGED(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 1; \
} while (0)
#define IS_NOT_LOGGED_LSN(LSN) \
((LSN).file == 0 && (LSN).offset == 1)
/*
* LOG_COMPARE -- compare two LSNs.
*/
#define LOG_COMPARE(lsn0, lsn1) \
((lsn0)->file != (lsn1)->file ? \
((lsn0)->file < (lsn1)->file ? -1 : 1) : \
((lsn0)->offset != (lsn1)->offset ? \
((lsn0)->offset < (lsn1)->offset ? -1 : 1) : 0))
/*******************************************************
* Txn.
*******************************************************/
#define DB_NONBLOCK(C) ((C)->txn != NULL && F_ISSET((C)->txn, TXN_NOWAIT))
#define NOWAIT_FLAG(txn) \
((txn) != NULL && F_ISSET((txn), TXN_NOWAIT) ? DB_LOCK_NOWAIT : 0)
#define IS_REAL_TXN(txn) \
((txn) != NULL && !F_ISSET(txn, TXN_CDSGROUP))
#define IS_SUBTRANSACTION(txn) \
((txn) != NULL && (txn)->parent != NULL)
/*******************************************************
* Crypto.
*******************************************************/
#define DB_IV_BYTES 16 /* Bytes per IV */
#define DB_MAC_KEY 20 /* Bytes per MAC checksum */
/*******************************************************
* Secondaries over RPC.
*******************************************************/
#ifdef CONFIG_TEST
/*
* These are flags passed to DB->associate calls by the Tcl API if running
* over RPC. The RPC server will mask out these flags before making the real
* DB->associate call.
*
* These flags must coexist with the valid flags to DB->associate (currently
* DB_AUTO_COMMIT and DB_CREATE). DB_AUTO_COMMIT is in the group of
* high-order shared flags (0xff000000), and DB_CREATE is in the low-order
* group (0x00000fff), so we pick a range in between.
*/
#define DB_RPC2ND_MASK 0x00f00000 /* Reserved bits. */
#define DB_RPC2ND_REVERSEDATA 0x00100000 /* callback_n(0) _s_reversedata. */
#define DB_RPC2ND_NOOP 0x00200000 /* callback_n(1) _s_noop */
#define DB_RPC2ND_CONCATKEYDATA 0x00300000 /* callback_n(2) _s_concatkeydata */
#define DB_RPC2ND_CONCATDATAKEY 0x00400000 /* callback_n(3) _s_concatdatakey */
#define DB_RPC2ND_REVERSECONCAT 0x00500000 /* callback_n(4) _s_reverseconcat */
#define DB_RPC2ND_TRUNCDATA 0x00600000 /* callback_n(5) _s_truncdata */
#define DB_RPC2ND_CONSTANT 0x00700000 /* callback_n(6) _s_constant */
#define DB_RPC2ND_GETZIP 0x00800000 /* sj_getzip */
#define DB_RPC2ND_GETNAME 0x00900000 /* sj_getname */
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Remaining general DB includes.
*******************************************************/
#include "dbinc/globals.h"
#include "dbinc/clock.h"
#include "dbinc/debug.h"
#include "dbinc/region.h"
#include "dbinc_auto/env_ext.h"
#include "dbinc/mutex.h"
#ifdef HAVE_REPLICATION_THREADS
#include "dbinc/repmgr.h"
#endif
#include "dbinc/rep.h"
#include "dbinc/os.h"
#include "dbinc_auto/clib_ext.h"
#include "dbinc_auto/common_ext.h"
/*******************************************************
* Remaining Log.
* These need to be defined after the general includes
* because they need rep.h from above.
*******************************************************/
/*
* Test if the environment is currently logging changes. If we're in recovery
* or we're a replication client, we don't need to log changes because they're
* already in the log, even though we have a fully functional log system.
*/
#define DBENV_LOGGING(env) \
(LOGGING_ON(env) && !IS_REP_CLIENT(env) && (!IS_RECOVERING(env)))
/*
* Test if we need to log a change. By default, we don't log operations without
* associated transactions, unless DIAGNOSTIC, DEBUG_ROP or DEBUG_WOP are on.
* This is because we want to get log records for read/write operations, and, if
* we are trying to debug something, more information is always better.
*
* The DBC_RECOVER flag is set when we're in abort, as well as during recovery;
* thus DBC_LOGGING may be false for a particular dbc even when DBENV_LOGGING
* is true.
*
* We explicitly use LOGGING_ON/IS_REP_CLIENT here because we don't want to pull
* in the log headers, which IS_RECOVERING (and thus DBENV_LOGGING) rely on, and
* because DBC_RECOVER should be set anytime IS_RECOVERING would be true.
*
* If we're not in recovery (master - doing an abort or a client applying
* a txn), then a client's only path through here is on an internal
* operation, and a master's only path through here is a transactional
* operation. Detect if either is not the case.
*/
#if defined(DIAGNOSTIC) || defined(DEBUG_ROP) || defined(DEBUG_WOP)
#define DBC_LOGGING(dbc) __dbc_logging(dbc)
#else
#define DBC_LOGGING(dbc) \
((dbc)->txn != NULL && LOGGING_ON((dbc)->env) && \
!F_ISSET((dbc), DBC_RECOVER) && !IS_REP_CLIENT((dbc)->env))
#endif
#endif /* !_DB_INT_H_ */

188
build_brew/errno.h Normal file
View File

@@ -0,0 +1,188 @@
/*-
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)errno.h 8.5 (Berkeley) 1/21/94
* FreeBSD: /repoman/r/ncvs/src/sys/sys/errno.h,v 1.28 2005/04/02 12:33:28 das Exp $
*
* $Id: errno.h 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#ifndef _SYS_ERRNO_H_
#define _SYS_ERRNO_H_
#undef errno
#define errno DB_GLOBAL(db_errno)
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* Input/output error */
#define ENXIO 6 /* Device not configured */
#define E2BIG 7 /* Argument list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file descriptor */
#define ECHILD 10 /* No child processes */
#define EDEADLK 11 /* Resource deadlock avoided */
/* 11 was EAGAIN */
#define ENOMEM 12 /* Cannot allocate memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#ifndef _POSIX_SOURCE
#define ENOTBLK 15 /* Block device required */
#endif
#define EBUSY 16 /* Device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* Operation not supported by device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* Too many open files in system */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Inappropriate ioctl for device */
#ifndef _POSIX_SOURCE
#define ETXTBSY 26 /* Text file busy */
#endif
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only filesystem */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
/* math software */
#define EDOM 33 /* Numerical argument out of domain */
#define ERANGE 34 /* Result too large */
/* non-blocking and interrupt i/o */
#define EAGAIN 35 /* Resource temporarily unavailable */
#ifndef _POSIX_SOURCE
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#ifndef EALREADY /* BREW already has an EALREADY. */
#define EALREADY 37 /* Operation already in progress */
#endif
/* ipc/network software -- argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported */
#define ENOTSUP EOPNOTSUPP /* Operation not supported */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Operation timed out */
#define ECONNREFUSED 61 /* Connection refused */
#define ELOOP 62 /* Too many levels of symbolic links */
#endif /* _POSIX_SOURCE */
#define ENAMETOOLONG 63 /* File name too long */
/* should be rearranged */
#ifndef _POSIX_SOURCE
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#endif /* _POSIX_SOURCE */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
#ifndef _POSIX_SOURCE
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
#define EBADRPC 72 /* RPC struct is bad */
#define ERPCMISMATCH 73 /* RPC version wrong */
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#define EPROGMISMATCH 75 /* Program version wrong */
#define EPROCUNAVAIL 76 /* Bad procedure for program */
#endif /* _POSIX_SOURCE */
#define ENOLCK 77 /* No locks available */
#define ENOSYS 78 /* Function not implemented */
#ifndef _POSIX_SOURCE
#define EFTYPE 79 /* Inappropriate file type or format */
#define EAUTH 80 /* Authentication error */
#define ENEEDAUTH 81 /* Need authenticator */
#define EIDRM 82 /* Identifier removed */
#define ENOMSG 83 /* No message of desired type */
#define EOVERFLOW 84 /* Value too large to be stored in data type */
#define ECANCELED 85 /* Operation canceled */
#define EILSEQ 86 /* Illegal byte sequence */
#define ENOATTR 87 /* Attribute not found */
#define EDOOFUS 88 /* Programming error */
#endif /* _POSIX_SOURCE */
#define EBADMSG 89 /* Bad message */
#define EMULTIHOP 90 /* Multihop attempted */
#define ENOLINK 91 /* Link has been severed */
#define EPROTO 92 /* Protocol error */
#ifndef _POSIX_SOURCE
#define ELAST 92 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
#ifdef _KERNEL
/* pseudo-errors returned inside kernel to modify return to process */
#define ERESTART (-1) /* restart syscall */
#define EJUSTRETURN (-2) /* don't modify regs, just return */
#define ENOIOCTL (-3) /* ioctl not handled by this layer */
#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
#endif
#endif

183
build_s60/bdb_s60.mmp Normal file
View File

@@ -0,0 +1,183 @@
// bdb_s60.mmp
// DO NOT EDIT: automatically built by dist/s_s60_mmp
TARGET bdb_s60.lib
TARGETTYPE lib
UID 0x10004262 0xE8000016
VENDORID 0x70000002
SOURCE ..\btree\bt_compact.c
SOURCE ..\btree\bt_compare.c
SOURCE ..\btree\bt_conv.c
SOURCE ..\btree\bt_curadj.c
SOURCE ..\btree\bt_cursor.c
SOURCE ..\btree\bt_delete.c
SOURCE ..\btree\bt_method.c
SOURCE ..\btree\bt_open.c
SOURCE ..\btree\bt_put.c
SOURCE ..\btree\bt_rec.c
SOURCE ..\btree\bt_reclaim.c
SOURCE ..\btree\bt_recno.c
SOURCE ..\btree\bt_rsearch.c
SOURCE ..\btree\bt_search.c
SOURCE ..\btree\bt_split.c
SOURCE ..\btree\bt_stat.c
SOURCE ..\btree\btree_auto.c
SOURCE ..\clib\snprintf.c
SOURCE ..\clib\strcasecmp.c
SOURCE ..\clib\strsep.c
SOURCE ..\common\crypto_stub.c
SOURCE ..\common\db_byteorder.c
SOURCE ..\common\db_err.c
SOURCE ..\common\db_getlong.c
SOURCE ..\common\db_idspace.c
SOURCE ..\common\db_log2.c
SOURCE ..\common\db_shash.c
SOURCE ..\common\dbt.c
SOURCE ..\common\mkpath.c
SOURCE ..\common\zerofill.c
SOURCE ..\db\crdel_auto.c
SOURCE ..\db\crdel_rec.c
SOURCE ..\db\db.c
SOURCE ..\db\db_am.c
SOURCE ..\db\db_auto.c
SOURCE ..\db\db_cam.c
SOURCE ..\db\db_cds.c
SOURCE ..\db\db_conv.c
SOURCE ..\db\db_dispatch.c
SOURCE ..\db\db_dup.c
SOURCE ..\db\db_iface.c
SOURCE ..\db\db_join.c
SOURCE ..\db\db_meta.c
SOURCE ..\db\db_method.c
SOURCE ..\db\db_open.c
SOURCE ..\db\db_overflow.c
SOURCE ..\db\db_pr.c
SOURCE ..\db\db_rec.c
SOURCE ..\db\db_reclaim.c
SOURCE ..\db\db_remove.c
SOURCE ..\db\db_rename.c
SOURCE ..\db\db_ret.c
SOURCE ..\db\db_setid.c
SOURCE ..\db\db_setlsn.c
SOURCE ..\db\db_stati.c
SOURCE ..\db\db_truncate.c
SOURCE ..\db\db_upg.c
SOURCE ..\db\db_vrfy_stub.c
SOURCE ..\dbreg\dbreg.c
SOURCE ..\dbreg\dbreg_auto.c
SOURCE ..\dbreg\dbreg_rec.c
SOURCE ..\dbreg\dbreg_stat.c
SOURCE ..\dbreg\dbreg_util.c
SOURCE ..\env\env_alloc.c
SOURCE ..\env\env_config.c
SOURCE ..\env\env_failchk.c
SOURCE ..\env\env_file.c
SOURCE ..\env\env_globals.c
SOURCE ..\env\env_method.c
SOURCE ..\env\env_name.c
SOURCE ..\env\env_open.c
SOURCE ..\env\env_recover.c
SOURCE ..\env\env_region.c
SOURCE ..\env\env_register.c
SOURCE ..\env\env_sig.c
SOURCE ..\env\env_stat.c
SOURCE ..\fileops\fileops_auto.c
SOURCE ..\fileops\fop_basic.c
SOURCE ..\fileops\fop_rec.c
SOURCE ..\fileops\fop_util.c
SOURCE ..\hash\hash_func.c
SOURCE ..\hash\hash_stub.c
SOURCE ..\hmac\hmac.c
SOURCE ..\hmac\sha1.c
SOURCE ..\lock\lock.c
SOURCE ..\lock\lock_deadlock.c
SOURCE ..\lock\lock_failchk.c
SOURCE ..\lock\lock_id.c
SOURCE ..\lock\lock_list.c
SOURCE ..\lock\lock_method.c
SOURCE ..\lock\lock_region.c
SOURCE ..\lock\lock_stat.c
SOURCE ..\lock\lock_timer.c
SOURCE ..\lock\lock_util.c
SOURCE ..\log\log.c
SOURCE ..\log\log_archive.c
SOURCE ..\log\log_compare.c
SOURCE ..\log\log_debug.c
SOURCE ..\log\log_get.c
SOURCE ..\log\log_method.c
SOURCE ..\log\log_put.c
SOURCE ..\log\log_stat.c
SOURCE ..\mp\mp_alloc.c
SOURCE ..\mp\mp_bh.c
SOURCE ..\mp\mp_fget.c
SOURCE ..\mp\mp_fmethod.c
SOURCE ..\mp\mp_fopen.c
SOURCE ..\mp\mp_fput.c
SOURCE ..\mp\mp_fset.c
SOURCE ..\mp\mp_method.c
SOURCE ..\mp\mp_mvcc.c
SOURCE ..\mp\mp_region.c
SOURCE ..\mp\mp_register.c
SOURCE ..\mp\mp_resize.c
SOURCE ..\mp\mp_stat.c
SOURCE ..\mp\mp_sync.c
SOURCE ..\mp\mp_trickle.c
SOURCE ..\mutex\mut_alloc.c
SOURCE ..\mutex\mut_failchk.c
SOURCE ..\mutex\mut_method.c
SOURCE ..\mutex\mut_pthread.c
SOURCE ..\mutex\mut_region.c
SOURCE ..\mutex\mut_stat.c
SOURCE ..\os\os_abort.c
SOURCE ..\os\os_abs.c
SOURCE ..\os\os_alloc.c
SOURCE ..\os\os_clock.c
SOURCE ..\os\os_cpu.c
SOURCE ..\os\os_ctime.c
SOURCE ..\os\os_dir.c
SOURCE ..\os\os_errno.c
SOURCE ..\os\os_fid.c
SOURCE ..\os\os_flock.c
SOURCE ..\os\os_fsync.c
SOURCE ..\os\os_getenv.c
SOURCE ..\os\os_handle.c
SOURCE ..\os\os_map.c
SOURCE ..\os\os_mkdir.c
SOURCE ..\os\os_open.c
SOURCE ..\os\os_pid.c
SOURCE ..\os\os_rename.c
SOURCE ..\os\os_root.c
SOURCE ..\os\os_rpath.c
SOURCE ..\os\os_rw.c
SOURCE ..\os\os_seek.c
SOURCE ..\os\os_stack.c
SOURCE ..\os\os_stat.c
SOURCE ..\os\os_tmpdir.c
SOURCE ..\os\os_truncate.c
SOURCE ..\os\os_uid.c
SOURCE ..\os\os_unlink.c
SOURCE ..\os\os_yield.c
SOURCE ..\os_s60\os_config.c
SOURCE ..\qam\qam_stub.c
SOURCE ..\rep\rep_stub.c
SOURCE ..\repmgr\repmgr_stub.c
SOURCE ..\txn\txn.c
SOURCE ..\txn\txn_auto.c
SOURCE ..\txn\txn_chkpt.c
SOURCE ..\txn\txn_failchk.c
SOURCE ..\txn\txn_method.c
SOURCE ..\txn\txn_rec.c
SOURCE ..\txn\txn_recover.c
SOURCE ..\txn\txn_region.c
SOURCE ..\txn\txn_stat.c
SOURCE ..\txn\txn_util.c
SOURCE ..\xa\xa_stub.c
SYSTEMINCLUDE \epoc32\include\stdapis \epoc32\include
USERINCLUDE .
USERINCLUDE ..
LIBRARY libc.lib libpthread.lib euser.lib libcrt0.lib
nostrictdef

274
build_s60/clib_port.h Normal file
View File

@@ -0,0 +1,274 @@
/* DO NOT EDIT: automatically built from dist/clib_port.in. */
/*
* Minimum/maximum values for various types.
*/
#ifndef UINT16_MAX /* Maximum 16-bit unsigned. */
#define UINT16_MAX 65535
#endif
#ifndef UINT32_MAX /* Maximum 32-bit unsigned. */
#define UINT32_MAX 4294967295U
#endif
#ifndef INT_MAX
#if SIZEOF_INT == 4
#define INT_MAX 2147483647
#endif
#if SIZEOF_INT == 8
#define INT_MAX 9223372036854775807
#endif
#endif
#ifndef INT_MIN /* minimum (signed) int value */
#define INT_MIN (-INT_MAX-1)
#endif
#ifndef UINT_MAX /* maximum (signed) int value */
#if SIZEOF_INT == 4
#define UINT_MAX 4294967295U
#endif
#if SIZEOF_INT == 8
#define UINT_MAX 18446744073709551615U
#endif
#endif
#ifndef LONG_MAX /* maximum (signed) long value */
#if SIZEOF_LONG == 4
#define LONG_MAX 2147483647
#endif
#if SIZEOF_LONG == 8
#define LONG_MAX 9223372036854775807L
#endif
#endif
#ifndef LONG_MIN /* minimum (signed) long value */
#define LONG_MIN (-LONG_MAX-1)
#endif
#ifndef ULONG_MAX /* maximum (unsigned) long value */
#if SIZEOF_LONG == 4
#define ULONG_MAX 4294967295U
#endif
#if SIZEOF_LONG == 8
#define ULONG_MAX 18446744073709551615UL
#endif
#endif
#if defined(HAVE_64BIT_TYPES)
/*
* Override the system's 64-bit min/max constants. AIX's 32-bit compiler can
* handle 64-bit values, but the system's constants don't include the LL/ULL
* suffix, and so can't be compiled using the 32-bit compiler.
*/
#undef INT64_MAX
#undef INT64_MIN
#undef UINT64_MAX
#ifdef DB_WIN32
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
#define UINT64_MAX _UI64_MAX
#else
#define INT64_MAX 9223372036854775807LL
#define INT64_MIN (-INT64_MAX-1)
#define UINT64_MAX 18446744073709551615ULL
#endif /* DB_WIN32 */
#endif /* HAVE_64BIT_TYPES */
/*
* Exit success/failure macros.
*/
#ifndef HAVE_EXIT_SUCCESS
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif
/*
* File modes.
*/
#ifdef DB_WIN32
#ifndef S_IREAD /* WinCE doesn't have S_IREAD. */
#define S_IREAD 0
#endif
#ifndef S_IWRITE /* WinCE doesn't have S_IWRITE. */
#define S_IWRITE 0
#endif
#ifndef S_IRUSR
#define S_IRUSR S_IREAD /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0 /* X for other */
#endif
#else /* !DB_WIN32 */
#ifndef S_IRUSR
#define S_IRUSR 0000400 /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR 0000200 /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0000100 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0000040 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0000020 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0000010 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0000004 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0000002 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0000001 /* X for other */
#endif
#endif /* !DB_WIN32 */
/*
* Don't step on the namespace. Other libraries may have their own
* implementations of these functions, we don't want to use their
* implementations or force them to use ours based on the load order.
*/
#ifndef HAVE_ATOI
#define atoi __db_Catoi
#endif
#ifndef HAVE_ATOL
#define atol __db_Catol
#endif
#ifndef HAVE_FCLOSE
#define fclose __db_Cfclose
#endif
#ifndef HAVE_FGETC
#define fgetc __db_Cfgetc
#endif
#ifndef HAVE_FGETS
#define fgets __db_Cfgets
#endif
#ifndef HAVE_FOPEN
#define fopen __db_Cfopen
#endif
#ifndef HAVE_FWRITE
#define fwrite __db_Cfwrite
#endif
#ifndef HAVE_GETADDRINFO
#define freeaddrinfo(a) __db_Cfreeaddrinfo(a)
#define getaddrinfo(a, b, c, d) __db_Cgetaddrinfo(a, b, c, d)
#endif
#ifndef HAVE_GETCWD
#define getcwd __db_Cgetcwd
#endif
#ifndef HAVE_GETOPT
#define getopt __db_Cgetopt
#define optarg __db_Coptarg
#define opterr __db_Copterr
#define optind __db_Coptind
#define optopt __db_Coptopt
#define optreset __db_Coptreset
#endif
#ifndef HAVE_ISALPHA
#define isalpha __db_Cisalpha
#endif
#ifndef HAVE_ISDIGIT
#define isdigit __db_Cisdigit
#endif
#ifndef HAVE_ISPRINT
#define isprint __db_Cisprint
#endif
#ifndef HAVE_ISSPACE
#define isspace __db_Cisspace
#endif
#ifndef HAVE_LOCALTIME
#define localtime __db_Clocaltime
#endif
#ifndef HAVE_MEMCMP
#define memcmp __db_Cmemcmp
#endif
#ifndef HAVE_MEMCPY
#define memcpy __db_Cmemcpy
#endif
#ifndef HAVE_MEMMOVE
#define memmove __db_Cmemmove
#endif
#ifndef HAVE_PRINTF
#define printf __db_Cprintf
#define fprintf __db_Cfprintf
#endif
#ifndef HAVE_QSORT
#define qsort __db_Cqsort
#endif
#ifndef HAVE_RAISE
#define raise __db_Craise
#endif
#ifndef HAVE_RAND
#define rand __db_Crand
#define srand __db_Csrand
#endif
#ifndef HAVE_SNPRINTF
#define snprintf __db_Csnprintf
#endif
#ifndef HAVE_STRCASECMP
#define strcasecmp __db_Cstrcasecmp
#define strncasecmp __db_Cstrncasecmp
#endif
#ifndef HAVE_STRCAT
#define strcat __db_Cstrcat
#endif
#ifndef HAVE_STRCHR
#define strchr __db_Cstrchr
#endif
#ifndef HAVE_STRDUP
#define strdup __db_Cstrdup
#endif
#ifndef HAVE_STRERROR
#define strerror __db_Cstrerror
#endif
#ifndef HAVE_STRNCAT
#define strncat __db_Cstrncat
#endif
#ifndef HAVE_STRNCMP
#define strncmp __db_Cstrncmp
#endif
#ifndef HAVE_STRRCHR
#define strrchr __db_Cstrrchr
#endif
#ifndef HAVE_STRSEP
#define strsep __db_Cstrsep
#endif
#ifndef HAVE_STRTOL
#define strtol __db_Cstrtol
#endif
#ifndef HAVE_STRTOUL
#define strtoul __db_Cstrtoul
#endif
#ifndef HAVE_TIME
#define time __db_Ctime
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf __db_Cvsnprintf
#endif

2474
build_s60/db.h Normal file

File diff suppressed because it is too large Load Diff

572
build_s60/db_config.h Normal file
View File

@@ -0,0 +1,572 @@
/* DO NOT EDIT: automatically built by dist/s_s60. */
/* db_config.h. Generated from config.hin by configure. */
/* config.hin. Generated from configure.ac by autoheader. */
/* Define to 1 if you want to build a version for running the test suite. */
/* #undef CONFIG_TEST */
/* We use DB_WIN32 much as one would use _WIN32 -- to specify that we're using
an operating system environment that supports Win32 calls and semantics. We
don't use _WIN32 because Cygwin/GCC also defines _WIN32, even though
Cygwin/GCC closely emulates the Unix environment. */
/* #undef DB_WIN32 */
/* Define to 1 if you want a debugging version. */
/* #undef DEBUG */
/* Define to 1 if you want a version that logs read operations. */
/* #undef DEBUG_ROP */
/* Define to 1 if you want a version that logs write operations. */
/* #undef DEBUG_WOP */
/* Define to 1 if you want a version with run-time diagnostic checking. */
/* #undef DIAGNOSTIC */
/* Define to 1 if 64-bit types are available. */
/* #undef HAVE_64BIT_TYPES */
/* Define to 1 if you have the `abort' function. */
#define HAVE_ABORT 1
/* Define to 1 if you have the `atoi' function. */
#define HAVE_ATOI 1
/* Define to 1 if you have the `atol' function. */
#define HAVE_ATOL 1
/* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */
/* Define to 1 if you have the `backtrace_symbols' function. */
/* #undef HAVE_BACKTRACE_SYMBOLS */
/* Define to 1 if building on BREW. */
/* #undef HAVE_BREW */
/* Define to 1 if building on BREW (SDK2). */
/* #undef HAVE_BREW_SDK2 */
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if clock_gettime supports CLOCK_MONOTONIC. */
/* #undef HAVE_CLOCK_MONOTONIC */
/* Define to 1 if Berkeley DB release includes strong cryptography. */
/* #undef HAVE_CRYPTO */
/* Define to 1 if you have the `ctime_r' function. */
#define HAVE_CTIME_R 1
/* Define to 1 if ctime_r takes a buffer length as a third argument. */
/* #undef HAVE_CTIME_R_3ARG */
/* Define to 1 if you have the `directio' function. */
/* #undef HAVE_DIRECTIO */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */
#define HAVE_EXIT_SUCCESS 1
/* Define to 1 if you have the `fchmod' function. */
/* #undef HAVE_FCHMOD */
/* Define to 1 if you have the `fclose' function. */
#define HAVE_FCLOSE 1
/* Define to 1 if you have the `fcntl' function. */
#define HAVE_FCNTL 1
/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */
/* #undef HAVE_FCNTL_F_SETFD */
/* Define to 1 if you have the `fdatasync' function. */
/* #undef HAVE_FDATASYNC */
/* Define to 1 if you have the `fgetc' function. */
#define HAVE_FGETC 1
/* Define to 1 if you have the `fgets' function. */
#define HAVE_FGETS 1
/* Define to 1 if allocated filesystem blocks are not zeroed. */
#define HAVE_FILESYSTEM_NOTZERO 1
/* Define to 1 if you have the `fopen' function. */
#define HAVE_FOPEN 1
/* Define to 1 if you have the `ftruncate' function. */
/* #undef HAVE_FTRUNCATE */
/* Define to 1 if you have the `fwrite' function. */
#define HAVE_FWRITE 1
/* Define to 1 if you have the `getaddrinfo' function. */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getenv' function. */
/* #undef HAVE_GETENV */
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1
/* Define to 1 if getopt supports the optreset variable. */
/* #undef HAVE_GETOPT_OPTRESET */
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have the `getuid' function. */
/* #undef HAVE_GETUID */
/* Define to 1 if building Hash access method. */
/* #undef HAVE_HASH */
/* Define to 1 if you have the `hstrerror' function. */
/* #undef HAVE_HSTRERROR */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `isalpha' function. */
#define HAVE_ISALPHA 1
/* Define to 1 if you have the `isdigit' function. */
#define HAVE_ISDIGIT 1
/* Define to 1 if you have the `isprint' function. */
#define HAVE_ISPRINT 1
/* Define to 1 if you have the `isspace' function. */
#define HAVE_ISSPACE 1
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the `memcmp' function. */
#define HAVE_MEMCMP 1
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define to 1 if you have the `mlock' function. */
/* #undef HAVE_MLOCK */
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Define to 1 if you have the `munlock' function. */
/* #undef HAVE_MUNLOCK */
/* Define to 1 if you have the `munmap' function. */
#define HAVE_MUNMAP 1
/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */
/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */
/* Define to 1 to use the AIX _check_lock mutexes. */
/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */
/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */
/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */
/* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
/* #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY */
/* Define to 1 to use the UNIX fcntl system call mutexes. */
/* #undef HAVE_MUTEX_FCNTL */
/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes.
*/
/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on HP-UX. */
/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */
/* Define to 1 to use test-and-set mutexes with blocking mutexes. */
/* #undef HAVE_MUTEX_HYBRID */
/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */
/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes. */
/* #undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */
/* #undef HAVE_MUTEX_MSEM_INIT */
/* Define to 1 to use the GCC compiler and PowerPC assembly language mutexes.
*/
/* #undef HAVE_MUTEX_PPC_GCC_ASSEMBLY */
/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */
#define HAVE_MUTEX_PTHREADS 1
/* Define to 1 to use Reliant UNIX initspin mutexes. */
/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */
/* Define to 1 to use the IBM C compiler and S/390 assembly language mutexes.
*/
/* #undef HAVE_MUTEX_S390_CC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */
/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */
/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */
/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */
/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */
/* #undef HAVE_MUTEX_SEMA_INIT */
/* Define to 1 to use the SGI XXX_lock mutexes. */
/* #undef HAVE_MUTEX_SGI_INIT_LOCK */
/* Define to 1 to use the Solaris _lock_XXX mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */
/* Define to 1 to use the Solaris lwp threads mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LWP */
/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */
/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */
/* Define to 1 if the Berkeley DB library should support mutexes. */
#define HAVE_MUTEX_SUPPORT 1
/* Define to 1 if mutexes hold system resources. */
#define HAVE_MUTEX_SYSTEM_RESOURCES 1
/* Define to 1 to configure mutexes intra-process only. */
#define HAVE_MUTEX_THREAD_ONLY 1
/* Define to 1 to use the CC compiler and Tru64 assembly language mutexes. */
/* #undef HAVE_MUTEX_TRU64_CC_ASSEMBLY */
/* Define to 1 to use the UNIX International mutexes. */
/* #undef HAVE_MUTEX_UI_THREADS */
/* Define to 1 to use the UTS compiler and assembly language mutexes. */
/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */
/* Define to 1 to use VMS mutexes. */
/* #undef HAVE_MUTEX_VMS */
/* Define to 1 to use VxWorks mutexes. */
/* #undef HAVE_MUTEX_VXWORKS */
/* Define to 1 to use the MSVC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32 */
/* Define to 1 to use the GCC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32_GCC */
/* Define to 1 to use the GCC compiler and 64-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and 32-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the O_DIRECT flag. */
/* #undef HAVE_O_DIRECT */
/* Define to 1 if you have the `pread' function. */
/* #undef HAVE_PREAD */
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
/* Define to 1 if you have the `pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define to 1 to configure Berkeley DB for POSIX pthread API. */
/* #undef HAVE_PTHREAD_API */
/* Define to 1 if you have the `pthread_yield' function. */
/* #undef HAVE_PTHREAD_YIELD */
/* Define to 1 if you have the `pwrite' function. */
/* #undef HAVE_PWRITE */
/* Define to 1 if building on QNX. */
/* #undef HAVE_QNX */
/* Define to 1 if you have the `qsort' function. */
#define HAVE_QSORT 1
/* Define to 1 if building Queue access method. */
/* #undef HAVE_QUEUE */
/* Define to 1 if you have the `raise' function. */
#define HAVE_RAISE 1
/* Define to 1 if you have the `rand' function. */
#define HAVE_RAND 1
/* Define to 1 if building replication support. */
/* #undef HAVE_REPLICATION */
/* Define to 1 if building the Berkeley DB replication framework. */
/* #undef HAVE_REPLICATION_THREADS */
/* Define to 1 if building RPC client/server. */
/* #undef HAVE_RPC */
/* Define to 1 if building on S60. */
#define HAVE_S60 1
/* Define to 1 if you have the `sched_yield' function. */
#define HAVE_SCHED_YIELD 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if shmctl/SHM_LOCK locks down shared memory segments. */
/* #undef HAVE_SHMCTL_SHM_LOCK */
/* Define to 1 if you have the `shmget' function. */
#define HAVE_SHMGET 1
/* Define to 1 if you have the `sigaction' function. */
/* #undef HAVE_SIGACTION */
/* Define to 1 if thread identifier type db_threadid_t is integral. */
#define HAVE_SIMPLE_THREAD_TYPE 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if building statistics support. */
#define HAVE_STATISTICS 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strcat' function. */
#define HAVE_STRCAT 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncat' function. */
#define HAVE_STRNCAT 1
/* Define to 1 if you have the `strncmp' function. */
#define HAVE_STRNCMP 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strsep' function. */
#define HAVE_STRSEP 1
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if `st_blksize' is member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */
/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* Define to 1 if port includes files in the Berkeley DB source code. */
#define HAVE_SYSTEM_INCLUDE_FILES 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `time' function. */
#define HAVE_TIME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if unlink of file with open file descriptors will fail. */
/* #undef HAVE_UNLINK_WITH_OPEN_FAILURE */
/* Define to 1 if port includes historic database upgrade support. */
/* #undef HAVE_UPGRADE_SUPPORT */
/* Define to 1 if building access method verification support. */
/* #undef HAVE_VERIFY */
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if building on VxWorks. */
/* #undef HAVE_VXWORKS */
/* Define to 1 if you have the `yield' function. */
/* #undef HAVE_YIELD */
/* Define to 1 if you have the `_fstati64' function. */
/* #undef HAVE__FSTATI64 */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "Oracle Technology Network Berkeley DB forum"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Berkeley DB"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Berkeley DB 4.7.25"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "db-4.7.25"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.7.25"
/* The size of `char', as computed by sizeof. */
#define SIZEOF_CHAR 1
/* The size of `char *', as computed by sizeof. */
#define SIZEOF_CHAR_P 4
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `long long', as computed by sizeof. */
/* #undef SIZEOF_LONG_LONG */
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `unsigned char', as computed by sizeof. */
#define SIZEOF_UNSIGNED_CHAR 1
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* The size of `unsigned long', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG 4
/* The size of `unsigned long long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG_LONG */
/* The size of `unsigned short', as computed by sizeof. */
#define SIZEOF_UNSIGNED_SHORT 2
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define to 1 to mask harmless uninitialized memory read/writes. */
/* #undef UMRW */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */

913
build_s60/db_int.h Normal file
View File

@@ -0,0 +1,913 @@
/* DO NOT EDIT: automatically built by dist/s_s60. */
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_int.h 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#ifndef _DB_INT_H_
#define _DB_INT_H_
/*******************************************************
* Berkeley DB ANSI/POSIX include files.
*******************************************************/
#ifdef HAVE_SYSTEM_INCLUDE_FILES
#include <sys/types.h>
#ifdef DIAG_MVCC
#include <sys/mman.h>
#endif
#include <sys/stat.h>
#if defined(__INCLUDE_SELECT_H)
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_VXWORKS
#include <selectLib.h>
#endif
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_VXWORKS
#include <net/uio.h>
#else
#include <sys/uio.h>
#endif
#if defined(__INCLUDE_NETWORKING)
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#endif
#if defined(STDC_HEADERS) || defined(__cplusplus)
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#if defined(__INCLUDE_DIRECTORY)
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#endif /* __INCLUDE_DIRECTORY */
#endif /* !HAVE_SYSTEM_INCLUDE_FILES */
#ifdef DB_WIN32
#include "dbinc/win_db.h"
#endif
#include "db.h"
#include "clib_port.h"
#include "dbinc/queue.h"
#include "dbinc/shqueue.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************
* Forward structure declarations.
*******************************************************/
struct __db_reginfo_t; typedef struct __db_reginfo_t REGINFO;
struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD;
struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST;
struct __vrfy_childinfo;typedef struct __vrfy_childinfo VRFY_CHILDINFO;
struct __vrfy_dbinfo; typedef struct __vrfy_dbinfo VRFY_DBINFO;
struct __vrfy_pageinfo; typedef struct __vrfy_pageinfo VRFY_PAGEINFO;
typedef SH_TAILQ_HEAD(__hash_head) DB_HASHTAB;
/*******************************************************
* General purpose constants and macros.
*******************************************************/
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE (!FALSE)
#define MEGABYTE 1048576
#define GIGABYTE 1073741824
#define NS_PER_MS 1000000 /* Nanoseconds in a millisecond */
#define NS_PER_US 1000 /* Nanoseconds in a microsecond */
#define NS_PER_SEC 1000000000 /* Nanoseconds in a second */
#define US_PER_MS 1000 /* Microseconds in a millisecond */
#define US_PER_SEC 1000000 /* Microseconds in a second */
#define MS_PER_SEC 1000 /* Milliseconds in a second */
#define RECNO_OOB 0 /* Illegal record number. */
/* Test for a power-of-two (tests true for zero, which doesn't matter here). */
#define POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
/* Test for valid page sizes. */
#define DB_MIN_PGSIZE 0x000200 /* Minimum page size (512). */
#define DB_MAX_PGSIZE 0x010000 /* Maximum page size (65536). */
#define IS_VALID_PAGESIZE(x) \
(POWER_OF_TWO(x) && (x) >= DB_MIN_PGSIZE && ((x) <= DB_MAX_PGSIZE))
/* Minimum number of pages cached, by default. */
#define DB_MINPAGECACHE 16
/*
* If we are unable to determine the underlying filesystem block size, use
* 8K on the grounds that most OS's use less than 8K for a VM page size.
*/
#define DB_DEF_IOSIZE (8 * 1024)
/* Align an integer to a specific boundary. */
#undef DB_ALIGN
#define DB_ALIGN(v, bound) \
(((v) + (bound) - 1) & ~(((uintmax_t)(bound)) - 1))
/* Increment a pointer to a specific boundary. */
#undef ALIGNP_INC
#define ALIGNP_INC(p, bound) \
(void *)(((uintptr_t)(p) + (bound) - 1) & ~(((uintptr_t)(bound)) - 1))
/*
* Print an address as a u_long (a u_long is the largest type we can print
* portably). Most 64-bit systems have made longs 64-bits, so this should
* work.
*/
#define P_TO_ULONG(p) ((u_long)(uintptr_t)(p))
/*
* Convert a pointer to a small integral value.
*
* The (u_int16_t)(uintptr_t) cast avoids warnings: the (uintptr_t) cast
* converts the value to an integral type, and the (u_int16_t) cast converts
* it to a small integral type so we don't get complaints when we assign the
* final result to an integral type smaller than uintptr_t.
*/
#define P_TO_UINT32(p) ((u_int32_t)(uintptr_t)(p))
#define P_TO_UINT16(p) ((u_int16_t)(uintptr_t)(p))
/*
* There are several on-page structures that are declared to have a number of
* fields followed by a variable length array of items. The structure size
* without including the variable length array or the address of the first of
* those elements can be found using SSZ.
*
* This macro can also be used to find the offset of a structure element in a
* structure. This is used in various places to copy structure elements from
* unaligned memory references, e.g., pointers into a packed page.
*
* There are two versions because compilers object if you take the address of
* an array.
*/
#undef SSZ
#define SSZ(name, field) P_TO_UINT16(&(((name *)0)->field))
#undef SSZA
#define SSZA(name, field) P_TO_UINT16(&(((name *)0)->field[0]))
/* Structure used to print flag values. */
typedef struct __fn {
u_int32_t mask; /* Flag value. */
const char *name; /* Flag name. */
} FN;
/* Set, clear and test flags. */
#define FLD_CLR(fld, f) (fld) &= ~(f)
#define FLD_ISSET(fld, f) ((fld) & (f))
#define FLD_SET(fld, f) (fld) |= (f)
#define F_CLR(p, f) (p)->flags &= ~(f)
#define F_ISSET(p, f) ((p)->flags & (f))
#define F_SET(p, f) (p)->flags |= (f)
#define LF_CLR(f) ((flags) &= ~(f))
#define LF_ISSET(f) ((flags) & (f))
#define LF_SET(f) ((flags) |= (f))
/*
* Calculate a percentage. The values can overflow 32-bit integer arithmetic
* so we use floating point.
*
* When calculating a bytes-vs-page size percentage, we're getting the inverse
* of the percentage in all cases, that is, we want 100 minus the percentage we
* calculate.
*/
#define DB_PCT(v, total) \
((int)((total) == 0 ? 0 : ((double)(v) * 100) / (total)))
#define DB_PCT_PG(v, total, pgsize) \
((int)((total) == 0 ? 0 : \
100 - ((double)(v) * 100) / (((double)total) * (pgsize))))
/*
* Statistics update shared memory and so are expensive -- don't update the
* values unless we're going to display the results.
*/
#undef STAT
#ifdef HAVE_STATISTICS
#define STAT(x) x
#else
#define STAT(x)
#endif
/*
* Structure used for callback message aggregation.
*
* Display values in XXX_stat_print calls.
*/
typedef struct __db_msgbuf {
char *buf; /* Heap allocated buffer. */
char *cur; /* Current end of message. */
size_t len; /* Allocated length of buffer. */
} DB_MSGBUF;
#define DB_MSGBUF_INIT(a) do { \
(a)->buf = (a)->cur = NULL; \
(a)->len = 0; \
} while (0)
#define DB_MSGBUF_FLUSH(env, a) do { \
if ((a)->buf != NULL) { \
if ((a)->cur != (a)->buf) \
__db_msg(env, "%s", (a)->buf); \
__os_free(env, (a)->buf); \
DB_MSGBUF_INIT(a); \
} \
} while (0)
#define STAT_FMT(msg, fmt, type, v) do { \
DB_MSGBUF __mb; \
DB_MSGBUF_INIT(&__mb); \
__db_msgadd(env, &__mb, fmt, (type)(v)); \
__db_msgadd(env, &__mb, "\t%s", msg); \
DB_MSGBUF_FLUSH(env, &__mb); \
} while (0)
#define STAT_HEX(msg, v) \
__db_msg(env, "%#lx\t%s", (u_long)(v), msg)
#define STAT_ISSET(msg, p) \
__db_msg(env, "%sSet\t%s", (p) == NULL ? "!" : " ", msg)
#define STAT_LONG(msg, v) \
__db_msg(env, "%ld\t%s", (long)(v), msg)
#define STAT_LSN(msg, lsnp) \
__db_msg(env, "%lu/%lu\t%s", \
(u_long)(lsnp)->file, (u_long)(lsnp)->offset, msg)
#define STAT_POINTER(msg, v) \
__db_msg(env, "%#lx\t%s", P_TO_ULONG(v), msg)
#define STAT_STRING(msg, p) do { \
const char *__p = p; /* p may be a function call. */ \
__db_msg(env, "%s\t%s", __p == NULL ? "!Set" : __p, msg); \
} while (0)
#define STAT_ULONG(msg, v) \
__db_msg(env, "%lu\t%s", (u_long)(v), msg)
/*
* There are quite a few places in Berkeley DB where we want to initialize
* a DBT from a string or other random pointer type, using a length typed
* to size_t in most cases. This macro avoids a lot of casting. The macro
* comes in two flavors because we often want to clear the DBT first.
*/
#define DB_SET_DBT(dbt, d, s) do { \
(dbt).data = (void *)(d); \
(dbt).size = (u_int32_t)(s); \
} while (0)
#define DB_INIT_DBT(dbt, d, s) do { \
memset(&(dbt), 0, sizeof(dbt)); \
DB_SET_DBT(dbt, d, s); \
} while (0)
/*******************************************************
* API return values
*******************************************************/
/*
* Return values that are OK for each different call. Most calls have a
* standard 'return of 0 is only OK value', but some, like db->get have
* DB_NOTFOUND as a return value, but it really isn't an error.
*/
#define DB_RETOK_STD(ret) ((ret) == 0)
#define DB_RETOK_DBCDEL(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCGET(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBDEL(ret) DB_RETOK_DBCDEL(ret)
#define DB_RETOK_DBGET(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_DBPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST)
#define DB_RETOK_EXISTS(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_LGGET(ret) ((ret) == 0 || (ret) == DB_NOTFOUND)
#define DB_RETOK_MPGET(ret) ((ret) == 0 || (ret) == DB_PAGE_NOTFOUND)
#define DB_RETOK_REPPMSG(ret) ((ret) == 0 || \
(ret) == DB_REP_IGNORE || \
(ret) == DB_REP_ISPERM || \
(ret) == DB_REP_NEWMASTER || \
(ret) == DB_REP_NEWSITE || \
(ret) == DB_REP_NOTPERM)
/* Find a reasonable operation-not-supported error. */
#ifdef EOPNOTSUPP
#define DB_OPNOTSUP EOPNOTSUPP
#else
#ifdef ENOTSUP
#define DB_OPNOTSUP ENOTSUP
#else
#define DB_OPNOTSUP EINVAL
#endif
#endif
/*******************************************************
* Files.
*******************************************************/
/*
* We use 1024 as the maximum path length. It's too hard to figure out what
* the real path length is, as it was traditionally stored in <sys/param.h>,
* and that file isn't always available.
*/
#define DB_MAXPATHLEN 1024
#define PATH_DOT "." /* Current working directory. */
/* Path separator character(s). */
#define PATH_SEPARATOR "\\/:"
/*******************************************************
* Environment.
*******************************************************/
/* Type passed to __db_appname(). */
typedef enum {
DB_APP_NONE=0, /* No type (region). */
DB_APP_DATA, /* Data file. */
DB_APP_LOG, /* Log file. */
DB_APP_TMP /* Temporary file. */
} APPNAME;
/*
* A set of macros to check if various functionality has been configured.
*
* ALIVE_ON The is_alive function is configured.
* CDB_LOCKING CDB product locking.
* CRYPTO_ON Security has been configured.
* LOCKING_ON Locking has been configured.
* LOGGING_ON Logging has been configured.
* MUTEX_ON Mutexes have been configured.
* MPOOL_ON Memory pool has been configured.
* REP_ON Replication has been configured.
* RPC_ON RPC has been configured.
* TXN_ON Transactions have been configured.
*
* REP_ON is more complex than most: if the BDB library was compiled without
* replication support, ENV->rep_handle will be NULL; if the BDB library has
* replication support, but it was not configured, the region reference will
* be NULL.
*/
#define ALIVE_ON(env) ((env)->dbenv->is_alive != NULL)
#define CDB_LOCKING(env) F_ISSET(env, ENV_CDB)
#define CRYPTO_ON(env) ((env)->crypto_handle != NULL)
#define LOCKING_ON(env) ((env)->lk_handle != NULL)
#define LOGGING_ON(env) ((env)->lg_handle != NULL)
#define MPOOL_ON(env) ((env)->mp_handle != NULL)
#define MUTEX_ON(env) ((env)->mutex_handle != NULL)
#define REP_ON(env) \
((env)->rep_handle != NULL && (env)->rep_handle->region != NULL)
#define RPC_ON(dbenv) ((dbenv)->cl_handle != NULL)
#define TXN_ON(env) ((env)->tx_handle != NULL)
/*
* STD_LOCKING Standard locking, that is, locking was configured and CDB
* was not. We do not do locking in off-page duplicate trees,
* so we check for that in the cursor first.
*/
#define STD_LOCKING(dbc) \
(!F_ISSET(dbc, DBC_OPD) && \
!CDB_LOCKING((dbc)->env) && LOCKING_ON((dbc)->env))
/*
* IS_RECOVERING: The system is running recovery.
*/
#define IS_RECOVERING(env) \
(LOGGING_ON(env) && F_ISSET((env)->lg_handle, DBLOG_RECOVER))
/* Initialization methods are often illegal before/after open is called. */
#define ENV_ILLEGAL_AFTER_OPEN(env, name) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 1));
#define ENV_ILLEGAL_BEFORE_OPEN(env, name) \
if (!F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 0));
/* We're not actually user hostile, honest. */
#define ENV_REQUIRES_CONFIG(env, handle, i, flags) \
if (handle == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_REQUIRES_CONFIG_XX(env, handle, i, flags) \
if ((env)->handle->region == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_NOT_CONFIGURED(env, handle, i, flags) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
ENV_REQUIRES_CONFIG(env, handle, i, flags)
#define ENV_ENTER(env, ip) do { \
int __ret; \
PANIC_CHECK(env); \
if ((env)->thr_hashtab == NULL) \
ip = NULL; \
else { \
if ((__ret = \
__env_set_state(env, &(ip), THREAD_ACTIVE)) != 0) \
return (__ret); \
} \
} while (0)
#define ENV_GET_THREAD_INFO(env, ip) ENV_ENTER(env, ip)
#ifdef DIAGNOSTIC
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) { \
DB_ASSERT(env, (ip)->dbth_state == THREAD_ACTIVE); \
(ip)->dbth_state = THREAD_OUT; \
} \
} while (0)
#else
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) \
(ip)->dbth_state = THREAD_OUT; \
} while (0)
#endif
#ifdef DIAGNOSTIC
#define CHECK_THREAD(env) do { \
if ((env)->thr_hashtab != NULL) \
(void)__env_set_state(env, NULL, THREAD_VERIFY); \
} while (0)
#ifdef HAVE_STATISTICS
#define CHECK_MTX_THREAD(env, mtx) do { \
if (mtx->alloc_id != MTX_MUTEX_REGION && \
mtx->alloc_id != MTX_ENV_REGION && \
mtx->alloc_id != MTX_APPLICATION) \
CHECK_THREAD(env); \
} while (0)
#else
#define CHECK_MTX_THREAD(env, mtx)
#endif
#else
#define CHECK_THREAD(env)
#define CHECK_MTX_THREAD(env, mtx)
#endif
typedef enum {
THREAD_SLOT_NOT_IN_USE=0,
THREAD_OUT,
THREAD_ACTIVE,
THREAD_BLOCKED,
THREAD_BLOCKED_DEAD
#ifdef DIAGNOSTIC
, THREAD_VERIFY
#endif
} DB_THREAD_STATE;
typedef struct __pin_list {
roff_t b_ref; /* offset to buffer. */
int region; /* region containing buffer. */
} PIN_LIST;
#define PINMAX 4
struct __db_thread_info {
pid_t dbth_pid;
db_threadid_t dbth_tid;
DB_THREAD_STATE dbth_state;
SH_TAILQ_ENTRY dbth_links;
/*
* The following fields track which buffers this thread of
* control has pinned in the mpool buffer cache.
*/
u_int16_t dbth_pincount; /* Number of pins for this thread. */
u_int16_t dbth_pinmax; /* Number of slots allocated. */
roff_t dbth_pinlist; /* List of pins. */
PIN_LIST dbth_pinarray[PINMAX]; /* Initial array of slots. */
};
typedef struct __env_thread_info {
u_int32_t thr_count;
u_int32_t thr_max;
u_int32_t thr_nbucket;
roff_t thr_hashoff;
} THREAD_INFO;
#define DB_EVENT(env, e, einfo) do { \
DB_ENV *__dbenv = (env)->dbenv; \
if (__dbenv->db_event_func != NULL) \
__dbenv->db_event_func(__dbenv, e, einfo); \
} while (0)
typedef struct __flag_map {
u_int32_t inflag, outflag;
} FLAG_MAP;
/*
* Internal database environment structure.
*
* This is the private database environment handle. The public environment
* handle is the DB_ENV structure. The library owns this structure, the user
* owns the DB_ENV structure. The reason there are two structures is because
* the user's configuration outlives any particular DB_ENV->open call, and
* separate structures allows us to easily discard internal information without
* discarding the user's configuration.
*/
struct __env {
DB_ENV *dbenv; /* Linked DB_ENV structure */
/*
* The ENV structure can be used concurrently, so field access is
* protected.
*/
db_mutex_t mtx_env; /* ENV structure mutex */
/*
* Some fields are included in the ENV structure rather than in the
* DB_ENV structure because they are only set as arguments to the
* DB_ENV->open method. In other words, because of the historic API,
* not for any rational reason.
*
* Arguments to DB_ENV->open.
*/
char *db_home; /* Database home */
u_int32_t open_flags; /* Flags */
int db_mode; /* Default open permissions */
pid_t pid_cache; /* Cached process ID */
DB_FH *lockfhp; /* fcntl(2) locking file handle */
DB_LOCKER *env_lref; /* Locker in non-threaded handles */
DB_DISTAB recover_dtab; /* Dispatch table for recover funcs */
int dir_mode; /* Intermediate directory perms. */
/* Thread tracking */
u_int32_t thr_nbucket; /* Number of hash buckets */
DB_HASHTAB *thr_hashtab; /* Hash table of DB_THREAD_INFO */
/* Mutex allocation */
struct {
int alloc_id; /* Allocation ID argument */
u_int32_t flags; /* Flags argument */
} *mutex_iq; /* Initial mutexes queue */
u_int mutex_iq_next; /* Count of initial mutexes */
u_int mutex_iq_max; /* Maximum initial mutexes */
/*
* List of open DB handles for this ENV, used for cursor
* adjustment. Must be protected for multi-threaded support.
*/
db_mutex_t mtx_dblist;
int db_ref; /* DB handle reference count */
TAILQ_HEAD(__dblist, __db) dblist;
/*
* XA support.
*/
int xa_rmid; /* XA Resource Manager ID */
TAILQ_ENTRY(__env) links; /* XA environments */
TAILQ_HEAD(__xa_txn, __db_txn) xa_txn; /* XA active transactions */
/*
* List of open file handles for this ENV. Must be protected
* for multi-threaded support.
*/
TAILQ_HEAD(__fdlist, __fh_t) fdlist;
db_mutex_t mtx_mt; /* Mersenne Twister mutex */
int mti; /* Mersenne Twister index */
u_long *mt; /* Mersenne Twister state vector */
DB_CIPHER *crypto_handle; /* Crypto handle */
DB_LOCKTAB *lk_handle; /* Lock handle */
DB_LOG *lg_handle; /* Log handle */
DB_MPOOL *mp_handle; /* Mpool handle */
DB_MUTEXMGR *mutex_handle; /* Mutex handle */
DB_REP *rep_handle; /* Replication handle */
DB_TXNMGR *tx_handle; /* Txn handle */
/* Application callback to copy data to/from a custom data source */
#define DB_USERCOPY_GETDATA 0x0001
#define DB_USERCOPY_SETDATA 0x0002
int (*dbt_usercopy)
__P((DBT *, u_int32_t, void *, u_int32_t, u_int32_t));
REGINFO *reginfo; /* REGINFO structure reference */
#define DB_TEST_ELECTINIT 1 /* after __rep_elect_init */
#define DB_TEST_ELECTVOTE1 2 /* after sending VOTE1 */
#define DB_TEST_POSTDESTROY 3 /* after destroy op */
#define DB_TEST_POSTLOG 4 /* after logging all pages */
#define DB_TEST_POSTLOGMETA 5 /* after logging meta in btree */
#define DB_TEST_POSTOPEN 6 /* after __os_open */
#define DB_TEST_POSTSYNC 7 /* after syncing the log */
#define DB_TEST_PREDESTROY 8 /* before destroy op */
#define DB_TEST_PREOPEN 9 /* before __os_open */
#define DB_TEST_SUBDB_LOCKS 10 /* subdb locking tests */
int test_abort; /* Abort value for testing */
int test_check; /* Checkpoint value for testing */
int test_copy; /* Copy value for testing */
#define ENV_CDB 0x00000001 /* DB_INIT_CDB */
#define ENV_DBLOCAL 0x00000002 /* Environment for a private DB */
#define ENV_LITTLEENDIAN 0x00000004 /* Little endian system. */
#define ENV_LOCKDOWN 0x00000008 /* DB_LOCKDOWN set */
#define ENV_NO_OUTPUT_SET 0x00000010 /* No output channel set */
#define ENV_OPEN_CALLED 0x00000020 /* DB_ENV->open called */
#define ENV_PRIVATE 0x00000040 /* DB_PRIVATE set */
#define ENV_RECOVER_FATAL 0x00000080 /* Doing fatal recovery in env */
#define ENV_REF_COUNTED 0x00000100 /* Region references this handle */
#define ENV_SYSTEM_MEM 0x00000200 /* DB_SYSTEM_MEM set */
#define ENV_THREAD 0x00000400 /* DB_THREAD set */
u_int32_t flags;
};
/*******************************************************
* Database Access Methods.
*******************************************************/
/*
* DB_IS_THREADED --
* The database handle is free-threaded (was opened with DB_THREAD).
*/
#define DB_IS_THREADED(dbp) \
((dbp)->mutex != MUTEX_INVALID)
/* Initialization methods are often illegal before/after open is called. */
#define DB_ILLEGAL_AFTER_OPEN(dbp, name) \
if (F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 1));
#define DB_ILLEGAL_BEFORE_OPEN(dbp, name) \
if (!F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 0));
/* Some initialization methods are illegal if environment isn't local. */
#define DB_ILLEGAL_IN_ENV(dbp, name) \
if (!F_ISSET((dbp)->env, ENV_DBLOCAL)) \
return (__db_mi_env((dbp)->env, name));
#define DB_ILLEGAL_METHOD(dbp, flags) { \
int __ret; \
if ((__ret = __dbh_am_chk(dbp, flags)) != 0) \
return (__ret); \
}
/*
* Common DBC->internal fields. Each access method adds additional fields
* to this list, but the initial fields are common.
*/
#define __DBC_INTERNAL \
DBC *opd; /* Off-page duplicate cursor. */\
\
void *page; /* Referenced page. */ \
db_pgno_t root; /* Tree root. */ \
db_pgno_t pgno; /* Referenced page number. */ \
db_indx_t indx; /* Referenced key item index. */\
\
DB_LOCK lock; /* Cursor lock. */ \
db_lockmode_t lock_mode; /* Lock mode. */
struct __dbc_internal {
__DBC_INTERNAL
};
/* Actions that __db_master_update can take. */
typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action;
/*
* Access-method-common macro for determining whether a cursor
* has been initialized.
*/
#define IS_INITIALIZED(dbc) ((dbc)->internal->pgno != PGNO_INVALID)
/* Free the callback-allocated buffer, if necessary, hanging off of a DBT. */
#define FREE_IF_NEEDED(env, dbt) \
if (F_ISSET((dbt), DB_DBT_APPMALLOC)) { \
__os_ufree((env), (dbt)->data); \
F_CLR((dbt), DB_DBT_APPMALLOC); \
}
/*
* Use memory belonging to object "owner" to return the results of
* any no-DBT-flag get ops on cursor "dbc".
*/
#define SET_RET_MEM(dbc, owner) \
do { \
(dbc)->rskey = &(owner)->my_rskey; \
(dbc)->rkey = &(owner)->my_rkey; \
(dbc)->rdata = &(owner)->my_rdata; \
} while (0)
/* Use the return-data memory src is currently set to use in dest as well. */
#define COPY_RET_MEM(src, dest) \
do { \
(dest)->rskey = (src)->rskey; \
(dest)->rkey = (src)->rkey; \
(dest)->rdata = (src)->rdata; \
} while (0)
/* Reset the returned-memory pointers to their defaults. */
#define RESET_RET_MEM(dbc) \
do { \
(dbc)->rskey = &(dbc)->my_rskey; \
(dbc)->rkey = &(dbc)->my_rkey; \
(dbc)->rdata = &(dbc)->my_rdata; \
} while (0)
/*******************************************************
* Mpool.
*******************************************************/
/*
* File types for DB access methods. Negative numbers are reserved to DB.
*/
#define DB_FTYPE_SET -1 /* Call pgin/pgout functions. */
#define DB_FTYPE_NOTSET 0 /* Don't call... */
#define DB_LSN_OFF_NOTSET -1 /* Not yet set. */
#define DB_CLEARLEN_NOTSET UINT32_MAX /* Not yet set. */
/* Structure used as the DB pgin/pgout pgcookie. */
typedef struct __dbpginfo {
size_t db_pagesize; /* Underlying page size. */
u_int32_t flags; /* Some DB_AM flags needed. */
DBTYPE type; /* DB type */
} DB_PGINFO;
/*******************************************************
* Log.
*******************************************************/
/* Initialize an LSN to 'zero'. */
#define ZERO_LSN(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 0; \
} while (0)
#define IS_ZERO_LSN(LSN) ((LSN).file == 0 && (LSN).offset == 0)
#define IS_INIT_LSN(LSN) ((LSN).file == 1 && (LSN).offset == 0)
#define INIT_LSN(LSN) do { \
(LSN).file = 1; \
(LSN).offset = 0; \
} while (0)
#define MAX_LSN(LSN) do { \
(LSN).file = UINT32_MAX; \
(LSN).offset = UINT32_MAX; \
} while (0)
#define IS_MAX_LSN(LSN) \
((LSN).file == UINT32_MAX && (LSN).offset == UINT32_MAX)
/* If logging is turned off, smash the lsn. */
#define LSN_NOT_LOGGED(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 1; \
} while (0)
#define IS_NOT_LOGGED_LSN(LSN) \
((LSN).file == 0 && (LSN).offset == 1)
/*
* LOG_COMPARE -- compare two LSNs.
*/
#define LOG_COMPARE(lsn0, lsn1) \
((lsn0)->file != (lsn1)->file ? \
((lsn0)->file < (lsn1)->file ? -1 : 1) : \
((lsn0)->offset != (lsn1)->offset ? \
((lsn0)->offset < (lsn1)->offset ? -1 : 1) : 0))
/*******************************************************
* Txn.
*******************************************************/
#define DB_NONBLOCK(C) ((C)->txn != NULL && F_ISSET((C)->txn, TXN_NOWAIT))
#define NOWAIT_FLAG(txn) \
((txn) != NULL && F_ISSET((txn), TXN_NOWAIT) ? DB_LOCK_NOWAIT : 0)
#define IS_REAL_TXN(txn) \
((txn) != NULL && !F_ISSET(txn, TXN_CDSGROUP))
#define IS_SUBTRANSACTION(txn) \
((txn) != NULL && (txn)->parent != NULL)
/*******************************************************
* Crypto.
*******************************************************/
#define DB_IV_BYTES 16 /* Bytes per IV */
#define DB_MAC_KEY 20 /* Bytes per MAC checksum */
/*******************************************************
* Secondaries over RPC.
*******************************************************/
#ifdef CONFIG_TEST
/*
* These are flags passed to DB->associate calls by the Tcl API if running
* over RPC. The RPC server will mask out these flags before making the real
* DB->associate call.
*
* These flags must coexist with the valid flags to DB->associate (currently
* DB_AUTO_COMMIT and DB_CREATE). DB_AUTO_COMMIT is in the group of
* high-order shared flags (0xff000000), and DB_CREATE is in the low-order
* group (0x00000fff), so we pick a range in between.
*/
#define DB_RPC2ND_MASK 0x00f00000 /* Reserved bits. */
#define DB_RPC2ND_REVERSEDATA 0x00100000 /* callback_n(0) _s_reversedata. */
#define DB_RPC2ND_NOOP 0x00200000 /* callback_n(1) _s_noop */
#define DB_RPC2ND_CONCATKEYDATA 0x00300000 /* callback_n(2) _s_concatkeydata */
#define DB_RPC2ND_CONCATDATAKEY 0x00400000 /* callback_n(3) _s_concatdatakey */
#define DB_RPC2ND_REVERSECONCAT 0x00500000 /* callback_n(4) _s_reverseconcat */
#define DB_RPC2ND_TRUNCDATA 0x00600000 /* callback_n(5) _s_truncdata */
#define DB_RPC2ND_CONSTANT 0x00700000 /* callback_n(6) _s_constant */
#define DB_RPC2ND_GETZIP 0x00800000 /* sj_getzip */
#define DB_RPC2ND_GETNAME 0x00900000 /* sj_getname */
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Remaining general DB includes.
*******************************************************/
#include "dbinc/globals.h"
#include "dbinc/clock.h"
#include "dbinc/debug.h"
#include "dbinc/region.h"
#include "dbinc_auto/env_ext.h"
#include "dbinc/mutex.h"
#ifdef HAVE_REPLICATION_THREADS
#include "dbinc/repmgr.h"
#endif
#include "dbinc/rep.h"
#include "dbinc/os.h"
#include "dbinc_auto/clib_ext.h"
#include "dbinc_auto/common_ext.h"
/*******************************************************
* Remaining Log.
* These need to be defined after the general includes
* because they need rep.h from above.
*******************************************************/
/*
* Test if the environment is currently logging changes. If we're in recovery
* or we're a replication client, we don't need to log changes because they're
* already in the log, even though we have a fully functional log system.
*/
#define DBENV_LOGGING(env) \
(LOGGING_ON(env) && !IS_REP_CLIENT(env) && (!IS_RECOVERING(env)))
/*
* Test if we need to log a change. By default, we don't log operations without
* associated transactions, unless DIAGNOSTIC, DEBUG_ROP or DEBUG_WOP are on.
* This is because we want to get log records for read/write operations, and, if
* we are trying to debug something, more information is always better.
*
* The DBC_RECOVER flag is set when we're in abort, as well as during recovery;
* thus DBC_LOGGING may be false for a particular dbc even when DBENV_LOGGING
* is true.
*
* We explicitly use LOGGING_ON/IS_REP_CLIENT here because we don't want to pull
* in the log headers, which IS_RECOVERING (and thus DBENV_LOGGING) rely on, and
* because DBC_RECOVER should be set anytime IS_RECOVERING would be true.
*
* If we're not in recovery (master - doing an abort or a client applying
* a txn), then a client's only path through here is on an internal
* operation, and a master's only path through here is a transactional
* operation. Detect if either is not the case.
*/
#if defined(DIAGNOSTIC) || defined(DEBUG_ROP) || defined(DEBUG_WOP)
#define DBC_LOGGING(dbc) __dbc_logging(dbc)
#else
#define DBC_LOGGING(dbc) \
((dbc)->txn != NULL && LOGGING_ON((dbc)->env) && \
!F_ISSET((dbc), DBC_RECOVER) && !IS_REP_CLIENT((dbc)->env))
#endif
#endif /* !_DB_INT_H_ */

3
build_unix/.IGNORE_ME Normal file
View File

@@ -0,0 +1,3 @@
Some combinations of the gzip and tar archive exploders found
on Linux systems ignore directories that don't have any files
(other than symbolic links) in them. So, here's a file.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
Document file - DO NOT EDIT
<BEGIN> CORE_INFO_TYPE
Workspace
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> projectList
$(PRJ_DIR)/BerkeleyDB20.wpj \
$(PRJ_DIR)/db_archive/db_archive20.wpj \
$(PRJ_DIR)/db_checkpoint/db_checkpoint20.wpj \
$(PRJ_DIR)/db_deadlock/db_deadlock20.wpj \
$(PRJ_DIR)/db_dump/db_dump20.wpj \
$(PRJ_DIR)/db_load/db_load20.wpj \
$(PRJ_DIR)/db_printlog/db_printlog20.wpj \
$(PRJ_DIR)/db_recover/db_recover20.wpj \
$(PRJ_DIR)/db_stat/db_stat20.wpj \
$(PRJ_DIR)/db_upgrade/db_upgrade20.wpj \
$(PRJ_DIR)/db_verify/db_verify20.wpj \
$(PRJ_DIR)/dbdemo/dbdemo20.wpj
<END>
<BEGIN> userComments
<END>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
Document file - DO NOT EDIT
<BEGIN> CORE_INFO_TYPE
Workspace
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> projectList
$(PRJ_DIR)/BerkeleyDB20small.wpj \
$(PRJ_DIR)/db_archive/db_archive20.wpj \
$(PRJ_DIR)/db_checkpoint/db_checkpoint20.wpj \
$(PRJ_DIR)/db_deadlock/db_deadlock20.wpj \
$(PRJ_DIR)/db_dump/db_dump20.wpj \
$(PRJ_DIR)/db_load/db_load20.wpj \
$(PRJ_DIR)/db_printlog/db_printlog20.wpj \
$(PRJ_DIR)/db_recover/db_recover20.wpj \
$(PRJ_DIR)/db_stat/db_stat20.wpj \
$(PRJ_DIR)/db_upgrade/db_upgrade20.wpj \
$(PRJ_DIR)/db_verify/db_verify20.wpj \
$(PRJ_DIR)/dbdemo/dbdemo20.wpj
<END>
<BEGIN> userComments
<END>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
Document file - DO NOT EDIT
<BEGIN> CORE_INFO_TYPE
Workspace
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> projectList
$(PRJ_DIR)/BerkeleyDB22.wpj \
$(PRJ_DIR)/db_archive/db_archive22.wpj \
$(PRJ_DIR)/db_checkpoint/db_checkpoint22.wpj \
$(PRJ_DIR)/db_deadlock/db_deadlock22.wpj \
$(PRJ_DIR)/db_dump/db_dump22.wpj \
$(PRJ_DIR)/db_load/db_load22.wpj \
$(PRJ_DIR)/db_printlog/db_printlog22.wpj \
$(PRJ_DIR)/db_recover/db_recover22.wpj \
$(PRJ_DIR)/db_stat/db_stat22.wpj \
$(PRJ_DIR)/db_upgrade/db_upgrade22.wpj \
$(PRJ_DIR)/db_verify/db_verify22.wpj \
$(PRJ_DIR)/dbdemo/dbdemo22.wpj
<END>
<BEGIN> userComments
<END>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
Document file - DO NOT EDIT
<BEGIN> CORE_INFO_TYPE
Workspace
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> projectList
$(PRJ_DIR)/BerkeleyDB22small.wpj \
$(PRJ_DIR)/db_archive/db_archive22.wpj \
$(PRJ_DIR)/db_checkpoint/db_checkpoint22.wpj \
$(PRJ_DIR)/db_deadlock/db_deadlock22.wpj \
$(PRJ_DIR)/db_dump/db_dump22.wpj \
$(PRJ_DIR)/db_load/db_load22.wpj \
$(PRJ_DIR)/db_printlog/db_printlog22.wpj \
$(PRJ_DIR)/db_recover/db_recover22.wpj \
$(PRJ_DIR)/db_stat/db_stat22.wpj \
$(PRJ_DIR)/db_upgrade/db_upgrade22.wpj \
$(PRJ_DIR)/db_verify/db_verify22.wpj \
$(PRJ_DIR)/dbdemo/dbdemo22.wpj
<END>
<BEGIN> userComments
<END>

276
build_vxworks/clib_port.h Normal file
View File

@@ -0,0 +1,276 @@
/* DO NOT EDIT: automatically built from dist/clib_port.in. */
/*
* Minimum/maximum values for various types.
*/
#ifndef UINT16_MAX /* Maximum 16-bit unsigned. */
#define UINT16_MAX 65535
#endif
#ifndef UINT32_MAX /* Maximum 32-bit unsigned. */
#define UINT32_MAX 4294967295U
#endif
#ifndef INT_MAX
#if SIZEOF_INT == 4
#define INT_MAX 2147483647
#endif
#if SIZEOF_INT == 8
#define INT_MAX 9223372036854775807
#endif
#endif
#ifndef INT_MIN /* minimum (signed) int value */
#define INT_MIN (-INT_MAX-1)
#endif
#ifndef UINT_MAX /* maximum (signed) int value */
#if SIZEOF_INT == 4
#define UINT_MAX 4294967295U
#endif
#if SIZEOF_INT == 8
#define UINT_MAX 18446744073709551615U
#endif
#endif
#ifndef LONG_MAX /* maximum (signed) long value */
#if SIZEOF_LONG == 4
#define LONG_MAX 2147483647
#endif
#if SIZEOF_LONG == 8
#define LONG_MAX 9223372036854775807L
#endif
#endif
#ifndef LONG_MIN /* minimum (signed) long value */
#define LONG_MIN (-LONG_MAX-1)
#endif
#ifndef ULONG_MAX /* maximum (unsigned) long value */
#if SIZEOF_LONG == 4
#define ULONG_MAX 4294967295U
#endif
#if SIZEOF_LONG == 8
#define ULONG_MAX 18446744073709551615UL
#endif
#endif
#if defined(HAVE_64BIT_TYPES)
/*
* Override the system's 64-bit min/max constants. AIX's 32-bit compiler can
* handle 64-bit values, but the system's constants don't include the LL/ULL
* suffix, and so can't be compiled using the 32-bit compiler.
*/
#undef INT64_MAX
#undef INT64_MIN
#undef UINT64_MAX
#ifdef DB_WIN32
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
#define UINT64_MAX _UI64_MAX
#else
#define INT64_MAX 9223372036854775807LL
#define INT64_MIN (-INT64_MAX-1)
#define UINT64_MAX 18446744073709551615ULL
#endif /* DB_WIN32 */
#define INT64_FMT "%lld"
#define UINT64_FMT "%llu"
#endif /* HAVE_64BIT_TYPES */
/*
* Exit success/failure macros.
*/
#ifndef HAVE_EXIT_SUCCESS
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif
/*
* File modes.
*/
#ifdef DB_WIN32
#ifndef S_IREAD /* WinCE doesn't have S_IREAD. */
#define S_IREAD 0
#endif
#ifndef S_IWRITE /* WinCE doesn't have S_IWRITE. */
#define S_IWRITE 0
#endif
#ifndef S_IRUSR
#define S_IRUSR S_IREAD /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0 /* X for other */
#endif
#else /* !DB_WIN32 */
#ifndef S_IRUSR
#define S_IRUSR 0000400 /* R for owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR 0000200 /* W for owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0000100 /* X for owner */
#endif
#ifndef S_IRGRP
#define S_IRGRP 0000040 /* R for group */
#endif
#ifndef S_IWGRP
#define S_IWGRP 0000020 /* W for group */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0000010 /* X for group */
#endif
#ifndef S_IROTH
#define S_IROTH 0000004 /* R for other */
#endif
#ifndef S_IWOTH
#define S_IWOTH 0000002 /* W for other */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0000001 /* X for other */
#endif
#endif /* !DB_WIN32 */
/*
* Don't step on the namespace. Other libraries may have their own
* implementations of these functions, we don't want to use their
* implementations or force them to use ours based on the load order.
*/
#ifndef HAVE_ATOI
#define atoi __db_Catoi
#endif
#ifndef HAVE_ATOL
#define atol __db_Catol
#endif
#ifndef HAVE_FCLOSE
#define fclose __db_Cfclose
#endif
#ifndef HAVE_FGETC
#define fgetc __db_Cfgetc
#endif
#ifndef HAVE_FGETS
#define fgets __db_Cfgets
#endif
#ifndef HAVE_FOPEN
#define fopen __db_Cfopen
#endif
#ifndef HAVE_FWRITE
#define fwrite __db_Cfwrite
#endif
#ifndef HAVE_GETADDRINFO
#define freeaddrinfo(a) __db_Cfreeaddrinfo(a)
#define getaddrinfo(a, b, c, d) __db_Cgetaddrinfo(a, b, c, d)
#endif
#ifndef HAVE_GETCWD
#define getcwd __db_Cgetcwd
#endif
#ifndef HAVE_GETOPT
#define getopt __db_Cgetopt
#define optarg __db_Coptarg
#define opterr __db_Copterr
#define optind __db_Coptind
#define optopt __db_Coptopt
#define optreset __db_Coptreset
#endif
#ifndef HAVE_ISALPHA
#define isalpha __db_Cisalpha
#endif
#ifndef HAVE_ISDIGIT
#define isdigit __db_Cisdigit
#endif
#ifndef HAVE_ISPRINT
#define isprint __db_Cisprint
#endif
#ifndef HAVE_ISSPACE
#define isspace __db_Cisspace
#endif
#ifndef HAVE_LOCALTIME
#define localtime __db_Clocaltime
#endif
#ifndef HAVE_MEMCMP
#define memcmp __db_Cmemcmp
#endif
#ifndef HAVE_MEMCPY
#define memcpy __db_Cmemcpy
#endif
#ifndef HAVE_MEMMOVE
#define memmove __db_Cmemmove
#endif
#ifndef HAVE_PRINTF
#define printf __db_Cprintf
#define fprintf __db_Cfprintf
#endif
#ifndef HAVE_QSORT
#define qsort __db_Cqsort
#endif
#ifndef HAVE_RAISE
#define raise __db_Craise
#endif
#ifndef HAVE_RAND
#define rand __db_Crand
#define srand __db_Csrand
#endif
#ifndef HAVE_SNPRINTF
#define snprintf __db_Csnprintf
#endif
#ifndef HAVE_STRCASECMP
#define strcasecmp __db_Cstrcasecmp
#define strncasecmp __db_Cstrncasecmp
#endif
#ifndef HAVE_STRCAT
#define strcat __db_Cstrcat
#endif
#ifndef HAVE_STRCHR
#define strchr __db_Cstrchr
#endif
#ifndef HAVE_STRDUP
#define strdup __db_Cstrdup
#endif
#ifndef HAVE_STRERROR
#define strerror __db_Cstrerror
#endif
#ifndef HAVE_STRNCAT
#define strncat __db_Cstrncat
#endif
#ifndef HAVE_STRNCMP
#define strncmp __db_Cstrncmp
#endif
#ifndef HAVE_STRRCHR
#define strrchr __db_Cstrrchr
#endif
#ifndef HAVE_STRSEP
#define strsep __db_Cstrsep
#endif
#ifndef HAVE_STRTOL
#define strtol __db_Cstrtol
#endif
#ifndef HAVE_STRTOUL
#define strtoul __db_Cstrtoul
#endif
#ifndef HAVE_TIME
#define time __db_Ctime
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf __db_Cvsnprintf
#endif

2483
build_vxworks/db.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,199 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_archive.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
int db_archive_main __P((int, char *[]));
int db_archive_usage __P((void));
int db_archive_version_check __P((void));
const char *progname;
int
db_archive(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_archive", args, &argc, &argv);
return (db_archive_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_archive_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
u_int32_t flags;
int ch, exitval, ret, verbose;
char **file, *home, **list, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_archive_version_check()) != 0)
return (ret);
dbenv = NULL;
flags = 0;
exitval = verbose = 0;
home = passwd = NULL;
file = list = NULL;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "adh:lP:sVv")) != EOF)
switch (ch) {
case 'a':
LF_SET(DB_ARCH_ABS);
break;
case 'd':
LF_SET(DB_ARCH_REMOVE);
break;
case 'h':
home = optarg;
break;
case 'l':
LF_SET(DB_ARCH_LOG);
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 's':
LF_SET(DB_ARCH_DATA);
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
/*
* !!!
* The verbose flag no longer actually does anything,
* but it's left rather than adding it back at some
* future date.
*/
verbose = 1;
break;
case '?':
default:
return (db_archive_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_archive_usage());
/* Handle possible interruptions. */
__db_util_siginit();
/*
* Create an environment object and initialize it for error
* reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto shutdown;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto shutdown;
}
/*
* If attaching to a pre-existing environment fails, create a
* private one and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
(ret == DB_VERSION_MISMATCH ||
(ret = dbenv->open(dbenv, home, DB_CREATE |
DB_INIT_LOG | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto shutdown;
}
/* Get the list of names. */
if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
goto shutdown;
}
/* Print the list of names. */
if (list != NULL) {
for (file = list; *file != NULL; ++file)
printf("%s\n", *file);
free(list);
}
if (0) {
shutdown: exitval = 1;
}
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (passwd != NULL)
free(passwd);
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
db_archive_usage()
{
(void)fprintf(stderr,
"usage: %s [-adlsVv] [-h home] [-P password]\n", progname);
return (EXIT_FAILURE);
}
int
db_archive_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_archive20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_archive20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_archive20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_archive.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_archive.c_dependencies
<END>
<BEGIN> FILE_db_archive.c_objects
db_archive.o
<END>
<BEGIN> FILE_db_archive.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_archive.c
<END>
<BEGIN> userComments
db_archive
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_archive22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_archive22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_archive22.out
<END>
<BEGIN> BUILD_RULE_db_archive22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_archive.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_archive.c_dependencies
<END>
<BEGIN> FILE_db_archive.c_objects
db_archive.o
<END>
<BEGIN> FILE_db_archive.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_archive.c
<END>
<BEGIN> userComments
db_archive
<END>

View File

@@ -0,0 +1,245 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_checkpoint.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
int db_checkpoint_main __P((int, char *[]));
int db_checkpoint_usage __P((void));
int db_checkpoint_version_check __P((void));
const char *progname;
int
db_checkpoint(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_checkpoint", args, &argc, &argv);
return (db_checkpoint_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_checkpoint_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
time_t now;
long argval;
u_int32_t flags, kbytes, minutes, seconds;
int ch, exitval, once, ret, verbose;
char *home, *logfile, *passwd, time_buf[CTIME_BUFLEN];
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_checkpoint_version_check()) != 0)
return (ret);
/*
* !!!
* Don't allow a fully unsigned 32-bit number, some compilers get
* upset and require it to be specified in hexadecimal and so on.
*/
#define MAX_UINT32_T 2147483647
dbenv = NULL;
kbytes = minutes = 0;
exitval = once = verbose = 0;
flags = 0;
home = logfile = passwd = NULL;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "1h:k:L:P:p:Vv")) != EOF)
switch (ch) {
case '1':
once = 1;
flags = DB_FORCE;
break;
case 'h':
home = optarg;
break;
case 'k':
if (__db_getlong(NULL, progname,
optarg, 1, (long)MAX_UINT32_T, &argval))
return (EXIT_FAILURE);
kbytes = (u_int32_t)argval;
break;
case 'L':
logfile = optarg;
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 'p':
if (__db_getlong(NULL, progname,
optarg, 1, (long)MAX_UINT32_T, &argval))
return (EXIT_FAILURE);
minutes = (u_int32_t)argval;
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
verbose = 1;
break;
case '?':
default:
return (db_checkpoint_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_checkpoint_usage());
if (once == 0 && kbytes == 0 && minutes == 0) {
(void)fprintf(stderr,
"%s: at least one of -1, -k and -p must be specified\n",
progname);
return (db_checkpoint_usage());
}
/* Handle possible interruptions. */
__db_util_siginit();
/* Log our process ID. */
if (logfile != NULL && __db_util_logset(progname, logfile))
goto shutdown;
/*
* Create an environment object and initialize it for error
* reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto shutdown;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto shutdown;
}
/*
* If attaching to a pre-existing environment fails, create a
* private one and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
(!once || ret == DB_VERSION_MISMATCH ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_TXN | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto shutdown;
}
/*
* If we have only a time delay, then we'll sleep the right amount
* to wake up when a checkpoint is necessary. If we have a "kbytes"
* field set, then we'll check every 30 seconds.
*/
seconds = kbytes != 0 ? 30 : minutes * 60;
while (!__db_util_interrupted()) {
if (verbose) {
(void)time(&now);
dbenv->errx(dbenv,
"checkpoint begin: %s", __os_ctime(&now, time_buf));
}
if ((ret = dbenv->txn_checkpoint(dbenv,
kbytes, minutes, flags)) != 0) {
dbenv->err(dbenv, ret, "txn_checkpoint");
goto shutdown;
}
if (verbose) {
(void)time(&now);
dbenv->errx(dbenv,
"checkpoint complete: %s", __os_ctime(&now, time_buf));
}
if (once)
break;
__os_yield(dbenv->env, seconds, 0);
}
if (0) {
shutdown: exitval = 1;
}
/* Clean up the logfile. */
if (logfile != NULL)
(void)remove(logfile);
/* Clean up the environment. */
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (passwd != NULL)
free(passwd);
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
db_checkpoint_usage()
{
(void)fprintf(stderr, "usage: %s [-1Vv]\n\t%s\n", progname,
"[-h home] [-k kbytes] [-L file] [-P password] [-p min]");
return (EXIT_FAILURE);
}
int
db_checkpoint_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_checkpoint20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_checkpoint20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_checkpoint20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_checkpoint.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_checkpoint.c_dependencies
<END>
<BEGIN> FILE_db_checkpoint.c_objects
db_checkpoint.o
<END>
<BEGIN> FILE_db_checkpoint.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_checkpoint.c
<END>
<BEGIN> userComments
db_checkpoint
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_checkpoint22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_checkpoint22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_checkpoint22.out
<END>
<BEGIN> BUILD_RULE_db_checkpoint22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_checkpoint.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_checkpoint.c_dependencies
<END>
<BEGIN> FILE_db_checkpoint.c_objects
db_checkpoint.o
<END>
<BEGIN> FILE_db_checkpoint.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_checkpoint.c
<END>
<BEGIN> userComments
db_checkpoint
<END>

581
build_vxworks/db_config.h Normal file
View File

@@ -0,0 +1,581 @@
/* DO NOT EDIT: automatically built by dist/s_vxworks. */
/* !!!
* The CONFIG_TEST option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want to build a version for running the test suite. */
/* #undef CONFIG_TEST */
/* We use DB_WIN32 much as one would use _WIN32 -- to specify that we're using
an operating system environment that supports Win32 calls and semantics. We
don't use _WIN32 because Cygwin/GCC also defines _WIN32, even though
Cygwin/GCC closely emulates the Unix environment. */
/* #undef DB_WIN32 */
/* !!!
* The DEBUG option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want a debugging version. */
/* #undef DEBUG */
/* Define to 1 if you want a version that logs read operations. */
/* #undef DEBUG_ROP */
/* Define to 1 if you want a version that logs write operations. */
/* #undef DEBUG_WOP */
/* !!!
* The DIAGNOSTIC option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want a version with run-time diagnostic checking. */
/* #undef DIAGNOSTIC */
/* Define to 1 if 64-bit types are available. */
#define HAVE_64BIT_TYPES 1
/* Define to 1 if you have the `abort' function. */
#define HAVE_ABORT 1
/* Define to 1 if you have the `atoi' function. */
#define HAVE_ATOI 1
/* Define to 1 if you have the `atol' function. */
#define HAVE_ATOL 1
/* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */
/* Define to 1 if you have the `backtrace_symbols' function. */
/* #undef HAVE_BACKTRACE_SYMBOLS */
/* Define to 1 if building BREW. */
/* #undef HAVE_BREW */
/* Define to 1 if building on BREW (SDK2). */
/* #undef HAVE_BREW_SDK2 */
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define to 1 if clock_gettime supports CLOCK_MONOTONIC. */
/* #undef HAVE_CLOCK_MONOTONIC */
/* Define to 1 if Berkeley DB release includes strong cryptography. */
#define HAVE_CRYPTO 1
/* Define to 1 if you have the `ctime_r' function. */
#define HAVE_CTIME_R 1
/* Define to 1 if ctime_r takes a buffer length as a third argument. */
#define HAVE_CTIME_R_3ARG 1
/* Define to 1 if you have the `directio' function. */
/* #undef HAVE_DIRECTIO */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */
#define HAVE_EXIT_SUCCESS 1
/* Define to 1 if you have the `fchmod' function. */
/* #undef HAVE_FCHMOD */
/* Define to 1 if you have the `fclose' function. */
#define HAVE_FCLOSE 1
/* Define to 1 if you have the `fcntl' function. */
/* #undef HAVE_FCNTL */
/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */
/* #undef HAVE_FCNTL_F_SETFD */
/* Define to 1 if you have the `fdatasync' function. */
/* #undef HAVE_FDATASYNC */
/* Define to 1 if you have the `fgetc' function. */
#define HAVE_FGETC 1
/* Define to 1 if you have the `fgets' function. */
#define HAVE_FGETS 1
/* Define to 1 if allocated filesystem blocks are not zeroed. */
#define HAVE_FILESYSTEM_NOTZERO 1
/* Define to 1 if you have the `fopen' function. */
#define HAVE_FOPEN 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `fwrite' function. */
#define HAVE_FWRITE 1
/* Define to 1 if you have the `getaddrinfo' function. */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getenv' function. */
#define HAVE_GETENV 1
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getopt' function. */
/* #undef HAVE_GETOPT */
/* Define to 1 if getopt supports the optreset variable. */
/* #undef HAVE_GETOPT_OPTRESET */
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have the `getuid' function. */
/* #undef HAVE_GETUID */
/* Define to 1 if building Hash access method. */
#define HAVE_HASH 1
/* Define to 1 if you have the `hstrerror' function. */
/* #undef HAVE_HSTRERROR */
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
/* Define to 1 if you have the `isalpha' function. */
#define HAVE_ISALPHA 1
/* Define to 1 if you have the `isdigit' function. */
#define HAVE_ISDIGIT 1
/* Define to 1 if you have the `isprint' function. */
#define HAVE_ISPRINT 1
/* Define to 1 if you have the `isspace' function. */
#define HAVE_ISSPACE 1
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the `memcmp' function. */
#define HAVE_MEMCMP 1
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mlock' function. */
/* #undef HAVE_MLOCK */
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Define to 1 if you have the `munlock' function. */
/* #undef HAVE_MUNLOCK */
/* Define to 1 if you have the `munmap' function. */
/* #undef HAVE_MUNMAP */
/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */
/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */
/* Define to 1 to use the AIX _check_lock mutexes. */
/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */
/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */
/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */
/* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
/* #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY */
/* Define to 1 to use the UNIX fcntl system call mutexes. */
/* #undef HAVE_MUTEX_FCNTL */
/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes.
*/
/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on HP-UX. */
/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */
/* Define to 1 to use test-and-set mutexes with blocking mutexes. */
/* #undef HAVE_MUTEX_HYBRID */
/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */
/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes. */
/* #undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */
/* #undef HAVE_MUTEX_MSEM_INIT */
/* Define to 1 to use the GCC compiler and PowerPC assembly language mutexes.
*/
/* #undef HAVE_MUTEX_PPC_GCC_ASSEMBLY */
/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */
/* #undef HAVE_MUTEX_PTHREADS */
/* Define to 1 to use Reliant UNIX initspin mutexes. */
/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */
/* Define to 1 to use the IBM C compiler and S/390 assembly language mutexes.
*/
/* #undef HAVE_MUTEX_S390_CC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */
/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */
/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */
/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */
/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */
/* #undef HAVE_MUTEX_SEMA_INIT */
/* Define to 1 to use the SGI XXX_lock mutexes. */
/* #undef HAVE_MUTEX_SGI_INIT_LOCK */
/* Define to 1 to use the Solaris _lock_XXX mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */
/* Define to 1 to use the Solaris lwp threads mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LWP */
/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */
/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */
/* Define to 1 if the Berkeley DB library should support mutexes. */
#define HAVE_MUTEX_SUPPORT 1
/* Define to 1 if mutexes hold system resources. */
#define HAVE_MUTEX_SYSTEM_RESOURCES 1
/* Define to 1 to configure mutexes intra-process only. */
/* #undef HAVE_MUTEX_THREAD_ONLY */
/* Define to 1 to use the CC compiler and Tru64 assembly language mutexes. */
/* #undef HAVE_MUTEX_TRU64_CC_ASSEMBLY */
/* Define to 1 to use the UNIX International mutexes. */
/* #undef HAVE_MUTEX_UI_THREADS */
/* Define to 1 to use the UTS compiler and assembly language mutexes. */
/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */
/* Define to 1 to use VMS mutexes. */
/* #undef HAVE_MUTEX_VMS */
/* Define to 1 to use VxWorks mutexes. */
#define HAVE_MUTEX_VXWORKS 1
/* Define to 1 to use the MSVC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32 */
/* Define to 1 to use the GCC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32_GCC */
/* Define to 1 to use the GCC compiler and 64-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and 32-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the O_DIRECT flag. */
/* #undef HAVE_O_DIRECT */
/* Define to 1 if you have the `pread' function. */
/* #undef HAVE_PREAD */
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
/* Define to 1 if you have the `pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define to 1 to configure Berkeley DB for POSIX pthread API. */
/* #undef HAVE_PTHREAD_API */
/* Define to 1 if you have the `pthread_yield' function. */
/* #undef HAVE_PTHREAD_YIELD */
/* Define to 1 if you have the `pwrite' function. */
/* #undef HAVE_PWRITE */
/* Define to 1 if building on QNX. */
/* #undef HAVE_QNX */
/* Define to 1 if you have the `qsort' function. */
#define HAVE_QSORT 1
/* Define to 1 if building Queue access method. */
#define HAVE_QUEUE 1
/* Define to 1 if you have the `raise' function. */
#define HAVE_RAISE 1
/* Define to 1 if you have the `rand' function. */
#define HAVE_RAND 1
/* Define to 1 if building replication support. */
#define HAVE_REPLICATION 1
/* Define to 1 if building the Berkeley DB replication framework. */
/* #undef HAVE_REPLICATION_THREADS */
/* Define to 1 if building RPC client/server. */
/* #undef HAVE_RPC */
/* Define to 1 if building on S60. */
/* #undef HAVE_S60 */
/* Define to 1 if you have the `sched_yield' function. */
#define HAVE_SCHED_YIELD 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if shmctl/SHM_LOCK locks down shared memory segments. */
/* #undef HAVE_SHMCTL_SHM_LOCK */
/* Define to 1 if you have the `shmget' function. */
/* #undef HAVE_SHMGET */
/* Define to 1 if you have the `sigaction' function. */
/* #undef HAVE_SIGACTION */
/* Define to 1 if thread identifier type db_threadid_t is integral. */
#define HAVE_SIMPLE_THREAD_TYPE 1
/* Define to 1 if you have the `snprintf' function. */
/* #undef HAVE_SNPRINTF */
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if building statistics support. */
#define HAVE_STATISTICS 1
/* Define to 1 if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
/* #undef HAVE_STRCASECMP */
/* Define to 1 if you have the `strcat' function. */
#define HAVE_STRCAT 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
/* #undef HAVE_STRDUP */
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncat' function. */
#define HAVE_STRNCAT 1
/* Define to 1 if you have the `strncmp' function. */
#define HAVE_STRNCMP 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strsep' function. */
/* #undef HAVE_STRSEP */
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if `st_blksize' is member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
/* Define to 1 if you have the `sysconf' function. */
/* #undef HAVE_SYSCONF */
/* Define to 1 if port includes files in the Berkeley DB source code. */
#define HAVE_SYSTEM_INCLUDE_FILES 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define to 1 if you have the <sys/types.h> header file. */
/* #undef HAVE_SYS_TYPES_H */
/* Define to 1 if you have the `time' function. */
#define HAVE_TIME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if unlink of file with open file descriptors will fail. */
#define HAVE_UNLINK_WITH_OPEN_FAILURE 1
/* Define to 1 if port includes historic database upgrade support. */
#define HAVE_UPGRADE_SUPPORT 1
/* Define to 1 if building access method verification support. */
#define HAVE_VERIFY 1
/* Define to 1 if you have the `vsnprintf' function. */
/* #undef HAVE_VSNPRINTF */
/* Define to 1 if building VxWorks. */
#define HAVE_VXWORKS 1
/* Define to 1 if you have the `yield' function. */
/* #undef HAVE_YIELD */
/* Define to 1 if you have the `_fstati64' function. */
/* #undef HAVE__FSTATI64 */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "Oracle Technology Network Berkeley DB forum"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Berkeley DB"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Berkeley DB 4.7.25"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "db-4.7.25"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.7.25"
/* The size of a `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of a `char *', as computed by sizeof. */
/* #undef SIZEOF_CHAR_P */
/* The size of a `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of a `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of a `long long', as computed by sizeof. */
/* #undef SIZEOF_LONG_LONG */
/* The size of a `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of a `size_t', as computed by sizeof. */
/* #undef SIZEOF_SIZE_T */
/* The size of a `unsigned char', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_CHAR */
/* The size of a `unsigned int', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_INT */
/* The size of a `unsigned long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG */
/* The size of a `unsigned long long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG_LONG */
/* The size of a `unsigned short', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_SHORT */
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define to 1 to mask harmless uninitialized memory read/writes. */
/* #undef UMRW */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline
#endif
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */

View File

@@ -0,0 +1,581 @@
/* DO NOT EDIT: automatically built by dist/s_vxworks. */
/* !!!
* The CONFIG_TEST option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want to build a version for running the test suite. */
/* #undef CONFIG_TEST */
/* We use DB_WIN32 much as one would use _WIN32 -- to specify that we're using
an operating system environment that supports Win32 calls and semantics. We
don't use _WIN32 because Cygwin/GCC also defines _WIN32, even though
Cygwin/GCC closely emulates the Unix environment. */
/* #undef DB_WIN32 */
/* !!!
* The DEBUG option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want a debugging version. */
/* #undef DEBUG */
/* Define to 1 if you want a version that logs read operations. */
/* #undef DEBUG_ROP */
/* Define to 1 if you want a version that logs write operations. */
/* #undef DEBUG_WOP */
/* !!!
* The DIAGNOSTIC option may be added using the Tornado project build.
* DO NOT modify it here.
*/
/* Define to 1 if you want a version with run-time diagnostic checking. */
/* #undef DIAGNOSTIC */
/* Define to 1 if 64-bit types are available. */
#define HAVE_64BIT_TYPES 1
/* Define to 1 if you have the `abort' function. */
#define HAVE_ABORT 1
/* Define to 1 if you have the `atoi' function. */
#define HAVE_ATOI 1
/* Define to 1 if you have the `atol' function. */
#define HAVE_ATOL 1
/* Define to 1 if you have the `backtrace' function. */
/* #undef HAVE_BACKTRACE */
/* Define to 1 if you have the `backtrace_symbols' function. */
/* #undef HAVE_BACKTRACE_SYMBOLS */
/* Define to 1 if building BREW. */
/* #undef HAVE_BREW */
/* Define to 1 if building on BREW (SDK2). */
/* #undef HAVE_BREW_SDK2 */
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define to 1 if clock_gettime supports CLOCK_MONOTONIC. */
/* #undef HAVE_CLOCK_MONOTONIC */
/* Define to 1 if Berkeley DB release includes strong cryptography. */
/* #undef HAVE_CRYPTO */
/* Define to 1 if you have the `ctime_r' function. */
#define HAVE_CTIME_R 1
/* Define to 1 if ctime_r takes a buffer length as a third argument. */
#define HAVE_CTIME_R_3ARG 1
/* Define to 1 if you have the `directio' function. */
/* #undef HAVE_DIRECTIO */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <execinfo.h> header file. */
/* #undef HAVE_EXECINFO_H */
/* Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines. */
#define HAVE_EXIT_SUCCESS 1
/* Define to 1 if you have the `fchmod' function. */
/* #undef HAVE_FCHMOD */
/* Define to 1 if you have the `fclose' function. */
#define HAVE_FCLOSE 1
/* Define to 1 if you have the `fcntl' function. */
/* #undef HAVE_FCNTL */
/* Define to 1 if fcntl/F_SETFD denies child access to file descriptors. */
/* #undef HAVE_FCNTL_F_SETFD */
/* Define to 1 if you have the `fdatasync' function. */
/* #undef HAVE_FDATASYNC */
/* Define to 1 if you have the `fgetc' function. */
#define HAVE_FGETC 1
/* Define to 1 if you have the `fgets' function. */
#define HAVE_FGETS 1
/* Define to 1 if allocated filesystem blocks are not zeroed. */
#define HAVE_FILESYSTEM_NOTZERO 1
/* Define to 1 if you have the `fopen' function. */
#define HAVE_FOPEN 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `fwrite' function. */
#define HAVE_FWRITE 1
/* Define to 1 if you have the `getaddrinfo' function. */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* Define to 1 if you have the `getenv' function. */
#define HAVE_GETENV 1
/* Define to 1 if you have the `getgid' function. */
#define HAVE_GETGID 1
/* Define to 1 if you have the `getopt' function. */
/* #undef HAVE_GETOPT */
/* Define to 1 if getopt supports the optreset variable. */
/* #undef HAVE_GETOPT_OPTRESET */
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have the `getuid' function. */
/* #undef HAVE_GETUID */
/* Define to 1 if building Hash access method. */
/* #undef HAVE_HASH */
/* Define to 1 if you have the `hstrerror' function. */
/* #undef HAVE_HSTRERROR */
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
/* Define to 1 if you have the `isalpha' function. */
#define HAVE_ISALPHA 1
/* Define to 1 if you have the `isdigit' function. */
#define HAVE_ISDIGIT 1
/* Define to 1 if you have the `isprint' function. */
#define HAVE_ISPRINT 1
/* Define to 1 if you have the `isspace' function. */
#define HAVE_ISSPACE 1
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
/* Define to 1 if you have the `memcmp' function. */
#define HAVE_MEMCMP 1
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mlock' function. */
/* #undef HAVE_MLOCK */
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Define to 1 if you have the `munlock' function. */
/* #undef HAVE_MUNLOCK */
/* Define to 1 if you have the `munmap' function. */
/* #undef HAVE_MUNMAP */
/* Define to 1 to use the GCC compiler and 68K assembly language mutexes. */
/* #undef HAVE_MUTEX_68K_GCC_ASSEMBLY */
/* Define to 1 to use the AIX _check_lock mutexes. */
/* #undef HAVE_MUTEX_AIX_CHECK_LOCK */
/* Define to 1 to use the GCC compiler and Alpha assembly language mutexes. */
/* #undef HAVE_MUTEX_ALPHA_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and ARM assembly language mutexes. */
/* #undef HAVE_MUTEX_ARM_GCC_ASSEMBLY */
/* Define to 1 to use the Apple/Darwin _spin_lock_try mutexes. */
/* #undef HAVE_MUTEX_DARWIN_SPIN_LOCK_TRY */
/* Define to 1 to use the UNIX fcntl system call mutexes. */
/* #undef HAVE_MUTEX_FCNTL */
/* Define to 1 to use the GCC compiler and PaRisc assembly language mutexes.
*/
/* #undef HAVE_MUTEX_HPPA_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on HP-UX. */
/* #undef HAVE_MUTEX_HPPA_MSEM_INIT */
/* Define to 1 to use test-and-set mutexes with blocking mutexes. */
/* #undef HAVE_MUTEX_HYBRID */
/* Define to 1 to use the GCC compiler and IA64 assembly language mutexes. */
/* #undef HAVE_MUTEX_IA64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and MIPS assembly language mutexes. */
/* #undef HAVE_MUTEX_MIPS_GCC_ASSEMBLY */
/* Define to 1 to use the msem_XXX mutexes on systems other than HP-UX. */
/* #undef HAVE_MUTEX_MSEM_INIT */
/* Define to 1 to use the GCC compiler and PowerPC assembly language mutexes.
*/
/* #undef HAVE_MUTEX_PPC_GCC_ASSEMBLY */
/* Define to 1 to use POSIX 1003.1 pthread_XXX mutexes. */
/* #undef HAVE_MUTEX_PTHREADS */
/* Define to 1 to use Reliant UNIX initspin mutexes. */
/* #undef HAVE_MUTEX_RELIANTUNIX_INITSPIN */
/* Define to 1 to use the IBM C compiler and S/390 assembly language mutexes.
*/
/* #undef HAVE_MUTEX_S390_CC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and S/390 assembly language mutexes. */
/* #undef HAVE_MUTEX_S390_GCC_ASSEMBLY */
/* Define to 1 to use the SCO compiler and x86 assembly language mutexes. */
/* #undef HAVE_MUTEX_SCO_X86_CC_ASSEMBLY */
/* Define to 1 to use the obsolete POSIX 1003.1 sema_XXX mutexes. */
/* #undef HAVE_MUTEX_SEMA_INIT */
/* Define to 1 to use the SGI XXX_lock mutexes. */
/* #undef HAVE_MUTEX_SGI_INIT_LOCK */
/* Define to 1 to use the Solaris _lock_XXX mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LOCK_TRY */
/* Define to 1 to use the Solaris lwp threads mutexes. */
/* #undef HAVE_MUTEX_SOLARIS_LWP */
/* Define to 1 to use the GCC compiler and Sparc assembly language mutexes. */
/* #undef HAVE_MUTEX_SPARC_GCC_ASSEMBLY */
/* Define to 1 if the Berkeley DB library should support mutexes. */
#define HAVE_MUTEX_SUPPORT 1
/* Define to 1 if mutexes hold system resources. */
#define HAVE_MUTEX_SYSTEM_RESOURCES 1
/* Define to 1 to configure mutexes intra-process only. */
/* #undef HAVE_MUTEX_THREAD_ONLY */
/* Define to 1 to use the CC compiler and Tru64 assembly language mutexes. */
/* #undef HAVE_MUTEX_TRU64_CC_ASSEMBLY */
/* Define to 1 to use the UNIX International mutexes. */
/* #undef HAVE_MUTEX_UI_THREADS */
/* Define to 1 to use the UTS compiler and assembly language mutexes. */
/* #undef HAVE_MUTEX_UTS_CC_ASSEMBLY */
/* Define to 1 to use VMS mutexes. */
/* #undef HAVE_MUTEX_VMS */
/* Define to 1 to use VxWorks mutexes. */
#define HAVE_MUTEX_VXWORKS 1
/* Define to 1 to use the MSVC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32 */
/* Define to 1 to use the GCC compiler and Windows mutexes. */
/* #undef HAVE_MUTEX_WIN32_GCC */
/* Define to 1 to use the GCC compiler and 64-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_64_GCC_ASSEMBLY */
/* Define to 1 to use the GCC compiler and 32-bit x86 assembly language
mutexes. */
/* #undef HAVE_MUTEX_X86_GCC_ASSEMBLY */
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the O_DIRECT flag. */
/* #undef HAVE_O_DIRECT */
/* Define to 1 if you have the `pread' function. */
/* #undef HAVE_PREAD */
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
/* Define to 1 if you have the `pstat_getdynamic' function. */
/* #undef HAVE_PSTAT_GETDYNAMIC */
/* Define to 1 to configure Berkeley DB for POSIX pthread API. */
/* #undef HAVE_PTHREAD_API */
/* Define to 1 if you have the `pthread_yield' function. */
/* #undef HAVE_PTHREAD_YIELD */
/* Define to 1 if you have the `pwrite' function. */
/* #undef HAVE_PWRITE */
/* Define to 1 if building on QNX. */
/* #undef HAVE_QNX */
/* Define to 1 if you have the `qsort' function. */
#define HAVE_QSORT 1
/* Define to 1 if building Queue access method. */
/* #undef HAVE_QUEUE */
/* Define to 1 if you have the `raise' function. */
#define HAVE_RAISE 1
/* Define to 1 if you have the `rand' function. */
#define HAVE_RAND 1
/* Define to 1 if building replication support. */
/* #undef HAVE_REPLICATION */
/* Define to 1 if building the Berkeley DB replication framework. */
/* #undef HAVE_REPLICATION_THREADS */
/* Define to 1 if building RPC client/server. */
/* #undef HAVE_RPC */
/* Define to 1 if building on S60. */
/* #undef HAVE_S60 */
/* Define to 1 if you have the `sched_yield' function. */
#define HAVE_SCHED_YIELD 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the `setgid' function. */
#define HAVE_SETGID 1
/* Define to 1 if you have the `setuid' function. */
#define HAVE_SETUID 1
/* Define to 1 if shmctl/SHM_LOCK locks down shared memory segments. */
/* #undef HAVE_SHMCTL_SHM_LOCK */
/* Define to 1 if you have the `shmget' function. */
/* #undef HAVE_SHMGET */
/* Define to 1 if you have the `sigaction' function. */
/* #undef HAVE_SIGACTION */
/* Define to 1 if thread identifier type db_threadid_t is integral. */
#define HAVE_SIMPLE_THREAD_TYPE 1
/* Define to 1 if you have the `snprintf' function. */
/* #undef HAVE_SNPRINTF */
/* Define to 1 if you have the `stat' function. */
#define HAVE_STAT 1
/* Define to 1 if building statistics support. */
/* #undef HAVE_STATISTICS */
/* Define to 1 if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
/* #undef HAVE_STRCASECMP */
/* Define to 1 if you have the `strcat' function. */
#define HAVE_STRCAT 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
/* #undef HAVE_STRDUP */
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the `strftime' function. */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncat' function. */
#define HAVE_STRNCAT 1
/* Define to 1 if you have the `strncmp' function. */
#define HAVE_STRNCMP 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strsep' function. */
/* #undef HAVE_STRSEP */
/* Define to 1 if you have the `strtol' function. */
#define HAVE_STRTOL 1
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
/* Define to 1 if `st_blksize' is member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
/* Define to 1 if you have the `sysconf' function. */
/* #undef HAVE_SYSCONF */
/* Define to 1 if port includes files in the Berkeley DB source code. */
#define HAVE_SYSTEM_INCLUDE_FILES 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* #undef HAVE_SYS_STAT_H */
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define to 1 if you have the <sys/types.h> header file. */
/* #undef HAVE_SYS_TYPES_H */
/* Define to 1 if you have the `time' function. */
#define HAVE_TIME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if unlink of file with open file descriptors will fail. */
#define HAVE_UNLINK_WITH_OPEN_FAILURE 1
/* Define to 1 if port includes historic database upgrade support. */
#define HAVE_UPGRADE_SUPPORT 1
/* Define to 1 if building access method verification support. */
/* #undef HAVE_VERIFY */
/* Define to 1 if you have the `vsnprintf' function. */
/* #undef HAVE_VSNPRINTF */
/* Define to 1 if building VxWorks. */
#define HAVE_VXWORKS 1
/* Define to 1 if you have the `yield' function. */
/* #undef HAVE_YIELD */
/* Define to 1 if you have the `_fstati64' function. */
/* #undef HAVE__FSTATI64 */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "Oracle Technology Network Berkeley DB forum"
/* Define to the full name of this package. */
#define PACKAGE_NAME "Berkeley DB"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Berkeley DB 4.7.25"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "db-4.7.25"
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.7.25"
/* The size of a `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of a `char *', as computed by sizeof. */
/* #undef SIZEOF_CHAR_P */
/* The size of a `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of a `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of a `long long', as computed by sizeof. */
/* #undef SIZEOF_LONG_LONG */
/* The size of a `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of a `size_t', as computed by sizeof. */
/* #undef SIZEOF_SIZE_T */
/* The size of a `unsigned char', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_CHAR */
/* The size of a `unsigned int', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_INT */
/* The size of a `unsigned long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG */
/* The size of a `unsigned long long', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_LONG_LONG */
/* The size of a `unsigned short', as computed by sizeof. */
/* #undef SIZEOF_UNSIGNED_SHORT */
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define to 1 to mask harmless uninitialized memory read/writes. */
/* #undef UMRW */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline
#endif
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */

1212
build_vxworks/db_cxx.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,249 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_deadlock.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
int db_deadlock_main __P((int, char *[]));
int db_deadlock_usage __P((void));
int db_deadlock_version_check __P((void));
const char *progname;
int
db_deadlock(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_deadlock", args, &argc, &argv);
return (db_deadlock_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_deadlock_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
u_int32_t atype;
time_t now;
u_long secs, usecs;
int rejected, ch, exitval, ret, verbose;
char *home, *logfile, *passwd, *str, time_buf[CTIME_BUFLEN];
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_deadlock_version_check()) != 0)
return (ret);
dbenv = NULL;
atype = DB_LOCK_DEFAULT;
home = logfile = passwd = NULL;
secs = usecs = 0;
exitval = verbose = 0;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "a:h:L:P:t:Vv")) != EOF)
switch (ch) {
case 'a':
switch (optarg[0]) {
case 'e':
atype = DB_LOCK_EXPIRE;
break;
case 'm':
atype = DB_LOCK_MAXLOCKS;
break;
case 'n':
atype = DB_LOCK_MINLOCKS;
break;
case 'o':
atype = DB_LOCK_OLDEST;
break;
case 'W':
atype = DB_LOCK_MAXWRITE;
break;
case 'w':
atype = DB_LOCK_MINWRITE;
break;
case 'y':
atype = DB_LOCK_YOUNGEST;
break;
default:
return (db_deadlock_usage());
/* NOTREACHED */
}
if (optarg[1] != '\0')
return (db_deadlock_usage());
break;
case 'h':
home = optarg;
break;
case 'L':
logfile = optarg;
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 't':
if ((str = strchr(optarg, '.')) != NULL) {
*str++ = '\0';
if (*str != '\0' && __db_getulong(
NULL, progname, str, 0, LONG_MAX, &usecs))
return (EXIT_FAILURE);
}
if (*optarg != '\0' && __db_getulong(
NULL, progname, optarg, 0, LONG_MAX, &secs))
return (EXIT_FAILURE);
if (secs == 0 && usecs == 0)
return (db_deadlock_usage());
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
verbose = 1;
break;
case '?':
default:
return (db_deadlock_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_deadlock_usage());
/* Handle possible interruptions. */
__db_util_siginit();
/* Log our process ID. */
if (logfile != NULL && __db_util_logset(progname, logfile))
goto shutdown;
/*
* Create an environment object and initialize it for error
* reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto shutdown;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto shutdown;
}
if (verbose) {
(void)dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, 1);
(void)dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR, 1);
}
/* An environment is required. */
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0) {
dbenv->err(dbenv, ret, "open");
goto shutdown;
}
while (!__db_util_interrupted()) {
if (verbose) {
(void)time(&now);
dbenv->errx(dbenv,
"running at %.24s", __os_ctime(&now, time_buf));
}
if ((ret =
dbenv->lock_detect(dbenv, 0, atype, &rejected)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->lock_detect");
goto shutdown;
}
if (verbose)
dbenv->errx(dbenv, "rejected %d locks", rejected);
/* Make a pass every "secs" secs and "usecs" usecs. */
if (secs == 0 && usecs == 0)
break;
__os_yield(dbenv->env, secs, usecs);
}
if (0) {
shutdown: exitval = 1;
}
/* Clean up the logfile. */
if (logfile != NULL)
(void)remove(logfile);
/* Clean up the environment. */
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (passwd != NULL)
free(passwd);
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int
db_deadlock_usage()
{
(void)fprintf(stderr,
"usage: %s [-Vv] [-a e | m | n | o | W | w | y]\n\t%s\n", progname,
"[-h home] [-L file] [-P password] [-t sec.usec]");
return (EXIT_FAILURE);
}
int
db_deadlock_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_deadlock20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_deadlock20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_deadlock20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_deadlock.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_deadlock.c_dependencies
<END>
<BEGIN> FILE_db_deadlock.c_objects
db_deadlock.o
<END>
<BEGIN> FILE_db_deadlock.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_deadlock.c
<END>
<BEGIN> userComments
db_deadlock
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_deadlock22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_deadlock22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_deadlock22.out
<END>
<BEGIN> BUILD_RULE_db_deadlock22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_deadlock.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_deadlock.c_dependencies
<END>
<BEGIN> FILE_db_deadlock.c_objects
db_deadlock.o
<END>
<BEGIN> FILE_db_deadlock.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_deadlock.c
<END>
<BEGIN> userComments
db_deadlock
<END>

View File

@@ -0,0 +1,481 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_dump.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/db_am.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
int db_dump_db_init __P((DB_ENV *, char *, int, u_int32_t, int *));
int db_dump_dump_sub __P((DB_ENV *, DB *, char *, int, int));
int db_dump_main __P((int, char *[]));
int db_dump_show_subs __P((DB *));
int db_dump_usage __P((void));
int db_dump_version_check __P((void));
const char *progname;
int
db_dump(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_dump", args, &argc, &argv);
return (db_dump_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_dump_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
DB *dbp;
u_int32_t cache;
int ch;
int exitval, keyflag, lflag, nflag, pflag, private;
int ret, Rflag, rflag, resize;
char *dopt, *home, *passwd, *subname;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_dump_version_check()) != 0)
return (ret);
dbenv = NULL;
dbp = NULL;
exitval = lflag = nflag = pflag = rflag = Rflag = 0;
keyflag = 0;
cache = MEGABYTE;
private = 0;
dopt = home = passwd = subname = NULL;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "d:f:h:klNpP:rRs:V")) != EOF)
switch (ch) {
case 'd':
dopt = optarg;
break;
case 'f':
if (freopen(optarg, "w", stdout) == NULL) {
fprintf(stderr, "%s: %s: reopen: %s\n",
progname, optarg, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 'h':
home = optarg;
break;
case 'k':
keyflag = 1;
break;
case 'l':
lflag = 1;
break;
case 'N':
nflag = 1;
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 'p':
pflag = 1;
break;
case 's':
subname = optarg;
break;
case 'R':
Rflag = 1;
/* DB_AGGRESSIVE requires DB_SALVAGE */
/* FALLTHROUGH */
case 'r':
rflag = 1;
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case '?':
default:
return (db_dump_usage());
}
argc -= optind;
argv += optind;
if (argc != 1)
return (db_dump_usage());
if (dopt != NULL && pflag) {
fprintf(stderr,
"%s: the -d and -p options may not both be specified\n",
progname);
return (EXIT_FAILURE);
}
if (lflag && subname != NULL) {
fprintf(stderr,
"%s: the -l and -s options may not both be specified\n",
progname);
return (EXIT_FAILURE);
}
if (keyflag && rflag) {
fprintf(stderr, "%s: %s",
"the -k and -r or -R options may not both be specified\n",
progname);
return (EXIT_FAILURE);
}
if (subname != NULL && rflag) {
fprintf(stderr, "%s: %s",
"the -s and -r or R options may not both be specified\n",
progname);
return (EXIT_FAILURE);
}
/* Handle possible interruptions. */
__db_util_siginit();
/*
* Create an environment object and initialize it for error
* reporting.
*/
retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto err;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (nflag) {
if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOLOCKING");
goto err;
}
if ((ret = dbenv->set_flags(dbenv, DB_NOPANIC, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOPANIC");
goto err;
}
}
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto err;
}
/* Initialize the environment. */
if (db_dump_db_init(dbenv, home, rflag, cache, &private) != 0)
goto err;
/* Create the DB object and open the file. */
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
goto err;
}
/*
* If we're salvaging, don't do an open; it might not be safe.
* Dispatch now into the salvager.
*/
if (rflag) {
/* The verify method is a destructor. */
ret = dbp->verify(dbp, argv[0], NULL, stdout,
DB_SALVAGE |
(Rflag ? DB_AGGRESSIVE : 0) |
(pflag ? DB_PRINTABLE : 0));
dbp = NULL;
if (ret != 0)
goto err;
goto done;
}
if ((ret = dbp->open(dbp, NULL,
argv[0], subname, DB_UNKNOWN, DB_RDONLY, 0)) != 0) {
dbp->err(dbp, ret, "open: %s", argv[0]);
goto err;
}
if (private != 0) {
if ((ret = __db_util_cache(dbp, &cache, &resize)) != 0)
goto err;
if (resize) {
(void)dbp->close(dbp, 0);
dbp = NULL;
(void)dbenv->close(dbenv, 0);
dbenv = NULL;
goto retry;
}
}
if (dopt != NULL) {
if ((ret = __db_dumptree(dbp, NULL, dopt, NULL)) != 0) {
dbp->err(dbp, ret, "__db_dumptree: %s", argv[0]);
goto err;
}
} else if (lflag) {
if (dbp->get_multiple(dbp)) {
if (db_dump_show_subs(dbp))
goto err;
} else {
dbp->errx(dbp,
"%s: does not contain multiple databases", argv[0]);
goto err;
}
} else {
if (subname == NULL && dbp->get_multiple(dbp)) {
if (db_dump_dump_sub(dbenv, dbp, argv[0], pflag, keyflag))
goto err;
} else
if (dbp->dump(dbp, NULL,
__db_pr_callback, stdout, pflag, keyflag))
goto err;
}
if (0) {
err: exitval = 1;
}
done: if (dbp != NULL && (ret = dbp->close(dbp, 0)) != 0) {
exitval = 1;
dbenv->err(dbenv, ret, "close");
}
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (passwd != NULL)
free(passwd);
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/*
* db_init --
* Initialize the environment.
*/
int
db_dump_db_init(dbenv, home, is_salvage, cache, is_privatep)
DB_ENV *dbenv;
char *home;
int is_salvage;
u_int32_t cache;
int *is_privatep;
{
int ret;
/*
* Try and use the underlying environment when opening a database.
* We wish to use the buffer pool so our information is as up-to-date
* as possible, even if the mpool cache hasn't been flushed.
*
* If we are not doing a salvage, we want to join the environment;
* if a locking system is present, this will let us use it and be
* safe to run concurrently with other threads of control. (We never
* need to use transactions explicitly, as we're read-only.) Note
* that in CDB, too, this will configure our environment
* appropriately, and our cursors will (correctly) do locking as CDB
* read cursors.
*
* If we are doing a salvage, the verification code will protest
* if we initialize transactions, logging, or locking; do an
* explicit DB_INIT_MPOOL to try to join any existing environment
* before we create our own.
*/
*is_privatep = 0;
if ((ret = dbenv->open(dbenv, home,
DB_USE_ENVIRON | (is_salvage ? DB_INIT_MPOOL : 0), 0)) == 0)
return (0);
if (ret == DB_VERSION_MISMATCH)
goto err;
/*
* An environment is required because we may be trying to look at
* databases in directories other than the current one. We could
* avoid using an environment iff the -h option wasn't specified,
* but that seems like more work than it's worth.
*
* No environment exists (or, at least no environment that includes
* an mpool region exists). Create one, but make it private so that
* no files are actually created.
*/
*is_privatep = 1;
if ((ret = dbenv->set_cachesize(dbenv, 0, cache, 1)) == 0 &&
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_USE_ENVIRON, 0)) == 0)
return (0);
/* An environment is required. */
err: dbenv->err(dbenv, ret, "DB_ENV->open");
return (1);
}
/*
* dump_sub --
* Dump out the records for a DB containing subdatabases.
*/
int
db_dump_dump_sub(dbenv, parent_dbp, parent_name, pflag, keyflag)
DB_ENV *dbenv;
DB *parent_dbp;
char *parent_name;
int pflag, keyflag;
{
DB *dbp;
DBC *dbcp;
DBT key, data;
int ret;
char *subdb;
/*
* Get a cursor and step through the database, dumping out each
* subdatabase.
*/
if ((ret = parent_dbp->cursor(parent_dbp, NULL, &dbcp, 0)) != 0) {
dbenv->err(dbenv, ret, "DB->cursor");
return (1);
}
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
while ((ret = dbcp->get(dbcp, &key, &data,
DB_IGNORE_LEASE | DB_NEXT)) == 0) {
/* Nul terminate the subdatabase name. */
if ((subdb = malloc(key.size + 1)) == NULL) {
dbenv->err(dbenv, ENOMEM, NULL);
return (1);
}
memcpy(subdb, key.data, key.size);
subdb[key.size] = '\0';
/* Create the DB object and open the file. */
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
free(subdb);
return (1);
}
if ((ret = dbp->open(dbp, NULL,
parent_name, subdb, DB_UNKNOWN, DB_RDONLY, 0)) != 0)
dbp->err(dbp, ret,
"DB->open: %s:%s", parent_name, subdb);
if (ret == 0 && dbp->dump(
dbp, subdb, __db_pr_callback, stdout, pflag, keyflag))
ret = 1;
(void)dbp->close(dbp, 0);
free(subdb);
if (ret != 0)
return (1);
}
if (ret != DB_NOTFOUND) {
parent_dbp->err(parent_dbp, ret, "DBcursor->get");
return (1);
}
if ((ret = dbcp->close(dbcp)) != 0) {
parent_dbp->err(parent_dbp, ret, "DBcursor->close");
return (1);
}
return (0);
}
/*
* show_subs --
* Display the subdatabases for a database.
*/
int
db_dump_show_subs(dbp)
DB *dbp;
{
DBC *dbcp;
DBT key, data;
int ret;
/*
* Get a cursor and step through the database, printing out the key
* of each key/data pair.
*/
if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
dbp->err(dbp, ret, "DB->cursor");
return (1);
}
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
while ((ret = dbcp->get(dbcp, &key, &data,
DB_IGNORE_LEASE | DB_NEXT)) == 0) {
if ((ret = dbp->dbenv->prdbt(
&key, 1, NULL, stdout, __db_pr_callback, 0)) != 0) {
dbp->errx(dbp, NULL);
return (1);
}
}
if (ret != DB_NOTFOUND) {
dbp->err(dbp, ret, "DBcursor->get");
return (1);
}
if ((ret = dbcp->close(dbcp)) != 0) {
dbp->err(dbp, ret, "DBcursor->close");
return (1);
}
return (0);
}
/*
* usage --
* Display the usage message.
*/
int
db_dump_usage()
{
(void)fprintf(stderr, "usage: %s [-klNprRV]\n\t%s\n",
progname,
"[-d ahr] [-f output] [-h home] [-P password] [-s database] db_file");
return (EXIT_FAILURE);
}
int
db_dump_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_dump20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_dump20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_dump20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_dump.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_dump.c_dependencies
<END>
<BEGIN> FILE_db_dump.c_objects
db_dump.o
<END>
<BEGIN> FILE_db_dump.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_dump.c
<END>
<BEGIN> userComments
db_dump
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_dump22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_dump22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_dump22.out
<END>
<BEGIN> BUILD_RULE_db_dump22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_dump.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_dump.c_dependencies
<END>
<BEGIN> FILE_db_dump.c_objects
db_dump.o
<END>
<BEGIN> FILE_db_dump.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_dump.c
<END>
<BEGIN> userComments
db_dump
<END>

View File

@@ -0,0 +1,879 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_hotbackup.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/log.h"
#include "dbinc/db_page.h"
#include "dbinc/qam.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
enum which_open { OPEN_ORIGINAL, OPEN_HOT_BACKUP };
int db_hotbackup_backup_dir_clean __P((DB_ENV *, char *, char *, int *, int, int));
int db_hotbackup_data_copy __P((DB_ENV *, char *, char *, char *, int));
int db_hotbackup_env_init __P((DB_ENV **,
char *, char **, char ***, char *, enum which_open));
int db_hotbackup_main __P((int, char *[]));
int db_hotbackup_read_data_dir __P((DB_ENV *, char *, char *, char *, int, int));
int db_hotbackup_read_log_dir __P((DB_ENV *, char *, char *, char *, int *, int, int));
int db_hotbackup_usage __P((void));
int db_hotbackup_version_check __P((void));
const char *progname;
int
db_hotbackup(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_hotbackup", args, &argc, &argv);
return (db_hotbackup_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_hotbackup_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
time_t now;
DB_ENV *dbenv;
u_int data_cnt, data_next;
int ch, checkpoint, copy_min, db_config, exitval;
int remove_max, ret, update, verbose;
char *backup_dir, **data_dir, **dir, *home, *log_dir, *passwd;
char home_buf[DB_MAXPATHLEN], time_buf[CTIME_BUFLEN];
/*
* Make sure all verbose message are output before any error messages
* in the case where the output is being logged into a file. This
* call has to be done before any operation is performed on the stream.
*
* Use unbuffered I/O because line-buffered I/O requires a buffer, and
* some operating systems have buffer alignment and size constraints we
* don't want to care about. There isn't enough output for the calls
* to matter.
*/
setbuf(stdout, NULL);
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_hotbackup_version_check()) != 0)
return (ret);
checkpoint = db_config = data_cnt =
data_next = exitval = update = verbose = 0;
data_dir = NULL;
backup_dir = home = passwd = NULL;
log_dir = NULL;
copy_min = remove_max = 0;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "b:cDd:h:l:P:uVv")) != EOF)
switch (ch) {
case 'b':
backup_dir = optarg;
break;
case 'c':
checkpoint = 1;
break;
case 'D':
db_config = 1;
break;
case 'd':
/*
* User can specify a list of directories -- keep an
* array, leaving room for the trailing NULL.
*/
if (data_dir == NULL || data_next >= data_cnt - 2) {
data_cnt = data_cnt == 0 ? 20 : data_cnt * 2;
if ((data_dir = realloc(data_dir,
data_cnt * sizeof(*data_dir))) == NULL) {
fprintf(stderr, "%s: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
}
data_dir[data_next++] = optarg;
break;
case 'h':
home = optarg;
break;
case 'l':
log_dir = optarg;
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 'u':
update = 1;
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
verbose = 1;
break;
case '?':
default:
return (db_hotbackup_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_hotbackup_usage());
/* NULL-terminate any list of data directories. */
if (data_dir != NULL) {
data_dir[data_next] = NULL;
/*
* -d is relative to the current directory, to run a checkpoint
* we must have directories relative to the environment.
*/
if (checkpoint == 1) {
fprintf(stderr,
"%s: cannot specify -d and -c\n", progname);
return (db_hotbackup_usage());
}
}
if (db_config && (data_dir != NULL || log_dir != NULL)) {
fprintf(stderr,
"%s: cannot specify -D and -d or -l\n", progname);
return (db_hotbackup_usage());
}
/* Handle possible interruptions. */
__db_util_siginit();
/*
* The home directory defaults to the environment variable DB_HOME.
* The log directory defaults to the home directory.
*
* We require a source database environment directory and a target
* backup directory.
*/
if (home == NULL) {
home = home_buf;
if ((ret = __os_getenv(
NULL, "DB_HOME", &home, sizeof(home_buf))) != 0) {
fprintf(stderr,
"%s failed to get environment variable DB_HOME: %s\n",
progname, db_strerror(ret));
return (EXIT_FAILURE);
}
/*
* home set to NULL if __os_getenv failed to find DB_HOME.
*/
}
if (home == NULL) {
fprintf(stderr,
"%s: no source database environment specified\n", progname);
return (db_hotbackup_usage());
}
if (backup_dir == NULL) {
fprintf(stderr,
"%s: no target backup directory specified\n", progname);
return (db_hotbackup_usage());
}
if (verbose) {
(void)time(&now);
printf("%s: hot backup started at %s",
progname, __os_ctime(&now, time_buf));
}
/* Open the source environment. */
if (db_hotbackup_env_init(&dbenv, home,
(db_config || log_dir != NULL) ? &log_dir : NULL,
db_config ? &data_dir : NULL,
passwd, OPEN_ORIGINAL) != 0)
goto shutdown;
if (db_config && __os_abspath(log_dir)) {
fprintf(stderr,
"%s: DB_CONFIG must not contain an absolute path for the log directory",
progname);
goto shutdown;
}
/*
* If the -c option is specified, checkpoint the source home
* database environment, and remove any unnecessary log files.
*/
if (checkpoint) {
if (verbose)
printf("%s: %s: force checkpoint\n", progname, home);
if ((ret =
dbenv->txn_checkpoint(dbenv, 0, 0, DB_FORCE)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->txn_checkpoint");
goto shutdown;
}
if (!update) {
if (verbose)
printf("%s: %s: remove unnecessary log files\n",
progname, home);
if ((ret = dbenv->log_archive(dbenv,
NULL, DB_ARCH_REMOVE)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
goto shutdown;
}
}
}
/*
* If the target directory for the backup does not exist, create it
* with mode read-write-execute for the owner. Ignore errors here,
* it's simpler and more portable to just always try the create. If
* there's a problem, we'll fail with reasonable errors later.
*/
(void)__os_mkdir(NULL, backup_dir, DB_MODE_700);
/*
* If -u was specified, remove all log files; if -u was not specified,
* remove all files.
*
* Potentially there are two directories to clean, the log directory
* and the target directory. First, clean up the log directory if
* it's different from the target directory, then clean up the target
* directory.
*/
if (db_config && log_dir != NULL &&
db_hotbackup_backup_dir_clean(
dbenv, backup_dir, log_dir, &remove_max, update, verbose) != 0)
goto shutdown;
if (db_hotbackup_backup_dir_clean(dbenv,
backup_dir, NULL, &remove_max, update, verbose) != 0)
goto shutdown;
/*
* If the -u option was not specified, copy all database files found in
* the database environment home directory, or any directory specified
* using the -d option, into the target directory for the backup.
*/
if (!update) {
if (db_hotbackup_read_data_dir(dbenv, home,
backup_dir, home, verbose, db_config) != 0)
goto shutdown;
if (data_dir != NULL)
for (dir = data_dir; *dir != NULL; ++dir) {
/*
* Don't allow absolute path names taken from
* the DB_CONFIG file -- running recovery with
* them would corrupt the source files.
*/
if (db_config && __os_abspath(*dir)) {
fprintf(stderr,
"%s: data directory '%s' is absolute path, not permitted with -D option\n",
progname, *dir);
goto shutdown;
}
if (db_hotbackup_read_data_dir(dbenv, home,
backup_dir, *dir, verbose, db_config) != 0)
goto shutdown;
}
}
/*
* Copy all log files found in the directory specified by the -l option
* (or in the database environment home directory, if no -l option was
* specified), into the target directory for the backup.
*
* The log directory defaults to the home directory.
*/
if (db_hotbackup_read_log_dir(dbenv, db_config ? home : NULL, backup_dir,
log_dir == NULL ? home : log_dir, &copy_min, update, verbose) != 0)
goto shutdown;
/*
* If we're updating a snapshot, the lowest-numbered log file copied
* into the backup directory should be less than, or equal to, the
* highest-numbered log file removed from the backup directory during
* cleanup.
*/
if (update && remove_max < copy_min &&
!(remove_max == 0 && copy_min == 1)) {
fprintf(stderr,
"%s: the largest log file removed (%d) must be greater\n",
progname, remove_max);
fprintf(stderr,
"%s: than or equal the smallest log file copied (%d)\n",
progname, copy_min);
goto shutdown;
}
/* Close the source environment. */
if ((ret = dbenv->close(dbenv, 0)) != 0) {
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
dbenv = NULL;
goto shutdown;
}
/* Perform catastrophic recovery on the hot backup. */
if (verbose)
printf("%s: %s: run catastrophic recovery\n",
progname, backup_dir);
if (db_hotbackup_env_init(
&dbenv, backup_dir, NULL, NULL, passwd, OPEN_HOT_BACKUP) != 0)
goto shutdown;
/*
* Remove any unnecessary log files from the hot backup.
*/
if (verbose)
printf("%s: %s: remove unnecessary log files\n",
progname, backup_dir);
if ((ret =
dbenv->log_archive(dbenv, NULL, DB_ARCH_REMOVE)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
goto shutdown;
}
if (0) {
shutdown: exitval = 1;
}
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (exitval == 0) {
if (verbose) {
(void)time(&now);
printf("%s: hot backup completed at %s",
progname, __os_ctime(&now, time_buf));
}
} else {
fprintf(stderr, "%s: HOT BACKUP FAILED!\n", progname);
}
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/*
* env_init --
* Open a database environment.
*/
int
db_hotbackup_env_init(dbenvp, home, log_dirp, data_dirp, passwd, which)
DB_ENV **dbenvp;
char *home, **log_dirp, ***data_dirp, *passwd;
enum which_open which;
{
DB_ENV *dbenv;
int ret;
*dbenvp = NULL;
/*
* Create an environment object and initialize it for error reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
return (1);
}
dbenv->set_errfile(dbenv, stderr);
setbuf(stderr, NULL);
dbenv->set_errpfx(dbenv, progname);
/* Any created intermediate directories are created private. */
if ((ret = dbenv->set_intermediate_dir_mode(dbenv, "rwx------")) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->set_intermediate_dir_mode");
return (1);
}
/*
* If a log directory has been specified, and it's not the same as the
* home directory, set it for the environment.
*/
if (log_dirp != NULL && *log_dirp != NULL &&
(ret = dbenv->set_lg_dir(dbenv, *log_dirp)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->set_lg_dir: %s", *log_dirp);
return (1);
}
/* Optionally set the password. */
if (passwd != NULL &&
(ret = dbenv->set_encrypt(dbenv, passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->set_encrypt");
return (1);
}
switch (which) {
case OPEN_ORIGINAL:
/*
* Opening the database environment we're trying to back up.
* We try to attach to a pre-existing environment; if that
* fails, we create a private environment and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
(ret == DB_VERSION_MISMATCH ||
(ret = dbenv->open(dbenv, home, DB_CREATE |
DB_INIT_LOG | DB_INIT_TXN | DB_PRIVATE | DB_USE_ENVIRON,
0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open: %s", home);
return (1);
}
if (log_dirp != NULL && *log_dirp == NULL)
(void)dbenv->get_lg_dir(dbenv, (const char **)log_dirp);
if (data_dirp != NULL && *data_dirp == NULL)
(void)dbenv->get_data_dirs(
dbenv, (const char ***)data_dirp);
break;
case OPEN_HOT_BACKUP:
/*
* Opening the backup copy of the database environment. We
* better be the only user, we're running recovery.
* Ensure that there at least minimal cache for worst
* case page size.
*/
if ((ret =
dbenv->set_cachesize(dbenv, 0, 64 * 1024 * 10, 0)) != 0) {
dbenv->err(dbenv,
ret, "DB_ENV->set_cachesize: %s", home);
return (1);
}
if ((ret = dbenv->open(dbenv, home, DB_CREATE |
DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_PRIVATE |
DB_RECOVER_FATAL | DB_USE_ENVIRON, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->open: %s", home);
return (1);
}
break;
}
*dbenvp = dbenv;
return (0);
}
/*
* backup_dir_clean --
* Clean out the backup directory.
*/
int
db_hotbackup_backup_dir_clean(dbenv, backup_dir, log_dir, remove_maxp, update, verbose)
DB_ENV *dbenv;
char *backup_dir, *log_dir;
int *remove_maxp, update, verbose;
{
ENV *env;
int cnt, fcnt, ret, v;
char **names, *dir, buf[DB_MAXPATHLEN], path[DB_MAXPATHLEN];
env = dbenv->env;
/* We may be cleaning a log directory separate from the target. */
if (log_dir != NULL) {
if ((size_t)snprintf(buf, sizeof(buf), "%s%c%s",
backup_dir, PATH_SEPARATOR[0] ,log_dir) >= sizeof(buf)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
backup_dir, PATH_SEPARATOR[0] ,log_dir);
return (1);
}
dir = buf;
} else
dir = backup_dir;
/* Get a list of file names. */
if ((ret = __os_dirlist(env, dir, 0, &names, &fcnt)) != 0) {
if (log_dir != NULL && !update)
return (0);
dbenv->err(dbenv, ret, "%s: directory read", dir);
return (1);
}
for (cnt = fcnt; --cnt >= 0;) {
/*
* Skip non-log files (if update was specified).
*/
if (strncmp(names[cnt], LFPREFIX, sizeof(LFPREFIX) - 1)) {
if (update)
continue;
} else {
/* Track the highest-numbered log file removed. */
v = atoi(names[cnt] + sizeof(LFPREFIX) - 1);
if (*remove_maxp < v)
*remove_maxp = v;
}
if ((size_t)snprintf(path, sizeof(path), "%s%c%s",
dir, PATH_SEPARATOR[0], names[cnt]) >= sizeof(path)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
dir, PATH_SEPARATOR[0], names[cnt]);
return (1);
}
if (verbose)
printf("%s: removing %s\n", progname, path);
if (__os_unlink(env, path, 0) != 0)
return (1);
}
__os_dirfree(env, names, fcnt);
if (verbose && *remove_maxp != 0)
printf("%s: highest numbered log file removed: %d\n",
progname, *remove_maxp);
return (0);
}
/*
* read_data_dir --
* Read a directory looking for databases to copy.
*/
int
db_hotbackup_read_data_dir(dbenv, home, backup_dir, dir, verbose, db_config)
DB_ENV *dbenv;
char *home, *backup_dir, *dir;
int verbose, db_config;
{
ENV *env;
int cnt, fcnt, ret;
char *bd, **names;
char buf[DB_MAXPATHLEN], bbuf[DB_MAXPATHLEN];
env = dbenv->env;
bd = backup_dir;
if (db_config && dir != home) {
/* Build a path name to the destination. */
if ((size_t)(cnt = snprintf(bbuf, sizeof(bbuf), "%s%c%s%c",
backup_dir, PATH_SEPARATOR[0],
dir, PATH_SEPARATOR[0])) >= sizeof(buf)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
backup_dir, PATH_SEPARATOR[0], dir);
return (1);
}
bd = bbuf;
/* Create the path. */
if ((ret = __db_mkpath(env, bd)) != 0) {
dbenv->err(dbenv, ret, "%s: cannot create", bd);
return (1);
}
/* step on the trailing '/' */
bd[cnt - 1] = '\0';
/* Build a path name to the source. */
if ((size_t)snprintf(buf, sizeof(buf),
"%s%c%s", home, PATH_SEPARATOR[0], dir) >= sizeof(buf)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
home, PATH_SEPARATOR[0], dir);
return (1);
}
dir = buf;
}
/* Get a list of file names. */
if ((ret = __os_dirlist(env, dir, 0, &names, &fcnt)) != 0) {
dbenv->err(dbenv, ret, "%s: directory read", dir);
return (1);
}
for (cnt = fcnt; --cnt >= 0;) {
/*
* Skip files in DB's name space (but not Queue
* extent files, we need them).
*/
if (!strncmp(names[cnt], LFPREFIX, sizeof(LFPREFIX) - 1))
continue;
if (!strncmp(names[cnt],
DB_REGION_PREFIX, sizeof(DB_REGION_PREFIX) - 1) &&
strncmp(names[cnt],
QUEUE_EXTENT_PREFIX, sizeof(QUEUE_EXTENT_PREFIX) - 1))
continue;
/*
* Skip DB_CONFIG.
*/
if (!db_config &&
!strncmp(names[cnt], "DB_CONFIG", sizeof("DB_CONFIG")))
continue;
/* Copy the file. */
if (db_hotbackup_data_copy(dbenv, names[cnt], dir, bd, verbose) != 0)
return (1);
}
__os_dirfree(env, names, fcnt);
return (0);
}
/*
* read_log_dir --
* * Read a directory looking for log files to copy. If home
* is passed then we are possibly using a log dir in the destination,
* following DB_CONFIG configuration.
*/
int
db_hotbackup_read_log_dir(dbenv, home, backup_dir, log_dir, copy_minp, update, verbose)
DB_ENV *dbenv;
char *home, *backup_dir, *log_dir;
int *copy_minp, update, verbose;
{
ENV *env;
u_int32_t aflag;
int cnt, ret, v;
char **begin, **names, *backupd, *logd;
char from[DB_MAXPATHLEN], to[DB_MAXPATHLEN];
env = dbenv->env;
if (home != NULL && log_dir != NULL) {
if ((size_t)snprintf(from, sizeof(from), "%s%c%s",
home, PATH_SEPARATOR[0], log_dir) >= sizeof(from)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
home, PATH_SEPARATOR[0], log_dir);
return (1);
}
logd = strdup(from);
if ((size_t)(cnt = snprintf(to, sizeof(to),
"%s%c%s%c", backup_dir, PATH_SEPARATOR[0],
log_dir, PATH_SEPARATOR[0])) >= sizeof(to)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
backup_dir, PATH_SEPARATOR[0], log_dir);
return (1);
}
backupd = strdup(to);
/* Create the backup log directory. */
if ((ret = __db_mkpath(env, backupd)) != 0) {
dbenv->err(dbenv, ret, "%s: cannot create", backupd);
return (1);
}
/* Step on the trailing '/'. */
backupd[cnt - 1] = '\0';
} else {
backupd = backup_dir;
logd = log_dir;
}
again: aflag = DB_ARCH_LOG;
/*
* If this is an update and we are deleting files, first process
* those files that can be removed, then repeat with the rest.
*/
if (update)
aflag = 0;
/* Get a list of file names to be copied. */
if ((ret = dbenv->log_archive(dbenv, &names, aflag)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_archive");
return (1);
}
if (names == NULL)
goto done;
begin = names;
for (; *names != NULL; names++) {
/* Track the lowest-numbered log file copied. */
v = atoi(*names + sizeof(LFPREFIX) - 1);
if (*copy_minp == 0 || *copy_minp > v)
*copy_minp = v;
if ((size_t)snprintf(from, sizeof(from), "%s%c%s",
logd, PATH_SEPARATOR[0], *names) >= sizeof(from)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
logd, PATH_SEPARATOR[0], *names);
return (1);
}
/*
* If we're going to remove the file, attempt to rename the
* instead of copying and then removing. The likely failure
* is EXDEV (source and destination are on different volumes).
* Fall back to a copy, regardless of the error. We don't
* worry about partial contents, the copy truncates the file
* on open.
*/
if (update) {
if ((size_t)snprintf(to, sizeof(to), "%s%c%s",
backupd, PATH_SEPARATOR[0], *names) >= sizeof(to)) {
dbenv->errx(dbenv, "%s%c%s: path too long",
backupd, PATH_SEPARATOR[0], *names);
return (1);
}
if (__os_rename(env, from, to, 1) == 0) {
if (verbose)
printf("%s: moving %s to %s\n",
progname, from, to);
continue;
}
}
/* Copy the file. */
if (db_hotbackup_data_copy(dbenv, *names, logd, backupd, verbose) != 0)
return (1);
if (update) {
if (verbose)
printf("%s: removing %s\n", progname, from);
if ((ret = __os_unlink(env, from, 0)) != 0) {
dbenv->err(dbenv, ret,
"unlink of %s failed", from);
return (1);
}
}
}
free(begin);
done: if (update) {
update = 0;
goto again;
}
if (verbose && *copy_minp != 0)
printf("%s: lowest numbered log file copied: %d\n",
progname, *copy_minp);
if (logd != log_dir)
free(logd);
if (backupd != backup_dir)
free(backupd);
return (0);
}
/*
* data_copy --
* Copy a file into the backup directory.
*/
int
db_hotbackup_data_copy(dbenv, file, from_dir, to_dir, verbose)
DB_ENV *dbenv;
char *file, *from_dir, *to_dir;
int verbose;
{
DB_FH *rfhp, *wfhp;
ENV *env;
size_t nr, nw;
int ret;
char *buf;
rfhp = wfhp = NULL;
env = dbenv->env;
ret = 0;
if (verbose)
printf("%s: copying %s%c%s to %s%c%s\n", progname, from_dir,
PATH_SEPARATOR[0], file, to_dir, PATH_SEPARATOR[0], file);
/*
* We MUST copy multiples of the page size, atomically, to ensure a
* database page is not updated by another thread of control during
* the copy.
*
* !!!
* The current maximum page size for Berkeley DB is 64KB; we will have
* to increase this value if the maximum page size is ever more than a
* megabyte
*/
if ((buf = malloc(MEGABYTE)) == NULL) {
dbenv->err(dbenv,
errno, "%lu buffer allocation", (u_long)MEGABYTE);
return (1);
}
/* Open the input file. */
if (snprintf(buf, MEGABYTE, "%s%c%s",
from_dir, PATH_SEPARATOR[0], file) >= MEGABYTE) {
dbenv->errx(dbenv,
"%s%c%s: path too long", from_dir, PATH_SEPARATOR[0], file);
goto err;
}
if ((ret = __os_open(env, buf, 0, DB_OSO_RDONLY, 0, &rfhp)) != 0) {
dbenv->err(dbenv, ret, "%s", buf);
goto err;
}
/* Open the output file. */
if (snprintf(buf, MEGABYTE, "%s%c%s",
to_dir, PATH_SEPARATOR[0], file) >= MEGABYTE) {
dbenv->errx(dbenv,
"%s%c%s: path too long", to_dir, PATH_SEPARATOR[0], file);
goto err;
}
if ((ret = __os_open(env, buf, 0,
DB_OSO_CREATE | DB_OSO_TRUNC, DB_MODE_600, &wfhp)) != 0) {
dbenv->err(dbenv, ret, "%s", buf);
goto err;
}
/* Copy the data. */
while ((ret = __os_read(env, rfhp, buf, MEGABYTE, &nr)) == 0 &&
nr > 0)
if ((ret = __os_write(env, wfhp, buf, nr, &nw)) != 0)
break;
if (0) {
err: ret = 1;
}
if (buf != NULL)
free(buf);
if (rfhp != NULL && __os_closehandle(env, rfhp) != 0)
ret = 1;
/* We may be running on a remote filesystem; force the flush. */
if (wfhp != NULL) {
if (__os_fsync(env, wfhp) != 0)
ret = 1;
if (__os_closehandle(env, wfhp) != 0)
ret = 1;
}
return (ret);
}
int
db_hotbackup_usage()
{
(void)fprintf(stderr, "usage: %s [-cDuVv]\n\t%s\n", progname,
"[-d data_dir ...] [-h home] [-l log_dir] [-P password] -b backup_dir");
return (EXIT_FAILURE);
}
int
db_hotbackup_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_hotbackup20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_hotbackup20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_hotbackup20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_hotbackup.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_hotbackup.c_dependencies
<END>
<BEGIN> FILE_db_hotbackup.c_objects
db_hotbackup.o
<END>
<BEGIN> FILE_db_hotbackup.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_hotbackup.c
<END>
<BEGIN> userComments
db_hotbackup
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_hotbackup22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_hotbackup22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_hotbackup22.out
<END>
<BEGIN> BUILD_RULE_db_hotbackup22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_hotbackup.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_hotbackup.c_dependencies
<END>
<BEGIN> FILE_db_hotbackup.c_objects
db_hotbackup.o
<END>
<BEGIN> FILE_db_hotbackup.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_hotbackup.c
<END>
<BEGIN> userComments
db_hotbackup
<END>

916
build_vxworks/db_int.h Normal file
View File

@@ -0,0 +1,916 @@
/* DO NOT EDIT: automatically built by dist/s_vxworks. */
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_int.h 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#ifndef _DB_INT_H_
#define _DB_INT_H_
/*******************************************************
* Berkeley DB ANSI/POSIX include files.
*******************************************************/
#include "vxWorks.h"
#ifdef HAVE_SYSTEM_INCLUDE_FILES
#include <sys/types.h>
#ifdef DIAG_MVCC
#include <sys/mman.h>
#endif
#include <sys/stat.h>
#if defined(__INCLUDE_SELECT_H)
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_VXWORKS
#include <selectLib.h>
#endif
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_VXWORKS
#include <net/uio.h>
#else
#include <sys/uio.h>
#endif
#if defined(__INCLUDE_NETWORKING)
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#endif
#if defined(STDC_HEADERS) || defined(__cplusplus)
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#if defined(__INCLUDE_DIRECTORY)
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#endif /* __INCLUDE_DIRECTORY */
#endif /* !HAVE_SYSTEM_INCLUDE_FILES */
#include "clib_port.h"
#include "db.h"
#ifdef DB_WIN32
#include "dbinc/win_db.h"
#endif
#include "db.h"
#include "clib_port.h"
#include "dbinc/queue.h"
#include "dbinc/shqueue.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************
* Forward structure declarations.
*******************************************************/
struct __db_reginfo_t; typedef struct __db_reginfo_t REGINFO;
struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD;
struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST;
struct __vrfy_childinfo;typedef struct __vrfy_childinfo VRFY_CHILDINFO;
struct __vrfy_dbinfo; typedef struct __vrfy_dbinfo VRFY_DBINFO;
struct __vrfy_pageinfo; typedef struct __vrfy_pageinfo VRFY_PAGEINFO;
typedef SH_TAILQ_HEAD(__hash_head) DB_HASHTAB;
/*******************************************************
* General purpose constants and macros.
*******************************************************/
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE (!FALSE)
#define MEGABYTE 1048576
#define GIGABYTE 1073741824
#define NS_PER_MS 1000000 /* Nanoseconds in a millisecond */
#define NS_PER_US 1000 /* Nanoseconds in a microsecond */
#define NS_PER_SEC 1000000000 /* Nanoseconds in a second */
#define US_PER_MS 1000 /* Microseconds in a millisecond */
#define US_PER_SEC 1000000 /* Microseconds in a second */
#define MS_PER_SEC 1000 /* Milliseconds in a second */
#define RECNO_OOB 0 /* Illegal record number. */
/* Test for a power-of-two (tests true for zero, which doesn't matter here). */
#define POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
/* Test for valid page sizes. */
#define DB_MIN_PGSIZE 0x000200 /* Minimum page size (512). */
#define DB_MAX_PGSIZE 0x010000 /* Maximum page size (65536). */
#define IS_VALID_PAGESIZE(x) \
(POWER_OF_TWO(x) && (x) >= DB_MIN_PGSIZE && ((x) <= DB_MAX_PGSIZE))
/* Minimum number of pages cached, by default. */
#define DB_MINPAGECACHE 16
/*
* If we are unable to determine the underlying filesystem block size, use
* 8K on the grounds that most OS's use less than 8K for a VM page size.
*/
#define DB_DEF_IOSIZE (8 * 1024)
/* Align an integer to a specific boundary. */
#undef DB_ALIGN
#define DB_ALIGN(v, bound) \
(((v) + (bound) - 1) & ~(((uintmax_t)(bound)) - 1))
/* Increment a pointer to a specific boundary. */
#undef ALIGNP_INC
#define ALIGNP_INC(p, bound) \
(void *)(((uintptr_t)(p) + (bound) - 1) & ~(((uintptr_t)(bound)) - 1))
/*
* Print an address as a u_long (a u_long is the largest type we can print
* portably). Most 64-bit systems have made longs 64-bits, so this should
* work.
*/
#define P_TO_ULONG(p) ((u_long)(uintptr_t)(p))
/*
* Convert a pointer to a small integral value.
*
* The (u_int16_t)(uintptr_t) cast avoids warnings: the (uintptr_t) cast
* converts the value to an integral type, and the (u_int16_t) cast converts
* it to a small integral type so we don't get complaints when we assign the
* final result to an integral type smaller than uintptr_t.
*/
#define P_TO_UINT32(p) ((u_int32_t)(uintptr_t)(p))
#define P_TO_UINT16(p) ((u_int16_t)(uintptr_t)(p))
/*
* There are several on-page structures that are declared to have a number of
* fields followed by a variable length array of items. The structure size
* without including the variable length array or the address of the first of
* those elements can be found using SSZ.
*
* This macro can also be used to find the offset of a structure element in a
* structure. This is used in various places to copy structure elements from
* unaligned memory references, e.g., pointers into a packed page.
*
* There are two versions because compilers object if you take the address of
* an array.
*/
#undef SSZ
#define SSZ(name, field) P_TO_UINT16(&(((name *)0)->field))
#undef SSZA
#define SSZA(name, field) P_TO_UINT16(&(((name *)0)->field[0]))
/* Structure used to print flag values. */
typedef struct __fn {
u_int32_t mask; /* Flag value. */
const char *name; /* Flag name. */
} FN;
/* Set, clear and test flags. */
#define FLD_CLR(fld, f) (fld) &= ~(f)
#define FLD_ISSET(fld, f) ((fld) & (f))
#define FLD_SET(fld, f) (fld) |= (f)
#define F_CLR(p, f) (p)->flags &= ~(f)
#define F_ISSET(p, f) ((p)->flags & (f))
#define F_SET(p, f) (p)->flags |= (f)
#define LF_CLR(f) ((flags) &= ~(f))
#define LF_ISSET(f) ((flags) & (f))
#define LF_SET(f) ((flags) |= (f))
/*
* Calculate a percentage. The values can overflow 32-bit integer arithmetic
* so we use floating point.
*
* When calculating a bytes-vs-page size percentage, we're getting the inverse
* of the percentage in all cases, that is, we want 100 minus the percentage we
* calculate.
*/
#define DB_PCT(v, total) \
((int)((total) == 0 ? 0 : ((double)(v) * 100) / (total)))
#define DB_PCT_PG(v, total, pgsize) \
((int)((total) == 0 ? 0 : \
100 - ((double)(v) * 100) / (((double)total) * (pgsize))))
/*
* Statistics update shared memory and so are expensive -- don't update the
* values unless we're going to display the results.
*/
#undef STAT
#ifdef HAVE_STATISTICS
#define STAT(x) x
#else
#define STAT(x)
#endif
/*
* Structure used for callback message aggregation.
*
* Display values in XXX_stat_print calls.
*/
typedef struct __db_msgbuf {
char *buf; /* Heap allocated buffer. */
char *cur; /* Current end of message. */
size_t len; /* Allocated length of buffer. */
} DB_MSGBUF;
#define DB_MSGBUF_INIT(a) do { \
(a)->buf = (a)->cur = NULL; \
(a)->len = 0; \
} while (0)
#define DB_MSGBUF_FLUSH(env, a) do { \
if ((a)->buf != NULL) { \
if ((a)->cur != (a)->buf) \
__db_msg(env, "%s", (a)->buf); \
__os_free(env, (a)->buf); \
DB_MSGBUF_INIT(a); \
} \
} while (0)
#define STAT_FMT(msg, fmt, type, v) do { \
DB_MSGBUF __mb; \
DB_MSGBUF_INIT(&__mb); \
__db_msgadd(env, &__mb, fmt, (type)(v)); \
__db_msgadd(env, &__mb, "\t%s", msg); \
DB_MSGBUF_FLUSH(env, &__mb); \
} while (0)
#define STAT_HEX(msg, v) \
__db_msg(env, "%#lx\t%s", (u_long)(v), msg)
#define STAT_ISSET(msg, p) \
__db_msg(env, "%sSet\t%s", (p) == NULL ? "!" : " ", msg)
#define STAT_LONG(msg, v) \
__db_msg(env, "%ld\t%s", (long)(v), msg)
#define STAT_LSN(msg, lsnp) \
__db_msg(env, "%lu/%lu\t%s", \
(u_long)(lsnp)->file, (u_long)(lsnp)->offset, msg)
#define STAT_POINTER(msg, v) \
__db_msg(env, "%#lx\t%s", P_TO_ULONG(v), msg)
#define STAT_STRING(msg, p) do { \
const char *__p = p; /* p may be a function call. */ \
__db_msg(env, "%s\t%s", __p == NULL ? "!Set" : __p, msg); \
} while (0)
#define STAT_ULONG(msg, v) \
__db_msg(env, "%lu\t%s", (u_long)(v), msg)
/*
* There are quite a few places in Berkeley DB where we want to initialize
* a DBT from a string or other random pointer type, using a length typed
* to size_t in most cases. This macro avoids a lot of casting. The macro
* comes in two flavors because we often want to clear the DBT first.
*/
#define DB_SET_DBT(dbt, d, s) do { \
(dbt).data = (void *)(d); \
(dbt).size = (u_int32_t)(s); \
} while (0)
#define DB_INIT_DBT(dbt, d, s) do { \
memset(&(dbt), 0, sizeof(dbt)); \
DB_SET_DBT(dbt, d, s); \
} while (0)
/*******************************************************
* API return values
*******************************************************/
/*
* Return values that are OK for each different call. Most calls have a
* standard 'return of 0 is only OK value', but some, like db->get have
* DB_NOTFOUND as a return value, but it really isn't an error.
*/
#define DB_RETOK_STD(ret) ((ret) == 0)
#define DB_RETOK_DBCDEL(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCGET(ret) ((ret) == 0 || (ret) == DB_KEYEMPTY || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBCPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST || \
(ret) == DB_NOTFOUND)
#define DB_RETOK_DBDEL(ret) DB_RETOK_DBCDEL(ret)
#define DB_RETOK_DBGET(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_DBPUT(ret) ((ret) == 0 || (ret) == DB_KEYEXIST)
#define DB_RETOK_EXISTS(ret) DB_RETOK_DBCGET(ret)
#define DB_RETOK_LGGET(ret) ((ret) == 0 || (ret) == DB_NOTFOUND)
#define DB_RETOK_MPGET(ret) ((ret) == 0 || (ret) == DB_PAGE_NOTFOUND)
#define DB_RETOK_REPPMSG(ret) ((ret) == 0 || \
(ret) == DB_REP_IGNORE || \
(ret) == DB_REP_ISPERM || \
(ret) == DB_REP_NEWMASTER || \
(ret) == DB_REP_NEWSITE || \
(ret) == DB_REP_NOTPERM)
/* Find a reasonable operation-not-supported error. */
#ifdef EOPNOTSUPP
#define DB_OPNOTSUP EOPNOTSUPP
#else
#ifdef ENOTSUP
#define DB_OPNOTSUP ENOTSUP
#else
#define DB_OPNOTSUP EINVAL
#endif
#endif
/*******************************************************
* Files.
*******************************************************/
/*
* We use 1024 as the maximum path length. It's too hard to figure out what
* the real path length is, as it was traditionally stored in <sys/param.h>,
* and that file isn't always available.
*/
#define DB_MAXPATHLEN 1024
#define PATH_DOT "." /* Current working directory. */
/* Path separator character(s). */
#define PATH_SEPARATOR "/\\"
/*******************************************************
* Environment.
*******************************************************/
/* Type passed to __db_appname(). */
typedef enum {
DB_APP_NONE=0, /* No type (region). */
DB_APP_DATA, /* Data file. */
DB_APP_LOG, /* Log file. */
DB_APP_TMP /* Temporary file. */
} APPNAME;
/*
* A set of macros to check if various functionality has been configured.
*
* ALIVE_ON The is_alive function is configured.
* CDB_LOCKING CDB product locking.
* CRYPTO_ON Security has been configured.
* LOCKING_ON Locking has been configured.
* LOGGING_ON Logging has been configured.
* MUTEX_ON Mutexes have been configured.
* MPOOL_ON Memory pool has been configured.
* REP_ON Replication has been configured.
* RPC_ON RPC has been configured.
* TXN_ON Transactions have been configured.
*
* REP_ON is more complex than most: if the BDB library was compiled without
* replication support, ENV->rep_handle will be NULL; if the BDB library has
* replication support, but it was not configured, the region reference will
* be NULL.
*/
#define ALIVE_ON(env) ((env)->dbenv->is_alive != NULL)
#define CDB_LOCKING(env) F_ISSET(env, ENV_CDB)
#define CRYPTO_ON(env) ((env)->crypto_handle != NULL)
#define LOCKING_ON(env) ((env)->lk_handle != NULL)
#define LOGGING_ON(env) ((env)->lg_handle != NULL)
#define MPOOL_ON(env) ((env)->mp_handle != NULL)
#define MUTEX_ON(env) ((env)->mutex_handle != NULL)
#define REP_ON(env) \
((env)->rep_handle != NULL && (env)->rep_handle->region != NULL)
#define RPC_ON(dbenv) ((dbenv)->cl_handle != NULL)
#define TXN_ON(env) ((env)->tx_handle != NULL)
/*
* STD_LOCKING Standard locking, that is, locking was configured and CDB
* was not. We do not do locking in off-page duplicate trees,
* so we check for that in the cursor first.
*/
#define STD_LOCKING(dbc) \
(!F_ISSET(dbc, DBC_OPD) && \
!CDB_LOCKING((dbc)->env) && LOCKING_ON((dbc)->env))
/*
* IS_RECOVERING: The system is running recovery.
*/
#define IS_RECOVERING(env) \
(LOGGING_ON(env) && F_ISSET((env)->lg_handle, DBLOG_RECOVER))
/* Initialization methods are often illegal before/after open is called. */
#define ENV_ILLEGAL_AFTER_OPEN(env, name) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 1));
#define ENV_ILLEGAL_BEFORE_OPEN(env, name) \
if (!F_ISSET((env), ENV_OPEN_CALLED)) \
return (__db_mi_open(env, name, 0));
/* We're not actually user hostile, honest. */
#define ENV_REQUIRES_CONFIG(env, handle, i, flags) \
if (handle == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_REQUIRES_CONFIG_XX(env, handle, i, flags) \
if ((env)->handle->region == NULL) \
return (__env_not_config(env, i, flags));
#define ENV_NOT_CONFIGURED(env, handle, i, flags) \
if (F_ISSET((env), ENV_OPEN_CALLED)) \
ENV_REQUIRES_CONFIG(env, handle, i, flags)
#define ENV_ENTER(env, ip) do { \
int __ret; \
PANIC_CHECK(env); \
if ((env)->thr_hashtab == NULL) \
ip = NULL; \
else { \
if ((__ret = \
__env_set_state(env, &(ip), THREAD_ACTIVE)) != 0) \
return (__ret); \
} \
} while (0)
#define ENV_GET_THREAD_INFO(env, ip) ENV_ENTER(env, ip)
#ifdef DIAGNOSTIC
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) { \
DB_ASSERT(env, (ip)->dbth_state == THREAD_ACTIVE); \
(ip)->dbth_state = THREAD_OUT; \
} \
} while (0)
#else
#define ENV_LEAVE(env, ip) do { \
if ((ip) != NULL) \
(ip)->dbth_state = THREAD_OUT; \
} while (0)
#endif
#ifdef DIAGNOSTIC
#define CHECK_THREAD(env) do { \
if ((env)->thr_hashtab != NULL) \
(void)__env_set_state(env, NULL, THREAD_VERIFY); \
} while (0)
#ifdef HAVE_STATISTICS
#define CHECK_MTX_THREAD(env, mtx) do { \
if (mtx->alloc_id != MTX_MUTEX_REGION && \
mtx->alloc_id != MTX_ENV_REGION && \
mtx->alloc_id != MTX_APPLICATION) \
CHECK_THREAD(env); \
} while (0)
#else
#define CHECK_MTX_THREAD(env, mtx)
#endif
#else
#define CHECK_THREAD(env)
#define CHECK_MTX_THREAD(env, mtx)
#endif
typedef enum {
THREAD_SLOT_NOT_IN_USE=0,
THREAD_OUT,
THREAD_ACTIVE,
THREAD_BLOCKED,
THREAD_BLOCKED_DEAD
#ifdef DIAGNOSTIC
, THREAD_VERIFY
#endif
} DB_THREAD_STATE;
typedef struct __pin_list {
roff_t b_ref; /* offset to buffer. */
int region; /* region containing buffer. */
} PIN_LIST;
#define PINMAX 4
struct __db_thread_info {
pid_t dbth_pid;
db_threadid_t dbth_tid;
DB_THREAD_STATE dbth_state;
SH_TAILQ_ENTRY dbth_links;
/*
* The following fields track which buffers this thread of
* control has pinned in the mpool buffer cache.
*/
u_int16_t dbth_pincount; /* Number of pins for this thread. */
u_int16_t dbth_pinmax; /* Number of slots allocated. */
roff_t dbth_pinlist; /* List of pins. */
PIN_LIST dbth_pinarray[PINMAX]; /* Initial array of slots. */
};
typedef struct __env_thread_info {
u_int32_t thr_count;
u_int32_t thr_max;
u_int32_t thr_nbucket;
roff_t thr_hashoff;
} THREAD_INFO;
#define DB_EVENT(env, e, einfo) do { \
DB_ENV *__dbenv = (env)->dbenv; \
if (__dbenv->db_event_func != NULL) \
__dbenv->db_event_func(__dbenv, e, einfo); \
} while (0)
typedef struct __flag_map {
u_int32_t inflag, outflag;
} FLAG_MAP;
/*
* Internal database environment structure.
*
* This is the private database environment handle. The public environment
* handle is the DB_ENV structure. The library owns this structure, the user
* owns the DB_ENV structure. The reason there are two structures is because
* the user's configuration outlives any particular DB_ENV->open call, and
* separate structures allows us to easily discard internal information without
* discarding the user's configuration.
*/
struct __env {
DB_ENV *dbenv; /* Linked DB_ENV structure */
/*
* The ENV structure can be used concurrently, so field access is
* protected.
*/
db_mutex_t mtx_env; /* ENV structure mutex */
/*
* Some fields are included in the ENV structure rather than in the
* DB_ENV structure because they are only set as arguments to the
* DB_ENV->open method. In other words, because of the historic API,
* not for any rational reason.
*
* Arguments to DB_ENV->open.
*/
char *db_home; /* Database home */
u_int32_t open_flags; /* Flags */
int db_mode; /* Default open permissions */
pid_t pid_cache; /* Cached process ID */
DB_FH *lockfhp; /* fcntl(2) locking file handle */
DB_LOCKER *env_lref; /* Locker in non-threaded handles */
DB_DISTAB recover_dtab; /* Dispatch table for recover funcs */
int dir_mode; /* Intermediate directory perms. */
/* Thread tracking */
u_int32_t thr_nbucket; /* Number of hash buckets */
DB_HASHTAB *thr_hashtab; /* Hash table of DB_THREAD_INFO */
/* Mutex allocation */
struct {
int alloc_id; /* Allocation ID argument */
u_int32_t flags; /* Flags argument */
} *mutex_iq; /* Initial mutexes queue */
u_int mutex_iq_next; /* Count of initial mutexes */
u_int mutex_iq_max; /* Maximum initial mutexes */
/*
* List of open DB handles for this ENV, used for cursor
* adjustment. Must be protected for multi-threaded support.
*/
db_mutex_t mtx_dblist;
int db_ref; /* DB handle reference count */
TAILQ_HEAD(__dblist, __db) dblist;
/*
* XA support.
*/
int xa_rmid; /* XA Resource Manager ID */
TAILQ_ENTRY(__env) links; /* XA environments */
TAILQ_HEAD(__xa_txn, __db_txn) xa_txn; /* XA active transactions */
/*
* List of open file handles for this ENV. Must be protected
* for multi-threaded support.
*/
TAILQ_HEAD(__fdlist, __fh_t) fdlist;
db_mutex_t mtx_mt; /* Mersenne Twister mutex */
int mti; /* Mersenne Twister index */
u_long *mt; /* Mersenne Twister state vector */
DB_CIPHER *crypto_handle; /* Crypto handle */
DB_LOCKTAB *lk_handle; /* Lock handle */
DB_LOG *lg_handle; /* Log handle */
DB_MPOOL *mp_handle; /* Mpool handle */
DB_MUTEXMGR *mutex_handle; /* Mutex handle */
DB_REP *rep_handle; /* Replication handle */
DB_TXNMGR *tx_handle; /* Txn handle */
/* Application callback to copy data to/from a custom data source */
#define DB_USERCOPY_GETDATA 0x0001
#define DB_USERCOPY_SETDATA 0x0002
int (*dbt_usercopy)
__P((DBT *, u_int32_t, void *, u_int32_t, u_int32_t));
REGINFO *reginfo; /* REGINFO structure reference */
#define DB_TEST_ELECTINIT 1 /* after __rep_elect_init */
#define DB_TEST_ELECTVOTE1 2 /* after sending VOTE1 */
#define DB_TEST_POSTDESTROY 3 /* after destroy op */
#define DB_TEST_POSTLOG 4 /* after logging all pages */
#define DB_TEST_POSTLOGMETA 5 /* after logging meta in btree */
#define DB_TEST_POSTOPEN 6 /* after __os_open */
#define DB_TEST_POSTSYNC 7 /* after syncing the log */
#define DB_TEST_PREDESTROY 8 /* before destroy op */
#define DB_TEST_PREOPEN 9 /* before __os_open */
#define DB_TEST_SUBDB_LOCKS 10 /* subdb locking tests */
int test_abort; /* Abort value for testing */
int test_check; /* Checkpoint value for testing */
int test_copy; /* Copy value for testing */
#define ENV_CDB 0x00000001 /* DB_INIT_CDB */
#define ENV_DBLOCAL 0x00000002 /* Environment for a private DB */
#define ENV_LITTLEENDIAN 0x00000004 /* Little endian system. */
#define ENV_LOCKDOWN 0x00000008 /* DB_LOCKDOWN set */
#define ENV_NO_OUTPUT_SET 0x00000010 /* No output channel set */
#define ENV_OPEN_CALLED 0x00000020 /* DB_ENV->open called */
#define ENV_PRIVATE 0x00000040 /* DB_PRIVATE set */
#define ENV_RECOVER_FATAL 0x00000080 /* Doing fatal recovery in env */
#define ENV_REF_COUNTED 0x00000100 /* Region references this handle */
#define ENV_SYSTEM_MEM 0x00000200 /* DB_SYSTEM_MEM set */
#define ENV_THREAD 0x00000400 /* DB_THREAD set */
u_int32_t flags;
};
/*******************************************************
* Database Access Methods.
*******************************************************/
/*
* DB_IS_THREADED --
* The database handle is free-threaded (was opened with DB_THREAD).
*/
#define DB_IS_THREADED(dbp) \
((dbp)->mutex != MUTEX_INVALID)
/* Initialization methods are often illegal before/after open is called. */
#define DB_ILLEGAL_AFTER_OPEN(dbp, name) \
if (F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 1));
#define DB_ILLEGAL_BEFORE_OPEN(dbp, name) \
if (!F_ISSET((dbp), DB_AM_OPEN_CALLED)) \
return (__db_mi_open((dbp)->env, name, 0));
/* Some initialization methods are illegal if environment isn't local. */
#define DB_ILLEGAL_IN_ENV(dbp, name) \
if (!F_ISSET((dbp)->env, ENV_DBLOCAL)) \
return (__db_mi_env((dbp)->env, name));
#define DB_ILLEGAL_METHOD(dbp, flags) { \
int __ret; \
if ((__ret = __dbh_am_chk(dbp, flags)) != 0) \
return (__ret); \
}
/*
* Common DBC->internal fields. Each access method adds additional fields
* to this list, but the initial fields are common.
*/
#define __DBC_INTERNAL \
DBC *opd; /* Off-page duplicate cursor. */\
\
void *page; /* Referenced page. */ \
db_pgno_t root; /* Tree root. */ \
db_pgno_t pgno; /* Referenced page number. */ \
db_indx_t indx; /* Referenced key item index. */\
\
DB_LOCK lock; /* Cursor lock. */ \
db_lockmode_t lock_mode; /* Lock mode. */
struct __dbc_internal {
__DBC_INTERNAL
};
/* Actions that __db_master_update can take. */
typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action;
/*
* Access-method-common macro for determining whether a cursor
* has been initialized.
*/
#define IS_INITIALIZED(dbc) ((dbc)->internal->pgno != PGNO_INVALID)
/* Free the callback-allocated buffer, if necessary, hanging off of a DBT. */
#define FREE_IF_NEEDED(env, dbt) \
if (F_ISSET((dbt), DB_DBT_APPMALLOC)) { \
__os_ufree((env), (dbt)->data); \
F_CLR((dbt), DB_DBT_APPMALLOC); \
}
/*
* Use memory belonging to object "owner" to return the results of
* any no-DBT-flag get ops on cursor "dbc".
*/
#define SET_RET_MEM(dbc, owner) \
do { \
(dbc)->rskey = &(owner)->my_rskey; \
(dbc)->rkey = &(owner)->my_rkey; \
(dbc)->rdata = &(owner)->my_rdata; \
} while (0)
/* Use the return-data memory src is currently set to use in dest as well. */
#define COPY_RET_MEM(src, dest) \
do { \
(dest)->rskey = (src)->rskey; \
(dest)->rkey = (src)->rkey; \
(dest)->rdata = (src)->rdata; \
} while (0)
/* Reset the returned-memory pointers to their defaults. */
#define RESET_RET_MEM(dbc) \
do { \
(dbc)->rskey = &(dbc)->my_rskey; \
(dbc)->rkey = &(dbc)->my_rkey; \
(dbc)->rdata = &(dbc)->my_rdata; \
} while (0)
/*******************************************************
* Mpool.
*******************************************************/
/*
* File types for DB access methods. Negative numbers are reserved to DB.
*/
#define DB_FTYPE_SET -1 /* Call pgin/pgout functions. */
#define DB_FTYPE_NOTSET 0 /* Don't call... */
#define DB_LSN_OFF_NOTSET -1 /* Not yet set. */
#define DB_CLEARLEN_NOTSET UINT32_MAX /* Not yet set. */
/* Structure used as the DB pgin/pgout pgcookie. */
typedef struct __dbpginfo {
size_t db_pagesize; /* Underlying page size. */
u_int32_t flags; /* Some DB_AM flags needed. */
DBTYPE type; /* DB type */
} DB_PGINFO;
/*******************************************************
* Log.
*******************************************************/
/* Initialize an LSN to 'zero'. */
#define ZERO_LSN(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 0; \
} while (0)
#define IS_ZERO_LSN(LSN) ((LSN).file == 0 && (LSN).offset == 0)
#define IS_INIT_LSN(LSN) ((LSN).file == 1 && (LSN).offset == 0)
#define INIT_LSN(LSN) do { \
(LSN).file = 1; \
(LSN).offset = 0; \
} while (0)
#define MAX_LSN(LSN) do { \
(LSN).file = UINT32_MAX; \
(LSN).offset = UINT32_MAX; \
} while (0)
#define IS_MAX_LSN(LSN) \
((LSN).file == UINT32_MAX && (LSN).offset == UINT32_MAX)
/* If logging is turned off, smash the lsn. */
#define LSN_NOT_LOGGED(LSN) do { \
(LSN).file = 0; \
(LSN).offset = 1; \
} while (0)
#define IS_NOT_LOGGED_LSN(LSN) \
((LSN).file == 0 && (LSN).offset == 1)
/*
* LOG_COMPARE -- compare two LSNs.
*/
#define LOG_COMPARE(lsn0, lsn1) \
((lsn0)->file != (lsn1)->file ? \
((lsn0)->file < (lsn1)->file ? -1 : 1) : \
((lsn0)->offset != (lsn1)->offset ? \
((lsn0)->offset < (lsn1)->offset ? -1 : 1) : 0))
/*******************************************************
* Txn.
*******************************************************/
#define DB_NONBLOCK(C) ((C)->txn != NULL && F_ISSET((C)->txn, TXN_NOWAIT))
#define NOWAIT_FLAG(txn) \
((txn) != NULL && F_ISSET((txn), TXN_NOWAIT) ? DB_LOCK_NOWAIT : 0)
#define IS_REAL_TXN(txn) \
((txn) != NULL && !F_ISSET(txn, TXN_CDSGROUP))
#define IS_SUBTRANSACTION(txn) \
((txn) != NULL && (txn)->parent != NULL)
/*******************************************************
* Crypto.
*******************************************************/
#define DB_IV_BYTES 16 /* Bytes per IV */
#define DB_MAC_KEY 20 /* Bytes per MAC checksum */
/*******************************************************
* Secondaries over RPC.
*******************************************************/
#ifdef CONFIG_TEST
/*
* These are flags passed to DB->associate calls by the Tcl API if running
* over RPC. The RPC server will mask out these flags before making the real
* DB->associate call.
*
* These flags must coexist with the valid flags to DB->associate (currently
* DB_AUTO_COMMIT and DB_CREATE). DB_AUTO_COMMIT is in the group of
* high-order shared flags (0xff000000), and DB_CREATE is in the low-order
* group (0x00000fff), so we pick a range in between.
*/
#define DB_RPC2ND_MASK 0x00f00000 /* Reserved bits. */
#define DB_RPC2ND_REVERSEDATA 0x00100000 /* callback_n(0) _s_reversedata. */
#define DB_RPC2ND_NOOP 0x00200000 /* callback_n(1) _s_noop */
#define DB_RPC2ND_CONCATKEYDATA 0x00300000 /* callback_n(2) _s_concatkeydata */
#define DB_RPC2ND_CONCATDATAKEY 0x00400000 /* callback_n(3) _s_concatdatakey */
#define DB_RPC2ND_REVERSECONCAT 0x00500000 /* callback_n(4) _s_reverseconcat */
#define DB_RPC2ND_TRUNCDATA 0x00600000 /* callback_n(5) _s_truncdata */
#define DB_RPC2ND_CONSTANT 0x00700000 /* callback_n(6) _s_constant */
#define DB_RPC2ND_GETZIP 0x00800000 /* sj_getzip */
#define DB_RPC2ND_GETNAME 0x00900000 /* sj_getname */
#endif
#if defined(__cplusplus)
}
#endif
/*******************************************************
* Remaining general DB includes.
*******************************************************/
#include "dbinc/globals.h"
#include "dbinc/clock.h"
#include "dbinc/debug.h"
#include "dbinc/region.h"
#include "dbinc_auto/env_ext.h"
#include "dbinc/mutex.h"
#ifdef HAVE_REPLICATION_THREADS
#include "dbinc/repmgr.h"
#endif
#include "dbinc/rep.h"
#include "dbinc/os.h"
#include "dbinc_auto/clib_ext.h"
#include "dbinc_auto/common_ext.h"
/*******************************************************
* Remaining Log.
* These need to be defined after the general includes
* because they need rep.h from above.
*******************************************************/
/*
* Test if the environment is currently logging changes. If we're in recovery
* or we're a replication client, we don't need to log changes because they're
* already in the log, even though we have a fully functional log system.
*/
#define DBENV_LOGGING(env) \
(LOGGING_ON(env) && !IS_REP_CLIENT(env) && (!IS_RECOVERING(env)))
/*
* Test if we need to log a change. By default, we don't log operations without
* associated transactions, unless DIAGNOSTIC, DEBUG_ROP or DEBUG_WOP are on.
* This is because we want to get log records for read/write operations, and, if
* we are trying to debug something, more information is always better.
*
* The DBC_RECOVER flag is set when we're in abort, as well as during recovery;
* thus DBC_LOGGING may be false for a particular dbc even when DBENV_LOGGING
* is true.
*
* We explicitly use LOGGING_ON/IS_REP_CLIENT here because we don't want to pull
* in the log headers, which IS_RECOVERING (and thus DBENV_LOGGING) rely on, and
* because DBC_RECOVER should be set anytime IS_RECOVERING would be true.
*
* If we're not in recovery (master - doing an abort or a client applying
* a txn), then a client's only path through here is on an internal
* operation, and a master's only path through here is a transactional
* operation. Detect if either is not the case.
*/
#if defined(DIAGNOSTIC) || defined(DEBUG_ROP) || defined(DEBUG_WOP)
#define DBC_LOGGING(dbc) __dbc_logging(dbc)
#else
#define DBC_LOGGING(dbc) \
((dbc)->txn != NULL && LOGGING_ON((dbc)->env) && \
!F_ISSET((dbc), DBC_RECOVER) && !IS_REP_CLIENT((dbc)->env))
#endif
#endif /* !_DB_INT_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_load20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_load20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_load20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_db_load.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_load.c_dependencies
<END>
<BEGIN> FILE_db_load.c_objects
db_load.o
<END>
<BEGIN> FILE_db_load.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_load.c
<END>
<BEGIN> userComments
db_load
<END>

View File

@@ -0,0 +1,192 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_load22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_load22.a
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
ccpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
-mcpu=pentiumpro -march=pentiumpro
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
-g \
-mcpu=pentiumpro \
-march=pentiumpro \
-ansi \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-xassembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM2 \
-DTOOL_FAMILY=gnu \
-DTOOL=gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
ccpentium -E -P
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
ldpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
ccpentium -r -nostdlib -Wl,-X
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
nmpentium -g
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
-M -w
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
-MD
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
-xc
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
-U
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
sizepentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
gnu
<END>
<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUM2gnu_TC
::tc_PENTIUM2gnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_load22.out
<END>
<BEGIN> BUILD_RULE_db_load22.pl
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUM2gnu
<END>
<BEGIN> BUILD__LIST
PENTIUM2gnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.2
<END>
<BEGIN> FILE_db_load.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_load.c_dependencies
<END>
<BEGIN> FILE_db_load.c_objects
db_load.o
<END>
<BEGIN> FILE_db_load.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_load.c
<END>
<BEGIN> userComments
db_load
<END>

View File

@@ -0,0 +1,594 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_printlog.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/fop.h"
#include "dbinc/hash.h"
#include "dbinc/log.h"
#include "dbinc/qam.h"
#include "dbinc/txn.h"
#ifndef lint
static const char copyright[] =
"Copyright (c) 1996,2008 Oracle. All rights reserved.\n";
#endif
int db_printlog_print_app_record __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
int db_printlog_env_init_print __P((ENV *, u_int32_t, DB_DISTAB *));
int db_printlog_env_init_print_42 __P((ENV *, DB_DISTAB *));
int db_printlog_env_init_print_43 __P((ENV *, DB_DISTAB *));
int db_printlog_env_init_print_45 __P((ENV *, DB_DISTAB *));
int db_printlog_lsn_arg __P((char *, DB_LSN *));
int db_printlog_main __P((int, char *[]));
int db_printlog_open_rep_db __P((DB_ENV *, DB **, DBC **));
int db_printlog_usage __P((void));
int db_printlog_version_check __P((void));
const char *progname;
int
db_printlog(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_printlog", args, &argc, &argv);
return (db_printlog_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_printlog_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB *dbp;
DBC *dbc;
DBT data, keydbt;
DB_DISTAB dtab;
DB_ENV *dbenv;
DB_LOGC *logc;
DB_LSN key, start, stop, verslsn;
ENV *env;
u_int32_t logcflag, newversion, version;
int ch, cmp, exitval, nflag, rflag, ret, repflag;
char *home, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_printlog_version_check()) != 0)
return (ret);
dbp = NULL;
dbc = NULL;
dbenv = NULL;
logc = NULL;
ZERO_LSN(start);
ZERO_LSN(stop);
exitval = nflag = rflag = repflag = 0;
home = passwd = NULL;
memset(&dtab, 0, sizeof(dtab));
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "b:e:h:NP:rRV")) != EOF)
switch (ch) {
case 'b':
/* Don't use getsubopt(3), not all systems have it. */
if (db_printlog_lsn_arg(optarg, &start))
return (db_printlog_usage());
break;
case 'e':
/* Don't use getsubopt(3), not all systems have it. */
if (db_printlog_lsn_arg(optarg, &stop))
return (db_printlog_usage());
break;
case 'h':
home = optarg;
break;
case 'N':
nflag = 1;
break;
case 'P':
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
if (passwd == NULL) {
fprintf(stderr, "%s: strdup: %s\n",
progname, strerror(errno));
return (EXIT_FAILURE);
}
break;
case 'r':
rflag = 1;
break;
case 'R': /* Undocumented */
repflag = 1;
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case '?':
default:
return (db_printlog_usage());
}
argc -= optind;
argv += optind;
if (argc > 0)
return (db_printlog_usage());
/* Handle possible interruptions. */
__db_util_siginit();
/*
* Create an environment object and initialize it for error
* reporting.
*/
if ((ret = db_env_create(&dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_env_create: %s\n", progname, db_strerror(ret));
goto shutdown;
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (nflag) {
if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOLOCKING");
goto shutdown;
}
if ((ret = dbenv->set_flags(dbenv, DB_NOPANIC, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOPANIC");
goto shutdown;
}
}
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto shutdown;
}
/*
* Set up an app-specific dispatch function so that we can gracefully
* handle app-specific log records.
*/
if ((ret = dbenv->set_app_dispatch(
dbenv, db_printlog_print_app_record)) != 0) {
dbenv->err(dbenv, ret, "app_dispatch");
goto shutdown;
}
/*
* An environment is required, but as all we're doing is reading log
* files, we create one if it doesn't already exist. If we create
* it, create it private so it automatically goes away when we're done.
* If we are reading the replication database, do not open the env
* with logging, because we don't want to log the opens.
*/
if (repflag) {
if ((ret = dbenv->open(dbenv, home,
DB_INIT_MPOOL | DB_USE_ENVIRON, 0)) != 0 &&
(ret == DB_VERSION_MISMATCH ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_USE_ENVIRON, 0))
!= 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto shutdown;
}
} else if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
(ret == DB_VERSION_MISMATCH ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_LOG | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto shutdown;
}
env = dbenv->env;
/* Allocate a log cursor. */
if (repflag) {
if ((ret = db_printlog_open_rep_db(dbenv, &dbp, &dbc)) != 0)
goto shutdown;
} else if ((ret = dbenv->log_cursor(dbenv, &logc, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->log_cursor");
goto shutdown;
}
if (IS_ZERO_LSN(start)) {
memset(&keydbt, 0, sizeof(keydbt));
logcflag = rflag ? DB_PREV : DB_NEXT;
} else {
key = start;
logcflag = DB_SET;
}
memset(&data, 0, sizeof(data));
/*
* If we're using the repflag, we're immediately initializing
* the print table. Use the current version. If we're printing
* the log then initialize version to 0 so that we get the
* correct version right away.
*/
if (repflag)
version = DB_LOGVERSION;
else
version = 0;
ZERO_LSN(verslsn);
/* Initialize print callbacks if repflag. */
if (repflag &&
(ret = db_printlog_env_init_print(env, version, &dtab)) != 0) {
dbenv->err(dbenv, ret, "callback: initialization");
goto shutdown;
}
for (; !__db_util_interrupted(); logcflag = rflag ? DB_PREV : DB_NEXT) {
if (repflag) {
ret = dbc->get(dbc, &keydbt, &data, logcflag);
if (ret == 0)
key = ((__rep_control_args *)keydbt.data)->lsn;
} else
ret = logc->get(logc, &key, &data, logcflag);
if (ret != 0) {
if (ret == DB_NOTFOUND)
break;
dbenv->err(dbenv,
ret, repflag ? "DBC->get" : "DB_LOGC->get");
goto shutdown;
}
/*
* We may have reached the end of the range we're displaying.
*/
if (!IS_ZERO_LSN(stop)) {
cmp = LOG_COMPARE(&key, &stop);
if ((rflag && cmp < 0) || (!rflag && cmp > 0))
break;
}
if (!repflag && key.file != verslsn.file) {
/*
* If our log file changed, we need to see if the
* version of the log file changed as well.
* If it changed, reset the print table.
*/
if ((ret = logc->version(logc, &newversion, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_LOGC->version");
goto shutdown;
}
if (version != newversion) {
version = newversion;
if ((ret = db_printlog_env_init_print(env, version,
&dtab)) != 0) {
dbenv->err(dbenv, ret,
"callback: initialization");
goto shutdown;
}
}
}
ret = __db_dispatch(dbenv->env,
&dtab, &data, &key, DB_TXN_PRINT, NULL);
/*
* XXX
* Just in case the underlying routines don't flush.
*/
(void)fflush(stdout);
if (ret != 0) {
dbenv->err(dbenv, ret, "tx: dispatch");
goto shutdown;
}
}
if (0) {
shutdown: exitval = 1;
}
if (logc != NULL && (ret = logc->close(logc, 0)) != 0)
exitval = 1;
if (dbc != NULL && (ret = dbc->close(dbc)) != 0)
exitval = 1;
if (dbp != NULL && (ret = dbp->close(dbp, 0)) != 0)
exitval = 1;
if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
}
if (passwd != NULL)
free(passwd);
/* Resend any caught signal. */
__db_util_sigresend();
return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/*
* env_init_print --
*/
int
db_printlog_env_init_print(env, version, dtabp)
ENV *env;
u_int32_t version;
DB_DISTAB *dtabp;
{
int ret;
/*
* We need to prime the print table with the current print
* functions. Then we overwrite only specific entries based on
* each previous version we support.
*/
if ((ret = db_printlog_env_init_print_45(env, dtabp)) != 0)
return (ret);
switch (version) {
/*
* There are no log record/recovery differences between
* 4.4 and 4.5. The log version changed due to checksum.
* There are no log recovery differences between
* 4.5 and 4.6. The name of the rep_gen in txn_checkpoint
* changed (to spare, since we don't use it anymore).
*/
case DB_LOGVERSION_47:
case DB_LOGVERSION_46:
case DB_LOGVERSION_45:
case DB_LOGVERSION_44:
ret = 0;
break;
case DB_LOGVERSION_43:
ret = db_printlog_env_init_print_43(env, dtabp);
break;
case DB_LOGVERSION_42:
ret = db_printlog_env_init_print_42(env, dtabp);
break;
default:
env->dbenv->errx(env->dbenv,
"Unknown version %lu", (u_long)version);
ret = EINVAL;
break;
}
return (ret);
}
int
db_printlog_env_init_print_42(env, dtabp)
ENV *env;
DB_DISTAB *dtabp;
{
int ret;
if ((ret = __db_add_recovery_int(env, dtabp,
__db_relink_42_print, DB___db_relink_42)) != 0)
goto err;
if ((ret = __db_add_recovery_int(env, dtabp,
__db_pg_alloc_42_print, DB___db_pg_alloc_42)) != 0)
goto err;
if ((ret = __db_add_recovery_int(env, dtabp,
__db_pg_free_42_print, DB___db_pg_free_42)) != 0)
goto err;
if ((ret = __db_add_recovery_int(env, dtabp,
__db_pg_freedata_42_print, DB___db_pg_freedata_42)) != 0)
goto err;
#if HAVE_HASH
if ((ret = __db_add_recovery_int(env, dtabp,
__ham_metagroup_42_print, DB___ham_metagroup_42)) != 0)
goto err;
if ((ret = __db_add_recovery_int(env, dtabp,
__ham_groupalloc_42_print, DB___ham_groupalloc_42)) != 0)
goto err;
#endif
if ((ret = __db_add_recovery_int(env, dtabp,
__txn_ckp_42_print, DB___txn_ckp_42)) != 0)
goto err;
if ((ret = __db_add_recovery_int(env, dtabp,
__txn_regop_42_print, DB___txn_regop_42)) != 0)
goto err;
err:
return (ret);
}
int
db_printlog_env_init_print_43(env, dtabp)
ENV *env;
DB_DISTAB *dtabp;
{
int ret;
if ((ret = __db_add_recovery_int(env, dtabp,
__bam_relink_43_print, DB___bam_relink_43)) != 0)
goto err;
/*
* We want to use the 4.2-based txn_regop record.
*/
if ((ret = __db_add_recovery_int(env, dtabp,
__txn_regop_42_print, DB___txn_regop_42)) != 0)
goto err;
err:
return (ret);
}
/*
* env_init_print_45 --
*
*/
int
db_printlog_env_init_print_45(env, dtabp)
ENV *env;
DB_DISTAB *dtabp;
{
int ret;
if ((ret = __bam_init_print(env, dtabp)) != 0)
goto err;
if ((ret = __crdel_init_print(env, dtabp)) != 0)
goto err;
if ((ret = __db_init_print(env, dtabp)) != 0)
goto err;
if ((ret = __dbreg_init_print(env, dtabp)) != 0)
goto err;
if ((ret = __fop_init_print(env, dtabp)) != 0)
goto err;
#ifdef HAVE_HASH
if ((ret = __ham_init_print(env, dtabp)) != 0)
goto err;
#endif
#ifdef HAVE_QUEUE
if ((ret = __qam_init_print(env, dtabp)) != 0)
goto err;
#endif
if ((ret = __txn_init_print(env, dtabp)) != 0)
goto err;
err:
return (ret);
}
int
db_printlog_usage()
{
fprintf(stderr, "usage: %s %s\n", progname,
"[-NrV] [-b file/offset] [-e file/offset] [-h home] [-P password]");
return (EXIT_FAILURE);
}
int
db_printlog_version_check()
{
int v_major, v_minor, v_patch;
/* Make sure we're loaded with the right version of the DB library. */
(void)db_version(&v_major, &v_minor, &v_patch);
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
fprintf(stderr,
"%s: version %d.%d doesn't match library version %d.%d\n",
progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
v_major, v_minor);
return (EXIT_FAILURE);
}
return (0);
}
/* Print an unknown, application-specific log record as best we can. */
int
db_printlog_print_app_record(dbenv, dbt, lsnp, op)
DB_ENV *dbenv;
DBT *dbt;
DB_LSN *lsnp;
db_recops op;
{
u_int32_t i, rectype;
int ch;
DB_ASSERT(dbenv->env, op == DB_TXN_PRINT);
COMPQUIET(dbenv, NULL);
COMPQUIET(op, DB_TXN_PRINT);
/*
* Fetch the rectype, which always must be at the beginning of the
* record (if dispatching is to work at all).
*/
memcpy(&rectype, dbt->data, sizeof(rectype));
/*
* Applications may wish to customize the output here based on the
* rectype. We just print the entire log record in the generic
* mixed-hex-and-printable format we use for binary data.
*/
printf("[%lu][%lu]application specific record: rec: %lu\n",
(u_long)lsnp->file, (u_long)lsnp->offset, (u_long)rectype);
printf("\tdata: ");
for (i = 0; i < dbt->size; i++) {
ch = ((u_int8_t *)dbt->data)[i];
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
}
printf("\n\n");
return (0);
}
int
db_printlog_open_rep_db(dbenv, dbpp, dbcp)
DB_ENV *dbenv;
DB **dbpp;
DBC **dbcp;
{
int ret;
DB *dbp;
*dbpp = NULL;
*dbcp = NULL;
if ((ret = db_create(dbpp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
return (ret);
}
dbp = *dbpp;
if ((ret =
dbp->open(dbp, NULL, REPDBNAME, NULL, DB_BTREE, 0, 0)) != 0) {
dbenv->err(dbenv, ret, "DB->open");
goto err;
}
if ((ret = dbp->cursor(dbp, NULL, dbcp, 0)) != 0) {
dbenv->err(dbenv, ret, "DB->cursor");
goto err;
}
return (0);
err: if (*dbpp != NULL)
(void)(*dbpp)->close(*dbpp, 0);
return (ret);
}
/*
* lsn_arg --
* Parse a LSN argument.
*/
int
db_printlog_lsn_arg(arg, lsnp)
char *arg;
DB_LSN *lsnp;
{
u_long uval;
char *p;
/*
* Expected format is: lsn.file/lsn.offset.
*/
if ((p = strchr(arg, '/')) == NULL)
return (1);
*p = '\0';
if (__db_getulong(NULL, progname, arg, 0, UINT32_MAX, &uval))
return (1);
lsnp->file = uval;
if (__db_getulong(NULL, progname, p + 1, 0, UINT32_MAX, &uval))
return (1);
lsnp->offset = uval;
return (0);
}

View File

@@ -0,0 +1,286 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_printlog20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_printlog20.a
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
cc386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
-g \
-mpentium \
-ansi \
-nostdinc \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-I$(PRJ_DIR)/.. \
-I$(PRJ_DIR)/../.. \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
-g \
-mpentium \
-ansi \
-nostdinc \
-fvolatile \
-nostdlib \
-fno-builtin \
-fno-defer-pop \
-P \
-x \
assembler-with-cpp \
-I$(WIND_BASE)/target/h \
-DCPU=PENTIUM
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
cc386 -E -P -xc
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
ld386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
-X -N
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
-X -r
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
nm386 -g
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
-D
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
-I
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
size386
<END>
<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
{$(WIND_BASE)/target/h/} \
{$(WIND_BASE)/target/src/} \
{$(WIND_BASE)/target/config/}
<END>
<BEGIN> BUILD_PENTIUMgnu_TC
::tc_PENTIUMgnu
<END>
<BEGIN> BUILD_RULE_archive
<END>
<BEGIN> BUILD_RULE_db_printlog20.out
<END>
<BEGIN> BUILD_RULE_objects
<END>
<BEGIN> BUILD__CURRENT
PENTIUMgnu
<END>
<BEGIN> BUILD__LIST
PENTIUMgnu
<END>
<BEGIN> CORE_INFO_TYPE
::prj_vxApp
<END>
<BEGIN> CORE_INFO_VERSION
2.0
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../btree/btree_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../btree/btree_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../btree/btree_autop.c_objects
btree_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../btree/btree_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/crdel_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/crdel_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/crdel_autop.c_objects
crdel_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/crdel_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/db_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/db_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/db_autop.c_objects
db_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../db/db_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_db_printlog.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_printlog.c_dependencies
<END>
<BEGIN> FILE_db_printlog.c_objects
db_printlog.o
<END>
<BEGIN> FILE_db_printlog.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../dbreg/dbreg_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../dbreg/dbreg_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../dbreg/dbreg_autop.c_objects
dbreg_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../dbreg/dbreg_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../fileops/fileops_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../fileops/fileops_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../fileops/fileops_autop.c_objects
fileops_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../fileops/fileops_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../hash/hash_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../hash/hash_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../hash/hash_autop.c_objects
hash_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../hash/hash_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../qam/qam_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../qam/qam_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../qam/qam_autop.c_objects
qam_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../qam/qam_autop.c_tool
C/C++ compiler
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../txn/txn_autop.c_dependDone
FALSE
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../txn/txn_autop.c_dependencies
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../txn/txn_autop.c_objects
txn_autop.o
<END>
<BEGIN> FILE_$(PRJ_DIR)/../../txn/txn_autop.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/../../btree/btree_autop.c \
$(PRJ_DIR)/../../db/crdel_autop.c \
$(PRJ_DIR)/../../db/db_autop.c \
$(PRJ_DIR)/db_printlog.c \
$(PRJ_DIR)/../../dbreg/dbreg_autop.c \
$(PRJ_DIR)/../../fileops/fileops_autop.c \
$(PRJ_DIR)/../../hash/hash_autop.c \
$(PRJ_DIR)/../../qam/qam_autop.c \
$(PRJ_DIR)/../../txn/txn_autop.c
<END>
<BEGIN> userComments
db_printlog
<END>

Some files were not shown because too many files have changed in this diff Show More