Compare commits
No commits in common. "c8" and "c9s" have entirely different histories.
|
@ -1,2 +1,39 @@
|
|||
SOURCES/tdb-1.4.7.tar.gz
|
||||
SOURCES/tdb.keyring
|
||||
/tdb-1.2.9.tar.gz
|
||||
/tdb-1.2.10.tar.gz
|
||||
/tdb-1.2.11.tar.gz
|
||||
/tdb-1.2.12.tar.gz
|
||||
/tdb-1.2.13.tar.gz
|
||||
/tdb-1.3.0.tar.gz
|
||||
/tdb-1.3.1.tar.gz
|
||||
/tdb-1.3.3.tar.gz
|
||||
/tdb-1.3.4.tar.gz
|
||||
/tdb-1.3.5.tar.gz
|
||||
/tdb-1.3.6.tar.gz
|
||||
/tdb-1.3.7.tar.gz
|
||||
/tdb-1.3.8.tar.gz
|
||||
/tdb-1.3.9.tar.gz
|
||||
/tdb-1.3.10.tar.gz
|
||||
/tdb-1.3.11.tar.gz
|
||||
/tdb-1.3.12.tar.gz
|
||||
/tdb-1.3.13.tar.gz
|
||||
/tdb-1.3.14.tar.gz
|
||||
/tdb-1.3.15.tar.gz
|
||||
/tdb-1.3.16.tar.gz
|
||||
/tdb-1.3.17.tar.gz
|
||||
/tdb-1.3.18.tar.gz
|
||||
/tdb-1.4.2.tar.gz
|
||||
/tdb.keyring
|
||||
/tdb-1.4.3.tar.asc
|
||||
/tdb-1.4.3.tar.gz
|
||||
/tdb-1.4.4.tar.asc
|
||||
/tdb-1.4.4.tar.gz
|
||||
/tdb-1.4.6.tar.asc
|
||||
/tdb-1.4.6.tar.gz
|
||||
/tdb-1.4.7.tar.asc
|
||||
/tdb-1.4.7.tar.gz
|
||||
/tdb-1.4.8.tar.asc
|
||||
/tdb-1.4.8.tar.gz
|
||||
/tdb-1.4.9.tar.gz
|
||||
/tdb-1.4.9.tar.asc
|
||||
/tdb-1.4.10.tar.asc
|
||||
/tdb-1.4.10.tar.gz
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
fc6c6704609d599b0eff6612f18613f19aad5be1 SOURCES/tdb-1.4.7.tar.gz
|
||||
41c0b3a84123968a0df75d416c57fe2879205585 SOURCES/tdb.keyring
|
||||
36f3fde462949b3581a379ab6a6d1ccd78f6b717 tdb-1.4.10.tar.asc
|
||||
284c7927ca381502cda87631945808f69833c582 tdb-1.4.10.tar.gz
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
From 87dfb0ce329447625050771fd83dae1841ece1b8 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Slebodnik <lslebodn@fedoraproject.org>
|
||||
Date: Wed, 12 Jun 2019 13:38:17 +0200
|
||||
Subject: [PATCH] wafsamba: Fix few SyntaxWarnings caused by regular
|
||||
expressions
|
||||
|
||||
./buildtools/wafsamba/samba_utils.py:258: SyntaxWarning: invalid escape sequence \$
|
||||
lst = re.split('(\$\{\w+\})', string)
|
||||
./buildtools/wafsamba/samba_utils.py:261: SyntaxWarning: invalid escape sequence \$
|
||||
if re.match('\$\{\w+\}', v):
|
||||
./buildtools/wafsamba/samba_cross.py:80: SyntaxWarning: invalid escape sequence \(
|
||||
m = re.match('\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans)
|
||||
./buildtools/wafsamba/samba_conftests.py:400: SyntaxWarning: invalid escape sequence \s
|
||||
m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
|
||||
./buildtools/wafsamba/samba_abi.py:24: SyntaxWarning: invalid escape sequence \$
|
||||
sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}$', r'\1', sig)
|
||||
./buildtools/wafsamba/samba_abi.py:25: SyntaxWarning: invalid escape sequence \$
|
||||
sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}(\s0x[0-9a-f]+\s<\w+>)+$', r'\1', sig)
|
||||
./buildtools/wafsamba/samba_abi.py:26: SyntaxWarning: invalid escape sequence \$
|
||||
sig = re.sub('^\$[0-9]+\s=\s(0x[0-9a-f]+)\s?(<\w+>)?$', r'\1', sig)
|
||||
./buildtools/wafsamba/samba_abi.py:33: SyntaxWarning: invalid escape sequence \*
|
||||
m = m.replace('*', '\*')
|
||||
./buildtools/wafsamba/samba_abi.py:44: SyntaxWarning: invalid escape sequence \s
|
||||
sig = re.sub(',\s\.\.\.', '', sig)
|
||||
./buildtools/wafsamba/samba_headers.py:22: SyntaxWarning: invalid escape sequence \s
|
||||
re_header = re.compile('^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
|
||||
./buildtools/wafsamba/symbols.py:122: SyntaxWarning: invalid escape sequence \[
|
||||
re_sharedlib = re.compile(b'Shared library: \[(.*)\]')
|
||||
./buildtools/wafsamba/symbols.py:124: SyntaxWarning: invalid escape sequence \[
|
||||
re_rpath = re.compile(b'Library (rpath|runpath): \[(.*)\]')
|
||||
./buildtools/wafsamba/pkgconfig.py:12: SyntaxWarning: invalid escape sequence \w
|
||||
a = re.split('(@\w+@)', s)
|
||||
./buildtools/wafsamba/pkgconfig.py:17: SyntaxWarning: invalid escape sequence \w
|
||||
if re.match('@\w+@', v):
|
||||
./buildtools/wafsamba/configure_file.py:16: SyntaxWarning: invalid escape sequence \w
|
||||
a = re.split('(@\w+@)', s)
|
||||
./buildtools/wafsamba/configure_file.py:19: SyntaxWarning: invalid escape sequence \w
|
||||
if re.match('@\w+@', v):
|
||||
---
|
||||
buildtools/wafsamba/configure_file.py | 4 ++--
|
||||
buildtools/wafsamba/pkgconfig.py | 4 ++--
|
||||
buildtools/wafsamba/samba_abi.py | 12 ++++++------
|
||||
buildtools/wafsamba/samba_conftests.py | 2 +-
|
||||
buildtools/wafsamba/samba_cross.py | 2 +-
|
||||
buildtools/wafsamba/samba_headers.py | 2 +-
|
||||
buildtools/wafsamba/samba_utils.py | 4 ++--
|
||||
buildtools/wafsamba/symbols.py | 4 ++--
|
||||
8 files changed, 17 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/buildtools/wafsamba/configure_file.py b/buildtools/wafsamba/configure_file.py
|
||||
index 6ad43546249fba7b4c0a037035e8574e7a9d2753..98a58a4604513e3633317e73299c1c9280c250d2 100644
|
||||
--- a/buildtools/wafsamba/configure_file.py
|
||||
+++ b/buildtools/wafsamba/configure_file.py
|
||||
@@ -13,10 +13,10 @@ def subst_at_vars(task):
|
||||
s = task.inputs[0].read()
|
||||
|
||||
# split on the vars
|
||||
- a = re.split('(@\w+@)', s)
|
||||
+ a = re.split(r'(@\w+@)', s)
|
||||
out = []
|
||||
for v in a:
|
||||
- if re.match('@\w+@', v):
|
||||
+ if re.match(r'@\w+@', v):
|
||||
vname = v[1:-1]
|
||||
if not vname in task.env and vname.upper() in task.env:
|
||||
vname = vname.upper()
|
||||
diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
|
||||
index b83d5f382a58352bb3318b594aa2b45fc02d87d5..b77bd618c8903789c7ba9e64a6972a4e080f1821 100644
|
||||
--- a/buildtools/wafsamba/pkgconfig.py
|
||||
+++ b/buildtools/wafsamba/pkgconfig.py
|
||||
@@ -9,12 +9,12 @@ def subst_at_vars(task):
|
||||
|
||||
s = task.inputs[0].read()
|
||||
# split on the vars
|
||||
- a = re.split('(@\w+@)', s)
|
||||
+ a = re.split(r'(@\w+@)', s)
|
||||
out = []
|
||||
done_var = {}
|
||||
back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
|
||||
for v in a:
|
||||
- if re.match('@\w+@', v):
|
||||
+ if re.match(r'@\w+@', v):
|
||||
vname = v[1:-1]
|
||||
if not vname in task.env and vname.upper() in task.env:
|
||||
vname = vname.upper()
|
||||
diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
|
||||
index 5e7686da3d68b1ebcd842b8a319a5997fa9cf600..761667fcfe1f3937be22c8261b45dcb3979ae4cd 100644
|
||||
--- a/buildtools/wafsamba/samba_abi.py
|
||||
+++ b/buildtools/wafsamba/samba_abi.py
|
||||
@@ -21,16 +21,16 @@ version_key = lambda x: list(map(int, x.split(".")))
|
||||
def normalise_signature(sig):
|
||||
'''normalise a signature from gdb'''
|
||||
sig = sig.strip()
|
||||
- sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}$', r'\1', sig)
|
||||
- sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}(\s0x[0-9a-f]+\s<\w+>)+$', r'\1', sig)
|
||||
- sig = re.sub('^\$[0-9]+\s=\s(0x[0-9a-f]+)\s?(<\w+>)?$', r'\1', sig)
|
||||
- sig = re.sub('0x[0-9a-f]+', '0xXXXX', sig)
|
||||
+ sig = re.sub(r'^\$[0-9]+\s=\s\{(.+)\}$', r'\1', sig)
|
||||
+ sig = re.sub(r'^\$[0-9]+\s=\s\{(.+)\}(\s0x[0-9a-f]+\s<\w+>)+$', r'\1', sig)
|
||||
+ sig = re.sub(r'^\$[0-9]+\s=\s(0x[0-9a-f]+)\s?(<\w+>)?$', r'\1', sig)
|
||||
+ sig = re.sub(r'0x[0-9a-f]+', '0xXXXX', sig)
|
||||
sig = re.sub('", <incomplete sequence (\\\\[a-z0-9]+)>', r'\1"', sig)
|
||||
|
||||
for t in abi_type_maps:
|
||||
# we need to cope with non-word characters in mapped types
|
||||
m = t
|
||||
- m = m.replace('*', '\*')
|
||||
+ m = m.replace('*', r'\*')
|
||||
if m[-1].isalnum() or m[-1] == '_':
|
||||
m += '\\b'
|
||||
if m[0].isalnum() or m[0] == '_':
|
||||
@@ -41,7 +41,7 @@ def normalise_signature(sig):
|
||||
|
||||
def normalise_varargs(sig):
|
||||
'''cope with older versions of gdb'''
|
||||
- sig = re.sub(',\s\.\.\.', '', sig)
|
||||
+ sig = re.sub(r',\s\.\.\.', '', sig)
|
||||
return sig
|
||||
|
||||
|
||||
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
|
||||
index ef632ba903369e4211991f17a3b204bcd96c3a2f..63e50567860ff890b00b0ce6c7607c917b7329d1 100644
|
||||
--- a/buildtools/wafsamba/samba_conftests.py
|
||||
+++ b/buildtools/wafsamba/samba_conftests.py
|
||||
@@ -397,7 +397,7 @@ WriteMakefile(
|
||||
|
||||
if section:
|
||||
man = Utils.readf(os.path.join(bdir,'Makefile'))
|
||||
- m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
|
||||
+ m = re.search(r'MAN%sEXT\s+=\s+(\w+)' % section, man)
|
||||
if not m:
|
||||
conf.end_msg('not found', color='YELLOW')
|
||||
return
|
||||
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
|
||||
index 8863c2c53e7d7dd9317c9233f0085ffd0eea6b2f..34793902fba884cf2d8358bf4315dc98027266b6 100644
|
||||
--- a/buildtools/wafsamba/samba_cross.py
|
||||
+++ b/buildtools/wafsamba/samba_cross.py
|
||||
@@ -77,7 +77,7 @@ def cross_answer(ca_file, msg):
|
||||
f.close()
|
||||
return (0, ans.strip("'"))
|
||||
else:
|
||||
- m = re.match('\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans)
|
||||
+ m = re.match(r'\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans)
|
||||
if m:
|
||||
f.close()
|
||||
return (int(m.group(1)), m.group(2))
|
||||
diff --git a/buildtools/wafsamba/samba_headers.py b/buildtools/wafsamba/samba_headers.py
|
||||
index a268c011c5d8e406e0d763554c55668cfb5388bc..c8bee19010978a04460b0637fcc8fd484a699ea8 100644
|
||||
--- a/buildtools/wafsamba/samba_headers.py
|
||||
+++ b/buildtools/wafsamba/samba_headers.py
|
||||
@@ -19,7 +19,7 @@ def header_install_path(header, header_path):
|
||||
return ''
|
||||
|
||||
|
||||
-re_header = re.compile('^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
|
||||
+re_header = re.compile(r'^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
|
||||
|
||||
# a dictionary mapping source header paths to public header paths
|
||||
header_map = {}
|
||||
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
|
||||
index ad97de1859ba24c4afd5106b4f9694b0dc855643..75c9794ec40f327ef8ccf9aa33fafd6ed6181e3b 100644
|
||||
--- a/buildtools/wafsamba/samba_utils.py
|
||||
+++ b/buildtools/wafsamba/samba_utils.py
|
||||
@@ -255,10 +255,10 @@ def TO_LIST(str, delimiter=None):
|
||||
|
||||
def subst_vars_error(string, env):
|
||||
'''substitute vars, throw an error if a variable is not defined'''
|
||||
- lst = re.split('(\$\{\w+\})', string)
|
||||
+ lst = re.split(r'(\$\{\w+\})', string)
|
||||
out = []
|
||||
for v in lst:
|
||||
- if re.match('\$\{\w+\}', v):
|
||||
+ if re.match(r'\$\{\w+\}', v):
|
||||
vname = v[2:-1]
|
||||
if not vname in env:
|
||||
raise KeyError("Failed to find variable %s in %s in env %s <%s>" % (vname, string, env.__class__, str(env)))
|
||||
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
|
||||
index 3eca3d46bd71cf0780b3c8e36a26b96bd3aa3b83..73e8ca8ce53ef5d956ac58e14a2403dd49f01109 100644
|
||||
--- a/buildtools/wafsamba/symbols.py
|
||||
+++ b/buildtools/wafsamba/symbols.py
|
||||
@@ -119,9 +119,9 @@ def find_ldd_path(bld, libname, binary):
|
||||
|
||||
|
||||
# some regular expressions for parsing readelf output
|
||||
-re_sharedlib = re.compile(b'Shared library: \[(.*)\]')
|
||||
+re_sharedlib = re.compile(r'Shared library: \[(.*)\]')
|
||||
# output from readelf could be `Library rpath` or `Libray runpath`
|
||||
-re_rpath = re.compile(b'Library (rpath|runpath): \[(.*)\]')
|
||||
+re_rpath = re.compile(r'Library (rpath|runpath): \[(.*)\]')
|
||||
|
||||
def get_libs(bld, binname):
|
||||
'''find the list of linked libraries for any binary or library
|
||||
--
|
||||
2.22.0
|
||||
|
|
@ -1,567 +0,0 @@
|
|||
From 7880e098039ca3e42fa43a055d6812f7b3ef9c0a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
|
||||
Date: Fri, 16 Jul 2021 16:56:49 +0200
|
||||
Subject: [PATCH] Revert "tdb: fix studio compiler build"
|
||||
|
||||
This reverts commit 3c1013caf4b57c6af5a5d210df232c08a1227a17.
|
||||
---
|
||||
lib/tdb/common/lock.c | 6 +-
|
||||
lib/tdb/include/tdb.h | 138 +++++++++++++++++++++---------------------
|
||||
2 files changed, 71 insertions(+), 73 deletions(-)
|
||||
|
||||
diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c
|
||||
index c4e276f84d6..5fba02f9b12 100644
|
||||
--- tdb/common/lock.c
|
||||
+++ tdb/common/lock.c
|
||||
@@ -506,7 +506,6 @@ int tdb_lock(struct tdb_context *tdb, int list, int ltype)
|
||||
}
|
||||
|
||||
/* lock a list in the database. list -1 is the alloc list. non-blocking lock */
|
||||
-_PUBLIC_ int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype);
|
||||
_PUBLIC_ int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype)
|
||||
{
|
||||
return tdb_lock_list(tdb, list, ltype, TDB_LOCK_NOWAIT);
|
||||
@@ -568,7 +567,6 @@ int tdb_nest_unlock(struct tdb_context *tdb, uint32_t offset, int ltype,
|
||||
return ret;
|
||||
}
|
||||
|
||||
-_PUBLIC_ int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
|
||||
_PUBLIC_ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
|
||||
{
|
||||
/* a global lock allows us to avoid per chain locks */
|
||||
@@ -1019,14 +1017,14 @@ void tdb_release_transaction_locks(struct tdb_context *tdb)
|
||||
/* Following functions are added specifically to support CTDB. */
|
||||
|
||||
/* Don't do actual fcntl locking, just mark tdb locked */
|
||||
-_PUBLIC_ int tdb_transaction_write_lock_mark(struct tdb_context *tdb);
|
||||
+int tdb_transaction_write_lock_mark(struct tdb_context *tdb);
|
||||
_PUBLIC_ int tdb_transaction_write_lock_mark(struct tdb_context *tdb)
|
||||
{
|
||||
return tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_MARK_ONLY);
|
||||
}
|
||||
|
||||
/* Don't do actual fcntl unlocking, just mark tdb unlocked */
|
||||
-_PUBLIC_ int tdb_transaction_write_lock_unmark(struct tdb_context *tdb);
|
||||
+int tdb_transaction_write_lock_unmark(struct tdb_context *tdb);
|
||||
_PUBLIC_ int tdb_transaction_write_lock_unmark(struct tdb_context *tdb)
|
||||
{
|
||||
return tdb_nest_unlock(tdb, TRANSACTION_LOCK, F_WRLCK, true);
|
||||
diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h
|
||||
index 696547c8cd9..9d63a96b4ac 100644
|
||||
--- tdb/include/tdb.h
|
||||
+++ tdb/include/tdb.h
|
||||
@@ -159,7 +159,7 @@ struct tdb_logging_context {
|
||||
*
|
||||
* @return A tdb context structure, NULL on error.
|
||||
*/
|
||||
-_PUBLIC_ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
|
||||
+struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
|
||||
int open_flags, mode_t mode);
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ _PUBLIC_ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_f
|
||||
*
|
||||
* @see tdb_open()
|
||||
*/
|
||||
-_PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
|
||||
+struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
|
||||
int open_flags, mode_t mode,
|
||||
const struct tdb_logging_context *log_ctx,
|
||||
tdb_hash_func hash_fn);
|
||||
@@ -218,7 +218,7 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td
|
||||
*
|
||||
* @param[in] max_dead The maximum number of dead records per hash chain.
|
||||
*/
|
||||
-_PUBLIC_ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
|
||||
+void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
|
||||
|
||||
/**
|
||||
* @brief Reopen a tdb.
|
||||
@@ -233,7 +233,7 @@ _PUBLIC_ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
|
||||
* @note Don't call tdb_error() after this function cause the tdb context will
|
||||
* be freed on error.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_reopen(struct tdb_context *tdb);
|
||||
+int tdb_reopen(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Reopen all tdb's
|
||||
@@ -248,7 +248,7 @@ _PUBLIC_ int tdb_reopen(struct tdb_context *tdb);
|
||||
*
|
||||
* @return 0 on success, -1 on error.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_reopen_all(int parent_longlived);
|
||||
+int tdb_reopen_all(int parent_longlived);
|
||||
|
||||
/**
|
||||
* @brief Set a different tdb logging function.
|
||||
@@ -257,7 +257,7 @@ _PUBLIC_ int tdb_reopen_all(int parent_longlived);
|
||||
*
|
||||
* @param[in] log_ctx The logging function to set.
|
||||
*/
|
||||
-_PUBLIC_ void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
|
||||
+void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the tdb last error code.
|
||||
@@ -268,7 +268,7 @@ _PUBLIC_ void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb
|
||||
*
|
||||
* @see TDB_ERROR
|
||||
*/
|
||||
-_PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb);
|
||||
+enum TDB_ERROR tdb_error(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get a error string for the last tdb error
|
||||
@@ -277,7 +277,7 @@ _PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb);
|
||||
*
|
||||
* @return An error string.
|
||||
*/
|
||||
-_PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb);
|
||||
+const char *tdb_errorstr(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Fetch an entry in the database given a key.
|
||||
@@ -294,7 +294,7 @@ _PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
|
||||
+TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
/**
|
||||
* @brief Hand a record to a parser function without allocating it.
|
||||
@@ -319,7 +319,7 @@ _PUBLIC_ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
|
||||
* @return -1 if the record was not found. If the record was found,
|
||||
* the return value of "parser" is passed up to the caller.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
|
||||
+int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
|
||||
int (*parser)(TDB_DATA key, TDB_DATA data,
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
@@ -333,7 +333,7 @@ _PUBLIC_ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
|
||||
*
|
||||
* @return 0 on success, -1 if the key doesn't exist.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
/**
|
||||
* @brief Store an element in the database.
|
||||
@@ -355,7 +355,7 @@ _PUBLIC_ int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
|
||||
+int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
|
||||
|
||||
|
||||
/**
|
||||
@@ -380,7 +380,7 @@ _PUBLIC_ int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_storev(struct tdb_context *tdb, TDB_DATA key,
|
||||
+int tdb_storev(struct tdb_context *tdb, TDB_DATA key,
|
||||
const TDB_DATA *dbufs, int num_dbufs, int flag);
|
||||
|
||||
/**
|
||||
@@ -399,7 +399,7 @@ _PUBLIC_ int tdb_storev(struct tdb_context *tdb, TDB_DATA key,
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
|
||||
+int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
|
||||
|
||||
/**
|
||||
* @brief Close a database.
|
||||
@@ -411,7 +411,7 @@ _PUBLIC_ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf
|
||||
* @note Don't call tdb_error() after this function cause the tdb context will
|
||||
* be freed on error.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_close(struct tdb_context *tdb);
|
||||
+int tdb_close(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Find the first entry in the database and return its key.
|
||||
@@ -423,7 +423,7 @@ _PUBLIC_ int tdb_close(struct tdb_context *tdb);
|
||||
* @return The first entry of the database, an empty TDB_DATA entry
|
||||
* if the database is empty.
|
||||
*/
|
||||
-_PUBLIC_ TDB_DATA tdb_firstkey(struct tdb_context *tdb);
|
||||
+TDB_DATA tdb_firstkey(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Find the next entry in the database, returning its key.
|
||||
@@ -437,7 +437,7 @@ _PUBLIC_ TDB_DATA tdb_firstkey(struct tdb_context *tdb);
|
||||
* @return The next entry of the current key, an empty TDB_DATA
|
||||
* entry if there is no entry.
|
||||
*/
|
||||
-_PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
|
||||
+TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
/**
|
||||
* @brief Traverse the entire database.
|
||||
@@ -459,7 +459,7 @@ _PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
|
||||
*
|
||||
* @return The record count traversed, -1 on error.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data);
|
||||
+int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data);
|
||||
|
||||
/**
|
||||
* @brief Traverse the entire database.
|
||||
@@ -478,7 +478,7 @@ _PUBLIC_ int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *p
|
||||
*
|
||||
* @return The record count traversed, -1 on error.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data);
|
||||
+int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data);
|
||||
|
||||
/**
|
||||
* @brief Traverse a single hash chain
|
||||
@@ -511,7 +511,7 @@ _PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, vo
|
||||
* @return The record count traversed, -1 on error.
|
||||
*/
|
||||
|
||||
-_PUBLIC_ int tdb_traverse_chain(struct tdb_context *tdb,
|
||||
+int tdb_traverse_chain(struct tdb_context *tdb,
|
||||
unsigned chain,
|
||||
tdb_traverse_func fn,
|
||||
void *private_data);
|
||||
@@ -543,7 +543,7 @@ _PUBLIC_ int tdb_traverse_chain(struct tdb_context *tdb,
|
||||
* @return The record count traversed, -1 on error.
|
||||
*/
|
||||
|
||||
-_PUBLIC_ int tdb_traverse_key_chain(struct tdb_context *tdb,
|
||||
+int tdb_traverse_key_chain(struct tdb_context *tdb,
|
||||
TDB_DATA key,
|
||||
tdb_traverse_func fn,
|
||||
void *private_data);
|
||||
@@ -560,7 +560,7 @@ _PUBLIC_ int tdb_traverse_key_chain(struct tdb_context *tdb,
|
||||
*
|
||||
* @return 1 if the key is found, 0 if not.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with a write lock.
|
||||
@@ -572,7 +572,7 @@ _PUBLIC_ int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall(struct tdb_context *tdb);
|
||||
+int tdb_lockall(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with a write lock.
|
||||
@@ -587,7 +587,7 @@ _PUBLIC_ int tdb_lockall(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall_nonblock(struct tdb_context *tdb);
|
||||
+int tdb_lockall_nonblock(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Unlock entire database with write lock.
|
||||
@@ -600,7 +600,7 @@ _PUBLIC_ int tdb_lockall_nonblock(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_unlockall(struct tdb_context *tdb);
|
||||
+int tdb_unlockall(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with a read lock.
|
||||
@@ -612,7 +612,7 @@ _PUBLIC_ int tdb_unlockall(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall_read(struct tdb_context *tdb);
|
||||
+int tdb_lockall_read(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with a read lock.
|
||||
@@ -627,7 +627,7 @@ _PUBLIC_ int tdb_lockall_read(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall_read_nonblock(struct tdb_context *tdb);
|
||||
+int tdb_lockall_read_nonblock(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Unlock entire database with read lock.
|
||||
@@ -640,7 +640,7 @@ _PUBLIC_ int tdb_lockall_read_nonblock(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_unlockall_read(struct tdb_context *tdb);
|
||||
+int tdb_unlockall_read(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with write lock - mark only.
|
||||
@@ -654,7 +654,7 @@ _PUBLIC_ int tdb_unlockall_read(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall_mark(struct tdb_context *tdb);
|
||||
+int tdb_lockall_mark(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Lock entire database with write lock - unmark only.
|
||||
@@ -668,7 +668,7 @@ _PUBLIC_ int tdb_lockall_mark(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_lockall_unmark(struct tdb_context *tdb);
|
||||
+int tdb_lockall_unmark(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the current tdb file.
|
||||
@@ -679,7 +679,7 @@ _PUBLIC_ int tdb_lockall_unmark(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The name of the database.
|
||||
*/
|
||||
-_PUBLIC_ const char *tdb_name(struct tdb_context *tdb);
|
||||
+const char *tdb_name(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the underlying file descriptor being used by tdb.
|
||||
@@ -691,7 +691,7 @@ _PUBLIC_ const char *tdb_name(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The file descriptor or -1.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_fd(struct tdb_context *tdb);
|
||||
+int tdb_fd(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the current logging function.
|
||||
@@ -704,7 +704,7 @@ _PUBLIC_ int tdb_fd(struct tdb_context *tdb);
|
||||
*
|
||||
* @see tdb_get_logging_private()
|
||||
*/
|
||||
-_PUBLIC_ tdb_log_func tdb_log_fn(struct tdb_context *tdb);
|
||||
+tdb_log_func tdb_log_fn(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the private data of the logging function.
|
||||
@@ -715,7 +715,7 @@ _PUBLIC_ tdb_log_func tdb_log_fn(struct tdb_context *tdb);
|
||||
*
|
||||
* @see tdb_log_fn()
|
||||
*/
|
||||
-_PUBLIC_ void *tdb_get_logging_private(struct tdb_context *tdb);
|
||||
+void *tdb_get_logging_private(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Is a transaction active?
|
||||
@@ -733,7 +733,7 @@ _PUBLIC_ void *tdb_get_logging_private(struct tdb_context *tdb);
|
||||
* @see tdb_transaction_commit()
|
||||
* @see tdb_transaction_cancel()
|
||||
*/
|
||||
-_PUBLIC_ bool tdb_transaction_active(struct tdb_context *tdb);
|
||||
+bool tdb_transaction_active(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Start a transaction.
|
||||
@@ -766,7 +766,7 @@ _PUBLIC_ bool tdb_transaction_active(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_transaction_start(struct tdb_context *tdb);
|
||||
+int tdb_transaction_start(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Start a transaction, non-blocking.
|
||||
@@ -779,7 +779,7 @@ _PUBLIC_ int tdb_transaction_start(struct tdb_context *tdb);
|
||||
* @see tdb_errorstr()
|
||||
* @see tdb_transaction_start()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_transaction_start_nonblock(struct tdb_context *tdb);
|
||||
+int tdb_transaction_start_nonblock(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Prepare to commit a current transaction, for two-phase commits.
|
||||
@@ -796,7 +796,7 @@ _PUBLIC_ int tdb_transaction_start_nonblock(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_transaction_prepare_commit(struct tdb_context *tdb);
|
||||
+int tdb_transaction_prepare_commit(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Commit a current transaction.
|
||||
@@ -810,7 +810,7 @@ _PUBLIC_ int tdb_transaction_prepare_commit(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb);
|
||||
+int tdb_transaction_commit(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Cancel a current transaction.
|
||||
@@ -825,7 +825,7 @@ _PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_transaction_cancel(struct tdb_context *tdb);
|
||||
+int tdb_transaction_cancel(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the tdb sequence number.
|
||||
@@ -845,7 +845,7 @@ _PUBLIC_ int tdb_transaction_cancel(struct tdb_context *tdb);
|
||||
* @see tdb_open()
|
||||
* @see tdb_enable_seqnum()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_get_seqnum(struct tdb_context *tdb);
|
||||
+int tdb_get_seqnum(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the hash size.
|
||||
@@ -854,7 +854,7 @@ _PUBLIC_ int tdb_get_seqnum(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The hash size.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_hash_size(struct tdb_context *tdb);
|
||||
+int tdb_hash_size(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the map size.
|
||||
@@ -863,7 +863,7 @@ _PUBLIC_ int tdb_hash_size(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The map size.
|
||||
*/
|
||||
-_PUBLIC_ size_t tdb_map_size(struct tdb_context *tdb);
|
||||
+size_t tdb_map_size(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Get the tdb flags set during open.
|
||||
@@ -872,7 +872,7 @@ _PUBLIC_ size_t tdb_map_size(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The flags set to on the database.
|
||||
*/
|
||||
-_PUBLIC_ int tdb_get_flags(struct tdb_context *tdb);
|
||||
+int tdb_get_flags(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Add flags to the database.
|
||||
@@ -881,7 +881,7 @@ _PUBLIC_ int tdb_get_flags(struct tdb_context *tdb);
|
||||
*
|
||||
* @param[in] flag The tdb flags to add.
|
||||
*/
|
||||
-_PUBLIC_ void tdb_add_flags(struct tdb_context *tdb, unsigned flag);
|
||||
+void tdb_add_flags(struct tdb_context *tdb, unsigned flag);
|
||||
|
||||
/**
|
||||
* @brief Remove flags from the database.
|
||||
@@ -890,7 +890,7 @@ _PUBLIC_ void tdb_add_flags(struct tdb_context *tdb, unsigned flag);
|
||||
*
|
||||
* @param[in] flag The tdb flags to remove.
|
||||
*/
|
||||
-_PUBLIC_ void tdb_remove_flags(struct tdb_context *tdb, unsigned flag);
|
||||
+void tdb_remove_flags(struct tdb_context *tdb, unsigned flag);
|
||||
|
||||
/**
|
||||
* @brief Enable sequence number handling on an open tdb.
|
||||
@@ -899,7 +899,7 @@ _PUBLIC_ void tdb_remove_flags(struct tdb_context *tdb, unsigned flag);
|
||||
*
|
||||
* @see tdb_get_seqnum()
|
||||
*/
|
||||
-_PUBLIC_ void tdb_enable_seqnum(struct tdb_context *tdb);
|
||||
+void tdb_enable_seqnum(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Increment the tdb sequence number.
|
||||
@@ -912,7 +912,7 @@ _PUBLIC_ void tdb_enable_seqnum(struct tdb_context *tdb);
|
||||
* @see tdb_enable_seqnum()
|
||||
* @see tdb_get_seqnum()
|
||||
*/
|
||||
-_PUBLIC_ void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
|
||||
+void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
|
||||
|
||||
/**
|
||||
* @brief Create a hash of the key.
|
||||
@@ -921,7 +921,7 @@ _PUBLIC_ void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
|
||||
*
|
||||
* @return The hash.
|
||||
*/
|
||||
-_PUBLIC_ unsigned int tdb_jenkins_hash(TDB_DATA *key);
|
||||
+unsigned int tdb_jenkins_hash(TDB_DATA *key);
|
||||
|
||||
/**
|
||||
* @brief Check the consistency of the database.
|
||||
@@ -944,7 +944,7 @@ _PUBLIC_ unsigned int tdb_jenkins_hash(TDB_DATA *key);
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_check(struct tdb_context *tdb,
|
||||
+int tdb_check(struct tdb_context *tdb,
|
||||
int (*check) (TDB_DATA key, TDB_DATA data, void *private_data),
|
||||
void *private_data);
|
||||
|
||||
@@ -966,7 +966,7 @@ _PUBLIC_ int tdb_check(struct tdb_context *tdb,
|
||||
* @see tdb_error()
|
||||
* @see tdb_errorstr()
|
||||
*/
|
||||
-_PUBLIC_ int tdb_rescue(struct tdb_context *tdb,
|
||||
+int tdb_rescue(struct tdb_context *tdb,
|
||||
void (*walk) (TDB_DATA key, TDB_DATA data, void *private_data),
|
||||
void *private_data);
|
||||
|
||||
@@ -989,34 +989,34 @@ _PUBLIC_ int tdb_rescue(struct tdb_context *tdb,
|
||||
*
|
||||
* @see TDB_MUTEX_LOCKING
|
||||
*/
|
||||
-_PUBLIC_ bool tdb_runtime_check_for_robust_mutexes(void);
|
||||
+bool tdb_runtime_check_for_robust_mutexes(void);
|
||||
|
||||
/* @} ******************************************************************/
|
||||
|
||||
/* Low level locking functions: use with care */
|
||||
-_PUBLIC_ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainlock_read_nonblock(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
|
||||
-_PUBLIC_ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock_read_nonblock(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
|
||||
+int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
-_PUBLIC_ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr);
|
||||
+void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr);
|
||||
|
||||
/* wipe and repack */
|
||||
-_PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb);
|
||||
-_PUBLIC_ int tdb_repack(struct tdb_context *tdb);
|
||||
+int tdb_wipe_all(struct tdb_context *tdb);
|
||||
+int tdb_repack(struct tdb_context *tdb);
|
||||
|
||||
/* Debug functions. Not used in production. */
|
||||
-_PUBLIC_ void tdb_dump_all(struct tdb_context *tdb);
|
||||
-_PUBLIC_ int tdb_printfreelist(struct tdb_context *tdb);
|
||||
-_PUBLIC_ int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
|
||||
-_PUBLIC_ int tdb_freelist_size(struct tdb_context *tdb);
|
||||
-_PUBLIC_ char *tdb_summary(struct tdb_context *tdb);
|
||||
+void tdb_dump_all(struct tdb_context *tdb);
|
||||
+int tdb_printfreelist(struct tdb_context *tdb);
|
||||
+int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
|
||||
+int tdb_freelist_size(struct tdb_context *tdb);
|
||||
+char *tdb_summary(struct tdb_context *tdb);
|
||||
|
||||
-_PUBLIC_ extern TDB_DATA tdb_null;
|
||||
+extern TDB_DATA tdb_null;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEEkUejOXGVGO6QEby1R5ORYRMIQCUFAmKhdjAACgkQR5ORYRMI
|
||||
QCVzTAgAhdy0HkdutoHbnUJg/ZgfDv21HE5SWVTRXlX93PJFXqzhZWu7GL6C75tY
|
||||
kuVGF2+Vljcm5BDUGG4REomLW/rZoqUOJDMhBzeW5ZZvPWMMLPoYbX03en7y4fXn
|
||||
woECYhrT40lxdtR43sTUEdCGoxsQ1bL/tlz30Edyc6UbxV3LvM1Yaju95yTY4ax6
|
||||
JHFNQp1o+MwGyjeR9VPPYFn9Y+p+aLpxk3jypcbvW1oijR9GyzEWS6NqMOzuQwMz
|
||||
BtIJNUXd8gDjaPZPiiX52JnrnSc62My5D5ORYY2YjZw97K3bT0O+/DNv9/roiG5Y
|
||||
qFxwM0bUiX/ucG/Z6pbkJWKS/ZQAeg==
|
||||
=wdUI
|
||||
-----END PGP SIGNATURE-----
|
|
@ -0,0 +1,6 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
|
@ -1,30 +1,20 @@
|
|||
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||
%global with_python3 1
|
||||
%endif
|
||||
|
||||
Name: libtdb
|
||||
Version: 1.4.7
|
||||
Version: 1.4.10
|
||||
Release: 1%{?dist}
|
||||
Summary: The tdb library
|
||||
License: LGPLv3+
|
||||
License: LGPL-3.0-or-later
|
||||
URL: http://tdb.samba.org/
|
||||
Source0: http://samba.org/ftp/tdb/tdb-%{version}.tar.gz
|
||||
Source1: http://samba.org/ftp/tdb/tdb-%{version}.tar.asc
|
||||
# gpg2 --no-default-keyring --keyring ./tdb.keyring --recv-keys 9147A339719518EE9011BCB54793916113084025
|
||||
Source2: tdb.keyring
|
||||
|
||||
# Patches
|
||||
Patch0001: 0003-wafsamba-Fix-few-SyntaxWarnings-caused-by-regular-ex.patch
|
||||
Patch0002: libtdb-revert-breaking-tdb.h.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gnupg2
|
||||
BuildRequires: libxslt
|
||||
BuildRequires: docbook-style-xsl
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel
|
||||
%endif
|
||||
|
||||
Provides: bundled(libreplace)
|
||||
Obsoletes: python2-tdb < 1.4.2-1
|
||||
|
@ -46,7 +36,6 @@ Requires: libtdb = %{version}-%{release}
|
|||
%description -n tdb-tools
|
||||
Tools to manage Tdb files
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python3-tdb
|
||||
Summary: Python3 bindings for the Tdb library
|
||||
Requires: libtdb = %{version}-%{release}
|
||||
|
@ -54,7 +43,6 @@ Requires: libtdb = %{version}-%{release}
|
|||
|
||||
%description -n python3-tdb
|
||||
Python3 bindings for libtdb
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -n tdb-%{version} -p1
|
||||
|
@ -71,7 +59,7 @@ zcat %{SOURCE0} | gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} -
|
|||
%make_build check
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
%make_install
|
||||
|
||||
%files
|
||||
%{_libdir}/libtdb.so.*
|
||||
|
@ -92,50 +80,103 @@ make install DESTDIR=$RPM_BUILD_ROOT
|
|||
%{_mandir}/man8/tdbtool.8*
|
||||
%{_mandir}/man8/tdbrestore.8*
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python3-tdb
|
||||
%{python3_sitearch}/__pycache__/_tdb_text.cpython*.py[co]
|
||||
%{python3_sitearch}/tdb.cpython*.so
|
||||
%{python3_sitearch}/_tdb_text.py
|
||||
%endif
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
%changelog
|
||||
* Mon Oct 24 2022 Andreas Schneider <asn@redhat.com> - 1.4.7-1
|
||||
- resolves: rhbz#2132054 - Rebase to version 1.4.7
|
||||
* Wed Apr 24 2024 Pavel Filipenský <pfilipen@redhat.com> - 1.4.10-1
|
||||
- resolves: RHEL-33756 - Rebase to version 1.4.10
|
||||
|
||||
* Mon Dec 04 2023 Andreas Schneider <asn@redhat.com> - 1.4.9-1
|
||||
- resolves: RHEL-16480 - Rebase to version 1.4.9
|
||||
|
||||
* Mon Jun 05 2023 Pavel Filipenský <pfilipen@redhat.com> - 1.4.8-2
|
||||
- resolves: rhbz#2190420 - Rebuilt to retrigger brew build
|
||||
|
||||
* Tue May 16 2023 Pavel Filipenský <pfilipen@redhat.com> - 1.4.8-1
|
||||
- resolves: rhbz#2190420 - Rebase to version 1.4.8
|
||||
|
||||
* Fri Oct 21 2022 Andreas Schneider <asn@redhat.com> - 1.4.7-1
|
||||
- resolves: rhbz#2131998 - Rebase to version 1.4.7
|
||||
|
||||
* Mon May 02 2022 Pavel Filipenský <pfilipen@redhat.com> - 1.4.6-1
|
||||
- resolves: rhbz#2077482 - Rebase to version 1.4.6
|
||||
- resolves: rhbz#2077489 - Rebase libtdb to the version (1.4.6) required by Samba
|
||||
|
||||
* Thu Nov 25 2021 Pavel Filipenský <pfilipen@redhat.com> - 1.4.4-1
|
||||
* resolves: rhbz#2013604 - Rebase to version 1.4.4
|
||||
* Mon Nov 29 2021 Pavel Filipenský <pfilipen@redhat.com> - 1.4.4-1
|
||||
- resolves: rhbz#2013584 - Rebase to version 1.4.4
|
||||
|
||||
* Tue Jun 2 2020 Isaac Boukris <iboukris@redhat.com> - 1.4.3-1
|
||||
- Resolves: rhbz#1817565 - Rebase libtdb 1.4.3 for samba
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.4.3-10
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Tue Nov 26 2019 Isaac Boukris <iboukris@redhat.com> - 1.4.2-2
|
||||
- Resolves: rhbz#1754420 - Rebase libtdb 1.4.2 for samba
|
||||
- Related: rhbz#1754420 - Fix sssd tests (tdb)
|
||||
* Fri Jul 23 2021 Andreas Schneider <asn@redhat.com> - 1.4.3-9
|
||||
- resolves: rhbz#1938798 - Fix memory leak on transaction error
|
||||
|
||||
* Tue Apr 30 2019 Jakub Hrozek <jhrozek@redhat.com> - 1.3.18.2
|
||||
- Obsolete the python2 packages on upgrade
|
||||
- Resolves: rhbz#1567138 - libtdb: Drop Python 2 subpackage from RHEL 8
|
||||
* Mon May 31 2021 Andreas Schneider <asn@redhat.com> - 1.4.3-8
|
||||
- related: rhbz#1962774 - Rebuilt for running gating tests
|
||||
|
||||
* Wed Apr 24 2019 Jakub Hrozek <jhrozek@redhat.com> - 1.3.18.1
|
||||
- Resolves: rhbz#1684579 - Rebase libtdb to version 1.3.18 for Samba
|
||||
- Resolves: rhbz#1597319 - libtdb uses Python 2 to build
|
||||
- Resolves: rhbz#1567138 - libtdb: Drop Python 2 subpackage from RHEL 8
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.4.3-7
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Thu Sep 20 2018 Jakub Hrozek <jhrozek@redhat.com> - 1.3.16-3
|
||||
- Resolves: rhbz#1624137 - Review annocheck distro flag failures in libtdb
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.3-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Thu Jul 12 2018 Jakub Hrozek <jhrozek@redhat.com> - 1.3.16-2
|
||||
- Use pathfix.py to select python2 instead of pytho
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.3-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1.4.3-4
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.4.3-3
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Jan 22 2020 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.4.3-1
|
||||
- rhbz#1783927 - libtdb-1.4.3 is available
|
||||
|
||||
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.4.2-2
|
||||
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||
|
||||
* Mon Aug 26 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.4.2-1
|
||||
- rhbz#1691299 - libtdb-1.4.2 is available
|
||||
- rhbz#1737644 - libldb, libtalloc, libtevent, libtdb: Remove Python 2 subpackages from Fedora 31+
|
||||
|
||||
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.18-5
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.18-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Jun 14 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.3.18-3
|
||||
- rhbz#1718113 - samba fail to build with Python 3.8
|
||||
AttributeError: module 'time' has no attribute 'clock'
|
||||
|
||||
* Mon Jun 03 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.3.18-2
|
||||
- rhbz#1711638 - fails to build with Python 3.8.0a4
|
||||
|
||||
* Tue Feb 26 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.3.18-1
|
||||
- rhbz#1683185 - libtdb-1.3.18 is available
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.17-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Thu Jan 17 2019 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.3.17-1
|
||||
- rhbz#1667472 - libtdb-1.3.17 is available
|
||||
|
||||
* Fri Jul 13 2018 Jakub Hrozek <jhrozek@redhat.com> - 1.3.16-2
|
||||
- Drop the unneeded ABI hide patch
|
||||
- Use pathfix.py instead of a local patch to munge the python path
|
||||
|
||||
* Thu Jul 12 2018 Jakub Hrozek <jhrozek@redhat.com> - 1.3.16-1
|
||||
- New upstream release 1.3.16
|
||||
- Use RHEL_ALLOW_PYTHON2_FOR_BUILD=1 until libtalloc uses waf3
|
||||
- Apply a patch to hide local ABI symbols to avoid issues with new binutils
|
||||
- Patch the waf script to explicitly call python2 as "env python" doesn't
|
||||
yield py2 anymore
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
SHA512 (tdb-1.4.10.tar.asc) = 7bc9616aa6a3badba33e508777eec307de51c2abb494836677356e432036970641b53f3b7c0c207efe909194343d3554af7932412d163f59db0ec8877fd19848
|
||||
SHA512 (tdb-1.4.10.tar.gz) = b5147d811617d90a025d1070abf16c42744b3fc3cac1042fbff03b1e635af2eaf9c957a7bffdb3f56b4a0c775b44f8027def9f23deb1b3ede817b95bbece2ce9
|
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
|
||||
tdbtorture: tdbtorture.c
|
||||
gcc tdbtorture.c -g -ltdb -o tdbtorture
|
||||
|
||||
tdbtest: tdbtest.c
|
||||
gcc tdbtest.c -ltdb -lgdbm -g -o tdbtest
|
||||
|
||||
run: tdbtorture tdbtest
|
||||
@echo "Running tdbtorture"
|
||||
./tdbtorture
|
||||
@echo "Running tdbtest"
|
||||
./tdbtest
|
||||
|
||||
clean:
|
||||
rm -f tdbtorture tdbtest *.tdb *.gdbm
|
|
@ -0,0 +1,297 @@
|
|||
/* a test program for tdb - the trivial database */
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gdbm.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <tdb.h>
|
||||
|
||||
#define DELETE_PROB 7
|
||||
#define STORE_PROB 5
|
||||
|
||||
static struct tdb_context *db;
|
||||
static GDBM_FILE gdbm;
|
||||
|
||||
struct timeval tp1,tp2;
|
||||
|
||||
static void _start_timer(void)
|
||||
{
|
||||
gettimeofday(&tp1,NULL);
|
||||
}
|
||||
|
||||
static double _end_timer(void)
|
||||
{
|
||||
gettimeofday(&tp2,NULL);
|
||||
return((tp2.tv_sec - tp1.tv_sec) +
|
||||
(tp2.tv_usec - tp1.tv_usec)*1.0e-6);
|
||||
}
|
||||
|
||||
static void fatal(const char *why)
|
||||
{
|
||||
perror(why);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef PRINTF_ATTRIBUTE
|
||||
static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
|
||||
#endif
|
||||
static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vfprintf(stdout, format, ap);
|
||||
va_end(ap);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void compare_db(void)
|
||||
{
|
||||
TDB_DATA d, key, nextkey;
|
||||
datum gd, gkey, gnextkey;
|
||||
|
||||
key = tdb_firstkey(db);
|
||||
while (key.dptr) {
|
||||
d = tdb_fetch(db, key);
|
||||
gkey.dptr = key.dptr;
|
||||
gkey.dsize = key.dsize;
|
||||
|
||||
gd = gdbm_fetch(gdbm, gkey);
|
||||
|
||||
if (!gd.dptr) fatal("key not in gdbm");
|
||||
if (gd.dsize != d.dsize) fatal("data sizes differ");
|
||||
if (memcmp(gd.dptr, d.dptr, d.dsize)) {
|
||||
fatal("data differs");
|
||||
}
|
||||
|
||||
nextkey = tdb_nextkey(db, key);
|
||||
free(key.dptr);
|
||||
free(d.dptr);
|
||||
free(gd.dptr);
|
||||
key = nextkey;
|
||||
}
|
||||
|
||||
gkey = gdbm_firstkey(gdbm);
|
||||
while (gkey.dptr) {
|
||||
gd = gdbm_fetch(gdbm, gkey);
|
||||
key.dptr = gkey.dptr;
|
||||
key.dsize = gkey.dsize;
|
||||
|
||||
d = tdb_fetch(db, key);
|
||||
|
||||
if (!d.dptr) fatal("key not in db");
|
||||
if (d.dsize != gd.dsize) fatal("data sizes differ");
|
||||
if (memcmp(d.dptr, gd.dptr, gd.dsize)) {
|
||||
fatal("data differs");
|
||||
}
|
||||
|
||||
gnextkey = gdbm_nextkey(gdbm, gkey);
|
||||
free(gkey.dptr);
|
||||
free(gd.dptr);
|
||||
free(d.dptr);
|
||||
gkey = gnextkey;
|
||||
}
|
||||
}
|
||||
|
||||
static char *randbuf(int len)
|
||||
{
|
||||
char *buf;
|
||||
int i;
|
||||
buf = (char *)malloc(len+1);
|
||||
|
||||
for (i=0;i<len;i++) {
|
||||
buf[i] = 'a' + (rand() % 26);
|
||||
}
|
||||
buf[i] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void addrec_db(void)
|
||||
{
|
||||
int klen, dlen;
|
||||
char *k, *d;
|
||||
TDB_DATA key, data;
|
||||
|
||||
klen = 1 + (rand() % 4);
|
||||
dlen = 1 + (rand() % 100);
|
||||
|
||||
k = randbuf(klen);
|
||||
d = randbuf(dlen);
|
||||
|
||||
key.dptr = k;
|
||||
key.dsize = klen+1;
|
||||
|
||||
data.dptr = d;
|
||||
data.dsize = dlen+1;
|
||||
|
||||
if (rand() % DELETE_PROB == 0) {
|
||||
tdb_delete(db, key);
|
||||
} else if (rand() % STORE_PROB == 0) {
|
||||
if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
|
||||
fatal("tdb_store failed");
|
||||
}
|
||||
} else {
|
||||
data = tdb_fetch(db, key);
|
||||
if (data.dptr) free(data.dptr);
|
||||
}
|
||||
|
||||
free(k);
|
||||
free(d);
|
||||
}
|
||||
|
||||
static void addrec_gdbm(void)
|
||||
{
|
||||
int klen, dlen;
|
||||
char *k, *d;
|
||||
datum key, data;
|
||||
|
||||
klen = 1 + (rand() % 4);
|
||||
dlen = 1 + (rand() % 100);
|
||||
|
||||
k = randbuf(klen);
|
||||
d = randbuf(dlen);
|
||||
|
||||
key.dptr = k;
|
||||
key.dsize = klen+1;
|
||||
|
||||
data.dptr = d;
|
||||
data.dsize = dlen+1;
|
||||
|
||||
if (rand() % DELETE_PROB == 0) {
|
||||
gdbm_delete(gdbm, key);
|
||||
} else if (rand() % STORE_PROB == 0) {
|
||||
if (gdbm_store(gdbm, key, data, GDBM_REPLACE) != 0) {
|
||||
fatal("gdbm_store failed");
|
||||
}
|
||||
} else {
|
||||
data = gdbm_fetch(gdbm, key);
|
||||
if (data.dptr) free(data.dptr);
|
||||
}
|
||||
|
||||
free(k);
|
||||
free(d);
|
||||
}
|
||||
|
||||
static int traverse_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
|
||||
{
|
||||
#if 0
|
||||
printf("[%s] [%s]\n", key.dptr, dbuf.dptr);
|
||||
#endif
|
||||
tdb_delete(tdb, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void merge_test(void)
|
||||
{
|
||||
int i;
|
||||
char keys[5][2];
|
||||
char tdata[] = "test";
|
||||
TDB_DATA key, data;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
snprintf(keys[i],2, "%d", i);
|
||||
key.dptr = keys[i];
|
||||
key.dsize = 2;
|
||||
|
||||
data.dptr = tdata;
|
||||
data.dsize = 4;
|
||||
|
||||
if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
|
||||
fatal("tdb_store failed");
|
||||
}
|
||||
}
|
||||
|
||||
key.dptr = keys[0];
|
||||
tdb_delete(db, key);
|
||||
key.dptr = keys[4];
|
||||
tdb_delete(db, key);
|
||||
key.dptr = keys[2];
|
||||
tdb_delete(db, key);
|
||||
key.dptr = keys[1];
|
||||
tdb_delete(db, key);
|
||||
key.dptr = keys[3];
|
||||
tdb_delete(db, key);
|
||||
}
|
||||
|
||||
static char *test_path(const char *filename)
|
||||
{
|
||||
const char *prefix = getenv("TEST_DATA_PREFIX");
|
||||
|
||||
if (prefix) {
|
||||
char *path = NULL;
|
||||
int ret;
|
||||
|
||||
ret = asprintf(&path, "%s/%s", prefix, filename);
|
||||
if (ret == -1) {
|
||||
return NULL;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
return strdup(filename);
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
int i, seed=0;
|
||||
int loops = 10000;
|
||||
int num_entries;
|
||||
char *test_gdbm;
|
||||
char *test_tdb;
|
||||
|
||||
test_gdbm = test_path("test.gdbm");
|
||||
test_tdb = test_path("test.tdb");
|
||||
|
||||
unlink(test_gdbm);
|
||||
|
||||
db = tdb_open(test_tdb, 0, TDB_CLEAR_IF_FIRST,
|
||||
O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||
gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST,
|
||||
0600, NULL);
|
||||
|
||||
if (!db || !gdbm) {
|
||||
fatal("db open failed");
|
||||
}
|
||||
|
||||
#if 1
|
||||
srand(seed);
|
||||
_start_timer();
|
||||
for (i=0;i<loops;i++) addrec_gdbm();
|
||||
printf("gdbm got %.2f ops/sec\n", i/_end_timer());
|
||||
#endif
|
||||
|
||||
merge_test();
|
||||
|
||||
srand(seed);
|
||||
_start_timer();
|
||||
for (i=0;i<loops;i++) addrec_db();
|
||||
printf("tdb got %.2f ops/sec\n", i/_end_timer());
|
||||
|
||||
if (tdb_validate_freelist(db, &num_entries) == -1) {
|
||||
printf("tdb freelist is corrupt\n");
|
||||
} else {
|
||||
printf("tdb freelist is good (%d entries)\n", num_entries);
|
||||
}
|
||||
|
||||
compare_db();
|
||||
|
||||
printf("traversed %d records\n", tdb_traverse(db, traverse_fn, NULL));
|
||||
printf("traversed %d records\n", tdb_traverse(db, traverse_fn, NULL));
|
||||
|
||||
tdb_close(db);
|
||||
gdbm_close(gdbm);
|
||||
|
||||
free(test_tdb);
|
||||
free(test_gdbm);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#/bin/bash
|
||||
|
||||
make run || exit 1
|
||||
make clean || exit 2
|
|
@ -0,0 +1,501 @@
|
|||
/* this tests tdb by doing lots of ops from several simultaneous
|
||||
writers - that stresses the locking code.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <tdb.h>
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define REOPEN_PROB 30
|
||||
#define DELETE_PROB 8
|
||||
#define STORE_PROB 4
|
||||
#define APPEND_PROB 6
|
||||
#define TRANSACTION_PROB 10
|
||||
#define TRANSACTION_PREPARE_PROB 2
|
||||
#define LOCKSTORE_PROB 5
|
||||
#define TRAVERSE_PROB 20
|
||||
#define TRAVERSE_READ_PROB 20
|
||||
#define CULL_PROB 100
|
||||
#define KEYLEN 3
|
||||
#define DATALEN 100
|
||||
|
||||
static struct tdb_context *db;
|
||||
static int in_transaction;
|
||||
static int error_count;
|
||||
static int always_transaction = 0;
|
||||
static int hash_size = 2;
|
||||
static int loopnum;
|
||||
static int count_pipe;
|
||||
static bool mutex = false;
|
||||
static struct tdb_logging_context log_ctx;
|
||||
|
||||
#ifdef PRINTF_ATTRIBUTE
|
||||
static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
|
||||
#endif
|
||||
static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
/* trace level messages do not indicate an error */
|
||||
if (level != TDB_DEBUG_TRACE) {
|
||||
error_count++;
|
||||
}
|
||||
|
||||
va_start(ap, format);
|
||||
vfprintf(stdout, format, ap);
|
||||
va_end(ap);
|
||||
fflush(stdout);
|
||||
#if 0
|
||||
if (level != TDB_DEBUG_TRACE) {
|
||||
char *ptr;
|
||||
signal(SIGUSR1, SIG_IGN);
|
||||
asprintf(&ptr,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid());
|
||||
system(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void fatal(const char *why)
|
||||
{
|
||||
perror(why);
|
||||
error_count++;
|
||||
}
|
||||
|
||||
static char *randbuf(int len)
|
||||
{
|
||||
char *buf;
|
||||
int i;
|
||||
buf = (char *)malloc(len+1);
|
||||
|
||||
for (i=0;i<len;i++) {
|
||||
buf[i] = 'a' + (rand() % 26);
|
||||
}
|
||||
buf[i] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int cull_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
|
||||
void *state)
|
||||
{
|
||||
#if CULL_PROB
|
||||
if (random() % CULL_PROB == 0) {
|
||||
tdb_delete(tdb, key);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void addrec_db(void)
|
||||
{
|
||||
int klen, dlen;
|
||||
char *k, *d;
|
||||
TDB_DATA key, data;
|
||||
|
||||
klen = 1 + (rand() % KEYLEN);
|
||||
dlen = 1 + (rand() % DATALEN);
|
||||
|
||||
k = randbuf(klen);
|
||||
d = randbuf(dlen);
|
||||
|
||||
key.dptr = (unsigned char *)k;
|
||||
key.dsize = klen+1;
|
||||
|
||||
data.dptr = (unsigned char *)d;
|
||||
data.dsize = dlen+1;
|
||||
|
||||
#if REOPEN_PROB
|
||||
if (in_transaction == 0 && random() % REOPEN_PROB == 0) {
|
||||
tdb_reopen_all(0);
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TRANSACTION_PROB
|
||||
if (in_transaction == 0 &&
|
||||
(always_transaction || random() % TRANSACTION_PROB == 0)) {
|
||||
if (tdb_transaction_start(db) != 0) {
|
||||
fatal("tdb_transaction_start failed");
|
||||
}
|
||||
in_transaction++;
|
||||
goto next;
|
||||
}
|
||||
if (in_transaction && random() % TRANSACTION_PROB == 0) {
|
||||
if (random() % TRANSACTION_PREPARE_PROB == 0) {
|
||||
if (tdb_transaction_prepare_commit(db) != 0) {
|
||||
fatal("tdb_transaction_prepare_commit failed");
|
||||
}
|
||||
}
|
||||
if (tdb_transaction_commit(db) != 0) {
|
||||
fatal("tdb_transaction_commit failed");
|
||||
}
|
||||
in_transaction--;
|
||||
goto next;
|
||||
}
|
||||
if (in_transaction && random() % TRANSACTION_PROB == 0) {
|
||||
if (tdb_transaction_cancel(db) != 0) {
|
||||
fatal("tdb_transaction_cancel failed");
|
||||
}
|
||||
in_transaction--;
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DELETE_PROB
|
||||
if (random() % DELETE_PROB == 0) {
|
||||
tdb_delete(db, key);
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if STORE_PROB
|
||||
if (random() % STORE_PROB == 0) {
|
||||
if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
|
||||
fatal("tdb_store failed");
|
||||
}
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if APPEND_PROB
|
||||
if (random() % APPEND_PROB == 0) {
|
||||
if (tdb_append(db, key, data) != 0) {
|
||||
fatal("tdb_append failed");
|
||||
}
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LOCKSTORE_PROB
|
||||
if (random() % LOCKSTORE_PROB == 0) {
|
||||
tdb_chainlock(db, key);
|
||||
data = tdb_fetch(db, key);
|
||||
if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
|
||||
fatal("tdb_store failed");
|
||||
}
|
||||
if (data.dptr) free(data.dptr);
|
||||
tdb_chainunlock(db, key);
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TRAVERSE_PROB
|
||||
if (random() % TRAVERSE_PROB == 0) {
|
||||
tdb_traverse(db, cull_traverse, NULL);
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TRAVERSE_READ_PROB
|
||||
if (random() % TRAVERSE_READ_PROB == 0) {
|
||||
tdb_traverse_read(db, NULL, NULL);
|
||||
goto next;
|
||||
}
|
||||
#endif
|
||||
|
||||
data = tdb_fetch(db, key);
|
||||
if (data.dptr) free(data.dptr);
|
||||
|
||||
next:
|
||||
free(k);
|
||||
free(d);
|
||||
}
|
||||
|
||||
static int traverse_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
|
||||
void *state)
|
||||
{
|
||||
tdb_delete(tdb, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Usage: tdbtorture [-t] [-k] [-m] [-n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-H HASH_SIZE]\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void send_count_and_suicide(int sig)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
/* This ensures our successor can continue where we left off. */
|
||||
do {
|
||||
ret = write(count_pipe, &loopnum, sizeof(loopnum));
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
/* This gives a unique signature. */
|
||||
kill(getpid(), SIGUSR2);
|
||||
}
|
||||
|
||||
static int run_child(const char *filename, int i, int seed, unsigned num_loops, unsigned start)
|
||||
{
|
||||
int tdb_flags = TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH;
|
||||
|
||||
if (mutex) {
|
||||
tdb_flags |= TDB_MUTEX_LOCKING;
|
||||
}
|
||||
|
||||
db = tdb_open_ex(filename, hash_size, tdb_flags,
|
||||
O_RDWR | O_CREAT, 0600, &log_ctx, NULL);
|
||||
if (!db) {
|
||||
fatal("db open failed");
|
||||
}
|
||||
|
||||
srand(seed + i);
|
||||
srandom(seed + i);
|
||||
|
||||
/* Set global, then we're ready to handle being killed. */
|
||||
loopnum = start;
|
||||
signal(SIGUSR1, send_count_and_suicide);
|
||||
|
||||
for (;loopnum<num_loops && error_count == 0;loopnum++) {
|
||||
addrec_db();
|
||||
}
|
||||
|
||||
if (error_count == 0) {
|
||||
tdb_traverse_read(db, NULL, NULL);
|
||||
if (always_transaction) {
|
||||
while (in_transaction) {
|
||||
tdb_transaction_cancel(db);
|
||||
in_transaction--;
|
||||
}
|
||||
if (tdb_transaction_start(db) != 0)
|
||||
fatal("tdb_transaction_start failed");
|
||||
}
|
||||
tdb_traverse(db, traverse_fn, NULL);
|
||||
tdb_traverse(db, traverse_fn, NULL);
|
||||
if (always_transaction) {
|
||||
if (tdb_transaction_commit(db) != 0)
|
||||
fatal("tdb_transaction_commit failed");
|
||||
}
|
||||
}
|
||||
|
||||
tdb_close(db);
|
||||
|
||||
return (error_count < 100 ? error_count : 100);
|
||||
}
|
||||
|
||||
static char *test_path(const char *filename)
|
||||
{
|
||||
const char *prefix = getenv("TEST_DATA_PREFIX");
|
||||
|
||||
if (prefix) {
|
||||
char *path = NULL;
|
||||
int ret;
|
||||
|
||||
ret = asprintf(&path, "%s/%s", prefix, filename);
|
||||
if (ret == -1) {
|
||||
return NULL;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
return strdup(filename);
|
||||
}
|
||||
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
int i, seed = -1;
|
||||
int num_loops = 5000;
|
||||
int num_procs = 3;
|
||||
int c, pfds[2];
|
||||
extern char *optarg;
|
||||
pid_t *pids;
|
||||
int kill_random = 0;
|
||||
int *done;
|
||||
char *test_tdb;
|
||||
|
||||
log_ctx.log_fn = tdb_log;
|
||||
|
||||
while ((c = getopt(argc, argv, "n:l:s:H:thkm")) != -1) {
|
||||
switch (c) {
|
||||
case 'n':
|
||||
num_procs = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'l':
|
||||
num_loops = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'H':
|
||||
hash_size = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 's':
|
||||
seed = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 't':
|
||||
always_transaction = 1;
|
||||
break;
|
||||
case 'k':
|
||||
kill_random = 1;
|
||||
break;
|
||||
case 'm':
|
||||
mutex = tdb_runtime_check_for_robust_mutexes();
|
||||
if (!mutex) {
|
||||
printf("tdb_runtime_check_for_robust_mutexes() returned false\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
test_tdb = test_path("torture.tdb");
|
||||
|
||||
unlink(test_tdb);
|
||||
|
||||
if (seed == -1) {
|
||||
seed = (getpid() + time(NULL)) & 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n",
|
||||
num_procs, num_loops, hash_size, seed,
|
||||
(always_transaction ? " (all within transactions)" : ""));
|
||||
|
||||
if (num_procs == 1 && !kill_random) {
|
||||
/* Don't fork for this case, makes debugging easier. */
|
||||
error_count = run_child(test_tdb, 0, seed, num_loops, 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
pids = (pid_t *)calloc(sizeof(pid_t), num_procs);
|
||||
if (pids == NULL) {
|
||||
perror("Unable to allocate memory for pids");
|
||||
exit(1);
|
||||
}
|
||||
done = (int *)calloc(sizeof(int), num_procs);
|
||||
if (done == NULL) {
|
||||
perror("Unable to allocate memory for done");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pipe(pfds) != 0) {
|
||||
perror("Creating pipe");
|
||||
exit(1);
|
||||
}
|
||||
count_pipe = pfds[1];
|
||||
|
||||
for (i=0;i<num_procs;i++) {
|
||||
if ((pids[i]=fork()) == 0) {
|
||||
close(pfds[0]);
|
||||
exit(run_child(test_tdb, i, seed, num_loops, 0));
|
||||
}
|
||||
}
|
||||
|
||||
while (num_procs) {
|
||||
int status, j;
|
||||
pid_t pid;
|
||||
|
||||
if (error_count != 0) {
|
||||
/* try and stop the test on any failure */
|
||||
for (j=0;j<num_procs;j++) {
|
||||
if (pids[j] != 0) {
|
||||
kill(pids[j], SIGTERM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pid = waitpid(-1, &status, kill_random ? WNOHANG : 0);
|
||||
if (pid == 0) {
|
||||
struct timeval tv;
|
||||
|
||||
/* Sleep for 1/10 second. */
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100000;
|
||||
select(0, NULL, NULL, NULL, &tv);
|
||||
|
||||
/* Kill someone. */
|
||||
kill(pids[random() % num_procs], SIGUSR1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pid == -1) {
|
||||
perror("failed to wait for child\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (j=0;j<num_procs;j++) {
|
||||
if (pids[j] == pid) break;
|
||||
}
|
||||
if (j == num_procs) {
|
||||
printf("unknown child %d exited!?\n", (int)pid);
|
||||
exit(1);
|
||||
}
|
||||
if (WIFSIGNALED(status)) {
|
||||
if (WTERMSIG(status) == SIGUSR2
|
||||
|| WTERMSIG(status) == SIGUSR1) {
|
||||
/* SIGUSR2 means they wrote to pipe. */
|
||||
if (WTERMSIG(status) == SIGUSR2) {
|
||||
ssize_t ret;
|
||||
|
||||
do {
|
||||
ret = read(pfds[0], &done[j],
|
||||
sizeof(done[j]));
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
}
|
||||
pids[j] = fork();
|
||||
if (pids[j] == 0)
|
||||
exit(run_child(test_tdb, j, seed,
|
||||
num_loops, done[j]));
|
||||
printf("Restarting child %i for %u-%u\n",
|
||||
j, done[j], num_loops);
|
||||
continue;
|
||||
}
|
||||
printf("child %d exited with signal %d\n",
|
||||
(int)pid, WTERMSIG(status));
|
||||
error_count++;
|
||||
} else {
|
||||
if (WEXITSTATUS(status) != 0) {
|
||||
printf("child %d exited with status %d\n",
|
||||
(int)pid, WEXITSTATUS(status));
|
||||
error_count++;
|
||||
}
|
||||
}
|
||||
memmove(&pids[j], &pids[j+1],
|
||||
(num_procs - j - 1)*sizeof(pids[0]));
|
||||
num_procs--;
|
||||
}
|
||||
|
||||
free(pids);
|
||||
|
||||
done:
|
||||
if (error_count == 0) {
|
||||
int tdb_flags = TDB_DEFAULT;
|
||||
|
||||
if (mutex) {
|
||||
tdb_flags |= TDB_NOLOCK;
|
||||
}
|
||||
|
||||
db = tdb_open_ex(test_tdb, hash_size, tdb_flags,
|
||||
O_RDWR, 0, &log_ctx, NULL);
|
||||
if (!db) {
|
||||
fatal("db open failed\n");
|
||||
exit(1);
|
||||
}
|
||||
if (tdb_check(db, NULL, NULL) == -1) {
|
||||
printf("db check failed\n");
|
||||
exit(1);
|
||||
}
|
||||
tdb_close(db);
|
||||
printf("OK\n");
|
||||
}
|
||||
|
||||
free(test_tdb);
|
||||
return error_count;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- classic
|
||||
tests:
|
||||
- sanity:
|
||||
dir: sanity
|
||||
run: ./tdbtest.sh
|
||||
required_packages:
|
||||
- make
|
||||
- gcc
|
||||
- libtdb
|
||||
- libtdb-devel
|
||||
- gdbm
|
||||
- gdbm-devel
|
||||
|
Loading…
Reference in New Issue