1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-09 17:49:29 +03:00

lib/tdb: sync build files from samba master

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>

(This used to be ctdb commit 1d5c5a221c28f1dc652a80ed516a0f18ba588d9f)
This commit is contained in:
Stefan Metzmacher
2009-11-19 15:44:10 +01:00
parent 4576b9aae8
commit 42d131d951
23 changed files with 513 additions and 1244 deletions

View File

@ -12,6 +12,8 @@ libdir = @libdir@
VPATH = @srcdir@:@libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
sharedbuilddir = @sharedbuilddir@
INSTALLCMD = @INSTALL@
CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude
CFLAGS = $(CPPFLAGS) @CFLAGS@
LDFLAGS = @LDFLAGS@
@ -21,113 +23,52 @@ SHLD_FLAGS = @SHLD_FLAGS@
PACKAGE_VERSION = @PACKAGE_VERSION@
PICFLAG = @PICFLAG@
SHLIBEXT = @SHLIBEXT@
SWIG = swig
.PHONY: test
PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT)
PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT)
ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL)
PYTHON = @PYTHON@
PYTHON_CONFIG = @PYTHON_CONFIG@
PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@
PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@
PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@
LIB_PATH_VAR = @LIB_PATH_VAR@
tdbdir = @tdbdir@
TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
DIRS = bin common tools
SONAMEFLAG = @SONAMEFLAG@
VERSIONSCRIPT = @VERSIONSCRIPT@
EXPORTSFILE = @EXPORTSFILE@
SONAME = libtdb.$(SHLIBEXT).1
SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)
default: all
all: showflags dirs $(PROGS) $(SOLIB) libtdb.a
include $(tdbdir)/tdb.mk
include $(tdbdir)/rules.mk
showflags:
@echo 'tdb will be compiled with flags:'
@echo ' CFLAGS = $(CFLAGS)'
@echo ' CPPFLAGS = $(CPPFLAGS)'
@echo ' LDFLAGS = $(LDFLAGS)'
@echo ' LIBS = $(LIBS)'
all:: showflags dirs $(PROGS) $(TDB_SOLIB) libtdb.a $(PYTHON_BUILD_TARGET)
.SUFFIXES: .c .o
install:: all
$(TDB_SOLIB): $(TDB_OBJ)
$(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TDB_SONAME)
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
@$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/lib
${INSTALLCMD} -m 644 libtdb.a $(sharedbuilddir)/lib
${INSTALLCMD} -m 755 $(TDB_SOLIB) $(sharedbuilddir)/lib
ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/$(TDB_SONAME)
ln -sf $(TDB_SOLIB) $(sharedbuilddir)/lib/libtdb.so
${INSTALLCMD} -d $(sharedbuilddir)/include
${INSTALLCMD} -m 644 $(srcdir)/include/tdb.h $(sharedbuilddir)/include
dirs:
@mkdir -p $(DIRS)
check: test
install: all
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(includedir)
mkdir -p $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(libdir)/pkgconfig
cp $(PROGS) $(DESTDIR)$(bindir)
cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
cp libtdb.a $(SOLIB) $(DESTDIR)$(libdir)
test:: $(PYTHON_CHECK_TARGET)
installcheck:: test install
libtdb.a: $(TDB_OBJ)
ar -rv libtdb.a $(TDB_OBJ)
clean::
rm -f *.o *.a */*.o
rm -fr abi
libtdb.$(SHLIBEXT): $(SOLIB)
ln -fs $< $@
$(SONAME): $(SOLIB)
ln -fs $< $@
$(SOLIB): $(TDB_OBJ)
$(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(SONAME)
TDB_LIB = libtdb.a
bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm
bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb
bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb
bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb
bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb
test: bin/tdbtorture$(EXEEXT)
bin/tdbtorture$(EXEEXT)
installcheck: test install
clean:
rm -f $(ALL_PROGS) *.o *.a common/*.o tools/*.o tdb.pc
rm -f test.db test.tdb torture.tdb test.gdbm
rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT)
distclean: clean
rm -f *~ */*~
distclean:: clean
rm -f config.log config.status include/config.h config.cache
rm -f Makefile
realdistclean: distclean
realdistclean:: distclean
rm -f configure include/config.h.in
tdb_wrap.c tdb.py: tdb.i
$(SWIG) -O -Wall -python -keyword tdb.i
build-python: libtdb.$(SHLIBEXT) tdb_wrap.c tdb.py
./setup.py build
install-python:
./setup.py install --prefix=$(prefix)
check-python: build-python
# FIXME: Should be more portable:
LD_LIBRARY_PATH=. PYTHONPATH=.:build/lib.linux-i686-2.4 trial python/tests/simple.py
install-swig:
mkdir -p $(DESTDIR)`$(SWIG) -swiglib`
cp tdb.i $(DESTDIR)`$(SWIG) -swiglib`
clean-python:
./setup.py clean

View File

@ -9,8 +9,6 @@ autoheader $IPATHS || exit 1
rm -rf autom4te.cache
swig -O -Wall -python -keyword tdb.i # Ignore errors for now
echo "Now run ./configure and then make."
exit 0

View File

