talloc callbacks

Андрей Аладьев aladjev.andrew at gmail.com
Mon Apr 15 02:50:03 MDT 2013


I want to know how talloc tree is changing below the node with
callbacks. For example:

TALLOC_CTX * root = talloc_new ( NULL );
talloc_set_callback_fn(root, add, del);

char * c  = talloc(root, char); // add callback execution
short * s = talloc(c, short); // add callback execution
int * i   = talloc(c, int); // add callback execution
long * l  = talloc(i, long); // add callback execution

talloc_steal(...) // del callback and add callback

talloc_free(root); // del callback execution 4 times

2013/4/15 Volker Lendecke <Volker.Lendecke at sernet.de>:
> On Mon, Apr 15, 2013 at 01:27:56AM +0300, Андрей Аладьев wrote:
>> Hello. I've made a simple add and delete callbacks to talloc system. Idea
>> is simple:
>>
>> talloc_set_callback_fn(ctx, add, del);
>>
>> https://github.com/andrew-aladev/samba-talloc-debug/commits/master
>
> What do you exactly want to achieve here? talloc is one of
> our hottest code paths, adding to that I think should be
> justified very, very well. In particular if you want to
> log deletion of certain objects, talloc destructors should
> make it at least possible.
>
> With best regards,
>
> Volker Lendecke
>
>
> --
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list