Compare commits

..

1 Commits
bsddb ... zlib

Author SHA1 Message Date
Zachary Ware
75277be173 Import zlib 1.2.11 from https://zlib.net/zlib-1.2.11.tar.gz 2017-09-05 14:55:50 -07:00
5032 changed files with 76196 additions and 2241032 deletions

249
CMakeLists.txt Normal file
View File

@@ -0,0 +1,249 @@
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C)
set(VERSION "1.2.11")
option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
enable_testing()
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko
#
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
#
# Check for unistd.h
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# If we're doing an out of source build and the user has a zconf.h
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
endif()
endif()
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
${ZLIB_PC} @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
#============================================================================
# zlib
#============================================================================
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
zlib.h
)
set(ZLIB_PRIVATE_HDRS
crc32.h
deflate.h
gzguts.h
inffast.h
inffixed.h
inflate.h
inftrees.h
trees.h
zutil.h
)
set(ZLIB_SRCS
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
inflate.c
infback.c
inftrees.c
inffast.c
trees.c
uncompr.c
zutil.c
)
if(NOT MINGW)
set(ZLIB_DLL_SRCS
win32/zlib1.rc # If present will override custom build rule below.
)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
if(ASM686)
set(ZLIB_ASMS contrib/asm686/match.S)
elseif (AMD64)
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
endif ()
if(ZLIB_ASMS)
add_definitions(-DASMV)
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
endif()
endif()
if(MSVC)
if(ASM686)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
elseif (AMD64)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
endif()
if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
endif()
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
if(MINGW)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
COMMAND ${CMAKE_RC_COMPILER}
-D GCC_WINDRES
-I ${CMAKE_CURRENT_SOURCE_DIR}
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
# encoded into their final filename. We disable this on Cygwin because
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
# seems to be the default.
#
# This has no effect with MSVC, on that platform the version info for
# the DLL comes from the resource file win32/zlib1.rc
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
if(UNIX)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
elseif(BUILD_SHARED_LIBS AND WIN32)
# Creates zlib1.dll when building shared library version
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
endif()
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
install(TARGETS zlib zlibstatic
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
endif()
#============================================================================
# Example binaries
#============================================================================
add_executable(example test/example.c)
target_link_libraries(example zlib)
add_test(example example)
add_executable(minigzip test/minigzip.c)
target_link_libraries(minigzip zlib)
if(HAVE_OFF64_T)
add_executable(example64 test/example.c)
target_link_libraries(example64 zlib)
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
add_test(example64 example64)
add_executable(minigzip64 test/minigzip.c)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()

1515
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

368
FAQ Normal file
View File

@@ -0,0 +1,368 @@
Frequently Asked Questions about zlib
If your question is not there, please check the zlib home page
http://zlib.net/ which may have more recent information.
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
1. Is zlib Y2K-compliant?
Yes. zlib doesn't handle dates.
2. Where can I get a Windows DLL version?
The zlib sources can be compiled without change to produce a DLL. See the
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
precompiled DLL are found in the zlib web site at http://zlib.net/ .
3. Where can I get a Visual Basic interface to zlib?
See
* http://marknelson.us/1997/01/01/zlib-engine/
* win32/DLL_FAQ.txt in the zlib distribution
4. compress() returns Z_BUF_ERROR.
Make sure that before the call of compress(), the length of the compressed
buffer is equal to the available size of the compressed buffer and not
zero. For Visual Basic, check that this parameter is passed by reference
("as any"), not by value ("as long").
5. deflate() or inflate() returns Z_BUF_ERROR.
Before making the call, make sure that avail_in and avail_out are not zero.
When setting the parameter flush equal to Z_FINISH, also make sure that
avail_out is big enough to allow processing all pending input. Note that a
Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
made with more input or output space. A Z_BUF_ERROR may in fact be
unavoidable depending on how the functions are used, since it is not
possible to tell whether or not there is more output pending when
strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
heavily annotated example.
6. Where's the zlib documentation (man pages, etc.)?
It's in zlib.h . Examples of zlib usage are in the files test/example.c
and test/minigzip.c, with more in examples/ .
7. Why don't you use GNU autoconf or libtool or ...?
Because we would like to keep zlib as a very small and simple package.
zlib is rather portable and doesn't need much configuration.
8. I found a bug in zlib.
Most of the time, such problems are due to an incorrect usage of zlib.
Please try to reproduce the problem with a small program and send the
corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
data files without prior agreement.
9. Why do I get "undefined reference to gzputc"?
If "make test" produces something like
example.o(.text+0x154): undefined reference to `gzputc'
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
/usr/X11R6/lib. Remove any old versions, then do "make install".
10. I need a Delphi interface to zlib.
See the contrib/delphi directory in the zlib distribution.
11. Can zlib handle .zip archives?
Not by itself, no. See the directory contrib/minizip in the zlib
distribution.
12. Can zlib handle .Z files?
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
the code of uncompress on your own.
13. How can I make a Unix shared library?
By default a shared (and a static) library is built for Unix. So:
make distclean
./configure
make
14. How do I install a shared zlib library on Unix?
After the above, then:
make install
However, many flavors of Unix come with a shared zlib already installed.
Before going to the trouble of compiling a shared version of zlib and
trying to install it, you may want to check if it's already there! If you
can #include <zlib.h>, it's there. The -lz option will probably link to
it. You can check the version at the top of zlib.h or with the
ZLIB_VERSION symbol defined in zlib.h .
15. I have a question about OttoPDF.
We are not the authors of OttoPDF. The real author is on the OttoPDF web
site: Joel Hainley, jhainley@myndkryme.com.
16. Can zlib decode Flate data in an Adobe PDF file?
Yes. See http://www.pdflib.com/ . To modify PDF forms, see
http://sourceforge.net/projects/acroformtool/ .
17. Why am I getting this "register_frame_info not found" error on Solaris?
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
generates an error such as:
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
symbol __register_frame_info: referenced symbol not found
The symbol __register_frame_info is not part of zlib, it is generated by
the C compiler (cc or gcc). You must recompile applications using zlib
which have this problem. This problem is specific to Solaris. See
http://www.sunfreeware.com for Solaris versions of zlib and applications
using zlib.
18. Why does gzip give an error on a file I make with compress/deflate?
The compress and deflate functions produce data in the zlib format, which
is different and incompatible with the gzip format. The gz* functions in
zlib on the other hand use the gzip format. Both the zlib and gzip formats
use the same compressed data format internally, but have different headers
and trailers around the compressed data.
19. Ok, so why are there two different formats?
The gzip format was designed to retain the directory information about a
single file, such as the name and last modification date. The zlib format
on the other hand was designed for in-memory and communication channel
applications, and has a much more compact header and trailer and uses a
faster integrity check than gzip.
20. Well that's nice, but how do I make a gzip file in memory?
You can request that deflate write the gzip format instead of the zlib
format using deflateInit2(). You can also request that inflate decode the
gzip format using inflateInit2(). Read zlib.h for more details.
21. Is zlib thread-safe?
Yes. However any library routines that zlib uses and any application-
provided memory allocation routines must also be thread-safe. zlib's gz*
functions use stdio library routines, and most of zlib's functions use the
library memory allocation routines by default. zlib's *Init* functions
allow for the application to provide custom memory allocation routines.
Of course, you should only operate on any given zlib or gzip stream from a
single thread at a time.
22. Can I use zlib in my commercial application?
Yes. Please read the license in zlib.h.
23. Is zlib under the GNU license?
No. Please read the license in zlib.h.
24. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.
For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
with the dates of the alterations. The origin should include at least your
name (or your company's name), and an email address to contact for help or
issues with the library.
Note that distributing a compiled zlib library along with zlib.h and
zconf.h is also a source distribution, and so you should change
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
in zlib.h as you would for a full source distribution.
25. Will zlib work on a big-endian or little-endian architecture, and can I
exchange compressed data between them?
Yes and yes.
26. Will zlib work on a 64-bit machine?
Yes. It has been tested on 64-bit machines, and has no dependence on any
data types being limited to 32-bits in length. If you have any
difficulties, please provide a complete problem report to zlib@gzip.org
27. Will zlib decompress data from the PKWare Data Compression Library?
No. The PKWare DCL uses a completely different compressed data format than
does PKZIP and zlib. However, you can look in zlib's contrib/blast
directory for a possible solution to your problem.
28. Can I access data randomly in a compressed stream?
No, not without some preparation. If when compressing you periodically use
Z_FULL_FLUSH, carefully write all the pending data at those points, and
keep an index of those locations, then you can start decompression at those
points. You have to be careful to not use Z_FULL_FLUSH too often, since it
can significantly degrade compression. Alternatively, you can scan a
deflate stream once to generate an index, and then use that index for
random access. See examples/zran.c .
29. Does zlib work on MVS, OS/390, CICS, etc.?
It has in the past, but we have not heard of any recent evidence. There
were working ports of zlib 1.1.4 to MVS, but those links no longer work.
If you know of recent, successful applications of zlib on these operating
systems, please let us know. Thanks.
30. Is there some simpler, easier to read version of inflate I can look at to
understand the deflate format?
First off, you should read RFC 1951. Second, yes. Look in zlib's
contrib/puff directory.
31. Does zlib infringe on any patents?
As far as we know, no. In fact, that was originally the whole point behind
zlib. Look here for some more information:
http://www.gzip.org/#faq11
32. Can zlib work with greater than 4 GB of data?
Yes. inflate() and deflate() will process any amount of data correctly.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
type, but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
single call. gzseek() and gztell() may be limited to 4 GB depending on how
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
The word "may" appears several times above since there is a 4 GB limit only
if the compiler's "long" type is 32 bits. If the compiler's "long" type is
64 bits, then the limit is 16 exabytes.
33. Does zlib have any security vulnerabilities?
The only one that we are aware of is potentially in gzprintf(). If zlib is
compiled to use sprintf() or vsprintf(), then there is no protection
against a buffer overflow of an 8K string space (or other value as set by
gzbuffer()), other than the caller of gzprintf() assuring that the output
will not exceed 8K. On the other hand, if zlib is compiled to use
snprintf() or vsnprintf(), which should normally be the case, then there is
no vulnerability. The ./configure script will display warnings if an
insecure variation of sprintf() will be used by gzprintf(). Also the
zlibCompileFlags() function will return information on what variant of
sprintf() is used by gzprintf().
If you don't have snprintf() or vsnprintf() and would like one, you can
find a portable implementation here:
http://www.ijs.si/software/snprintf/
Note that you should be using the most recent version of zlib. Versions
1.1.3 and before were subject to a double-free vulnerability, and versions
1.2.1 and 1.2.2 were subject to an access exception when decompressing
invalid compressed data.
34. Is there a Java version of zlib?
Probably what you want is to use zlib in Java. zlib is already included
as part of the Java SDK in the java.util.zip package. If you really want
a version of zlib written in the Java language, look on the zlib home
page for links: http://zlib.net/ .
35. I get this or that compiler or source-code scanner warning when I crank it
up to maximally-pedantic. Can't you guys write proper code?
Many years ago, we gave up attempting to avoid warnings on every compiler
in the universe. It just got to be a waste of time, and some compilers
were downright silly as well as contradicted each other. So now, we simply
make sure that the code always works.
36. Valgrind (or some similar memory access checker) says that deflate is
performing a conditional jump that depends on an uninitialized value.
Isn't that a bug?
No. That is intentional for performance reasons, and the output of deflate
is not affected. This only started showing up recently since zlib 1.2.x
uses malloc() by default for allocations, whereas earlier versions used
calloc(), which zeros out the allocated memory. Even though the code was
correct, versions 1.2.4 and later was changed to not stimulate these
checkers.
37. Will zlib read the (insert any ancient or arcane format here) compressed
data format?
Probably not. Look in the comp.compression FAQ for pointers to various
formats and associated software.
38. How can I encrypt/decrypt zip files with zlib?
zlib doesn't support encryption. The original PKZIP encryption is very
weak and can be broken with freely available programs. To get strong
encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
compression. For PKZIP compatible "encryption", look at
http://www.info-zip.org/
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
"gzip" is the gzip format, and "deflate" is the zlib format. They should
probably have called the second one "zlib" instead to avoid confusion with
the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
correctly points to the zlib specification in RFC 1950 for the "deflate"
transfer encoding, there have been reports of servers and browsers that
incorrectly produce or expect raw deflate data per the deflate
specification in RFC 1951, most notably Microsoft. So even though the
"deflate" transfer encoding using the zlib format would be the more
efficient approach (and in fact exactly what the zlib format was designed
for), using the "gzip" transfer encoding is probably more reliable due to
an unfortunate choice of name on the part of the HTTP 1.1 authors.
Bottom line: use the gzip format for HTTP 1.1 encoding.
40. Does zlib support the new "Deflate64" format introduced by PKWare?
No. PKWare has apparently decided to keep that format proprietary, since
they have not documented it as they have previous compression formats. In
any case, the compression improvements are so modest compared to other more
modern approaches, that it's not worth the effort to implement.
41. I'm having a problem with the zip functions in zlib, can you help?
There are no zip functions in zlib. You are probably using minizip by
Giles Vollant, which is found in the contrib directory of zlib. It is not
part of zlib. In fact none of the stuff in contrib is part of zlib. The
files in there are not supported by the zlib authors. You need to contact
the authors of the respective contribution for help.
42. The match.asm code in contrib is under the GNU General Public License.
Since it's part of zlib, doesn't that mean that all of zlib falls under the
GNU GPL?
No. The files in contrib are not part of zlib. They were contributed by
other authors and are provided as a convenience to the user within the zlib
distribution. Each item in contrib has its own license.
43. Is zlib subject to export controls? What is its ECCN?
zlib is not subject to export controls, and so is classified as EAR99.
44. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?
No. Go away. Shoo.

68
INDEX Normal file
View File

@@ -0,0 +1,68 @@
CMakeLists.txt cmake build file
ChangeLog history of changes
FAQ Frequently Asked Questions about zlib
INDEX this file
Makefile dummy Makefile that tells you to ./configure
Makefile.in template for Unix Makefile
README guess what
configure configure script for Unix
make_vms.com makefile for VMS
test/example.c zlib usages examples for build testing
test/minigzip.c minimal gzip-like functionality for build testing
test/infcover.c inf*.c code coverage for build coverage testing
treebuild.xml XML description of source file dependencies
zconf.h.cmakein zconf.h template for cmake
zconf.h.in zconf.h template for configure
zlib.3 Man page for zlib
zlib.3.pdf Man page in PDF format
zlib.map Linux symbol information
zlib.pc.in Template for pkg-config descriptor
zlib.pc.cmakein zlib.pc template for cmake
zlib2ansi perl script to convert source files for C++ compilation
amiga/ makefiles for Amiga SAS C
as400/ makefiles for AS/400
doc/ documentation for formats and algorithms
msdos/ makefiles for MSDOS
nintendods/ makefile for Nintendo DS
old/ makefiles for various architectures and zlib documentation
files that have not yet been updated for zlib 1.2.x
qnx/ makefiles for QNX
watcom/ makefiles for OpenWatcom
win32/ makefiles for Windows
zlib public header files (required for library use):
zconf.h
zlib.h
private source files used to build the zlib library:
adler32.c
compress.c
crc32.c
crc32.h
deflate.c
deflate.h
gzclose.c
gzguts.h
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inffast.h
inffixed.h
inflate.c
inflate.h
inftrees.c
inftrees.h
trees.c
trees.h
uncompr.c
zutil.c
zutil.h
source files for sample programs
See examples/README.examples
unsupported contributions by third parties
See contrib/README.contrib

130
LICENSE
View File

@@ -1,130 +0,0 @@
/*-
* $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.
*/

5
Makefile Normal file
View File

@@ -0,0 +1,5 @@
all:
-@echo "Please use ./configure first. Thank you."
distclean:
make -f Makefile.in distclean

410
Makefile.in Normal file
View File

@@ -0,0 +1,410 @@
# Makefile for zlib
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DZLIB_DEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.11
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar
ARFLAGS=rc
RANLIB=ranlib
LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
TAR=tar
SHELL=/bin/sh
EXE=
prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
sharedlibdir = ${libdir}
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
SRCDIR=
ZINC=
ZINCOUT=-I.
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
PIC_OBJA =
OBJS = $(OBJC) $(OBJA)
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
all: static shared
static: example$(EXE) minigzip$(EXE)
shared: examplesh$(EXE) minigzipsh$(EXE)
all64: example64$(EXE) minigzip64$(EXE)
check: test
test: all teststatic testshared
teststatic: static
@TMPST=tmpst_$$; \
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
fi; \
rm -f $$TMPST
testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
fi; \
rm -f $$TMPSH
test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \
rm -f $$TMP64
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
cover: infcover
rm -f *.gcda
./infcover
gcov inf*.c
libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S
$(CPP) match.S > _match.s
$(CC) -c _match.s
mv _match.o match.o
rm -f _match.s
match.lo: match.S
$(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.lo
rm -f _match.s
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
adler32.o: $(SRCDIR)adler32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
crc32.o: $(SRCDIR)crc32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
deflate.o: $(SRCDIR)deflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
infback.o: $(SRCDIR)infback.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
inffast.o: $(SRCDIR)inffast.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
inflate.o: $(SRCDIR)inflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
inftrees.o: $(SRCDIR)inftrees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
trees.o: $(SRCDIR)trees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
zutil.o: $(SRCDIR)zutil.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
compress.o: $(SRCDIR)compress.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
uncompr.o: $(SRCDIR)uncompr.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
gzclose.o: $(SRCDIR)gzclose.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
gzlib.o: $(SRCDIR)gzlib.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
gzread.o: $(SRCDIR)gzread.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
gzwrite.o: $(SRCDIR)gzwrite.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
adler32.lo: $(SRCDIR)adler32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
-@mv objs/adler32.o $@
crc32.lo: $(SRCDIR)crc32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
-@mv objs/crc32.o $@
deflate.lo: $(SRCDIR)deflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
-@mv objs/deflate.o $@
infback.lo: $(SRCDIR)infback.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
-@mv objs/infback.o $@
inffast.lo: $(SRCDIR)inffast.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
-@mv objs/inffast.o $@
inflate.lo: $(SRCDIR)inflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
-@mv objs/inflate.o $@
inftrees.lo: $(SRCDIR)inftrees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
-@mv objs/inftrees.o $@
trees.lo: $(SRCDIR)trees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
-@mv objs/trees.o $@
zutil.lo: $(SRCDIR)zutil.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
-@mv objs/zutil.o $@
compress.lo: $(SRCDIR)compress.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
-@mv objs/compress.o $@
uncompr.lo: $(SRCDIR)uncompr.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
-@mv objs/uncompr.o $@
gzclose.lo: $(SRCDIR)gzclose.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
-@mv objs/gzclose.o $@
gzlib.lo: $(SRCDIR)gzlib.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
-@mv objs/gzlib.o $@
gzread.lo: $(SRCDIR)gzread.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
-@mv objs/gzread.o $@
gzwrite.lo: $(SRCDIR)gzwrite.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
-@mv objs/gzwrite.o $@
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
-@rmdir objs
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
minigzip64$(EXE): minigzip64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
cp $(STATICLIB) $(DESTDIR)$(libdir)
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
-@if test -n "$(SHAREDLIBV)"; then \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
($(LDCONFIG) || true) >/dev/null 2>&1; \
fi
rm -f $(DESTDIR)$(man3dir)/zlib.3
cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
uninstall:
cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
cd $(DESTDIR)$(libdir) && rm -f libz.a; \
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
cd $(DESTDIR)$(man3dir) && rm -f zlib.3
cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
docs: zlib.3.pdf
zlib.3.pdf: $(SRCDIR)zlib.3
groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
zconf.h.cmakein: $(SRCDIR)zconf.h.in
-@ TEMPFILE=zconfh_$$; \
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
touch -r $(SRCDIR)zconf.h.in $@ &&\
rm $$TEMPFILE
zconf: $(SRCDIR)zconf.h.in
cp -p $(SRCDIR)zconf.h.in zconf.h
mostlyclean: clean
clean:
rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
example64$(EXE) minigzip64$(EXE) \
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
tags:
etags $(SRCDIR)*.[ch]
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h

120
README
View File

@@ -1,5 +1,115 @@
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.
ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.11 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
rfc1952 (gzip format).
All functions of the compression library are documented in the file zlib.h
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
of the library is given in the file test/example.c which also tests that
the library is working correctly. Another example is given in the file
test/minigzip.c. The compression library itself is composed of all source
files in the root directory.
To compile all files and run the test program, follow the instructions given at
the top of Makefile.in. In short "./configure; make test", and if that goes
well, "make install" should work for most flavors of Unix. For Windows, use
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
make_vms.com.
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
<info@winimage.com> for the Windows DLL version. The zlib home page is
http://zlib.net/ . Before reporting a problem, please check this site to
verify that you have the latest version of zlib; otherwise get the latest
version and check whether the problem still exists or not.
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .
The changes made in version 1.2.11 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
zlib is available in Java using the java.util.zip package, documented at
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
at CPAN (Comprehensive Perl Archive Network) sites, including
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
http://docs.python.org/library/zlib.html .
zlib is built into tcl: http://wiki.tcl.tk/4610 .
An experimental package to read and write files in .zip format, written on top
of zlib by Gilles Vollant <info@winimage.com>, is available in the
contrib/minizip directory of zlib.
Notes for some targets:
- For Windows DLL versions, please see win32/DLL_FAQ.txt
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
compiler flag). The compiler bug has been reported to SGI.
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler.
- gzdopen is not supported on RISCOS or BEOS.
- For PalmOs, see http://palmzlib.sourceforge.net/
Acknowledgments:
The deflate format used by zlib was defined by Phil Katz. The deflate and
zlib specifications were written by L. Peter Deutsch. Thanks to all the
people who reported problems and suggested various improvements in zlib; they
are too numerous to cite here.
Copyright notice:
(C) 1995-2017 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.
If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
the FAQ for more information on the distribution of modified source versions.

186
adler32.c Normal file
View File

@@ -0,0 +1,186 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2011, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* use NO_DIVIDE if your processor does not do division in hardware --
try it both ways to see which is faster */
#ifdef NO_DIVIDE
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
(thank you to John Reiser for pointing this out) */
# define CHOP(a) \
do { \
unsigned long tmp = a >> 16; \
a &= 0xffffUL; \
a += (tmp << 4) - tmp; \
} while (0)
# define MOD28(a) \
do { \
CHOP(a); \
if (a >= BASE) a -= BASE; \
} while (0)
# define MOD(a) \
do { \
CHOP(a); \
MOD28(a); \
} while (0)
# define MOD63(a) \
do { /* this assumes a is not negative */ \
z_off64_t tmp = a >> 32; \
a &= 0xffffffffL; \
a += (tmp << 8) - (tmp << 5) + tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
tmp = a >> 16; \
a &= 0xffffL; \
a += (tmp << 4) - tmp; \
if (a >= BASE) a -= BASE; \
} while (0)
#else
# define MOD(a) a %= BASE
# define MOD28(a) a %= BASE
# define MOD63(a) a %= BASE
#endif
/* ========================================================================= */
uLong ZEXPORT adler32_z(adler, buf, len)
uLong adler;
const Bytef *buf;
z_size_t len;
{
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
adler &= 0xffff;
/* in case user likes doing a byte at a time, keep it fast */
if (len == 1) {
adler += buf[0];
if (adler >= BASE)
adler -= BASE;
sum2 += adler;
if (sum2 >= BASE)
sum2 -= BASE;
return adler | (sum2 << 16);
}
/* initial Adler-32 value (deferred check for len == 1 speed) */
if (buf == Z_NULL)
return 1L;
/* in case short lengths are provided, keep it somewhat fast */
if (len < 16) {
while (len--) {
adler += *buf++;
sum2 += adler;
}
if (adler >= BASE)
adler -= BASE;
MOD28(sum2); /* only added so many BASE's */
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
len -= NMAX;
n = NMAX / 16; /* NMAX is divisible by 16 */
do {
DO16(buf); /* 16 sums unrolled */
buf += 16;
} while (--n);
MOD(adler);
MOD(sum2);
}
/* do remaining bytes (less than NMAX, still just one modulo) */
if (len) { /* avoid modulos if none remaining */
while (len >= 16) {
len -= 16;
DO16(buf);
buf += 16;
}
while (len--) {
adler += *buf++;
sum2 += adler;
}
MOD(adler);
MOD(sum2);
}
/* return recombined sums */
return adler | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
{
unsigned long sum1;
unsigned long sum2;
unsigned rem;
/* for negative len, return invalid adler32 as a clue for debugging */
if (len2 < 0)
return 0xffffffffUL;
/* the derivation of this formula is left as an exercise for the reader */
MOD63(len2); /* assumes len2 >= 0 */
rem = (unsigned)len2;
sum1 = adler1 & 0xffff;
sum2 = rem * sum1;
MOD(sum2);
sum1 += (adler2 & 0xffff) + BASE - 1;
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 >= BASE) sum1 -= BASE;
if (sum1 >= BASE) sum1 -= BASE;
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
if (sum2 >= BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
{
return adler32_combine_(adler1, adler2, len2);
}

69
amiga/Makefile.pup Normal file
View File

@@ -0,0 +1,69 @@
# Amiga powerUP (TM) Makefile
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
# Copyright (C) 1998 by Andreas R. Kleinert
LIBNAME = libzip.a
CC = scppc
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER
AR = ppc-amigaos-ar cr
RANLIB = ppc-amigaos-ranlib
LD = ppc-amigaos-ld -r
LDFLAGS = -o
LDLIBS = LIB:scppc.a LIB:end.o
RM = delete quiet
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
TEST_OBJS = example.o minigzip.o
all: example minigzip
check: test
test: all
example
echo hello world | minigzip | minigzip -d
$(LIBNAME): $(OBJS)
$(AR) $@ $(OBJS)
-$(RANLIB) $@
example: example.o $(LIBNAME)
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
minigzip: minigzip.o $(LIBNAME)
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
mostlyclean: clean
clean:
$(RM) *.o example minigzip $(LIBNAME) foo.gz
zip:
zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
descrip.mms *.[ch]
tgz:
cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zlib.h zconf.h
compress.o: zlib.h zconf.h
crc32.o: crc32.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzclose.o: zlib.h zconf.h gzguts.h
gzlib.o: zlib.h zconf.h gzguts.h
gzread.o: zlib.h zconf.h gzguts.h
gzwrite.o: zlib.h zconf.h gzguts.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
uncompr.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h

68
amiga/Makefile.sas Normal file
View File

@@ -0,0 +1,68 @@
# SMakefile for zlib
# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
# Osma Ahvenlampi <Osma.Ahvenlampi@hut.fi>
# Amiga, SAS/C 6.56 & Smake
CC=sc
CFLAGS=OPT
#CFLAGS=OPT CPU=68030
#CFLAGS=DEBUG=LINE
LDFLAGS=LIB z.lib
SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
DEF=POSTINC
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
TEST_OBJS = example.o minigzip.o
all: SCOPTIONS example minigzip
check: test
test: all
example
echo hello world | minigzip | minigzip -d
install: z.lib
copy clone zlib.h zconf.h INCLUDE:
copy clone z.lib LIB:
z.lib: $(OBJS)
oml z.lib r $(OBJS)
example: example.o z.lib
$(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
minigzip: minigzip.o z.lib
$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
mostlyclean: clean
clean:
-delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
SCOPTIONS: Makefile.sas
copy to $@ <from <
$(SCOPTIONS)
<
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zlib.h zconf.h
compress.o: zlib.h zconf.h
crc32.o: crc32.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzclose.o: zlib.h zconf.h gzguts.h
gzlib.o: zlib.h zconf.h gzguts.h
gzread.o: zlib.h zconf.h gzguts.h
gzwrite.o: zlib.h zconf.h gzguts.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
uncompr.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h

File diff suppressed because it is too large Load Diff

View File

@@ -1,213 +0,0 @@
/*-
* 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);
}

View File

@@ -1,95 +0,0 @@
/*-
* 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);
}

View File

@@ -1,596 +0,0 @@
/*-
* 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);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,644 +0,0 @@
/*-
* 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);
}

View File

@@ -1,509 +0,0 @@
/*-
* 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));
}

View File

@@ -1,621 +0,0 @@
/*-
* 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);
}

View File

@@ -1,916 +0,0 @@
/*-
* 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));
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,82 +0,0 @@
/*-
* 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);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,433 +0,0 @@
/*-
* 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);
}

View File

@@ -1,715 +0,0 @@
/*-
* 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);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,656 +0,0 @@
/*-
* 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);
}

View File

@@ -1,153 +0,0 @@
/*-
* 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);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,271 +0,0 @@
/*-
* 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,697 +0,0 @@
/* 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,628 +0,0 @@
# 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

View File

@@ -1,29 +0,0 @@
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>
{{{
}}}
###############################################################################

View File

@@ -1,588 +0,0 @@
#============================================================================
# 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

View File

@@ -1,150 +0,0 @@
/*-
* $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)

View File

@@ -1,274 +0,0 @@
/* 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,573 +0,0 @@
/* 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 */

View File

@@ -1,914 +0,0 @@
/* 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_ */

View File

@@ -1,188 +0,0 @@
/*-
* 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

View File

@@ -1,183 +0,0 @@
// 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

View File

@@ -1,274 +0,0 @@
/* 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,572 +0,0 @@
/* 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 */

View File

@@ -1,913 +0,0 @@
/* 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_ */

View File

@@ -1,3 +0,0 @@
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

@@ -1,29 +0,0 @@
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

@@ -1,29 +0,0 @@
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

@@ -1,29 +0,0 @@
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

@@ -1,29 +0,0 @@
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>

View File

@@ -1,276 +0,0 @@
/* 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,199 +0,0 @@
/*-
* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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

@@ -1,245 +0,0 @@
/*-
* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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>

View File

@@ -1,581 +0,0 @@
/* 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

@@ -1,581 +0,0 @@
/* 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 */

File diff suppressed because it is too large Load Diff

View File

@@ -1,249 +0,0 @@
/*-
* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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

@@ -1,481 +0,0 @@
/*-
* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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

@@ -1,879 +0,0 @@
/*-
* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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>

View File

@@ -1,916 +0,0 @@
/* 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

@@ -1,158 +0,0 @@
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

@@ -1,192 +0,0 @@
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

@@ -1,594 +0,0 @@
/*-
* 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

@@ -1,286 +0,0 @@
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>

View File

@@ -1,320 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_printlog22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_printlog22.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_printlog22.out
<END>
<BEGIN> BUILD_RULE_db_printlog22.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_$(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>

View File

@@ -1,328 +0,0 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_recover.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
void db_recover_feedback __P((DB_ENV *, int, int));
int db_recover_main __P((int, char *[]));
int db_recover_read_timestamp __P((char *, time_t *));
int db_recover_usage __P((void));
int db_recover_version_check __P((void));
const char *progname;
int newline_needed;
int
db_recover(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_recover", args, &argc, &argv);
return (db_recover_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_recover_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
time_t timestamp;
u_int32_t flags;
int ch, exitval, fatal_recover, ret, retain_env, set_feedback, verbose;
char *home, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_recover_version_check()) != 0)
return (ret);
home = passwd = NULL;
timestamp = 0;
exitval = fatal_recover = retain_env = set_feedback = verbose = 0;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "cefh:P:t:Vv")) != EOF)
switch (ch) {
case 'c':
fatal_recover = 1;
break;
case 'e':
retain_env = 1;
break;
case 'f':
set_feedback = 1;
break;
case 'h':
home = 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 ((ret = db_recover_read_timestamp(optarg, &timestamp)) != 0)
return (ret);
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'v':
verbose = 1;
break;
case '?':
default:
return (db_recover_usage());
}
argc -= optind;
argv += optind;
if (argc != 0)
return (db_recover_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));
return (EXIT_FAILURE);
}
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
if (set_feedback)
(void)dbenv->set_feedback(dbenv, db_recover_feedback);
if (verbose)
(void)dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, 1);
if (timestamp &&
(ret = dbenv->set_tx_timestamp(dbenv, &timestamp)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->set_timestamp");
goto shutdown;
}
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
goto shutdown;
}
/*
* Initialize the environment -- we don't actually do anything
* else, that all that's needed to run recovery.
*
* Note that unless the caller specified the -e option, we use a
* private environment, as we're about to create a region, and we
* don't want to to leave it around. If we leave the region around,
* the application that should create it will simply join it instead,
* and will then be running with incorrectly sized (and probably
* terribly small) caches. Applications that use -e should almost
* certainly use DB_CONFIG files in the directory.
*/
flags = 0;
LF_SET(DB_CREATE | DB_INIT_LOG |
DB_INIT_MPOOL | DB_INIT_TXN | DB_USE_ENVIRON);
LF_SET(fatal_recover ? DB_RECOVER_FATAL : DB_RECOVER);
LF_SET(retain_env ? DB_INIT_LOCK : DB_PRIVATE);
if ((ret = dbenv->open(dbenv, home, flags, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto shutdown;
}
if (0) {
shutdown: exitval = 1;
}
/* Flush to the next line of the output device. */
if (newline_needed)
printf("\n");
/* Clean up the environment. */
if ((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_recover_feedback --
* Provide feedback on recovery progress.
*/
void
db_recover_feedback(dbenv, opcode, percent)
DB_ENV *dbenv;
int opcode;
int percent;
{
COMPQUIET(dbenv, NULL);
if (opcode == DB_RECOVER) {
printf("\rrecovery %d%% complete", percent);
(void)fflush(stdout);
newline_needed = 1;
}
}
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
/*
* read_timestamp --
* Convert a time argument to Epoch seconds.
*
* Copyright (c) 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.
*/
int
db_recover_read_timestamp(arg, timep)
char *arg;
time_t *timep;
{
struct tm *t;
time_t now;
int yearset;
char *p;
/* Start with the current time. */
(void)time(&now);
if ((t = localtime(&now)) == NULL) {
fprintf(stderr,
"%s: localtime: %s\n", progname, strerror(errno));
return (EXIT_FAILURE);
}
/* [[CC]YY]MMDDhhmm[.SS] */
if ((p = strchr(arg, '.')) == NULL)
t->tm_sec = 0; /* Seconds defaults to 0. */
else {
if (strlen(p + 1) != 2)
goto terr;
*p++ = '\0';
t->tm_sec = ATOI2(p);
}
yearset = 0;
switch (strlen(arg)) {
case 12: /* CCYYMMDDhhmm */
t->tm_year = ATOI2(arg);
t->tm_year *= 100;
yearset = 1;
/* FALLTHROUGH */
case 10: /* YYMMDDhhmm */
if (yearset) {
yearset = ATOI2(arg);
t->tm_year += yearset;
} else {
yearset = ATOI2(arg);
if (yearset < 69)
t->tm_year = yearset + 2000;
else
t->tm_year = yearset + 1900;
}
t->tm_year -= 1900; /* Convert to UNIX time. */
/* FALLTHROUGH */
case 8: /* MMDDhhmm */
t->tm_mon = ATOI2(arg);
--t->tm_mon; /* Convert from 01-12 to 00-11 */
t->tm_mday = ATOI2(arg);
t->tm_hour = ATOI2(arg);
t->tm_min = ATOI2(arg);
break;
default:
goto terr;
}
t->tm_isdst = -1; /* Figure out DST. */
*timep = mktime(t);
if (*timep == -1) {
terr: fprintf(stderr,
"%s: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]",
progname);
return (EXIT_FAILURE);
}
return (0);
}
int
db_recover_usage()
{
(void)fprintf(stderr, "usage: %s %s\n", progname,
"[-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]");
return (EXIT_FAILURE);
}
int
db_recover_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

@@ -1,158 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_recover20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_recover20.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_recover20.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_recover.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_recover.c_dependencies
<END>
<BEGIN> FILE_db_recover.c_objects
db_recover.o
<END>
<BEGIN> FILE_db_recover.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_recover.c
<END>
<BEGIN> userComments
db_recover
<END>

View File

@@ -1,192 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_recover22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_recover22.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_recover22.out
<END>
<BEGIN> BUILD_RULE_db_recover22.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_recover.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_recover.c_dependencies
<END>
<BEGIN> FILE_db_recover.c_objects
db_recover.o
<END>
<BEGIN> FILE_db_recover.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_recover.c
<END>
<BEGIN> userComments
db_recover
<END>

View File

@@ -1,474 +0,0 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996,2008 Oracle. All rights reserved.
*
* $Id: db_stat.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
typedef enum { T_NOTSET, T_DB,
T_ENV, T_LOCK, T_LOG, T_MPOOL, T_MUTEX, T_REP, T_TXN } test_t;
int db_stat_db_init __P((DB_ENV *, char *, test_t, u_int32_t, int *));
int db_stat_main __P((int, char *[]));
int db_stat_usage __P((void));
int db_stat_version_check __P((void));
const char *progname;
int
db_stat(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("db_stat", args, &argc, &argv);
return (db_stat_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
db_stat_main(argc, argv)
int argc;
char *argv[];
{
extern char *optarg;
extern int optind, __db_getopt_reset;
DB_ENV *dbenv;
DB *dbp;
test_t ttype;
u_int32_t cache, flags;
int ch, exitval;
int nflag, private, resize, ret;
char *db, *home, *p, *passwd, *subdb;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
if ((ret = db_stat_version_check()) != 0)
return (ret);
dbenv = NULL;
dbp = NULL;
ttype = T_NOTSET;
cache = MEGABYTE;
exitval = flags = nflag = private = 0;
db = home = passwd = subdb = NULL;
__db_getopt_reset = 1;
while ((ch = getopt(argc,
argv, "C:cd:Eefgh:L:lM:mNP:R:rs:tVxX:Z")) != EOF)
switch (ch) {
case 'C': case 'c':
if (ttype != T_NOTSET && ttype != T_LOCK)
goto argcombo;
ttype = T_LOCK;
if (ch != 'c')
for (p = optarg; *p; ++p)
switch (*p) {
case 'A':
LF_SET(DB_STAT_ALL);
break;
case 'c':
LF_SET(DB_STAT_LOCK_CONF);
break;
case 'l':
LF_SET(DB_STAT_LOCK_LOCKERS);
break;
case 'm': /* Backward compatible. */
break;
case 'o':
LF_SET(DB_STAT_LOCK_OBJECTS);
break;
case 'p':
LF_SET(DB_STAT_LOCK_PARAMS);
break;
default:
return (db_stat_usage());
}
break;
case 'd':
if (ttype != T_NOTSET && ttype != T_DB)
goto argcombo;
ttype = T_DB;
db = optarg;
break;
case 'E': case 'e':
if (ttype != T_NOTSET && ttype != T_ENV)
goto argcombo;
ttype = T_ENV;
LF_SET(DB_STAT_SUBSYSTEM);
if (ch == 'E')
LF_SET(DB_STAT_ALL);
break;
case 'f':
if (ttype != T_NOTSET && ttype != T_DB)
goto argcombo;
ttype = T_DB;
LF_SET(DB_FAST_STAT);
break;
case 'h':
home = optarg;
break;
case 'L': case 'l':
if (ttype != T_NOTSET && ttype != T_LOG)
goto argcombo;
ttype = T_LOG;
if (ch != 'l')
for (p = optarg; *p; ++p)
switch (*p) {
case 'A':
LF_SET(DB_STAT_ALL);
break;
default:
return (db_stat_usage());
}
break;
case 'M': case 'm':
if (ttype != T_NOTSET && ttype != T_MPOOL)
goto argcombo;
ttype = T_MPOOL;
if (ch != 'm')
for (p = optarg; *p; ++p)
switch (*p) {
case 'A':
LF_SET(DB_STAT_ALL);
break;
case 'h':
LF_SET(DB_STAT_MEMP_HASH);
break;
case 'm': /* Backward compatible. */
break;
default:
return (db_stat_usage());
}
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': case 'r':
if (ttype != T_NOTSET && ttype != T_REP)
goto argcombo;
ttype = T_REP;
if (ch != 'r')
for (p = optarg; *p; ++p)
switch (*p) {
case 'A':
LF_SET(DB_STAT_ALL);
break;
default:
return (db_stat_usage());
}
break;
case 's':
if (ttype != T_NOTSET && ttype != T_DB)
goto argcombo;
ttype = T_DB;
subdb = optarg;
break;
case 't':
if (ttype != T_NOTSET) {
argcombo: fprintf(stderr,
"%s: illegal option combination\n",
progname);
return (db_stat_usage());
}
ttype = T_TXN;
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
return (EXIT_SUCCESS);
case 'X': case 'x':
if (ttype != T_NOTSET && ttype != T_MUTEX)
goto argcombo;
ttype = T_MUTEX;
if (ch != 'x')
for (p = optarg; *p; ++p)
switch (*p) {
case 'A':
LF_SET(DB_STAT_ALL);
break;
default:
return (db_stat_usage());
}
break;
case 'Z':
LF_SET(DB_STAT_CLEAR);
break;
case '?':
default:
return (db_stat_usage());
}
argc -= optind;
argv += optind;
switch (ttype) {
case T_DB:
if (db == NULL)
return (db_stat_usage());
break;
case T_ENV:
case T_LOCK:
case T_LOG:
case T_MPOOL:
case T_MUTEX:
case T_REP:
case T_TXN:
break;
case T_NOTSET:
return (db_stat_usage());
}
/* 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_stat_db_init(dbenv, home, ttype, cache, &private) != 0)
goto err;
switch (ttype) {
case T_DB:
/* Create the DB object and open the file. */
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
goto err;
}
/*
* We open the database for writing so we can update the cached
* statistics, but it's OK to fail, we can open read-only and
* proceed.
*
* Turn off error messages for now -- we can't open lots of
* databases read-write (for example, master databases and
* hash databases for which we don't know the hash function).
*/
dbenv->set_errfile(dbenv, NULL);
ret = dbp->open(dbp, NULL, db, subdb, DB_UNKNOWN, 0, 0);
dbenv->set_errfile(dbenv, stderr);
if (ret != 0 && (ret = dbp->open(
dbp, NULL, db, subdb, DB_UNKNOWN, DB_RDONLY, 0)) != 0) {
dbenv->err(dbenv, ret, "DB->open: %s", db);
goto err;
}
/* Check if cache is too small for this DB's pagesize. */
if (private) {
if ((ret = __db_util_cache(dbp, &cache, &resize)) != 0)
goto err;
if (resize) {
(void)dbp->close(dbp, DB_NOSYNC);
dbp = NULL;
(void)dbenv->close(dbenv, 0);
dbenv = NULL;
goto retry;
}
}
if (dbp->stat_print(dbp, flags))
goto err;
break;
case T_ENV:
if (dbenv->stat_print(dbenv, flags))
goto err;
break;
case T_LOCK:
if (dbenv->lock_stat_print(dbenv, flags))
goto err;
break;
case T_LOG:
if (dbenv->log_stat_print(dbenv, flags))
goto err;
break;
case T_MPOOL:
if (dbenv->memp_stat_print(dbenv, flags))
goto err;
break;
case T_MUTEX:
if (dbenv->mutex_stat_print(dbenv, flags))
goto err;
break;
case T_REP:
#ifdef HAVE_REPLICATION_THREADS
if (dbenv->repmgr_stat_print(dbenv, flags))
goto err;
#endif
if (dbenv->rep_stat_print(dbenv, flags))
goto err;
break;
case T_TXN:
if (dbenv->txn_stat_print(dbenv, flags))
goto err;
break;
case T_NOTSET:
dbenv->errx(dbenv, "Unknown statistics flag");
goto err;
}
if (0) {
err: exitval = 1;
}
if (dbp != NULL && (ret = dbp->close(dbp, DB_NOSYNC)) != 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_stat_db_init(dbenv, home, ttype, cache, is_private)
DB_ENV *dbenv;
char *home;
test_t ttype;
u_int32_t cache;
int *is_private;
{
u_int32_t oflags;
int ret;
/*
* If our environment open fails, and we're trying to look at a
* shared region, it's a hard failure.
*
* We will probably just drop core if the environment we join does
* not include a memory pool. This is probably acceptable; trying
* to use an existing environment that does not contain a memory
* pool to look at a database can be safely construed as operator
* error, I think.
*/
*is_private = 0;
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) == 0)
return (0);
if (ret == DB_VERSION_MISMATCH)
goto err;
if (ttype != T_DB && ttype != T_LOG) {
dbenv->err(dbenv, ret, "DB_ENV->open%s%s",
home == NULL ? "" : ": ", home == NULL ? "" : home);
return (1);
}
/*
* We're looking at a database or set of log files and no environment
* exists. Create one, but make it private so no files are actually
* created. Declare a reasonably large cache so that we don't fail
* when reporting statistics on large databases.
*
* An environment is required to look at databases because we may be
* trying to look at databases in directories other than the current
* one.
*/
if ((ret = dbenv->set_cachesize(dbenv, 0, cache, 1)) != 0) {
dbenv->err(dbenv, ret, "set_cachesize");
return (1);
}
*is_private = 1;
oflags = DB_CREATE | DB_PRIVATE | DB_USE_ENVIRON;
if (ttype == T_DB)
oflags |= DB_INIT_MPOOL;
if (ttype == T_LOG)
oflags |= DB_INIT_LOG;
if ((ret = dbenv->open(dbenv, home, oflags, 0)) == 0)
return (0);
/* An environment is required. */
err: dbenv->err(dbenv, ret, "DB_ENV->open");
return (1);
}
int
db_stat_usage()
{
fprintf(stderr, "usage: %s %s\n", progname,
"-d file [-fN] [-h home] [-P password] [-s database]");
fprintf(stderr, "usage: %s %s\n\t%s\n", progname,
"[-cEelmNrtVxZ] [-C Aclop]",
"[-h home] [-L A] [-M A] [-P password] [-R A] [-X A]");
return (EXIT_FAILURE);
}
int
db_stat_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

@@ -1,158 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
db_stat20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/db_stat20.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_stat20.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_stat.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_stat.c_dependencies
<END>
<BEGIN> FILE_db_stat.c_objects
db_stat.o
<END>
<BEGIN> FILE_db_stat.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_stat.c
<END>
<BEGIN> userComments
db_stat
<END>

View File

@@ -1,192 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
db_stat22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/db_stat22.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_stat22.out
<END>
<BEGIN> BUILD_RULE_db_stat22.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_stat.c_dependDone
FALSE
<END>
<BEGIN> FILE_db_stat.c_dependencies
<END>
<BEGIN> FILE_db_stat.c_objects
db_stat.o
<END>
<BEGIN> FILE_db_stat.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/db_stat.c
<END>
<BEGIN> userComments
db_stat
<END>

View File

@@ -1,39 +0,0 @@
This README describes the steps needed to run a demo example of BerkeleyDB.
1. Read the pages in the Reference Guide that describe building
BerkeleyDB on VxWorks:
$(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/intro.html
$(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/notes.html
$(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/faq.html
2. Launch Tornado 2.0 and open up the BerkeleyDB project.
3. Add the demo project to that workspace:
$(WIND_BASE)/target/src/BerkeleyDB/build_vxworks/demo/dbdemo.wpj
4. Build BerkeleyDB as described in the Reference Guide.
5. Build the dbdemo project.
6. Download BerkeleyDB onto the target.
7. Download the dbdemo project onto the target.
8. Open a windsh to the target and run the demo:
-> dbdemo "<pathname>/<dbname>"
Where pathname is a pathname string pointing to a directory that the
demo can create a database in. That directory should already exist.
The dbname is the name for the database. For example:
-> dbdemo "/tmp/demo.db"
9. The demo program will ask for input. You can type in any string.
The program will add an entry to the database with that string as
the key and the reverse of that string as the data item for that key.
It will continue asking for input until you hit ^D or enter "quit".
Upon doing so, the demo program will display all the keys you have
entered as input and their data items.

View File

@@ -1,177 +0,0 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997,2008 Oracle. All rights reserved.
*
* $Id: dbdemo.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
extern int getopt(int, char * const *, const char *);
#else
#include <unistd.h>
#endif
#include <db_config.h>
#include <db_int.h>
#define DATABASE "access.db"
int dbdemo_main __P((int, char *[]));
int dbdemo_usage __P((void));
int
dbdemo(args)
char *args;
{
int argc;
char **argv;
__db_util_arg("dbdemo", args, &argc, &argv);
return (dbdemo_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
}
#include <stdio.h>
#define ERROR_RETURN ERROR
int
dbdemo_main(argc, argv)
int argc;
char *argv[];
{
extern int optind, __db_getopt_reset;
DB *dbp;
DBC *dbcp;
DBT key, data;
size_t len;
int ch, ret, rflag;
char *database, *p, *t, buf[1024], rbuf[1024];
const char *progname = "dbdemo"; /* Program name. */
rflag = 0;
__db_getopt_reset = 1;
while ((ch = getopt(argc, argv, "r")) != EOF)
switch (ch) {
case 'r':
rflag = 1;
break;
case '?':
default:
return (dbdemo_usage());
}
argc -= optind;
argv += optind;
/* Accept optional database name. */
database = *argv == NULL ? DATABASE : argv[0];
/* Optionally discard the database. */
if (rflag)
(void)remove(database);
/* Create and initialize database object, open the database. */
if ((ret = db_create(&dbp, NULL, 0)) != 0) {
fprintf(stderr,
"%s: db_create: %s\n", progname, db_strerror(ret));
return (EXIT_FAILURE);
}
dbp->set_errfile(dbp, stderr);
dbp->set_errpfx(dbp, progname);
if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) {
dbp->err(dbp, ret, "set_pagesize");
goto err1;
}
if ((ret = dbp->set_cachesize(dbp, 0, 32 * 1024, 0)) != 0) {
dbp->err(dbp, ret, "set_cachesize");
goto err1;
}
if ((ret = dbp->open(dbp,
NULL, database, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
dbp->err(dbp, ret, "%s: open", database);
goto err1;
}
/*
* Insert records into the database, where the key is the user
* input and the data is the user input in reverse order.
*/
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
for (;;) {
printf("input> ");
fflush(stdout);
if (fgets(buf, sizeof(buf), stdin) == NULL)
break;
if (strcmp(buf, "exit\n") == 0 || strcmp(buf, "quit\n") == 0)
break;
if ((len = strlen(buf)) <= 1)
continue;
for (t = rbuf, p = buf + (len - 2); p >= buf;)
*t++ = *p--;
*t++ = '\0';
key.data = buf;
data.data = rbuf;
data.size = key.size = (u_int32_t)len - 1;
switch (ret =
dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) {
case 0:
break;
default:
dbp->err(dbp, ret, "DB->put");
if (ret != DB_KEYEXIST)
goto err1;
break;
}
}
printf("\n");
/* Acquire a cursor for the database. */
if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
dbp->err(dbp, ret, "DB->cursor");
goto err1;
}
/* Initialize the key/data pair so the flags aren't set. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
/* Walk through the database and print out the key/data pairs. */
while ((ret = dbcp->get(dbcp, &key, &data, DB_NEXT)) == 0)
printf("%.*s : %.*s\n",
(int)key.size, (char *)key.data,
(int)data.size, (char *)data.data);
if (ret != DB_NOTFOUND) {
dbp->err(dbp, ret, "DBcursor->get");
goto err2;
}
/* Close everything down. */
if ((ret = dbcp->close(dbcp)) != 0) {
dbp->err(dbp, ret, "DBcursor->close");
goto err1;
}
if ((ret = dbp->close(dbp, 0)) != 0) {
fprintf(stderr,
"%s: DB->close: %s\n", progname, db_strerror(ret));
return (EXIT_FAILURE);
}
return (EXIT_SUCCESS);
err2: (void)dbcp->close(dbcp);
err1: (void)dbp->close(dbp, 0);
return (EXIT_FAILURE);
}
int
dbdemo_usage()
{
(void)fprintf(stderr, "usage: ex_access [-r] [database]\n");
return (EXIT_FAILURE);
}

View File

@@ -1,158 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
dbdemo20.out
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
ar386
<END>
<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUMgnu/dbdemo20.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_dbdemo20.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_dbdemo.c_dependDone
FALSE
<END>
<BEGIN> FILE_dbdemo.c_dependencies
<END>
<BEGIN> FILE_dbdemo.c_objects
dbdemo.o
<END>
<BEGIN> FILE_dbdemo.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/dbdemo.c
<END>
<BEGIN> userComments
dbdemo
<END>

View File

@@ -1,192 +0,0 @@
Document file - DO NOT EDIT
<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
dbdemo22.out
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
arpentium
<END>
<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
$(PRJ_DIR)/PENTIUM2gnu/dbdemo22.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_dbdemo22.out
<END>
<BEGIN> BUILD_RULE_dbdemo22.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_dbdemo.c_dependDone
FALSE
<END>
<BEGIN> FILE_dbdemo.c_dependencies
<END>
<BEGIN> FILE_dbdemo.c_objects
dbdemo.o
<END>
<BEGIN> FILE_dbdemo.c_tool
C/C++ compiler
<END>
<BEGIN> PROJECT_FILES
$(PRJ_DIR)/dbdemo.c
<END>
<BEGIN> userComments
dbdemo
<END>

View File

@@ -1,61 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db_small", "db_small.vcproj", "{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db_static", "db_static.vcproj", "{4AB4958F-8DD0-49B5-8C02-014B5637C59A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wce_tpcb", "wce_tpcb.vcproj", "{F2CE670A-ABAE-414A-9A17-8079AB58613F}"
ProjectSection(ProjectDependencies) = postProject
{4AB4958F-8DD0-49B5-8C02-014B5637C59A} = {4AB4958F-8DD0-49B5-8C02-014B5637C59A}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4)
Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4)
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)
{6A2849DA-8F7C-4B50-BDAE-AE7752EF8213}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)
{4AB4958F-8DD0-49B5-8C02-014B5637C59A}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4)
{F2CE670A-ABAE-414A-9A17-8079AB58613F}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4)
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,56 +0,0 @@
Microsoft eMbedded Visual Tools Workspace File, Format Version 4.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "db_small"=.\db_small.vcp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "db_static"=.\db_static.vcp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "wce_tpcb"=.\wce_tpcb.vcp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name db_static
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,181 +0,0 @@
# Microsoft eMbedded Visual Tools Project File - Name="@project_name@" - Package Owner=<4>
# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
# ** DO NOT EDIT **
# TARGTYPE "Win32 (WCE ARMV4) Application" 0xa301
# TARGTYPE "Win32 (WCE emulator) Application" 0xa601
CFG=@project_name@ - Win32 (WCE emulator) 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 "@project_name@.vcn".
!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 "@project_name@.vcn" CFG="@project_name@ - Win32 (WCE emulator) Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "@project_name@ - Win32 (WCE emulator) Release" (based on "Win32 (WCE emulator) Application")
!MESSAGE "@project_name@ - Win32 (WCE emulator) Debug" (based on "Win32 (WCE emulator) Application")
!MESSAGE "@project_name@ - Win32 (WCE ARMV4) Release" (based on "Win32 (WCE ARMV4) Application")
!MESSAGE "@project_name@ - Win32 (WCE ARMV4) Debug" (based on "Win32 (WCE ARMV4) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP ATL_Project 2
!IF "$(CFG)" == "@project_name@ - Win32 (WCE emulator) Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "@lib_rel_dest@_EMU"
# PROP BASE Intermediate_Dir "@lib_rel_dest@_EMU/@project_name@"
# PROP BASE CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "@lib_rel_dest@_EMU"
# PROP Intermediate_Dir "@lib_rel_dest@_EMU/@project_name@"
# PROP CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "_i386_" /r
# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "_X86_" /d "x86" /d "_i386_" /r
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "i_386_" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /Gs8192 @extra_cppflags@ /GF /O2 /c
# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /I "." /I ".." /D "_i386_" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "__NO_SYSTEM_INCLUDES" /Gs8192 @extra_cppflags@ /GF /O2 /c
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 /libpath:"@lib_rel_dest@_EMU"
# ADD LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 /libpath:"@lib_rel_dest@_EMU"
!ELSEIF "$(CFG)" == "@project_name@ - Win32 (WCE emulator) Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "@lib_debug_dest@_EMU"
# PROP BASE Intermediate_Dir "@lib_debug_dest@_EMU\@project_name@"
# PROP BASE CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "@lib_debug_dest@_EMU"
# PROP Intermediate_Dir "@lib_debug_dest@_EMU\@project_name@"
# PROP CPU_ID "{32E52003-403E-442D-BE48-DE10F8C6131D}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "$(CePlatform)" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "_X86_" /d "x86" /d "_i386_" /r
# ADD RSC /l 0x409 /d "$(CePlatform)" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "_X86_" /d "x86" /d "_i386_" /r
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "_i386_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "i_386_" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /Gs8192 @extra_cppflags@ /GF /c
# ADD CPP /nologo /W3 /Zi /Od /I "." /I ".." /D "DEBUG" /D "_i386_" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "i_386_" /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "__NO_SYSTEM_INCLUDES" /Gs8192 @extra_cppflags@ /GF /c
# SUBTRACT CPP
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /subsystem:$(CESubsystem) /MACHINE:IX86 /libpath:"@lib_debug_dest@_EMU"
# ADD LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib $(CEx86Corelibc) /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /debug /nodefaultlib:"OLDNAMES.lib" /nodefaultlib:$(CENoDefaultLib) /out:"Debug_EMU/@project_name@.exe" /subsystem:$(CESubsystem) /MACHINE:IX86 /libpath:"@lib_debug_dest@_EMU"
!ELSEIF "$(CFG)" == "@project_name@ - Win32 (WCE ARMV4) Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "@lib_rel_dest@_ARMV4"
# PROP BASE Intermediate_Dir "Release_ARMV4/@project_name@"
# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "@lib_rel_dest@_ARMV4"
# PROP Intermediate_Dir "Release_ARMV4/@project_name@"
# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r
# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "NDEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r
CPP=clarm.exe
# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /O2 /M$(CECrtMT) @extra_cppflags@ /c
# ADD CPP /nologo /W3 /I "." /I ".." /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /O2 /M$(CECrtMT) @extra_cppflags@ /c
# SUBTRACT CPP
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM /libpath:"@lib_rel_dest@_ARMV4"
# ADD LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM /libpath:"@lib_rel_dest@_ARMV4"
!ELSEIF "$(CFG)" == "@project_name@ - Win32 (WCE ARMV4) Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "@lib_debug_dest@_ARMV4"
# PROP BASE Intermediate_Dir "Debug_ARMV4/@project_name@"
# PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "@lib_debug_dest@_ARMV4"
# PROP Intermediate_Dir "Debug_ARMV4/@project_name@"
# PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r
# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "DEBUG" /d "UNICODE" /d "_UNICODE" /d "$(CePlatform)" /d "ARM" /d "_ARM_" /d "ARMV4" /r
CPP=clarm.exe
# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) @extra_cppflags@ /c
# ADD CPP /nologo /W3 /Zi /Od /I "." /I ".." /D "DEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /M$(CECrtMTDebug) @extra_cppflags@ /c
# SUBTRACT CPP
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM /libpath:"@lib_debug_dest@_ARMV4"
# ADD LINK32 libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"WinMainCRTStartup" /debug /nodefaultlib:"$(CENoDefaultLib)" /subsystem:$(CESubsystem) /align:"4096" /MACHINE:ARM /libpath:"@lib_debug_dest@_ARMV4"
!ENDIF
# Begin Target
# Name "@project_name@ - Win32 (WCE emulator) Release"
# Name "@project_name@ - Win32 (WCE emulator) Debug"
# Name "@project_name@ - Win32 (WCE ARMV4) Release"
# Name "@project_name@ - Win32 (WCE ARMV4) Debug"
# Begin Group "Files"
@SOURCE_FILES@
# End Group
# End Target
# End Project

View File

@@ -1,433 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="@project_name@"
ProjectGUID="{@PROJ_GUID@}"
>
<Platforms>
<Platform
Name="Smartphone 2003 (ARMV4)"
/>
<Platform
Name="Pocket PC 2003 (ARMV4)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Smartphone 2003 (ARMV4)"
OutputDirectory="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@"
IntermediateDirectory="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories=".,.."
PreprocessorDefinitions="DEBUG;ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;__NO_SYSTEM_INCLUDES;@extra_cppflags@"
RuntimeLibrary="1"
PrecompiledHeaderFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.pch"
AssemblerListingLocation="$(ConfigurationName)_Smartphone2003_ARMV4/"
ObjectFile="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@/"
ProgramDataBaseFileName="$(ConfigurationName)_Smartphone2003_ARMV4/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/r "
PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),DEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
AdditionalDependencies="libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib secchk.lib ccrtrtti.lib"
OutputFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(ConfigurationName)_Smartphone2003_ARMV4"
IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.pdb"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="WinMainCRTStartup"
BaseAddress="0x00010000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.bsc"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Debug|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@"
IntermediateDirectory="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories=".,.."
PreprocessorDefinitions="DEBUG;ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;__NO_SYSTEM_INCLUDES;@extra_cppflags@"
RuntimeLibrary="1"
PrecompiledHeaderFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.pch"
AssemblerListingLocation="$(ConfigurationName)_PocketPC2003_ARMV4/"
ObjectFile="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@/"
ProgramDataBaseFileName="$(ConfigurationName)_PocketPC2003_ARMV4/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/r "
PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),DEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
AdditionalDependencies="libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@sd.lib commctrl.lib coredll.lib secchk.lib ccrtrtti.lib"
OutputFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(ConfigurationName)_PocketPC2003_ARMV4"
IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.pdb"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="WinMainCRTStartup"
BaseAddress="0x00010000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.bsc"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Smartphone 2003 (ARMV4)"
OutputDirectory="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@"
IntermediateDirectory="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".,.."
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;NDEBUG;__NO_SYSTEM_INCLUDES;@extra_cppflags@"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.pch"
AssemblerListingLocation="$(ConfigurationName)_Smartphone2003_ARMV4/"
ObjectFile="$(ConfigurationName)_Smartphone2003_ARMV4\@project_name@/"
ProgramDataBaseFileName="$(ConfigurationName)_Smartphone2003_ARMV4/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/r "
PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),NDEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
AdditionalDependencies="libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib secchk.lib ccrtrtti.lib"
OutputFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(ConfigurationName)_Smartphone2003_ARMV4"
IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
ProgramDatabaseFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.pdb"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="WinMainCRTStartup"
BaseAddress="0x00010000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(ConfigurationName)_Smartphone2003_ARMV4/@project_name@.bsc"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Pocket PC 2003 (ARMV4)"
OutputDirectory="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@"
IntermediateDirectory="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".,.."
PreprocessorDefinitions="_WIN32_WCE=$(CEVER);$(CePlatform);ARM;_ARM_;ARMV4;UNDER_CE=$(CEVER);UNICODE;NDEBUG;__NO_SYSTEM_INCLUDES;@extra_cppflags@"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.pch"
AssemblerListingLocation="$(ConfigurationName)_PocketPC2003_ARMV4/"
ObjectFile="$(ConfigurationName)_PocketPC2003_ARMV4\@project_name@/"
ProgramDataBaseFileName="$(ConfigurationName)_PocketPC2003_ARMV4/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/r "
PreprocessorDefinitions="UNDER_CE=$(CEVER),_WIN32_WCE=$(CEVER),NDEBUG,UNICODE,_UNICODE,$(CePlatform),ARM,_ARM_,ARMV4"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/ALIGN:4096 /subsystem:$(CESubsystem) /MACHINE:ARM "
AdditionalDependencies="libdb@DB_VERSION_MAJOR@@DB_VERSION_MINOR@s.lib commctrl.lib coredll.lib secchk.lib ccrtrtti.lib"
OutputFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="$(ConfigurationName)_PocketPC2003_ARMV4"
IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
ProgramDatabaseFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.pdb"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="WinMainCRTStartup"
BaseAddress="0x00010000"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile="$(ConfigurationName)_PocketPC2003_ARMV4/@project_name@.bsc"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Files"
>
@SOURCE_FILES@
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,276 +0,0 @@
/* 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 "%I64d"
#define UINT64_FMT "%I64u"
#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

File diff suppressed because it is too large Load Diff

View File

@@ -1,585 +0,0 @@
/* DO NOT EDIT: automatically built by dist/s_windows. */
/* 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. */
#define DB_WIN32 1
/* 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. */
#define HAVE_64BIT_TYPES 1
/* 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. */
#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. */
/* #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. */
#ifndef HAVE_SMALLBUILD
#define HAVE_CRYPTO 1
#endif
/* 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. */
#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. */
/* #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. */
/* #undef HAVE_GETCWD */
/* Define to 1 if you have the `getenv' function. */
/* #undef HAVE_GETENV */
/* Define to 1 if you have the `getgid' function. */
/* #undef HAVE_GETGID */
/* Define to 1 if you have the `getopt' function. */
/*
* Windows does not have the getopt function, but as Berkeley DB example
* programs require getopt, we handle it outside of this configuration.
*/
#define HAVE_GETOPT 1
/* Define to 1 if getopt supports the optreset variable. */
#define HAVE_GETOPT_OPTRESET 1
/* 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. */
#ifndef HAVE_SMALLBUILD
#define HAVE_HASH 1
#endif
/* 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 `localtime' function. */
/* #undef HAVE_LOCALTIME */
/* Define to 1 if you have the `isspace' function. */
#define HAVE_ISSPACE 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. */
/* #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. */
#define HAVE_MUTEX_WIN32 1
/* 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. */
#ifndef HAVE_SMALLBUILD
#define HAVE_QUEUE 1
#endif
/* 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. */
/* #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. */
/* #undef HAVE_SETGID */
/* 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. */
#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. */
/* #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. */
#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. */
/* #undef HAVE_STRDUP */
/* 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. */
#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'. */
/* #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. */
#define HAVE_SYS_STAT_H 1
/* 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. */
#define 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. */
#ifndef HAVE_SMALLBUILD
#define HAVE_VERIFY 1
#endif
/* 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. */
#define HAVE__FSTATI64 1
/* 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 __inline
#endif
/* type to use in place of socklen_t if not defined */
/* #undef socklen_t */

View File

@@ -1,913 +0,0 @@
/* DO NOT EDIT: automatically built by dist/s_windows. */
/*-
* 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_ */

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