@ -0,0 +1,14 @@
AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
[ AC_ARG_WITH([shared-build-dir],
[AC_HELP_STRING([--with-shared-build-dir=DIR],
[temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
sharedbuilddir="$srcdir/sharedbuild"
if test x"$with_shared_build_dir" != x; then
sharedbuilddir=$with_shared_build_dir
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
fi
AC_SUBST(sharedbuilddir)
])

View File

@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2009-06-10'
timestamp='2009-04-27'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
| grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@ -656,7 +656,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@ -822,9 +822,6 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@ -885,17 +882,40 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
@ -927,7 +947,7 @@ EOF
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
@ -981,6 +1001,14 @@ EOF
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
@ -1046,7 +1074,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@ -1154,7 +1182,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)

View File

@ -1,59 +1,57 @@
################################################
# Start SUBSYSTEM LIBTDB
[LIBRARY::LIBTDB]
VERSION = 0.0.1
SO_VERSION = 0
DESCRIPTION = Trivial Database Library
OBJ_FILES = \
common/tdb.o common/dump.o common/io.o common/lock.o \
common/open.o common/traverse.o common/freelist.o \
common/error.o common/transaction.o
CFLAGS = -Ilib/tdb/include
PUBLIC_HEADERS = include/tdb.h
OUTPUT_TYPE = MERGED_OBJ
CFLAGS = -I$(tdbsrcdir)/include
#
# End SUBSYSTEM ldb
################################################
LIBTDB_OBJ_FILES = $(addprefix $(tdbsrcdir)/common/, \
tdb.o dump.o io.o lock.o \
open.o traverse.o freelist.o \
error.o transaction.o)
################################################
# Start BINARY tdbtool
[BINARY::tdbtool]
INSTALLDIR = BINDIR
OBJ_FILES= \
tools/tdbtool.o
PRIVATE_DEPENDENCIES = \
LIBTDB
# End BINARY tdbtool
################################################
tdbtool_OBJ_FILES = $(tdbsrcdir)/tools/tdbtool.o
################################################
# Start BINARY tdbtorture
[BINARY::tdbtorture]
INSTALLDIR = BINDIR
OBJ_FILES= \
tools/tdbtorture.o
PRIVATE_DEPENDENCIES = \
LIBTDB
# End BINARY tdbtorture
################################################
tdbtorture_OBJ_FILES = $(tdbsrcdir)/tools/tdbtorture.o
################################################
# Start BINARY tdbdump
[BINARY::tdbdump]
INSTALLDIR = BINDIR
OBJ_FILES= \
tools/tdbdump.o
PRIVATE_DEPENDENCIES = \
LIBTDB
# End BINARY tdbdump
################################################
tdbdump_OBJ_FILES = $(tdbsrcdir)/tools/tdbdump.o
################################################
# Start BINARY tdbbackup
[BINARY::tdbbackup]
INSTALLDIR = BINDIR
OBJ_FILES= \
tools/tdbbackup.o
PRIVATE_DEPENDENCIES = \
LIBTDB
# End BINARY tdbbackup
################################################
tdbbackup_OBJ_FILES = $(tdbsrcdir)/tools/tdbbackup.o

View File

@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2009-06-11'
timestamp='2009-04-17'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -153,9 +153,6 @@ case $os in
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@ -470,10 +467,6 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c90)
basic_machine=c90-cray
os=-unicos
@ -1267,7 +1260,7 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
@ -1620,7 +1613,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-cnk*|-aix*)
-aix*)
vendor=ibm
;;
-beos*)

View File

@ -2,14 +2,43 @@ AC_PREREQ(2.50)
AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
AC_DEFUN([SMB_ENABLE], [echo -n ""])
AC_INIT(tdb, 1.1.1)
AC_INIT(tdb, 1.1.6)
AC_CONFIG_SRCDIR([common/tdb.c])
AC_CONFIG_HEADER(include/config.h)
AC_LIBREPLACE_ALL_CHECKS
AC_LD_SONAMEFLAG
AC_LD_VERSIONSCRIPT
AC_LD_PICFLAG
AC_LD_SHLIBEXT
AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS
AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
m4_include(libtdb.m4)
AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python])
PYTHON_BUILD_TARGET="build-python"
PYTHON_INSTALL_TARGET="install-python"
PYTHON_CHECK_TARGET="check-python"
AC_SUBST(PYTHON_BUILD_TARGET)
AC_SUBST(PYTHON_INSTALL_TARGET)
AC_SUBST(PYTHON_CHECK_TARGET)
if test -z "$PYTHON_CONFIG"; then
PYTHON_BUILD_TARGET=""
PYTHON_INSTALL_TARGET=""
PYTHON_CHECK_TARGET=""
fi
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python], [Enables python binding]),
[ if test "x$enableval" = "xno" ; then
PYTHON_BUILD_TARGET=""
PYTHON_INSTALL_TARGET=""
PYTHON_CHECK_TARGET=""
fi
])
m4_include(build_macros.m4)
BUILD_WITH_SHARED_BUILD_DIR
AC_OUTPUT(Makefile tdb.pc)

View File

