summaryrefslogtreecommitdiff
path: root/lib/tdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-06-15 16:19:19 -0400
committerSimo Sorce <idra@samba.org>2009-06-15 16:31:12 -0400
commit7aee9f92e7c3e3eb48c0456d821125b60f8d8259 (patch)
treefa8be2b7149db8d8806d7f54d818b98ea5d34af7 /lib/tdb
parentf518e37c0912a54d5434f7639ba44f53d3455582 (diff)
downloadsamba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.tar.gz
samba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.tar.bz2
samba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.zip
Add exports file and abi checker for tdb
This is a first attempt at exporting symbols only for public functions We also provide a rudimentary ABI checker that tries to check that function signatures are not changed by mistake. Given our use of macros this is not an API checker. It's all based on tdb.h contents and the gcc -aux-info option
Diffstat (limited to 'lib/tdb')
-rw-r--r--lib/tdb/Makefile.in7
-rwxr-xr-xlib/tdb/abi_checks.sh35
-rw-r--r--lib/tdb/configure.ac3
-rw-r--r--lib/tdb/libtdb.m45
-rw-r--r--lib/tdb/rules.mk2
-rw-r--r--lib/tdb/tdb.exports64
-rw-r--r--lib/tdb/tdb.signatures59
7 files changed, 172 insertions, 3 deletions
diff --git a/lib/tdb/Makefile.in b/lib/tdb/Makefile.in
index df1b02be6a..93bfe37f4f 100644
--- a/lib/tdb/Makefile.in
+++ b/lib/tdb/Makefile.in
@@ -33,6 +33,10 @@ tdbdir = @tdbdir@
TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
+SONAMEFLAG = @SONAMEFLAG@
+VERSIONSCRIPT = @VERSIONSCRIPT@
+EXPORTSFILE = @EXPORTSFILE@
+
default: all
include $(tdbdir)/tdb.mk
@@ -42,7 +46,7 @@ all:: showflags dirs $(PROGS) $(TDB_SOLIB) libtdb.a $(PYTHON_BUILD_TARGET)
install:: all
$(TDB_SOLIB): $(TDB_OBJ)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(TDB_SONAME)
+ $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TDB_SONAME)
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/lib
@@ -60,6 +64,7 @@ installcheck:: test install
clean::
rm -f *.o *.a */*.o
+ rm -fr abi
distclean:: clean
rm -f config.log config.status include/config.h config.cache
diff --git a/lib/tdb/abi_checks.sh b/lib/tdb/abi_checks.sh
new file mode 100755
index 0000000000..042b0f3374
--- /dev/null
+++ b/lib/tdb/abi_checks.sh
@@ -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 }' > 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
diff --git a/lib/tdb/configure.ac b/lib/tdb/configure.ac
index e00f08af70..e5bd9f6c35 100644
--- a/lib/tdb/configure.ac
+++ b/lib/tdb/configure.ac
@@ -2,11 +2,12 @@ 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.4)
+AC_INIT(tdb, 1.1.5)
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
diff --git a/lib/tdb/libtdb.m4 b/lib/tdb/libtdb.m4
index 252e0b0be3..f5ed012a80 100644
--- a/lib/tdb/libtdb.m4
+++ b/lib/tdb/libtdb.m4
@@ -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
diff --git a/lib/tdb/rules.mk b/lib/tdb/rules.mk
index 7b765625df..73ab771c5c 100644
--- a/lib/tdb/rules.mk
+++ b/lib/tdb/rules.mk
@@ -15,7 +15,7 @@ showflags::
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
- @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@
+ @$(CC) $(PICFLAG) $(CFLAGS) $(ABI_CHECK) -c $< -o $@
distclean::
rm -f *~ */*~
diff --git a/lib/tdb/tdb.exports b/lib/tdb/tdb.exports
new file mode 100644
index 0000000000..f3dcd1514b
--- /dev/null
+++ b/lib/tdb/tdb.exports
@@ -0,0 +1,64 @@
+{
+ 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_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: *;
+};
diff --git a/lib/tdb/tdb.signatures b/lib/tdb/tdb.signatures
new file mode 100644
index 0000000000..12e0b24edb
--- /dev/null
+++ b/lib/tdb/tdb.signatures
@@ -0,0 +1,59 @@
+int tdb_reopen (struct tdb_context *);
+int tdb_reopen_all (int);
+void tdb_set_logging_function (struct tdb_context *, const struct tdb_logging_context *);
+enum TDB_ERROR tdb_error (struct tdb_context *);
+const char *tdb_errorstr (struct tdb_context *);
+TDB_DATA tdb_fetch (struct tdb_context *, TDB_DATA);
+int tdb_parse_record (struct tdb_context *, TDB_DATA, int (*) (TDB_DATA, TDB_DATA, void *), void *);
+int tdb_delete (struct tdb_context *, TDB_DATA);
+int tdb_store (struct tdb_context *, TDB_DATA, TDB_DATA, int);
+int tdb_append (struct tdb_context *, TDB_DATA, TDB_DATA);
+int tdb_close (struct tdb_context *);
+TDB_DATA tdb_firstkey (struct tdb_context *);
+TDB_DATA tdb_nextkey (struct tdb_context *, TDB_DATA);
+int tdb_traverse (struct tdb_context *, tdb_traverse_func, void *);
+int tdb_traverse_read (struct tdb_context *, tdb_traverse_func, void *);
+int tdb_exists (struct tdb_context *, TDB_DATA);
+int tdb_lockall (struct tdb_context *);
+int tdb_lockall_nonblock (struct tdb_context *);
+int tdb_unlockall (struct tdb_context *);
+int tdb_lockall_read (struct tdb_context *);
+int tdb_lockall_read_nonblock (struct tdb_context *);
+int tdb_unlockall_read (struct tdb_context *);
+int tdb_lockall_mark (struct tdb_context *);
+int tdb_lockall_unmark (struct tdb_context *);
+const char *tdb_name (struct tdb_context *);
+int tdb_fd (struct tdb_context *);
+tdb_log_func tdb_log_fn (struct tdb_context *);
+void *tdb_get_logging_private (struct tdb_context *);
+int tdb_transaction_start (struct tdb_context *);
+int tdb_transaction_prepare_commit (struct tdb_context *);
+int tdb_transaction_commit (struct tdb_context *);
+int tdb_transaction_cancel (struct tdb_context *);
+int tdb_transaction_recover (struct tdb_context *);
+int tdb_get_seqnum (struct tdb_context *);
+int tdb_hash_size (struct tdb_context *);
+size_t tdb_map_size (struct tdb_context *);
+int tdb_get_flags (struct tdb_context *);
+void tdb_add_flags (struct tdb_context *, unsigned int);
+void tdb_remove_flags (struct tdb_context *, unsigned int);
+void tdb_enable_seqnum (struct tdb_context *);
+void tdb_increment_seqnum_nonblock (struct tdb_context *);
+int tdb_chainlock (struct tdb_context *, TDB_DATA);
+int tdb_chainlock_nonblock (struct tdb_context *, TDB_DATA);
+int tdb_chainunlock (struct tdb_context *, TDB_DATA);
+int tdb_chainlock_read (struct tdb_context *, TDB_DATA);
+int tdb_chainunlock_read (struct tdb_context *, TDB_DATA);
+int tdb_chainlock_mark (struct tdb_context *, TDB_DATA);
+int tdb_chainlock_unmark (struct tdb_context *, TDB_DATA);
+void tdb_setalarm_sigptr (struct tdb_context *, volatile sig_atomic_t *);
+int tdb_wipe_all (struct tdb_context *);
+int tdb_repack (struct tdb_context *);
+void tdb_dump_all (struct tdb_context *);
+int tdb_printfreelist (struct tdb_context *);
+int tdb_validate_freelist (struct tdb_context *, int *);
+int tdb_freelist_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);
+void tdb_set_max_dead (struct tdb_context *, int);
+TDB_DATA tdb_null;