summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2010-02-24tdb: cleanup: always grab allrecord lock to infinity.Rusty Russell1-7/+3
We were previously inconsistent with our "global" lock: the transaction code grabbed it from FREELIST_TOP to end of file, and the rest of the code grabbed it from FREELIST_TOP to end of the hash chains. Change it to always grab to end of file for simplicity and so we can merge the two. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: remove num_locksRusty Russell2-11/+2
This was redundant before this patch series: it mirrored num_lockrecs exactly. It still does. Also, skip useless branch when locks == 1: unconditional assignment is cheaper anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: use tdb_nest_lock() for seqnum lock.Rusty Russell1-3/+3
This is pure overhead, but it centralizes the locking. Realloc (esp. as most implementations are lazy) is fast compared to the fnctl anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24tdb: use tdb_nest_lock() for active lock.Rusty Russell2-5/+18
Use our newly-generic nested lock tracking for the active lock. Note that the tdb_have_extra_locks() and tdb_release_extra_locks() functions have to skip over this lock now it is tracked. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-22tdb: use tdb_nest_lock() for open lock.Rusty Russell3-15/+10
This never nests, so it's overkill, but it centralizes the locking into lock.c and removes the ugly flag in the transaction code to track whether we have the lock or not. Note that we have a temporary hack so this places a real lock, despite the fact that we are in a transaction. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: use tdb_nest_lock() for transaction lock.Rusty Russell2-32/+23
Rather than a boutique lock and a separate nest count, use our newly-generic nested lock tracking for the transaction lock. Note that the tdb_have_extra_locks() and tdb_release_extra_locks() functions have to skip over this lock now it is tracked. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: find_nestlock() helper.Rusty Russell1-28/+23
Factor out two loops which find locks; we are going to introduce a couple more so a helper makes sense. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24tdb: cleanup: tdb_release_extra_locks() helperRusty Russell3-17/+22
Move locking intelligence back into lock.c, rather than open-coding the lock release in transaction.c. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: tdb_have_extra_locks() helperRusty Russell4-5/+17
In many places we check whether locks are held: add a helper to do this. The _tdb_lockall() case has already checked for the allrecord lock, so the extra work done by tdb_have_extra_locks() is merely redundant. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: don't suppress the transaction lock because of the allrecord lock.Rusty Russell1-6/+0
tdb_transaction_lock() and tdb_transaction_unlock() do nothing if we hold the allrecord lock. However, the two locks don't overlap, so this is wrong. This simplification makes the transaction lock a straight-forward nested lock. There are two callers for these functions: 1) The transaction code, which already makes sure the allrecord_lock isn't held. 2) The traverse code, which wants to stop transactions whether it has the allrecord lock or not. There have been deadlocks here before, however this should not bring them back (I hope!) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: tdb_nest_lock/tdb_nest_unlockRusty Russell3-45/+67
Because fcntl locks don't nest, we track them in the tdb->lockrecs array and only place/release them when the count goes to 1/0. We only do this for record locks, so we simply place the list number (or -1 for the free list) in the structure. To generalize this: 1) Put the offset rather than list number in struct tdb_lock_type. 2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the allrecord check out to the callers (except the mark case which doesn't care). 3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and move the allrecord out to the callers (except mark again). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: rename global_lock to allrecord_lock.Rusty Russell5-29/+29
The word global is overloaded in tdb. The global_lock inside struct tdb_context is used to indicate we hold a lock across all the chains. Rename it to allrecord_lock. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.Rusty Russell3-17/+17
The word global is overloaded in tdb. The GLOBAL_LOCK offset is used at open time to serialize initialization (and by the transaction code to block open). Rename it to OPEN_LOCK. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-24tdb: make _tdb_transaction_cancel static.Rusty Russell2-2/+1
Now tdb_open() calls tdb_transaction_cancel() instead of _tdb_transaction_cancel, we can make it static. Signed-off-by: Rusty Russell<rusty@rustcorp.com.au>
2010-02-17tdb: cleanup: split brlock and brunlock methods.Rusty Russell7-117/+235
This is taken from the CCAN code base: rather than using tdb_brlock for locking and unlocking, we split it into brlock and brunlock functions. For extra debugging information, brunlock says what kind of lock it is unlocking (even though fnctl locks don't need this). This requires an extra argument to tdb_transaction_unlock() so we know whether the lock was upgraded to a write lock or not. We also use a "flags" argument tdb_brlock: 1) TDB_LOCK_NOWAIT replaces lck_type = F_SETLK (vs F_SETLKW). 2) TDB_LOCK_MARK_ONLY replaces setting TDB_MARK_LOCK bit in ltype. 3) TDB_LOCK_PROBE replaces the "probe" argument. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-02-23libreplace: Remove the obsolete signal type cast.Andreas Schneider3-13/+4
AC_SIGNAL_TYPE is already obsolete in autoconf. C89 requires signal handlers to return void, only K&R returned int.
2010-02-23libutil: Remove obsolete signal type cast.Andreas Schneider1-5/+5
2010-02-22Spelling fixes for libutilBrad Hards7-24/+24
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes in lib/zlib.Brad Hards11-20/+20
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for libreplace.Brad Hards2-2/+2
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for tsocket API documentation.Brad Hards1-14/+14
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for lib/compression.Brad Hards1-2/+2
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for nss_wrapper.Brad Hards1-2/+2
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for popt API documentation.Brad Hards1-2/+2
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for tevent.Brad Hards3-4/+4
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22Spelling fixes for tdb.Brad Hards2-2/+2
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-19nss_wrapper: fix segfault in print_group() in the testsuiteMichael Adam1-1/+1
Running 'TESTS=posix_s3 POSIX_SUBTESTS="RPC-SAMR-LARGE-DC LOCAL-NSS-WRAPPER" make test' from s3 made smbtorture4 crash on my box. Michael
2010-02-18s4-smbtorture: add LOCAL-NSS-WRAPPER-DUPLICATES test.Günther Deschner1-1/+92
Guenther
2010-02-18s4-smbtorture: be more verbose in LOCAL-NSS-WRAPPER.Günther Deschner1-4/+4
Guenther
2010-02-18tsocket/bsd: fix comment in tdgram_bsd_recvfrom_handler()Stefan Metzmacher1-2/+4
metze
2010-02-17Fix commit d07cd37b993d3c9beded20323174633b806196b5Jeremy Allison1-1/+4
Which was: tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD Metze, this has to have been wrong - you are throwing away the talloc_realloc pointer returned. Also no error checking. Please review. Thank goodness for gcc warnings :-). Jeremy.
2010-02-17tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREADStefan Metzmacher1-4/+6
metze
2010-02-17tsocket/bsd: set IPV6_V6ONLY on AF_INET6 socketsStefan Metzmacher1-0/+36
Some system already have this as default. It's easier to behave the same way on all systems and handle ipv6 and ipv4 sockets separate. metze
2010-02-17tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote ↵Stefan Metzmacher1-2/+53
address if the local address is any metze
2010-02-17tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in ↵Stefan Metzmacher1-1/+1
tstream_bsd_connect_send() This is needed because, we can't use sizeof(sockaddr_storage) for AF_UNIX sockets. Also some platforms require exact values for AF_INET and AF_INET6. metze
2010-02-17tsocket/bsd: fix do_bind logic for AF_INETStefan Metzmacher1-2/+2
We want the explicit bind() when we don't use the any address. metze
2010-02-17socket_wrapper: also ignore AF_INET6 in swrap_setsockopt()Stefan Metzmacher1-0/+4
metze
2010-02-17util: added samba_runcmd()Andrew Tridgell3-0/+275
This allows us to run a child command in an async fashion, with control over logging of stdout and stderr (which appears in the Samba log file). This is useful for ensuring we don't miss important messages from rndc commands (for example). Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-16s4-dsdb: removed gendb_search_single_extended_dn()Andrew Tridgell2-105/+0
Use dsdb_search_one() instead, which allows for arbitrary controls Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-14util: update three other copies of our dlinklist.h macrosAndrew Tridgell1-48/+115
ldb and tevent have their own copies of these macros. This brings them in sync with the master copy of dlinklist.h
2010-02-14lib: use TYPESAFE_QSORT() in lib/ and libcli/Andrew Tridgell1-1/+2
2010-02-14s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb codeAndrew Tridgell1-1/+3
2010-02-13use ZERO_STRUCTVolker Lendecke1-1/+2
2010-02-13Use ZERO_STRUCTPVolker Lendecke1-1/+1
2010-02-13s3: Fix a typoVolker Lendecke1-1/+1
2010-02-13tdb: use fdatasync() instead of fsync() in transactionsAndrew Tridgell1-1/+1
This might help on some filesystems
2010-02-13libreplace: add fdatasync() if not availableAndrew Tridgell2-1/+5
2010-02-13util: added TYPESAFE_QSORT() macroAndrew Tridgell1-0/+38
This makes it much harder to get the type of a qsort comparison function wrong.
2010-02-13tdb: Apply some const, just for clarityVolker Lendecke1-1/+1
2010-02-12s3: Add tdb_data_equalVolker Lendecke2-0/+9