@ -1,708 +0,0 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* Whether strndup is broken */
#undef BROKEN_STRNDUP
/* Whether strnlen is broken */
#undef BROKEN_STRNLEN
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Whether the bool type is available */
#undef HAVE_BOOL
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Whether there is a C99 compliant vsnprintf */
#undef HAVE_C99_VSNPRINTF
/* Define to 1 if you have the `chroot' function. */
#undef HAVE_CHROOT
/* Define to 1 if you have the `chsize' function. */
#undef HAVE_CHSIZE
/* Whether or not we have comparison_fn_t */
#undef HAVE_COMPARISON_FN_T
/* Define to 1 if you have the <compat.h> header file. */
#undef HAVE_COMPAT_H
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
don't. */
#undef HAVE_DECL_ASPRINTF
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VASPRINTF
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VSNPRINTF
/* Define to 1 if you have the <direct.h> header file. */
#undef HAVE_DIRECT_H
/* 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 `dlclose' function. */
#undef HAVE_DLCLOSE
/* Define to 1 if you have the `dlerror' function. */
#undef HAVE_DLERROR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `dlopen' function. */
#undef HAVE_DLOPEN
/* Define to 1 if you have the `dlsym' function. */
#undef HAVE_DLSYM
/* Define to 1 if you have the `endnetgrent' function. */
#undef HAVE_ENDNETGRENT
/* Whether errno() is available */
#undef HAVE_ERRNO_DECL
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* Whether there is a __FUNCTION__ macro */
#undef HAVE_FUNCTION_MACRO
/* Define to 1 if you have the `getdents' function. */
#undef HAVE_GETDENTS
/* Define to 1 if you have the `getdirentries' function. */
#undef HAVE_GETDIRENTRIES
/* Define to 1 if you have the `getnetgrent' function. */
#undef HAVE_GETNETGRENT
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP
/* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Whether the compiler supports immediate structures */
#undef HAVE_IMMEDIATE_STRUCTURES
/* Define to 1 if you have the `initgroups' function. */
#undef HAVE_INITGROUPS
/* Define to 1 if you have the `innetgr' function. */
#undef HAVE_INNETGR
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if the system has the type `long long'. */
#undef HAVE_LONG_LONG
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define if target mkdir supports mode option */
#undef HAVE_MKDIR_MODE
/* Define to 1 if you have the `mkdtemp' function. */
#undef HAVE_MKDTEMP
/* Define to 1 if you have the `mktime' function. */
#undef HAVE_MKTIME
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
/* 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 <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <netinet/in_ip.h> header file. */
#undef HAVE_NETINET_IN_IP_H
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
#undef HAVE_NETINET_IN_SYSTM_H
/* Define to 1 if you have the <netinet/ip.h> header file. */
#undef HAVE_NETINET_IP_H
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* usability of net/if.h */
#undef HAVE_NET_IF_H
/* Whether the open(2) accepts O_DIRECT */
#undef HAVE_OPEN_O_DIRECT
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
/* Whether pread() is available */
#undef HAVE_PREAD_DECL
/* Define to 1 if you have the `printf' function. */
#undef HAVE_PRINTF
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
/* Whether pwrite() is available */
#undef HAVE_PWRITE_DECL
/* Define to 1 if you have the `rand' function. */
#undef HAVE_RAND
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
/* Define to 1 if you have the `rename' function. */
#undef HAVE_RENAME
/* Whether mkstemp is secure */
#undef HAVE_SECURE_MKSTEMP
/* Define to 1 if you have the `setbuffer' function. */
#undef HAVE_SETBUFFER
/* Define to 1 if you have the `setegid' function. */
#undef HAVE_SETEGID
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `seteuid' function. */
#undef HAVE_SETEUID
/* Define to 1 if you have the <setjmp.h> header file. */
#undef HAVE_SETJMP_H
/* Define to 1 if you have the `setlinebuf' function. */
#undef HAVE_SETLINEBUF
/* Define to 1 if you have the `setnetgrent' function. */
#undef HAVE_SETNETGRENT
/* Define to 1 if you have the `setresgid' function. */
#undef HAVE_SETRESGID
/* Whether setresgid() is available */
#undef HAVE_SETRESGID_DECL
/* Define to 1 if you have the `setresuid' function. */
#undef HAVE_SETRESUID
/* Whether setresuid() is available */
#undef HAVE_SETRESUID_DECL
/* Define to 1 if you have the <shadow.h> header file. */
#undef HAVE_SHADOW_H
/* Whether we have the atomic_t variable type */
#undef HAVE_SIG_ATOMIC_T_TYPE
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the `socketpair' function. */
#undef HAVE_SOCKETPAIR
/* Define to 1 if you have the `srand' function. */
#undef HAVE_SRAND
/* Define to 1 if you have the `srandom' function. */
#undef HAVE_SRANDOM
/* Define to 1 if you have the <standards.h> header file. */
#undef HAVE_STANDARDS_H
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasestr' function. */
#undef HAVE_STRCASESTR
/* 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. */
#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 `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define to 1 if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
/* Define to 1 if you have the `strtoll' function. */
#undef HAVE_STRTOLL
/* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
/* Define to 1 if you have the `strtouq' function. */
#undef HAVE_STRTOUQ
/* Define to 1 if `st_rdev' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#undef HAVE_ST_RDEV
/* Define to 1 if you have the `syslog' function. */
#undef HAVE_SYSLOG
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/acl.h> header file. */
#undef HAVE_SYS_ACL_H
/* Define to 1 if you have the <sys/capability.h> header file. */
#undef HAVE_SYS_CAPABILITY_H
/* 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/fcntl.h> header file. */
#undef HAVE_SYS_FCNTL_H
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define to 1 if you have the <sys/filsys.h> header file. */
#undef HAVE_SYS_FILSYS_H
/* Define to 1 if you have the <sys/fs/s5param.h> header file. */
#undef HAVE_SYS_FS_S5PARAM_H
/* Define to 1 if you have the <sys/id.h> header file. */
#undef HAVE_SYS_ID_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/ipc.h> header file. */
#undef HAVE_SYS_IPC_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/mode.h> header file. */
#undef HAVE_SYS_MODE_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/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/priv.h> header file. */
#undef HAVE_SYS_PRIV_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/security.h> header file. */
#undef HAVE_SYS_SECURITY_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/shm.h> header file. */
#undef HAVE_SYS_SHM_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/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_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/syslog.h> header file. */
#undef HAVE_SYS_SYSLOG_H
/* Define to 1 if you have the <sys/termio.h> header file. */
#undef HAVE_SYS_TERMIO_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 <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define to 1 if you have the <vararg.h> header file. */
#undef HAVE_VARARG_H
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Whether va_copy() is available */
#undef HAVE_VA_COPY
/* Whether the C compiler understands volatile */
#undef HAVE_VOLATILE
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the `vsyslog' function. */
#undef HAVE_VSYSLOG
/* Define to 1 if you have the `waitpid' function. */
#undef HAVE_WAITPID
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H
/* Define to 1 if you have the <ws2tcpip.h> header file. */
#undef HAVE_WS2TCPIP_H
/* Whether the _Bool type is available */
#undef HAVE__Bool
/* Whether the __VA_ARGS__ macro is available */
#undef HAVE__VA_ARGS__MACRO
/* Define to 1 if you have the `__strtoll' function. */
#undef HAVE___STRTOLL
/* Define to 1 if you have the `__strtoull' function. */
#undef HAVE___STRTOULL
/* Whether __va_copy() is available */
#undef HAVE___VA_COPY
/* Whether there is a __func__ macro */
#undef HAVE_func_MACRO
/* Whether MMAP is broken */
#undef MMAP_BLACKLIST
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Whether getpass should be replaced */
#undef REPLACE_GETPASS
/* Whether inet_ntoa should be replaced */
#undef REPLACE_INET_NTOA
/* replace readdir */
#undef REPLACE_READDIR
/* replace readdir using getdents() */
#undef REPLACE_READDIR_GETDENTS
/* replace readdir using getdirentries() */
#undef REPLACE_READDIR_GETDIRENTRIES
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Whether seekdir returns an int */
#undef SEEKDIR_RETURNS_INT
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* The size of `ssize_t', as computed by sizeof. */
#undef SIZEOF_SSIZE_T
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Whether telldir takes a const pointer */
#undef TELLDIR_TAKES_CONST_DIR
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
#ifndef _OSF_SOURCE
# define _OSF_SOURCE 1
#endif
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Whether to enable POSIX support */
#undef _POSIX_C_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Whether to enable System V compatibility */
#undef _SYSV
#ifndef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
#endif
/* Enable extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* 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
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef ino_t
/* Define to `short' if <sys/types.h> does not define. */
#undef int16_t
/* Define to `long' if <sys/types.h> does not define. */
#undef int32_t
/* Define to `long long' if <sys/types.h> does not define. */
#undef int64_t
/* Define to `char' if <sys/types.h> does not define. */
#undef int8_t
/* Define to `unsigned long long' if <sys/types.h> does not define. */
#undef intptr_t
/* Define to `off_t' if <sys/types.h> does not define. */
#undef loff_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `loff_t' if <sys/types.h> does not define. */
#undef offset_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned long long' if <sys/types.h> does not define. */
#undef ptrdiff_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Socket length type */
#undef socklen_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define to `unsigned short' if <sys/types.h> does not define. */
#undef uint16_t
/* Define to `unsigned long' if <sys/types.h> does not define. */
#undef uint32_t
/* Define to `unsigned long long' if <sys/types.h> does not define. */
#undef uint64_t
/* Define to `unsigned char' if <sys/types.h> does not define. */
#undef uint8_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef uint_t

