summaryrefslogtreecommitdiffstats
path: root/ctdb/lib/util
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-build: Change from ctdb-util to samba-utilMartin Schwenke2014-10-0612-2116/+0
| | | | | | | | | | | | | | | | | | Remove local lib/util and lib/tdb-wrap. Update wscript, packaging and includes.h. The only potentially surprising thing here is a fake samba-util subsystem that just depends on samba-util-core. As explained in a comment: When a combined build is implemented, CTDB will wanted to build against samba-util rather than samba-util-core. Similarly, other Samba subsystems expect samba-util. So, for a standalone build, just define a fake samba-util subsystem that pulls in samba-util-core. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-logging: Update to use Samba style debug.h/debug.cMartin Schwenke2014-10-062-74/+64
| | | | | | | | | | | | | | | | | | | | | Samba's debug subsystem has changed a lot, so CTDB's logging needs to be rewritten to be compatible. The new debug.h/debug.c can't just be pulled in because it has some extra dependencies into Samba's lib/util. For now, to support the smallest possible patch, implement a minimal subset of Samba's debug.[ch] that just supports the DEBUG_CALLBACK logtype. Define a callback for each logging method. Check later to see if debug_extra (or similar) can somehow be implemented using debug classes. The timestamp on CTDB CLI tool and test program DEBUG() output goes away, so update the unit test code to cope. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-logging: Remove log ringbufferMartin Schwenke2014-10-061-1/+0
| | | | | | | | | | | As far as we know, nobody uses this and it just complicates the logging subsystem. Remove all ringbuffer code and documentation. Update the local daemons startup code correspondingly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib: util [ctdb]: Signal handling - change CatchChild() and ↵Jeremy Allison2014-09-302-6/+6
| | | | | | | | | | | CatchChildLeaveStatus() to return the previous handler. Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc. https://bugzilla.samba.org/show_bug.cgi?id=10831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* lib/util: Do not duplicate the protocol list, use smb_constants.hAndrew Bartlett2014-09-291-11/+1
| | | | | | | | | This avoids the two lists getting out of sync, and only applies to a Samba build due to the surrounding #ifdef Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-build: Add missing configure checks for backtraceAmitay Isaacs2014-09-191-1/+1
| | | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Sep 19 06:06:31 CEST 2014 on sn-devel-104
* lib: Remove unused file_lines_slashcontVolker Lendecke2014-09-171-6/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Move "large_file_support()" to the source4 smb serverVolker Lendecke2014-09-171-1/+0
| | | | | | | That's the only place where it's used, make it static there. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-util: Clean up dependenciesMartin Schwenke2014-09-111-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-includes: Remove some unnecessary declarationsMartin Schwenke2014-09-111-2/+0
| | | | | | | | To accommodate removing file_lines_load() from here, drop the #ifdef around the declaration in util.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystemMartin Schwenke2014-09-103-140/+1
| | | | | | | | | | | | | | | This makes it consistent with Samba, to ease transition. Update unit test code to link to with tdb_wrap instead of including db_wrap.c. There are some potential whitespace fixes in this commit that have been ignored. CTDB's lib/tdb_wrap will be deleted after the transition to Samba's lib/tdb_wrap, so there's no point polishing it too much. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Make ctdb-util a wscript build subsystemMartin Schwenke2014-09-101-0/+10
| | | | | | | | | This makes it look similar to samba-util, easing the transition. Fold ctdb-util-misc into ctdb-util, since Samba doesn't separate them. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Move variable debug_extra from debug.*Martin Schwenke2014-09-102-2/+0
| | | | | | | | debug_extra is CTDB-specific. Moving it will help with the transitions to Samba's updated debug.[ch]. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Move definition of timeval_delta() to tools/ctdb.cMartin Schwenke2014-09-101-6/+0
| | | | | | | | This function is only used in this file. Samba's lib/util doesn't have timeval_delta(), so staging a clean transition. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Drop the argument to fault_setup()Martin Schwenke2014-09-102-5/+2
| | | | | | | | Samba's version doesn't accept an argument, so this aids a smooth transition. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-util: Add extra max_size argument to file_lines_load()Martin Schwenke2014-09-101-1/+5
| | | | | | | | | This is part of a migration to Samba's lib/util. CTDB always passes 0 (i.e. no max_size) so use a simple assert() to enforce this, rather than changing a lot of code that will be discarded anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Move hex_decode_talloc() to the lock helperMartin Schwenke2014-09-101-16/+0
| | | | | | | | | | This is the only place it is used. After migrating to Samba's lib/util, the lock helper can be changed to use strhex_to_data_blob(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-util: Remove util/strlist.c and references to str_util_*()Martin Schwenke2014-09-102-119/+0
| | | | | | | They're not used in CTDB. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Fix some "declarations after code" problemsMartin Schwenke2014-09-101-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-util: Variables should be declared extern in headersMartin Schwenke2014-09-101-3/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Remove autoconf build filesAmitay Isaacs2014-06-202-16/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-header: Protect against multiple includesAmitay Isaacs2014-06-201-0/+4
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* lib-util: rename memdup to smb_memdup and fix all callersBjörn Baumbach2014-04-161-1/+1
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org>
* dlinklist: Fix a typoVolker Lendecke2014-04-021-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Apr 2 17:11:37 CEST 2014 on sn-devel-104
* db_wrap: Make sure tdb messages are logged correctlyAmitay Isaacs2013-08-141-0/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 60cb40d090e45ff6134c098a238fac7ad854f134)
* build: Fix tdb.h path to enable building with system TDB libraryMathieu Parent2013-06-141-1/+1
| | | | (This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
* util: Do not stop build if backtracing is not supportedAmitay Isaacs2013-05-291-2/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit b091f09ea01482823bd850d1d4e2329e0a19c959)
* util: Add hex_decode_talloc() to decode hex string into a binary blobAmitay Isaacs2013-03-251-0/+16
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 307416afda707b687f5e89e8438e45c154a4c806)
* server: Replace BOOL datatype with bool, True/False with true/falseAmitay Isaacs2012-05-281-1/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 6e5cbe8fff71985e5a2fc16b7e9f2b868011ff5d)
* Remove explicit include of lib/tevent/tevent.h.Amitay Isaacs2012-04-131-1/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a)
* libutil: Remove obsolete signal type cast.Andreas Schneider2011-11-261-5/+5
| | | | (This used to be ctdb commit 8dd377b6a4d188af086f9a5b41a1b48e44eda6f3)
* Added some #ifndefs to stop files being included multiple times.Martin Schwenke2011-11-111-0/+4
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit fdca12c25e6fce6206135b994dedf44265e4eb09)
* idtree: fix overflow for v. large ids on allocation and removalRusty Russell2010-12-071-1/+1
| | | | | | | | | | | | | | (Imported from SAMBA commit 09a6538969ac). Chris Cowan tracked down a SEGV in sub_alloc: idp->level can actually be equal to 7 (MAX_LEVEL) there, as it can be in sub_remove. (We unfairly blamed a shift of a signed var for this crash in commit 2db1987f5a3a). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 73764104356d3738d9d20a9d06ce51535f74f475)
* idtree: fix right shift of signed ints, crash on large ids on AIXRusty Russell2010-10-081-1/+1
| | | | | | | | | | | | | | | | | | | Right-shifting signed integers in undefined; indeed it seems that on AIX with their compiler, doing a 30-bit shift on (INT_MAX-200) gives 0, not 1 as we might expect. The obvious fix is to make id and oid unsigned: l (level count) is also logically unsigned. (Note: Samba doesn't generally get to ids > 1 billion, but ctdb does) Reported-by: Chris Cowan <cc@us.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@samba.org> Autobuild-Date: Wed Oct 6 08:31:09 UTC 2010 on sn-devel-104 (This used to be ctdb commit 90b7e79446f06990f82c0128b2581e15497094fe)
* Merge commit 'rusty/ports-from-1.0.112' into fooRonnie Sahlberg2010-08-192-1/+4
|\ | | | | | | (This used to be ctdb commit 13e58d92f5f1723e850a82ae030d0ca57e89b1ee)
| * logging: give a unique logging name to each forked child.Rusty Russell2010-08-182-1/+4
| | | | | | | | | | | | | | | | This means we can distinguish which child is logging, esp. via syslog where we have no pid. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 68b3761a0874429b90731741f0531f76dcfbb081)
* | event: Update events to latest Samba version 0.9.8Rusty Russell2010-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | In Samba this is now called "tevent", and while we use the backwards compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now a separate tevent_fd_set_auto_close() function. This is based on Samba version 7f29f817fa939ef1bbb740584f09e76e2ecd5b06. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
* | talloc: update to 2.0.3 version from SAMBARusty Russell2010-08-181-7/+0
|/ | | | | | | | | This is based on SAMBA as at revision 2de63aa2801a907905b3e05557074af5b896d486. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit cecd93be0a0aab868430dd43f8276bfb4e35f02e)
* tdb: improve loggingRusty Russell2010-07-011-2/+3
| | | | | | | | When tdb throws an error, we didn't report the name of the tdb; we should. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit cfea357c9b2142c8cd8cac1ee712d40b188793e1)
* idtree: fix handling of large ids (eg INT_MAX)Rusty Russell2010-06-101-2/+4
| | | | | | | | | | | | | Since idtree assigns sequentially, it rarely reaches high numbers. But such numbers can be forced with idr_get_new_above(), and that reveals two bugs: 1) Crash in sub_remove() caused by pa array being too short. 2) Shift by more than 32 in _idr_find(), which is undefined, causing the "outside the current tree" optimization to misfire and return NULL. Signed-off-by: Rusty Russell <rusty@rustorp.com.au> (This used to be ctdb commit 32c04e11ebbcf8239e47016302c6ce802a8b0a6f)
* ctdb: migrate to new dlinklist.h from SambaAndrew Tridgell2010-02-091-86/+108
| | | | (This used to be ctdb commit f63c091f12f8d582e9518673365c7c52479c470c)
* util: added TLIST_*() macrosAndrew Tridgell2010-02-041-0/+46
| | | | | | | | | | | | The TLIST_*() macros are like the DLIST_*() macros, but take both a head and tail pointer for the list. This means that adding an element to the end of the list is efficient (it doesn't need to walk the list). We should move all uses of the DLIST_*() macros which use DLIST_ADD_END() to use the TLIST_*() macros instead. (This used to be ctdb commit 2d05a71349e9ade869b62cf261c2a9a21818a474)
* lib/util: add pre and post panic action hooksStefan Metzmacher2010-01-202-0/+13
| | | | | | metze (This used to be ctdb commit e366e77ba170d2c27110c56004ae1adf97abef9e)
* lib/util: import fault/backtrace handling from samba.Stefan Metzmacher2010-01-206-0/+1211
| | | | | | metze (This used to be ctdb commit 8171d66f0061fe23ed6dfef87ffe63bfc19596eb)
* move DEBUG* macros to one placeStefan Metzmacher2010-01-202-4/+2
| | | | | | metze (This used to be ctdb commit 4b4dd5d7f81bf226e05c7f3d40087043da1517a2)
* Dont store debug level DEBUG_DEBUG in the in-memory ringbuffer.Ronnie Sahlberg2009-12-041-1/+1
| | | | | | | | It is unlikely we will need something this verbose for normal troubleshooting. This allows us to keep a significantly longer time interval of log messages in the 500k slots available in the ringbuffer. (This used to be ctdb commit cc99c05c0c6484ad574039a454e6133852cb41fa)
* add an in memory ringbuffer where we store the last 500000 log entries ↵Ronnie Sahlberg2009-11-182-1/+2
| | | | | | | | regardless of log level. add commandt to extract this in memory buffer and to clear it (This used to be ctdb commit 29d2ee8d9c6c6f36b2334480f646d6db209f370e)
* debug: add debug_add and dump_data functionsMichael Adam2009-08-042-1/+80
| | | | | | Michael (This used to be ctdb commit 64405bdbebb2ddf0ae980e958ede77df79139000)
* Whitespace changes and using the CTDB_NO_MEMORY() macro changes toRonnie Sahlberg2009-05-211-1/+1
| | | | | | the previous patch. (This used to be ctdb commit d623ea7c04daa6349b42d50862843c9f86115488)
* add missing checks on so far ignored return valuesSumit Bose2009-05-212-2/+12
| | | | | | Most of these were found during a review by Jim Meyering <meyering@redhat.com> (This used to be ctdb commit 3aee5ee1deb4a19be3bd3a4ce3abbe09de763344)