summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* tdb: use tdb_nest_lock() for seqnum lock.Rusty Russell2010-02-171-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>
* tdb: use tdb_nest_lock() for active lock.Rusty Russell2010-02-242-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>
* tdb: use tdb_nest_lock() for open lock.Rusty Russell2010-02-223-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>
* tdb: use tdb_nest_lock() for transaction lock.Rusty Russell2010-02-172-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>
* tdb: cleanup: find_nestlock() helper.Rusty Russell2010-02-171-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>
* tdb: cleanup: tdb_release_extra_locks() helperRusty Russell2010-02-243-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>
* tdb: cleanup: tdb_have_extra_locks() helperRusty Russell2010-02-174-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>
* tdb: don't suppress the transaction lock because of the allrecord lock.Rusty Russell2010-02-171-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>
* tdb: cleanup: tdb_nest_lock/tdb_nest_unlockRusty Russell2010-02-173-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>
* tdb: cleanup: rename global_lock to allrecord_lock.Rusty Russell2010-02-175-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>
* tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.Rusty Russell2010-02-173-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>
* tdb: make _tdb_transaction_cancel static.Rusty Russell2010-02-242-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>
* tdb: cleanup: split brlock and brunlock methods.Rusty Russell2010-02-177-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>
* libreplace: Remove the obsolete signal type cast.Andreas Schneider2010-02-233-13/+4
| | | | | AC_SIGNAL_TYPE is already obsolete in autoconf. C89 requires signal handlers to return void, only K&R returned int.
* libutil: Remove obsolete signal type cast.Andreas Schneider2010-02-231-5/+5
|
* Spelling fixes for libutilBrad Hards2010-02-227-24/+24
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes in lib/zlib.Brad Hards2010-02-2211-20/+20
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for libreplace.Brad Hards2010-02-222-2/+2
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for tsocket API documentation.Brad Hards2010-02-221-14/+14
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for lib/compression.Brad Hards2010-02-221-2/+2
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for nss_wrapper.Brad Hards2010-02-221-2/+2
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for popt API documentation.Brad Hards2010-02-221-2/+2
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for tevent.Brad Hards2010-02-223-4/+4
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* Spelling fixes for tdb.Brad Hards2010-02-222-2/+2
| | | | Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
* nss_wrapper: fix segfault in print_group() in the testsuiteMichael Adam2010-02-191-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
* s4-smbtorture: add LOCAL-NSS-WRAPPER-DUPLICATES test.Günther Deschner2010-02-181-1/+92
| | | | Guenther
* s4-smbtorture: be more verbose in LOCAL-NSS-WRAPPER.Günther Deschner2010-02-181-4/+4
| | | | Guenther
* tsocket/bsd: fix comment in tdgram_bsd_recvfrom_handler()Stefan Metzmacher2010-02-181-2/+4
| | | | metze
* Fix commit d07cd37b993d3c9beded20323174633b806196b5Jeremy Allison2010-02-171-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.
* tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREADStefan Metzmacher2010-02-171-4/+6
| | | | metze
* tsocket/bsd: set IPV6_V6ONLY on AF_INET6 socketsStefan Metzmacher2010-02-171-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
* tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote ↵Stefan Metzmacher2010-02-171-2/+53
| | | | | | address if the local address is any metze
* tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in ↵Stefan Metzmacher2010-02-171-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
* tsocket/bsd: fix do_bind logic for AF_INETStefan Metzmacher2010-02-171-2/+2
| | | | | | We want the explicit bind() when we don't use the any address. metze
* socket_wrapper: also ignore AF_INET6 in swrap_setsockopt()Stefan Metzmacher2010-02-171-0/+4
| | | | metze
* util: added samba_runcmd()Andrew Tridgell2010-02-173-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>
* s4-dsdb: removed gendb_search_single_extended_dn()Andrew Tridgell2010-02-162-105/+0
| | | | | | Use dsdb_search_one() instead, which allows for arbitrary controls Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* util: update three other copies of our dlinklist.h macrosAndrew Tridgell2010-02-141-48/+115
| | | | | ldb and tevent have their own copies of these macros. This brings them in sync with the master copy of dlinklist.h
* lib: use TYPESAFE_QSORT() in lib/ and libcli/Andrew Tridgell2010-02-141-1/+2
|
* s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb codeAndrew Tridgell2010-02-141-1/+3
|
* use ZERO_STRUCTVolker Lendecke2010-02-131-1/+2
|
* Use ZERO_STRUCTPVolker Lendecke2010-02-131-1/+1
|
* s3: Fix a typoVolker Lendecke2010-02-131-1/+1
|
* tdb: use fdatasync() instead of fsync() in transactionsAndrew Tridgell2010-02-131-1/+1
| | | | This might help on some filesystems
* libreplace: add fdatasync() if not availableAndrew Tridgell2010-02-132-1/+5
|
* util: added TYPESAFE_QSORT() macroAndrew Tridgell2010-02-131-0/+38
| | | | | This makes it much harder to get the type of a qsort comparison function wrong.
* tdb: Apply some const, just for clarityVolker Lendecke2010-02-131-1/+1
|
* s3: Add tdb_data_equalVolker Lendecke2010-02-122-0/+9
|
* util: added file_compare() utility functionAndrew Tridgell2010-02-112-0/+27
| | | | | | | file_compare() returns true if two files are the same. It is meant for small files. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* libreplace: added replacements for dprintf() and vdprintf()Andrew Tridgell2010-02-112-1/+32
| | | | | | these are very useful for writing files with formatted writes Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>