View File

@ -30,6 +30,7 @@
extern "C" {
#endif
#include "signal.h"
/* flags to tdb_store() */
#define TDB_REPLACE 1 /* Unused */

View File

@ -1,9 +1,9 @@
dnl find the tdb sources. This is meant to work both for
dnl tdb standalone builds, and builds of packages using tdb
tdbdir=""
tdbpaths="$srcdir $srcdir/lib/tdb $srcdir/tdb $srcdir/../tdb"
tdbpaths=". lib/tdb tdb ../tdb ../lib/tdb"
for d in $tdbpaths; do
if test -f "$d/common/tdb.c"; then
if test -f "$srcdir/$d/common/tdb.c"; then
tdbdir="$d"
AC_SUBST(tdbdir)
break;
@ -28,3 +28,8 @@ AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h)
AC_HAVE_DECL(pread, [#include <unistd.h>])
AC_HAVE_DECL(pwrite, [#include <unistd.h>])
if test x"$VERSIONSCRIPT" != "x"; then
EXPORTSFILE=tdb.exports
AC_SUBST(EXPORTSFILE)
fi

View File

@ -1,8 +1,6 @@
[PYTHON::swig_tdb]
[PYTHON::pytdb]
LIBRARY_REALNAME = tdb.$(SHLIBEXT)
PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG
swig_tdb_OBJ_FILES = $(tdbsrcdir)/pytdb.o
$(swig_tdb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL)
pytdb_OBJ_FILES = $(tdbsrcdir)/pytdb.o

48
ctdb/lib/tdb/release-script.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
if [ "$1" = "" ]; then
echo "Please provide version string, eg: 1.2.0"
exit 1
fi
if [ ! -d "lib/tdb" ]; then
echo "Run this script from the samba base directory."
exit 1
fi
git clean -f -x -d lib/tdb
git clean -f -x -d lib/replace
curbranch=`git-branch |grep "^*" | tr -d "* "`
version=$1
strver=`echo ${version} | tr "." "-"`
# Checkout the release tag
git branch -f tdb-release-script-${strver} tdb-${strver}
if [ ! "$?" = "0" ]; then
echo "Unable to checkout tdb-${strver} release"
exit 1
fi
git checkout tdb-release-script-${strver}
# Test configure agrees with us
confver=`grep "^AC_INIT" lib/tdb/configure.ac | tr -d "AC_INIT(tdb, " | tr -d ")"`
if [ ! "$confver" = "$version" ]; then
echo "Wrong version, requested release for ${version}, found ${confver}"
exit 1
fi
# Now build tarball
cp -a lib/tdb tdb-${version}
cp -a lib/replace tdb-${version}/libreplace
pushd tdb-${version}
./autogen.sh
popd
tar cvzf tdb-${version}.tar.gz tdb-${version}
rm -fr tdb-${version}
#Clean up
git checkout $curbranch
git branch -d tdb-release-script-${strver}

16
ctdb/lib/tdb/rules.mk Normal file
View File

@ -0,0 +1,16 @@
showflags::
@echo 'tdb will be compiled with flags:'
@echo ' CFLAGS = $(CFLAGS)'
@echo ' CPPFLAGS = $(CPPFLAGS)'
@echo ' LDFLAGS = $(LDFLAGS)'
@echo ' LIBS = $(LIBS)'
.SUFFIXES: .c .o
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
@$(CC) $(PICFLAG) $(CFLAGS) $(ABI_CHECK) -c $< -o $@
distclean::
rm -f *~ */*~

View File

@ -0,0 +1,35 @@
#!/bin/bash
make clean
mkdir -p abi/common
mkdir -p abi/tools
ABI_CHECKS="-aux-info abi/\$@.X"
make ABI_CHECK="$ABI_CHECKS" CC="/usr/bin/gcc"
for i in abi/*/*.X; do cat $i | grep 'tdb\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' | sort > abi/signatures
grep '^extern' include/tdb.h | grep -v '"C"' | sort | uniq | awk -F "extern " '{ print $2 }' >> abi/signatures
cat > abi/exports << EOF
{
global:
EOF
#Functions
cat abi/signatures | grep "(" | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
#global vars
cat abi/signatures | grep -v "(" | awk -F ';' '{print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
cat >> abi/exports << EOF
local: *;
};
EOF
diff -u tdb.signatures abi/signatures
if [ "$?" != "0" ]; then
echo "WARNING: Possible ABI Change!!"
fi
diff -u tdb.exports abi/exports
if [ "$?" != "0" ]; then
echo "WARNING: Export file may be outdated!!"
fi

View File

@ -1,116 +0,0 @@
"""Provide a more Pythonic and object-oriented interface to tdb."""
#
# Swig interface to Samba
#
# Copyright (C) Tim Potter 2006
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import os
from tdb import *
# Open flags
DEFAULT = TDB_DEFAULT
CLEAR_IF_FIRST = TDB_CLEAR_IF_FIRST
INTERNAL = TDB_INTERNAL
NOLOCK = TDB_NOLOCK
NOMMAP = TDB_NOMMAP
# Class representing a TDB file
class Tdb:
# Create and destroy Tdb objects
def __init__(self, name, hash_size = 0, flags = TDB_DEFAULT,
open_flags = os.O_RDWR | os.O_CREAT, mode = 0600):
self.tdb = tdb_open(name, hash_size, flags, open_flags, mode)
if self.tdb is None:
raise IOError, tdb_errorstr(self.tdb)
def __del__(self):
self.close()
def close(self):
if hasattr(self, 'tdb') and self.tdb is not None:
if tdb_close(self.tdb) == -1:
raise IOError, tdb_errorstr(self.tdb)
self.tdb = None
# Random access to keys, values
def __getitem__(self, key):
result = tdb_fetch(self.tdb, key)
if result is None:
raise KeyError, '%s: %s' % (key, tdb_errorstr(self.tdb))
return result
def __setitem__(self, key, item):
if tdb_store(self.tdb, key, item) == -1:
raise IOError, tdb_errorstr(self.tdb)
def __delitem__(self, key):
if not tdb_exists(self.tdb, key):
raise KeyError, '%s: %s' % (key, tdb_errorstr(self.tdb))
tdb_delete(self.tdb, key)
def has_key(self, key):
return tdb_exists(self.tdb, key)
# Tdb iterator
class TdbIterator:
def __init__(self, tdb):
self.tdb = tdb
self.key = None
def __iter__(self):
return self
def next(self):
if self.key is None:
self.key = tdb_firstkey(self.tdb)
if self.key is None:
raise StopIteration
return self.key
else:
self.key = tdb_nextkey(self.tdb, self.key)
if self.key is None:
raise StopIteration
return self.key
def __iter__(self):
return Tdb.TdbIterator(self.tdb)
# Implement other dict functions using TdbIterator
def keys(self):
return [k for k in iter(self)]
def values(self):
return [self[k] for k in iter(self)]
def items(self):
return [(k, self[k]) for k in iter(self)]
def __len__(self):
return len(self.keys())
def clear(self):
for k in iter(self):
del(self[k])

View File

@ -1,167 +0,0 @@
/*
Unix SMB/CIFS implementation.
Swig interface to tdb.
Copyright (C) 2004,2005 Tim Potter <tpot@samba.org>
** NOTE! The following LGPL license applies to the tdb
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
%module tdb
%{
/* This symbol is used in both includes.h and Python.h which causes an
annoying compiler warning. */
#ifdef HAVE_FSTAT
#undef HAVE_FSTAT
#endif
#if (__GNUC__ >= 3)
/** Use gcc attribute to check printf fns. a1 is the 1-based index of
* the parameter containing the format, and a2 the index of the first
* argument. Note that some gcc 2.x versions don't handle this
* properly **/
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
#else
#define PRINTF_ATTRIBUTE(a1, a2)
#endif
/* Include tdb headers */
#include "lib/tdb/include/tdb.h"
%}
/* The tdb functions will crash if a NULL tdb context is passed */
%include exception.i
%typemap(check) TDB_CONTEXT* {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError,
"tdb context must be non-NULL");
}
/* In and out typemaps for the TDB_DATA structure. This is converted to
and from the Python string type which can contain arbitrary binary
data.. */
%typemap(in) TDB_DATA {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
$1.dsize = PyString_Size($input);
$1.dptr = PyString_AsString($input);
}
%typemap(out) TDB_DATA {
if ($1.dptr == NULL && $1.dsize == 0) {
$result = Py_None;
} else {
$result = PyString_FromStringAndSize($1.dptr, $1.dsize);
free($1.dptr);
}
}
/* Treat a mode_t as an unsigned integer */
typedef int mode_t;
/* flags to tdb_store() */
#define TDB_REPLACE 1
#define TDB_INSERT 2
#define TDB_MODIFY 3
/* flags for tdb_open() */
#define TDB_DEFAULT 0 /* just a readability place holder */
#define TDB_CLEAR_IF_FIRST 1
#define TDB_INTERNAL 2 /* don't store on disk */
#define TDB_NOLOCK 4 /* don't do any locking */
#define TDB_NOMMAP 8 /* don't use mmap */
#define TDB_CONVERT 16 /* convert endian (internal use) */
#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
/* Throw an IOError exception if tdb_open() or tdb_open_ex() returns NULL */
%exception {
$action
if (result == NULL) {
PyErr_SetFromErrno(PyExc_IOError);
SWIG_fail;
}
}
TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode);
TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode,
tdb_log_func log_fn,
tdb_hash_func hash_fn);
%exception;
int tdb_reopen(TDB_CONTEXT *tdb);
int tdb_reopen_all(int parent_longlived);
void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func);
enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb);
const char *tdb_errorstr(TDB_CONTEXT *tdb);
TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag = TDB_REPLACE);
int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf);
int tdb_close(TDB_CONTEXT *tdb);
TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb);
TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state);
int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_lockall(TDB_CONTEXT *tdb);
void tdb_unlockall(TDB_CONTEXT *tdb);
/* Low level locking functions: use with care */
int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);
/* Debug functions. Not used in production. */
void tdb_dump_all(TDB_CONTEXT *tdb);
int tdb_printfreelist(TDB_CONTEXT *tdb);

