summaryrefslogtreecommitdiffstats
path: root/lib/talloc
Commit message (Collapse)AuthorAgeFilesLines
* talloc:build: improve detection of srcdirMichael Adam2014-06-201-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* talloc: version 2.1.1Stefan Metzmacher2014-05-163-1/+71
| | | | | | | | | | | | | | Changes: - documentation updates - a fix for pytalloc-util.pc - performance improvements here and there - fixed compiler warnings Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri May 16 19:51:26 CEST 2014 on sn-devel-104
* talloc/tests: avoid some unused variable warningsStefan Metzmacher2014-05-161-0/+13
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: fix compiler warningStefan Metzmacher2014-05-161-1/+4
| | | | | | | | | | | | | This avoids the following warning when using: CFLAGS="-O3 -g -fstrict-overflow -Wstrict-overflow=5" ../talloc.c: In Funktion »talloc_is_parent«: ../talloc.c:2658:21: Warnung: assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C1 +- C2 [-Wstrict-overflow] Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: check for TALLOC_GET_TYPE_ABORT_NOOPStefan Metzmacher2014-05-161-0/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: avoid a function call in TALLOC_FREE() if possible.Stefan Metzmacher2014-05-161-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: inline talloc_get_name()Stefan Metzmacher2014-05-161-6/+10
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: inline more static functionsStefan Metzmacher2014-05-161-19/+26
| | | | | | | We need the code to be as fast as possible. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Tune talloc_vasprintfVolker Lendecke2014-05-151-5/+9
| | | | | | | | | | | | vsnprintf is significantly more expensive than memcpy. For the common case where the string we print is less than a kilobyte, avoid the second vsnprintf. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 15 12:49:14 CEST 2014 on sn-devel-104
* talloc: Update flags in pytalloc-util pkgconfig fileLukas Slebodnik2014-04-041-2/+2
| | | | | | | | | | | | | | After exapnding, @LIB_RPATH@ will be -Wl,-rpatch,/usr/local/lib if rpath is used on install. But "-Wl," will be passed to linker and should not be among CFLAGS. Other pkgconfig files have @LIB_RPATH@ in the right place. @see commit 735c1cd2da15167748e92ba6de48fdb5169db587 Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Apr 4 23:50:25 CEST 2014 on sn-devel-104
* Add a basic guide on pytalloc.Jelmer Vernooij2013-11-282-0/+156
| | | | | | | | Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-By: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org> Autobuild-Date(master): Thu Nov 28 02:24:45 CET 2013 on sn-devel-104
* talloc: Add a warning to talloc_reference() documentation.Andreas Schneider2013-10-141-0/+8
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Kai Blin <kai@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Mon Oct 14 23:05:54 CEST 2013 on sn-devel-104
* talloc: Test the pooled objectVolker Lendecke2013-09-081-0/+36
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* talloc: Add talloc_pooled_objectVolker Lendecke2013-09-085-1/+174
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Allow nested pools.Volker Lendecke2013-09-083-24/+52
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>
* talloc: Add a separate pool sizeVolker Lendecke2013-09-081-12/+23
| | | | | | | | | | | | | This is necessary to allow talloc pools to be objects on their own. It is an incompatible change in the sense that talloc_get_size(pool) now returns 0 instead of the pool size. When the talloc_pooled_object() call is added, this will start to make sense again. Maybe we should add a talloc_pool_size call? Or is that overkill? Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* talloc: Put pool-specific data before the chunkVolker Lendecke2013-09-081-79/+125
| | | | | | | This is a preparation to make talloc pool real objects themselves. Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>
* talloc: Introduce __talloc_with_prefixVolker Lendecke2013-09-081-10/+22
| | | | | | | | This will allow to exchange the extra talloc pool header with the talloc_chunk structure Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>
* talloc: Decouple the dual use of chunk->poolVolker Lendecke2013-09-081-25/+23
| | | | | | | | | | | If we want nested pools, we will have pools that are pool members. So we will have to have a separate "next object" pointer for pools. As we have struct talloc_pool_chunk now, this additional pointer does not affect normal talloc objects. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Fix valgrind errors with memmove and talloc pools.Jeremy Allison2013-08-281-0/+21
| | | | | | | | | | bin/smbtorture //127.0.0.1 local.talloc now runs with no valgrind errors. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Aug 28 02:44:17 CEST 2013 on sn-devel-104
* Add simple limited pool tests to test_memlimit().Jeremy Allison2013-08-271-0/+27
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Remove talloc_memlimit_update(). No longer used.Jeremy Allison2013-08-271-24/+0
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Inside _talloc_realloc(), keep track of size changes over malloc/realloc/free.Jeremy Allison2013-08-271-4/+15
| | | | | | | | Replace the last use of talloc_memlimit_update() with talloc_memlimit_grow()/ talloc_memlimit_shrink(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Don't call talloc_memlimit_update() inside _talloc_realloc() when we're just ↵Jeremy Allison2013-08-271-15/+0
| | | | | | | manipulating pool members. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Fix a conditional check. (size - tc->size > 0) is always true if size and ↵Jeremy Allison2013-08-271-1/+1
| | | | | | | | | tc->size are unsigned. Replace with (size > tc->size). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* In _talloc_steal_internal(), correctly decrement the memory limit in the ↵Jeremy Allison2013-08-271-12/+5
| | | | | | | source, and increment in the destination. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Inside _talloc_free_internal(), always call talloc_memlimit_update_on_free() ↵Jeremy Allison2013-08-271-23/+4
| | | | | | | before we free the real memory. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Update memory limits when we call free() on a pool.Jeremy Allison2013-08-271-0/+2
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Change __talloc() to only call ↵Jeremy Allison2013-08-271-12/+9
| | | | | | | | | | talloc_memlimit_check()/talloc_memlimit_grow() on actual malloc allocation. Don't check the memlimit if the allocation was successful from a pool. We already checked the memory limit when we created the pool. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Change _talloc_total_mem_internal() to ignore memory allocated from a pool ↵Jeremy Allison2013-08-271-1/+8
| | | | | | | | | when calculating limit size. We must only count normal tallocs, or a talloc pool itself. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Remove magic TC_HDR_SIZE handling inside talloc_memlimit_check().Jeremy Allison2013-08-271-1/+1
| | | | | | | Callers already account for TC_HDR_SIZE, do not add it twice. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* Start to fix talloc memlimits with talloc pools.Jeremy Allison2013-08-271-0/+72
| | | | | | | | | | | | | | | | | | | | | | Add the functions: talloc_memlimit_grow(), talloc_memlimit_shrink(), talloc_memlimit_update_on_free(). as replacements for talloc_memlimit_update(). The interface to talloc_memlimit_update() is very hard to understand and use. The above functions are (to me) much clearer. The goal of these changes is to only update the memlimits on malloc/free/realloc, not on every pool allocation. That way we only count pool creation as allocation from any imposed limits, not allocation from an already created pool. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* build: Remove autoconf build systemAndrew Bartlett2013-05-282-52/+0
| | | | | | | | | | | We are now confident that that waf build system meets enough of our needs that we will work to improve it, rather than maintain two build systems. Andrew Bartlett Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* talloc: Fix a typoVolker Lendecke2013-05-201-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Kai Blin <kai@samba.org> Autobuild-User(master): Kai Blin <kai@samba.org> Autobuild-Date(master): Mon May 20 18:48:49 CEST 2013 on sn-devel-104
* talloc: only provide the --enable-talloc-compat1 in standalone buildStefan Metzmacher2013-05-141-4/+6
| | | | | | | | The compat library is already only built in standalone build, so we need the configure option also only in the standalone build. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* talloc: Simplify _talloc_free_poolmem a bitVolker Lendecke2013-04-181-2/+14
| | | | | | | | | | Early returns are easier to understand than "else if" Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Apr 18 22:50:42 CEST 2013 on sn-devel-104
* talloc: Do an early returnVolker Lendecke2013-04-181-3/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Avoid some "else" by doing early returnsVolker Lendecke2013-04-181-4/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Fix nonblank line endingsVolker Lendecke2013-04-181-34/+34
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/talloc: Move manpage to man/.Karolin Seeger2012-12-032-13/+13
| | | | | | | | Trying to be more consistent. Karolin Reviewed-by: Andreas Schneider <asn@samba.org>
* docs: man talloc: Add missing meta data.Karolin Seeger2012-11-291-0/+12
| | | | | | | | | This avoids warnings during the waf build and removes "FIXME" entries from the manpage. Karolin Reviewed-by: Andreas Schneider <asn@samba.org>
* talloc: Convert error cecking macros into fnsSimo Sorce2012-10-051-37/+74
| | | | | | | | | | | This will avoid 'surprise returns' and makes the code cleare to readers. These macros were complex enough to warrant a full function anyway not just for readability but also for debuggability. Thanks David for pointing out this issue. Autobuild-User(master): Simo Sorce <idra@samba.org> Autobuild-Date(master): Fri Oct 5 23:24:17 CEST 2012 on sn-devel-104
* Add tests for talloc_memlimitSimo Sorce2012-10-051-0/+172
| | | | | Autobuild-User(master): Simo Sorce <idra@samba.org> Autobuild-Date(master): Fri Oct 5 07:36:38 CEST 2012 on sn-devel-104
* Add memory limiting capability to tallocSimo Sorce2012-10-055-40/+327
| | | | | | | | | | | By calling talloc_set_memlimit() we can now set a max memory limit for a whole talloc hierarchy. ANy attempt to allocate memory beyond the max allowed for the whole hierarchy wil cause an allocation failure. Stealing memory correctly accounts for used memory in the old and the new hierarchy but exceeding the memory limit in the new parent will not cause a failure.
* doc: Remove build/ from doxygen config or it will not work in brew.Andreas Schneider2012-08-041-4/+1
| | | | | Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Sat Aug 4 16:31:22 CEST 2012 on sn-devel-104
* talloc: don't allow a talloc_pool inside a talloc_pool.Rusty Russell2012-07-182-1/+9
| | | | | | | | | We explicitly call free() on a pool which falls to zero, assuming it's not inside another pool (we crash). Check on creation and explicitly document this case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc: use a struct for pool headers.Rusty Russell2012-07-182-106/+90
| | | | | | | | | | | | | | | | | | This neatens the code a bit (we should do a similar thing for all the TALLOC_CHUNK macros). Two subtler changes: (1) As a result of the struct, we actually pack object_count into the talloc header on 32-bit platforms (since the header is 40 bytes, but needs to be 16-byte aligned). (2) I avoid VALGRIND_MAKE_MEM_UNDEFINED on memmove when we resize the only entry in a pool; that's done later anyway. With -O2 on my 11.04 Ubuntu 32-bit x86 laptop, the talloc_pool speed as measured by testsuite.c actually increases 10%. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* talloc: remove unused variablesBjörn Jacke2012-07-051-5/+0
| | | | | | | found by the IRIX compiler Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Thu Jul 5 23:50:54 CEST 2012 on sn-devel-104
* build: Remove unused release scripts for tallocAndrew Bartlett2012-05-306-518/+0
| | | | | | | | These now use waf dist, and the script/librelease.sh script as a wrapper. The mksyms.sh call in the source3/Makefile uses the copy in source3/script Andrew Bartlett
* talloc: Update doxygen config.Andreas Schneider2012-05-071-119/+391
| | | | | Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Mon May 7 21:13:15 CEST 2012 on sn-devel-104