View File

@ -1,95 +0,0 @@
# This file was created automatically by SWIG 1.3.28.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _tdb
import new
new_instancemethod = new.instancemethod
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'PySwigObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static) or hasattr(self,name):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own()
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
import types
try:
_object = types.ObjectType
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
del types
TDB_REPLACE = _tdb.TDB_REPLACE
TDB_INSERT = _tdb.TDB_INSERT
TDB_MODIFY = _tdb.TDB_MODIFY
TDB_DEFAULT = _tdb.TDB_DEFAULT
TDB_CLEAR_IF_FIRST = _tdb.TDB_CLEAR_IF_FIRST
TDB_INTERNAL = _tdb.TDB_INTERNAL
TDB_NOLOCK = _tdb.TDB_NOLOCK
TDB_NOMMAP = _tdb.TDB_NOMMAP
TDB_CONVERT = _tdb.TDB_CONVERT
TDB_BIGENDIAN = _tdb.TDB_BIGENDIAN
open = _tdb.open
open_ex = _tdb.open_ex
reopen = _tdb.reopen
reopen_all = _tdb.reopen_all
logging_function = _tdb.logging_function
error = _tdb.error
errorstr = _tdb.errorstr
fetch = _tdb.fetch
delete = _tdb.delete
store = _tdb.store
append = _tdb.append
close = _tdb.close
firstkey = _tdb.firstkey
nextkey = _tdb.nextkey
traverse = _tdb.traverse
exists = _tdb.exists
lockall = _tdb.lockall
unlockall = _tdb.unlockall
chainlock = _tdb.chainlock
chainunlock = _tdb.chainunlock
dump_all = _tdb.dump_all
printfreelist = _tdb.printfreelist

65
ctdb/lib/tdb/tdb.exports Normal file
View File

@ -0,0 +1,65 @@
{
global:
tdb_add_flags;
tdb_append;
tdb_chainlock;
tdb_chainlock_mark;
tdb_chainlock_nonblock;
tdb_chainlock_read;
tdb_chainlock_unmark;
tdb_chainunlock;
tdb_chainunlock_read;
tdb_check;
tdb_close;
tdb_delete;
tdb_dump_all;
tdb_enable_seqnum;
tdb_error;
tdb_errorstr;
tdb_exists;
tdb_fd;
tdb_fetch;
tdb_firstkey;
tdb_freelist_size;
tdb_get_flags;
tdb_get_logging_private;
tdb_get_seqnum;
tdb_hash_size;
tdb_increment_seqnum_nonblock;
tdb_lockall;
tdb_lockall_mark;
tdb_lockall_nonblock;
tdb_lockall_read;
tdb_lockall_read_nonblock;
tdb_lockall_unmark;
tdb_log_fn;
tdb_map_size;
tdb_name;
tdb_nextkey;
tdb_open;
tdb_open_ex;
tdb_parse_record;
tdb_printfreelist;
tdb_remove_flags;
tdb_reopen;
tdb_reopen_all;
tdb_repack;
tdb_setalarm_sigptr;
tdb_set_logging_function;
tdb_set_max_dead;
tdb_store;
tdb_transaction_cancel;
tdb_transaction_commit;
tdb_transaction_prepare_commit;
tdb_transaction_recover;
tdb_transaction_start;
tdb_traverse;
tdb_traverse_read;
tdb_unlockall;
tdb_unlockall_read;
tdb_validate_freelist;
tdb_wipe_all;
tdb_null;
local: *;
};

89
ctdb/lib/tdb/tdb.mk Normal file
View File

@ -0,0 +1,89 @@
dirs::
@mkdir -p bin common tools
PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT)
PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT)
ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL)
TDB_SONAME = libtdb.$(SHLIBEXT).1
TDB_SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)
TDB_STLIB = libtdb.a
TDB_LIB = $(TDB_STLIB)
bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm
bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb
bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb
bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb
bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb
test:: abi_checks
test:: bin/tdbtorture$(EXEEXT) $(TDB_SONAME)
$(LIB_PATH_VAR)=. bin/tdbtorture$(EXEEXT)
abi_checks::
@echo ABI checks:
@./script/abi_checks.sh tdb include/tdb.h
clean::
rm -f test.db test.tdb torture.tdb test.gdbm
rm -f $(TDB_SONAME) $(TDB_SOLIB) $(TDB_STLIB) libtdb.$(SHLIBEXT)
rm -f $(ALL_PROGS) tdb.pc
rm -f tdb.exports.sort tdb.exports.check tdb.exports.check.sort
rm -f tdb.signatures.sort tdb.signatures.check tdb.signatures.check.sort
build-python:: tdb.$(SHLIBEXT)
pytdb.o: $(tdbdir)/pytdb.c
$(CC) $(PICFLAG) -c $(tdbdir)/pytdb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) pytdb.o
$(SHLD) $(SHLD_FLAGS) -o $@ pytdb.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags`
install:: installdirs installbin installheaders installlibs \
$(PYTHON_INSTALL_TARGET)
install-python:: build-python
mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
cp tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
check-python:: build-python $(TDB_SONAME)
$(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py
clean::
rm -f tdb.$(SHLIBEXT)
installdirs::
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(includedir)
mkdir -p $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(libdir)/pkgconfig
installbin:: all installdirs
cp $(PROGS) $(DESTDIR)$(bindir)
installheaders:: installdirs
cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
installlibs:: all installdirs
cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
cp $(TDB_STLIB) $(TDB_SOLIB) $(DESTDIR)$(libdir)
$(TDB_STLIB): $(TDB_OBJ)
ar -rv $(TDB_STLIB) $(TDB_OBJ)
libtdb.$(SHLIBEXT): $(TDB_SOLIB)
ln -fs $< $@
$(TDB_SONAME): $(TDB_SOLIB)
ln -fs $< $@

View File

@ -1,12 +0,0 @@
prefix=/home/tridge/samba/samba4/prefix
exec_prefix=/home/tridge/samba/samba4/prefix
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: tdb
Description: Trivial Database Library
Requires.private:
Version: 0.0.1
Libs: -L${libdir} -ltdb
Libs.private: -lreplace
Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1

View File

@ -8,3 +8,4 @@ Description: A trivial database
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -ltdb
Cflags: -I${includedir}
URL: http://tdb.samba.org/

View File

@ -0,0 +1,60 @@
const char *tdb_errorstr (struct tdb_context *);
const char *tdb_name (struct tdb_context *);
enum TDB_ERROR tdb_error (struct tdb_context *);
int tdb_append (struct tdb_context *, TDB_DATA, TDB_DATA);
int tdb_chainlock_mark (struct tdb_context *, TDB_DATA);
int tdb_chainlock_nonblock (struct tdb_context *, TDB_DATA);
int tdb_chainlock_read (struct tdb_context *, TDB_DATA);
int tdb_chainlock (struct tdb_context *, TDB_DATA);
int tdb_chainlock_unmark (struct tdb_context *, TDB_DATA);
int tdb_chainunlock_read (struct tdb_context *, TDB_DATA);
int tdb_chainunlock (struct tdb_context *, TDB_DATA);
int tdb_close (struct tdb_context *);
int tdb_delete (struct tdb_context *, TDB_DATA);
int tdb_exists (struct tdb_context *, TDB_DATA);
int tdb_fd (struct tdb_context *);
int tdb_freelist_size (struct tdb_context *);
int tdb_get_flags (struct tdb_context *);
int tdb_get_seqnum (struct tdb_context *);
int tdb_hash_size (struct tdb_context *);
int tdb_lockall_mark (struct tdb_context *);
int tdb_lockall_nonblock (struct tdb_context *);
int tdb_lockall_read_nonblock (struct tdb_context *);
int tdb_lockall_read (struct tdb_context *);
int tdb_lockall (struct tdb_context *);
int tdb_lockall_unmark (struct tdb_context *);
int tdb_parse_record (struct tdb_context *, TDB_DATA, int (*) (TDB_DATA, TDB_DATA, void *), void *);
int tdb_printfreelist (struct tdb_context *);
int tdb_reopen_all (int);
int tdb_reopen (struct tdb_context *);
int tdb_repack (struct tdb_context *);
int tdb_store (struct tdb_context *, TDB_DATA, TDB_DATA, int);
int tdb_transaction_cancel (struct tdb_context *);
int tdb_transaction_commit (struct tdb_context *);
int tdb_transaction_prepare_commit (struct tdb_context *);
int tdb_transaction_recover (struct tdb_context *);
int tdb_transaction_start (struct tdb_context *);
int tdb_traverse_read (struct tdb_context *, tdb_traverse_func, void *);
int tdb_traverse (struct tdb_context *, tdb_traverse_func, void *);
int tdb_unlockall_read (struct tdb_context *);
int tdb_unlockall (struct tdb_context *);
int tdb_validate_freelist (struct tdb_context *, int *);
int tdb_wipe_all (struct tdb_context *);
size_t tdb_map_size (struct tdb_context *);
struct tdb_context *tdb_open (const char *, int, int, int, mode_t);
struct tdb_context *tdb_open_ex (const char *, int, int, int, mode_t, const struct tdb_logging_context *, tdb_hash_func);
TDB_DATA tdb_fetch (struct tdb_context *, TDB_DATA);
TDB_DATA tdb_firstkey (struct tdb_context *);
TDB_DATA tdb_nextkey (struct tdb_context *, TDB_DATA);
tdb_log_func tdb_log_fn (struct tdb_context *);
void tdb_add_flags (struct tdb_context *, unsigned int);
void tdb_dump_all (struct tdb_context *);
void tdb_enable_seqnum (struct tdb_context *);
void *tdb_get_logging_private (struct tdb_context *);
void tdb_increment_seqnum_nonblock (struct tdb_context *);
void tdb_remove_flags (struct tdb_context *, unsigned int);
void tdb_setalarm_sigptr (struct tdb_context *, volatile sig_atomic_t *);
void tdb_set_logging_function (struct tdb_context *, const struct tdb_logging_context *);
void tdb_set_max_dead (struct tdb_context *, int);
int tdb_check (struct tdb_context *, int (*)(TDB_DATA, TDB_DATA, void *), void *);
TDB_DATA tdb_null;

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>ldb</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033">
<h1>tdb</h1>
TDB is a Trivial Database. In concept, it is very much like GDBM, and BSD's DB
except that it allows multiple simultaneous writers and uses locking
internally to keep writers from trampling on each other. TDB is also extremely
small.
<h2>Download</h2>
You can download the latest releases of tdb from the <a
href="http://samba.org/ftp/tdb">tdb directory</a> on the samba public
source archive.
<h2>Discussion and bug reports</h2>
tdb does not currently have its own mailing list or bug tracking
system. For now, please use the <a
href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
mailing list, and the <a href="http://bugzilla.samba.org/">Samba
bugzilla</a> bug tracking system.
<h2>Download</h2>
You can download the latest code either via git or rsync.<br>
<br>
To fetch via git see the following guide:<br>
<a href="http://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using Git for Samba Development</a><br>
Once you have cloned the tree switch to the master branch and cd into the source/lib/tdb directory.<br>
<br>
To fetch via rsync use these commands:
<pre>
rsync -Pavz samba.org::ftp/unpacked/standalone_projects/lib/tdb .
rsync -Pavz samba.org::ftp/unpacked/standalone_projects/lib/replace .
</pre>
and build in tdb. It will find the replace library in the directory
above automatically.
</BODY>
</HTML>