lib/talloc/talloc.c

ソースコードを見る。

データ構造

struct  talloc_reference_handle
struct  talloc_chunk

型定義

typedef int(*) talloc_destructor_t (void *)

関数

static struct talloc_chunktalloc_chunk_from_ptr (const void *ptr)
static struct talloc_chunktalloc_parent_chunk (const void *ptr)
void * talloc_parent (const void *ptr)
const char * talloc_parent_name (const void *ptr)
static void * __talloc (const void *context, size_t size)
void _talloc_set_destructor (const void *ptr, int(*destructor)(void *))
int talloc_increase_ref_count (const void *ptr)
static int talloc_reference_destructor (struct talloc_reference_handle *handle)
static void _talloc_set_name_const (const void *ptr, const char *name)
static void * _talloc_named_const (const void *context, size_t size, const char *name)
void * _talloc_reference (const void *context, const void *ptr)
static int _talloc_free (void *ptr)
void * _talloc_steal (const void *new_ctx, const void *ptr)
static int talloc_unreference (const void *context, const void *ptr)
int talloc_unlink (const void *context, void *ptr)
static const char * talloc_set_name_v (const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2
const char * talloc_set_name (const void *ptr, const char *fmt,...)
void * talloc_named (const void *context, size_t size, const char *fmt,...)
const char * talloc_get_name (const void *ptr)
void * talloc_check_name (const void *ptr, const char *name)
void * talloc_init (const char *fmt,...)
void talloc_free_children (void *ptr)
void * _talloc (const void *context, size_t size)
void talloc_set_name_const (const void *ptr, const char *name)
void * talloc_named_const (const void *context, size_t size, const char *name)
int talloc_free (void *ptr)
void * _talloc_realloc (const void *context, void *ptr, size_t size, const char *name)
void * _talloc_move (const void *new_ctx, const void *_pptr)
size_t talloc_total_size (const void *ptr)
size_t talloc_total_blocks (const void *ptr)
size_t talloc_reference_count (const void *ptr)
void talloc_report_depth_cb (const void *ptr, int depth, int max_depth, void(*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data)
static void talloc_report_depth_FILE_helper (const void *ptr, int depth, int max_depth, int is_ref, void *_f)
void talloc_report_depth_file (const void *ptr, int depth, int max_depth, FILE *f)
void talloc_report_full (const void *ptr, FILE *f)
void talloc_report (const void *ptr, FILE *f)
static void talloc_report_null (void)
static void talloc_report_null_full (void)
void talloc_enable_null_tracking (void)
void talloc_disable_null_tracking (void)
void talloc_enable_leak_report (void)
void talloc_enable_leak_report_full (void)
void * _talloc_zero (const void *ctx, size_t size, const char *name)
void * _talloc_memdup (const void *t, const void *p, size_t size, const char *name)
char * talloc_strdup (const void *t, const char *p)
char * talloc_append_string (const void *t, char *orig, const char *append)
char * talloc_strndup (const void *t, const char *p, size_t n)
char * talloc_vasprintf (const void *t, const char *fmt, va_list ap)
char * talloc_asprintf (const void *t, const char *fmt,...)
char * talloc_vasprintf_append (char *s, const char *fmt, va_list ap)
 Realloc s to append the formatted result of fmt and ap, and return s, which may have moved.
char * talloc_asprintf_append (char *s, const char *fmt,...)
void * _talloc_array (const void *ctx, size_t el_size, unsigned count, const char *name)
void * _talloc_zero_array (const void *ctx, size_t el_size, unsigned count, const char *name)
void * _talloc_realloc_array (const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
void * talloc_realloc_fn (const void *context, void *ptr, size_t size)
static int talloc_autofree_destructor (void *ptr)
static void talloc_autofree (void)
void * talloc_autofree_context (void)
size_t talloc_get_size (const void *context)
void * talloc_find_parent_byname (const void *context, const char *name)
void talloc_show_parents (const void *context, FILE *file)
int talloc_is_parent (const void *context, const void *ptr)

変数

static void * null_context
static void * autofree_context


型定義

typedef int(*) talloc_destructor_t(void *)

talloc.c103 行で定義されています。


関数

static struct talloc_chunk* talloc_chunk_from_ptr ( const void *  ptr  )  [inline, static]

talloc.c120 行で定義されています。

参照先 talloc_chunk::flags.

参照元 __talloc()_talloc_free()_talloc_realloc()_talloc_reference()_talloc_set_destructor()_talloc_set_name_const()_talloc_steal()talloc_find_parent_byname()talloc_free_children()talloc_get_name()talloc_get_size()talloc_is_parent()talloc_parent_chunk()talloc_reference_count()talloc_reference_destructor()talloc_report_depth_cb()talloc_set_name_v()talloc_show_parents()talloc_total_blocks()talloc_total_size()talloc_unlink()talloc_unreference()talloc_vasprintf_append().

00121 {
00122         const char *pp = (const char *)ptr;
00123         struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
00124         if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { 
00125                 if (tc->flags & TALLOC_FLAG_FREE) {
00126                         TALLOC_ABORT("Bad talloc magic value - double free"); 
00127                 } else {
00128                         TALLOC_ABORT("Bad talloc magic value - unknown value"); 
00129                 }
00130         }
00131         return tc;
00132 }

static struct talloc_chunk* talloc_parent_chunk ( const void *  ptr  )  [inline, static]

talloc.c165 行で定義されています。

参照先 talloc_chunk::parenttalloc_chunk::prevtalloc_chunk_from_ptr().

参照元 _talloc_free()talloc_free_children()talloc_parent()talloc_parent_name()talloc_unlink()talloc_unreference().

00166 {
00167         struct talloc_chunk *tc;
00168 
00169         if (unlikely(ptr == NULL)) {
00170                 return NULL;
00171         }
00172 
00173         tc = talloc_chunk_from_ptr(ptr);
00174         while (tc->prev) tc=tc->prev;
00175 
00176         return tc->parent;
00177 }

void* talloc_parent ( const void *  ptr  ) 

talloc.c179 行で定義されています。

参照先 talloc_parent_chunk().

参照元 append_parent_acl().

00180 {
00181         struct talloc_chunk *tc = talloc_parent_chunk(ptr);
00182         return tc? TC_PTR_FROM_CHUNK(tc) : NULL;
00183 }

const char* talloc_parent_name ( const void *  ptr  ) 

talloc.c188 行で定義されています。

参照先 talloc_chunk::nametalloc_parent_chunk().

00189 {
00190         struct talloc_chunk *tc = talloc_parent_chunk(ptr);
00191         return tc? tc->name : NULL;
00192 }

static void* __talloc ( const void *  context,
size_t  size 
) [inline, static]

talloc.c197 行で定義されています。

参照先 talloc_chunk::childtalloc_chunk::destructortalloc_chunk::flagstalloc_chunk::nametalloc_chunk::nextnull_contexttalloc_chunk::parenttalloc_chunk::prevtalloc_chunk::refstalloc_chunk::sizetalloc_chunk_from_ptr().

参照元 _talloc()_talloc_named_const()talloc_init()talloc_named()talloc_strndup()talloc_vasprintf().

00198 {
00199         struct talloc_chunk *tc;
00200 
00201         if (unlikely(context == NULL)) {
00202                 context = null_context;
00203         }
00204 
00205         if (unlikely(size >= MAX_TALLOC_SIZE)) {
00206                 return NULL;
00207         }
00208 
00209         tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
00210         if (unlikely(tc == NULL)) return NULL;
00211 
00212         tc->size = size;
00213         tc->flags = TALLOC_MAGIC;
00214         tc->destructor = NULL;
00215         tc->child = NULL;
00216         tc->name = NULL;
00217         tc->refs = NULL;
00218 
00219         if (likely(context)) {
00220                 struct talloc_chunk *parent = talloc_chunk_from_ptr(context);
00221 
00222                 if (parent->child) {
00223                         parent->child->parent = NULL;
00224                         tc->next = parent->child;
00225                         tc->next->prev = tc;
00226                 } else {
00227                         tc->next = NULL;
00228                 }
00229                 tc->parent = parent;
00230                 tc->prev = NULL;
00231                 parent->child = tc;
00232         } else {
00233                 tc->next = tc->prev = tc->parent = NULL;
00234         }
00235 
00236         return TC_PTR_FROM_CHUNK(tc);
00237 }

void _talloc_set_destructor ( const void *  ptr,
int(*)(void *)  destructor 
)

talloc.c245 行で定義されています。

参照先 talloc_chunk::destructortalloc_chunk_from_ptr().

00246 {
00247         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00248         tc->destructor = destructor;
00249 }

int talloc_increase_ref_count ( const void *  ptr  ) 

talloc.c254 行で定義されています。

参照先 null_context.

参照元 test_misc()test_realloc().

00255 {
00256         if (unlikely(!talloc_reference(null_context, ptr))) {
00257                 return -1;
00258         }
00259         return 0;
00260 }

static int talloc_reference_destructor ( struct talloc_reference_handle handle  )  [static]

talloc.c267 行で定義されています。

参照先 handletalloc_chunk::refstalloc_chunk_from_ptr().

参照元 _talloc_reference().

00268 {
00269         struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);
00270         _TLIST_REMOVE(ptr_tc->refs, handle);
00271         return 0;
00272 }

static void _talloc_set_name_const ( const void *  ptr,
const char *  name 
) [inline, static]

talloc.c278 行で定義されています。

参照先 talloc_chunk::nametalloc_chunk_from_ptr().

参照元 _talloc_named_const()_talloc_realloc()talloc_set_name_const()talloc_set_name_v()talloc_strdup()talloc_strndup()talloc_vasprintf()talloc_vasprintf_append().

00279 {
00280         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00281         tc->name = name;
00282 }

static void* _talloc_named_const ( const void *  context,
size_t  size,
const char *  name 
) [inline, static]

talloc.c287 行で定義されています。

参照先 __talloc()_talloc_set_name_const().

参照元 _talloc_array()_talloc_memdup()_talloc_realloc()_talloc_reference()_talloc_zero()talloc_autofree_context()talloc_enable_null_tracking()talloc_named_const().

00288 {
00289         void *ptr;
00290 
00291         ptr = __talloc(context, size);
00292         if (unlikely(ptr == NULL)) {
00293                 return NULL;
00294         }
00295 
00296         _talloc_set_name_const(ptr, name);
00297 
00298         return ptr;
00299 }

void* _talloc_reference ( const void *  context,
const void *  ptr 
)

talloc.c310 行で定義されています。

参照先 _talloc_named_const()handletalloc_chunk::refstalloc_chunk_from_ptr()talloc_reference_destructor().

00311 {
00312         struct talloc_chunk *tc;
00313         struct talloc_reference_handle *handle;
00314         if (unlikely(ptr == NULL)) return NULL;
00315 
00316         tc = talloc_chunk_from_ptr(ptr);
00317         handle = (struct talloc_reference_handle *)_talloc_named_const(context,
00318                                                    sizeof(struct talloc_reference_handle),
00319                                                    TALLOC_MAGIC_REFERENCE);
00320         if (unlikely(handle == NULL)) return NULL;
00321 
00322         /* note that we hang the destructor off the handle, not the
00323            main context as that allows the caller to still setup their
00324            own destructor on the context if they want to */
00325         talloc_set_destructor(handle, talloc_reference_destructor);
00326         handle->ptr = discard_const_p(void, ptr);
00327         _TLIST_ADD(tc->refs, handle);
00328         return handle->ptr;
00329 }

static int _talloc_free ( void *  ptr  )  [inline, static]

talloc.c335 行で定義されています。

参照先 talloc_chunk::childtalloc_chunk::destructortalloc_chunk::flagstalloc_chunk::nextnull_contexttalloc_chunk::parenttalloc_chunk::prevtalloc_chunk::refstalloc_chunk_from_ptr()talloc_is_parent()talloc_parent_chunk().

参照元 _talloc_realloc()talloc_autofree()talloc_disable_null_tracking()talloc_free()talloc_free_children()talloc_init()talloc_named()talloc_unlink()talloc_unreference().

00336 {
00337         struct talloc_chunk *tc;
00338 
00339         if (unlikely(ptr == NULL)) {
00340                 return -1;
00341         }
00342 
00343         tc = talloc_chunk_from_ptr(ptr);
00344 
00345         if (unlikely(tc->refs)) {
00346                 int is_child;
00347                 /* check this is a reference from a child or grantchild
00348                  * back to it's parent or grantparent
00349                  *
00350                  * in that case we need to remove the reference and
00351                  * call another instance of talloc_free() on the current
00352                  * pointer.
00353                  */
00354                 is_child = talloc_is_parent(tc->refs, ptr);
00355                 _talloc_free(tc->refs);
00356                 if (is_child) {
00357                         return _talloc_free(ptr);
00358                 }
00359                 return -1;
00360         }
00361 
00362         if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) {
00363                 /* we have a free loop - stop looping */
00364                 return 0;
00365         }
00366 
00367         if (unlikely(tc->destructor)) {
00368                 talloc_destructor_t d = tc->destructor;
00369                 if (d == (talloc_destructor_t)-1) {
00370                         return -1;
00371                 }
00372                 tc->destructor = (talloc_destructor_t)-1;
00373                 if (d(ptr) == -1) {
00374                         tc->destructor = d;
00375                         return -1;
00376                 }
00377                 tc->destructor = NULL;
00378         }
00379 
00380         if (tc->parent) {
00381                 _TLIST_REMOVE(tc->parent->child, tc);
00382                 if (tc->parent->child) {
00383                         tc->parent->child->parent = tc->parent;
00384                 }
00385         } else {
00386                 if (tc->prev) tc->prev->next = tc->next;
00387                 if (tc->next) tc->next->prev = tc->prev;
00388         }
00389 
00390         tc->flags |= TALLOC_FLAG_LOOP;
00391 
00392         while (tc->child) {
00393                 /* we need to work out who will own an abandoned child
00394                    if it cannot be freed. In priority order, the first
00395                    choice is owner of any remaining reference to this
00396                    pointer, the second choice is our parent, and the
00397                    final choice is the null context. */
00398                 void *child = TC_PTR_FROM_CHUNK(tc->child);
00399                 const void *new_parent = null_context;
00400                 if (unlikely(tc->child->refs)) {
00401                         struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
00402                         if (p) new_parent = TC_PTR_FROM_CHUNK(p);
00403                 }
00404                 if (unlikely(_talloc_free(child) == -1)) {
00405                         if (new_parent == null_context) {
00406                                 struct talloc_chunk *p = talloc_parent_chunk(ptr);
00407                                 if (p) new_parent = TC_PTR_FROM_CHUNK(p);
00408                         }
00409                         talloc_steal(new_parent, child);
00410                 }
00411         }
00412 
00413         tc->flags |= TALLOC_FLAG_FREE;
00414         free(tc);
00415         return 0;
00416 }

void* _talloc_steal ( const void *  new_ctx,
const void *  ptr 
)

talloc.c423 行で定義されています。

参照先 talloc_chunk::childtalloc_chunk::nextnull_contexttalloc_chunk::parenttalloc_chunk::prevtalloc_chunk_from_ptr().

参照元 _talloc_move().

00424 {
00425         struct talloc_chunk *tc, *new_tc;
00426 
00427         if (unlikely(!ptr)) {
00428                 return NULL;
00429         }
00430 
00431         if (unlikely(new_ctx == NULL)) {
00432                 new_ctx = null_context;
00433         }
00434 
00435         tc = talloc_chunk_from_ptr(ptr);
00436 
00437         if (unlikely(new_ctx == NULL)) {
00438                 if (tc->parent) {
00439                         _TLIST_REMOVE(tc->parent->child, tc);
00440                         if (tc->parent->child) {
00441                                 tc->parent->child->parent = tc->parent;
00442                         }
00443                 } else {
00444                         if (tc->prev) tc->prev->next = tc->next;
00445                         if (tc->next) tc->next->prev = tc->prev;
00446                 }
00447                 
00448                 tc->parent = tc->next = tc->prev = NULL;
00449                 return discard_const_p(void, ptr);
00450         }
00451 
00452         new_tc = talloc_chunk_from_ptr(new_ctx);
00453 
00454         if (unlikely(tc == new_tc || tc->parent == new_tc)) {
00455                 return discard_const_p(void, ptr);
00456         }
00457 
00458         if (tc->parent) {
00459                 _TLIST_REMOVE(tc->parent->child, tc);
00460                 if (tc->parent->child) {
00461                         tc->parent->child->parent = tc->parent;
00462                 }
00463         } else {
00464                 if (tc->prev) tc->prev->next = tc->next;
00465                 if (tc->next) tc->next->prev = tc->prev;
00466         }
00467 
00468         tc->parent = new_tc;
00469         if (new_tc->child) new_tc->child->parent = NULL;
00470         _TLIST_ADD(new_tc->child, tc);
00471 
00472         return discard_const_p(void, ptr);
00473 }

static int talloc_unreference ( const void *  context,
const void *  ptr 
) [inline, static]

talloc.c482 行で定義されています。

参照先 _talloc_free()talloc_reference_handle::nextnull_contexttalloc_chunk::refstalloc_chunk_from_ptr()talloc_parent_chunk().

参照元 talloc_unlink().

00483 {
00484         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00485         struct talloc_reference_handle *h;
00486 
00487         if (unlikely(context == NULL)) {
00488                 context = null_context;
00489         }
00490 
00491         for (h=tc->refs;h;h=h->next) {
00492                 struct talloc_chunk *p = talloc_parent_chunk(h);
00493                 if (p == NULL) {
00494                         if (context == NULL) break;
00495                 } else if (TC_PTR_FROM_CHUNK(p) == context) {
00496                         break;
00497                 }
00498         }
00499         if (h == NULL) {
00500                 return -1;
00501         }
00502 
00503         return _talloc_free(h);
00504 }

int talloc_unlink ( const void *  context,
void *  ptr 
)

talloc.c510 行で定義されています。

参照先 _talloc_free()null_contexttalloc_chunk::refstalloc_chunk_from_ptr()talloc_parent_chunk()talloc_unreference().

参照元 test_lifeless()test_misc()test_unlink1()test_unref_reparent().

00511 {
00512         struct talloc_chunk *tc_p, *new_p;
00513         void *new_parent;
00514 
00515         if (ptr == NULL) {
00516                 return -1;
00517         }
00518 
00519         if (context == NULL) {
00520                 context = null_context;
00521         }
00522 
00523         if (talloc_unreference(context, ptr) == 0) {
00524                 return 0;
00525         }
00526 
00527         if (context == NULL) {
00528                 if (talloc_parent_chunk(ptr) != NULL) {
00529                         return -1;
00530                 }
00531         } else {
00532                 if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) {
00533                         return -1;
00534                 }
00535         }
00536         
00537         tc_p = talloc_chunk_from_ptr(ptr);
00538 
00539         if (tc_p->refs == NULL) {
00540                 return _talloc_free(ptr);
00541         }
00542 
00543         new_p = talloc_parent_chunk(tc_p->refs);
00544         if (new_p) {
00545                 new_parent = TC_PTR_FROM_CHUNK(new_p);
00546         } else {
00547                 new_parent = NULL;
00548         }
00549 
00550         if (talloc_unreference(new_parent, ptr) != 0) {
00551                 return -1;
00552         }
00553 
00554         talloc_steal(new_parent, ptr);
00555 
00556         return 0;
00557 }

static const char *static const char * talloc_set_name_v ( const void *  ptr,
const char *  fmt,
va_list  ap 
) [inline, static]

talloc.c564 行で定義されています。

参照先 _talloc_set_name_const()talloc_chunk::nametalloc_chunk_from_ptr()talloc_vasprintf().

参照元 talloc_init()talloc_named()talloc_set_name().

00565 {
00566         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00567         tc->name = talloc_vasprintf(ptr, fmt, ap);
00568         if (likely(tc->name)) {
00569                 _talloc_set_name_const(tc->name, ".name");
00570         }
00571         return tc->name;
00572 }

const char* talloc_set_name ( const void *  ptr,
const char *  fmt,
  ... 
)

talloc.c577 行で定義されています。

参照先 nametalloc_set_name_v().

参照元 test_misc().

00578 {
00579         const char *name;
00580         va_list ap;
00581         va_start(ap, fmt);
00582         name = talloc_set_name_v(ptr, fmt, ap);
00583         va_end(ap);
00584         return name;
00585 }

void* talloc_named ( const void *  context,
size_t  size,
const char *  fmt,
  ... 
)

talloc.c593 行で定義されています。

参照先 __talloc()_talloc_free()nametalloc_set_name_v().

参照元 test_misc().

00594 {
00595         va_list ap;
00596         void *ptr;
00597         const char *name;
00598 
00599         ptr = __talloc(context, size);
00600         if (unlikely(ptr == NULL)) return NULL;
00601 
00602         va_start(ap, fmt);
00603         name = talloc_set_name_v(ptr, fmt, ap);
00604         va_end(ap);
00605 
00606         if (unlikely(name == NULL)) {
00607                 _talloc_free(ptr);
00608                 return NULL;
00609         }
00610 
00611         return ptr;
00612 }

const char* talloc_get_name ( const void *  ptr  ) 

talloc.c617 行で定義されています。

参照先 talloc_chunk::nametalloc_chunk_from_ptr().

参照元 msg_pool_usage_helper()talloc_check_name()talloc_check_name_abort()talloc_report_depth_FILE_helper()talloc_show_parents()test_misc()test_talloc_ptrtype().

00618 {
00619         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00620         if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {
00621                 return ".reference";
00622         }
00623         if (likely(tc->name)) {
00624                 return tc->name;
00625         }
00626         return "UNNAMED";
00627 }

void* talloc_check_name ( const void *  ptr,
const char *  name 
)

talloc.c634 行で定義されています。

参照先 talloc_get_name().

参照元 talloc_check_name_abort().

00635 {
00636         const char *pname;
00637         if (unlikely(ptr == NULL)) return NULL;
00638         pname = talloc_get_name(ptr);
00639         if (likely(pname == name || strcmp(pname, name) == 0)) {
00640                 return discard_const_p(void, ptr);
00641         }
00642         return NULL;
00643 }

void* talloc_init ( const char *  fmt,
  ... 
)

talloc.c649 行で定義されています。

参照先 __talloc()_talloc_free()nametalloc_enable_null_tracking()talloc_set_name_v().

参照元 account_lockout_policy_handler()add_aliases()add_expanded_sid()add_trusted_domains()ads_add_group_acct()ads_add_service_principal_name()ads_add_user_acct()ads_check_posix_schema_mapping()ads_clear_service_principal_names()ads_create_machine_acct()ads_current_time()ads_do_paged_search_args()ads_do_search()ads_keytab_add_entry()ads_keytab_create_default()ads_process_results()api_wkssvc_NetrAddAlternateComputerName()api_WKSSVC_NETRENUMERATECOMPUTERNAMES()api_WKSSVC_NETRGETJOINABLEOUS()api_WKSSVC_NETRGETJOINABLEOUS2()api_WKSSVC_NETRGETJOININFORMATION()api_WKSSVC_NETRJOINDOMAIN()api_wkssvc_NetrJoinDomain2()api_WKSSVC_NETRLOGONDOMAINNAMEADD()api_WKSSVC_NETRLOGONDOMAINNAMEDEL()api_WKSSVC_NETRMESSAGEBUFFERSEND()api_wkssvc_NetrRemoveAlternateComputerName()api_WKSSVC_NETRRENAMEMACHINEINDOMAIN()api_wkssvc_NetrRenameMachineInDomain2()api_WKSSVC_NETRSETPRIMARYCOMPUTERNAME()api_WKSSVC_NETRUNJOINDOMAIN()api_wkssvc_NetrUnjoinDomain2()api_WKSSVC_NETRUSEADD()api_WKSSVC_NETRUSEDEL()api_WKSSVC_NETRUSEENUM()api_WKSSVC_NETRUSEGETINFO()api_WKSSVC_NETRVALIDATENAME()api_WKSSVC_NETRVALIDATENAME2()api_WKSSVC_NETRWKSTATRANSPORTADD()api_WKSSVC_NETRWKSTATRANSPORTDEL()api_WKSSVC_NETRWKSTAUSERGETINFO()api_WKSSVC_NETRWKSTAUSERSETINFO()api_WKSSVC_NETRWORKSTATIONSTATISTICSGET()api_wkssvc_NetWkstaEnumUsers()api_wkssvc_NetWkstaGetInfo()api_wkssvc_NetWkstaSetInfo()api_wkssvc_NetWkstaTransportEnum()append_ldap_suffix()atalk_chmod()atalk_chown()atalk_rename()atalk_rmdir()auth_ntlmssp_start()call_nt_transact_ioctl()call_nt_transact_query_security_desc()call_trans2findfirst()call_trans2findnext()call_trans2qfilepathinfo()canonicalize_ea_name()check_ntlm_password()child_msg_onlinestatus()child_process_request()cli_initialise()cli_list_user_quota()cli_rpc_pipe_open()cli_set_secdesc()cm_open_connection()cmd_samr_query_sec_obj()cmd_showacls()compare_printer()compare_printer_secdesc()conn_new()create_builtin_administrators()create_conn_struct()create_send_ctx()dns_negotiate_sec_ctx()do_cmd()DoDNSUpdate()dump_database()dump_sd()enum_dom_groups()enum_local_groups()estimate_ea_size()fetch_database()fetch_database_to_ldif()fetch_group_mem_info()fetch_machine_sid()fill_grent_mem()fork_child_dc_connect()free_pipe_context()get_dc_name_via_netlogon()get_nt_acl_no_snum()get_ntlm_challenge()get_sam_group_entries()get_samr_info_by_sid()init_afs_acl()init_child_connection()init_fake_file_handle()ldapsam_get_seq_num()lp_string()lsa_lookup_names()lsa_lookup_sids()lsa_open_policy()main()main_loop_talloc_get()make_auth_context()make_internal_rpc_pipe_p()make_server_info_pw()make_way_for_eventlogs()manage_gss_spnego_request()msg_pool_usage()net_ads_dns_register()net_ads_gpo_add_link()net_ads_gpo_apply()net_ads_gpo_delete_link()net_ads_gpo_get_gpo()net_ads_gpo_get_link()net_ads_gpo_list()net_ads_gpo_refresh()net_ads_join()net_ads_leave()net_ads_printer_publish()net_groupmap_memberships()net_lookup_ldap()net_rpc_join_newstyle()net_share_enum_rpc()net_usershare_add()net_usershare_info()net_usershare_list()netsamlogon_cache_get()notify_msg_ctr_init()nt_printer_publish_ads()nt_printing_setsec()ntlmssp_client_start()ntlmssp_server_start()ntlmssp_sign_init()open_printer_hnd()pdb_get_group_sid()pdb_new_rid()pdb_search_init()print_access_check()privilege_set_init()process_request()process_usershare_file()py_smb_query_secdesc()py_smb_set_secdesc()query_user_list()regfio_open()release_posix_lock_posix_flavour()release_posix_lock_windows_flavour()reply_spnego_kerberos()resolve_ads()rpc_info_internals()rpc_trustdom_establish()rpc_trustdom_list()rpc_trustdom_vampire()run_eatest()run_local_substitute()run_rpc_command()sam_lookup_groupmem()sam_trusted_domains()samr_connect()samr_create_dom_user()samr_delete_dom_user()samr_enum_dom_groups()samr_open_domain()samr_set_user_info2()save_driver_init_2()sequence_number()set_dc_type_and_flags()set_posix_lock_windows_flavour()set_sd()set_share_security()setup_dfs_referral()share_access_check()smb_info_set_ea()smbc_getxattr_ctx()smbc_removexattr_ctx()smbc_setxattr_ctx()spoolss_addprinterdriver()spoolss_addprinterex()spoolss_enumports()spoolss_enumprinterdrivers()spoolss_enumprinters()spoolss_getprinterdriverdir()spoolss_openprinter()srvsvc_netservergetinfo()terminate()test_misc()tmp_talloc_ctx()update_trustdom_cache()upgrade_to_version_4()upgrade_to_version_5()vfs_get_user_ntquota_list()wb_lookup_rids()write_eventlog_tdb().

00650 {
00651         va_list ap;
00652         void *ptr;
00653         const char *name;
00654 
00655         /*
00656          * samba3 expects talloc_report_depth_cb(NULL, ...)
00657          * reports all talloc'ed memory, so we need to enable
00658          * null_tracking
00659          */
00660         talloc_enable_null_tracking();
00661 
00662         ptr = __talloc(NULL, 0);
00663         if (unlikely(ptr == NULL)) return NULL;
00664 
00665         va_start(ap, fmt);
00666         name = talloc_set_name_v(ptr, fmt, ap);
00667         va_end(ap);
00668 
00669         if (unlikely(name == NULL)) {
00670                 _talloc_free(ptr);
00671                 return NULL;
00672         }
00673 
00674         return ptr;
00675 }

void talloc_free_children ( void *  ptr  ) 

talloc.c682 行で定義されています。

参照先 _talloc_free()talloc_chunk::childnull_contexttalloc_chunk::refstalloc_chunk_from_ptr()talloc_parent_chunk().

参照元 ads_process_results()free_pipe_context()print_notify_send_messages()print_notify_send_messages_to_printer().

00683 {
00684         struct talloc_chunk *tc;
00685 
00686         if (unlikely(ptr == NULL)) {
00687                 return;
00688         }
00689 
00690         tc = talloc_chunk_from_ptr(ptr);
00691 
00692         while (tc->child) {
00693                 /* we need to work out who will own an abandoned child
00694                    if it cannot be freed. In priority order, the first
00695                    choice is owner of any remaining reference to this
00696                    pointer, the second choice is our parent, and the
00697                    final choice is the null context. */
00698                 void *child = TC_PTR_FROM_CHUNK(tc->child);
00699                 const void *new_parent = null_context;
00700                 if (unlikely(tc->child->refs)) {
00701                         struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
00702                         if (p) new_parent = TC_PTR_FROM_CHUNK(p);
00703                 }
00704                 if (unlikely(_talloc_free(child) == -1)) {
00705                         if (new_parent == null_context) {
00706                                 struct talloc_chunk *p = talloc_parent_chunk(ptr);
00707                                 if (p) new_parent = TC_PTR_FROM_CHUNK(p);
00708                         }
00709                         talloc_steal(new_parent, child);
00710                 }
00711         }
00712 }

void* _talloc ( const void *  context,
size_t  size 
)

talloc.c717 行で定義されています。

参照先 __talloc().

参照元 lsa_lookup_names()lsa_lookup_sids()py_to_ACL()py_to_PRINTER_INFO_2()to_dependentfiles().

00718 {
00719         return __talloc(context, size);
00720 }

void talloc_set_name_const ( const void *  ptr,
const char *  name 
)

talloc.c725 行で定義されています。

参照先 _talloc_set_name_const().

参照元 test_misc().

00726 {
00727         _talloc_set_name_const(ptr, name);
00728 }

void* talloc_named_const ( const void *  context,
size_t  size,
const char *  name 
)

talloc.c735 行で定義されています。

参照先 _talloc_named_const().

参照元 _talloc_array_zeronull()_talloc_memdup_zeronull()_talloc_zero_zeronull()idmap_backends_sids_to_unixids()idmap_backends_unixids_to_sids()idmap_init_cache()idmap_set_mapping()idmap_sids_to_unixids()idmap_unixids_to_sids()talloc_zeronull()test_misc()test_ref1()test_ref2()test_ref3()test_ref4()test_unlink1()test_unref_reparent().

00736 {
00737         return _talloc_named_const(context, size, name);
00738 }

int talloc_free ( void *  ptr  ) 

talloc.c748 行で定義されています。

参照先 _talloc_free().

参照元 _lsa_enum_accounts()api_wkssvc_NetrAddAlternateComputerName()api_WKSSVC_NETRENUMERATECOMPUTERNAMES()api_WKSSVC_NETRGETJOINABLEOUS()api_WKSSVC_NETRGETJOINABLEOUS2()api_WKSSVC_NETRGETJOININFORMATION()api_WKSSVC_NETRJOINDOMAIN()api_wkssvc_NetrJoinDomain2()api_WKSSVC_NETRLOGONDOMAINNAMEADD()api_WKSSVC_NETRLOGONDOMAINNAMEDEL()api_WKSSVC_NETRMESSAGEBUFFERSEND()api_wkssvc_NetrRemoveAlternateComputerName()api_WKSSVC_NETRRENAMEMACHINEINDOMAIN()api_wkssvc_NetrRenameMachineInDomain2()api_WKSSVC_NETRSETPRIMARYCOMPUTERNAME()api_WKSSVC_NETRUNJOINDOMAIN()api_wkssvc_NetrUnjoinDomain2()api_WKSSVC_NETRUSEADD()api_WKSSVC_NETRUSEDEL()api_WKSSVC_NETRUSEENUM()api_WKSSVC_NETRUSEGETINFO()api_WKSSVC_NETRVALIDATENAME()api_WKSSVC_NETRVALIDATENAME2()api_WKSSVC_NETRWKSTATRANSPORTADD()api_WKSSVC_NETRWKSTATRANSPORTDEL()api_WKSSVC_NETRWKSTAUSERGETINFO()api_WKSSVC_NETRWKSTAUSERSETINFO()api_WKSSVC_NETRWORKSTATIONSTATISTICSGET()api_wkssvc_NetWkstaEnumUsers()api_wkssvc_NetWkstaGetInfo()api_wkssvc_NetWkstaSetInfo()api_wkssvc_NetWkstaTransportEnum()cli_do_rpc_ndr()fetch_group_mem_info()GUID_string2()idmap_ad_initialize()idmap_ad_sids_to_unixids()idmap_backends_sids_to_unixids()idmap_cache_del()idmap_cache_map_id()idmap_cache_map_sid()idmap_cache_set()idmap_cache_set_negative_id()idmap_cache_set_negative_sid()idmap_cache_shutdown()idmap_init()idmap_ldap_allocate_id()idmap_ldap_close()idmap_ldap_db_init()idmap_ldap_get_hwm()idmap_ldap_set_hwm()idmap_ldap_set_mapping()idmap_ldap_sids_to_unixids()idmap_ldap_unixids_to_sids()idmap_nss_sids_to_unixids()idmap_rid_initialize()idmap_rid_sids_to_unixids()idmap_rid_unixids_to_sids()idmap_set_mapping()idmap_sids_to_unixids()idmap_tdb_alloc_init()idmap_tdb_db_init()idmap_tdb_dump_data()idmap_tdb_id_to_sid()idmap_tdb_open_db()idmap_tdb_remove_mapping()idmap_tdb_set_mapping()idmap_tdb_sid_to_id()idmap_tdb_upgrade()idmap_unixids_to_sids()inotify_handler()inotify_setup()ndr_push_free()ndr_push_string()net_idmap_restore()net_idmap_secret()net_sam_provision()notify_add()notify_handler()notify_init()notify_load()notify_remove()notify_save()notify_send()rids_to_names()talloc_attrs()test_autofree()test_free_parent_deny_child()test_lifeless()test_loop()test_misc()test_move()test_realloc()test_realloc_child()test_realloc_fn()test_ref1()test_ref2()test_ref3()test_ref4()test_speed()test_steal()test_talloc_ptrtype()test_type()test_unlink1()test_unref_reparent()verify_idpool()winbindd_dual_sids2xids().

00749 {
00750         return _talloc_free(ptr);
00751 }

void* _talloc_realloc ( const void *  context,
void *  ptr,
size_t  size,
const char *  name 
)

talloc.c759 行で定義されています。

参照先 _talloc_free()_talloc_named_const()_talloc_set_name_const()talloc_chunk::childtalloc_chunk::flagstalloc_chunk::nexttalloc_chunk::parenttalloc_chunk::prevtalloc_chunk::refstalloc_chunk::sizetalloc_chunk_from_ptr().

参照元 _talloc_realloc_array()talloc_realloc_fn().

00760 {
00761         struct talloc_chunk *tc;
00762         void *new_ptr;
00763 
00764         /* size zero is equivalent to free() */
00765         if (unlikely(size == 0)) {
00766                 _talloc_free(ptr);
00767                 return NULL;
00768         }
00769 
00770         if (unlikely(size >= MAX_TALLOC_SIZE)) {
00771                 return NULL;
00772         }
00773 
00774         /* realloc(NULL) is equivalent to malloc() */
00775         if (ptr == NULL) {
00776                 return _talloc_named_const(context, size, name);
00777         }
00778 
00779         tc = talloc_chunk_from_ptr(ptr);
00780 
00781         /* don't allow realloc on referenced pointers */
00782         if (unlikely(tc->refs)) {
00783                 return NULL;
00784         }
00785 
00786         /* by resetting magic we catch users of the old memory */
00787         tc->flags |= TALLOC_FLAG_FREE;
00788 
00789 #if ALWAYS_REALLOC
00790         new_ptr = malloc(size + TC_HDR_SIZE);
00791         if (new_ptr) {
00792                 memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE);
00793                 free(tc);
00794         }
00795 #else
00796         new_ptr = realloc(tc, size + TC_HDR_SIZE);
00797 #endif
00798         if (unlikely(!new_ptr)) {       
00799                 tc->flags &= ~TALLOC_FLAG_FREE; 
00800                 return NULL; 
00801         }
00802 
00803         tc = (struct talloc_chunk *)new_ptr;
00804         tc->flags &= ~TALLOC_FLAG_FREE; 
00805         if (tc->parent) {
00806                 tc->parent->child = tc;
00807         }
00808         if (tc->child) {
00809                 tc->child->parent = tc;
00810         }
00811 
00812         if (tc->prev) {
00813                 tc->prev->next = tc;
00814         }
00815         if (tc->next) {
00816                 tc->next->prev = tc;
00817         }
00818 
00819         tc->size = size;
00820         _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name);
00821 
00822         return TC_PTR_FROM_CHUNK(tc);
00823 }

void* _talloc_move ( const void *  new_ctx,
const void *  _pptr 
)

talloc.c829 行で定義されています。

参照先 _talloc_steal().

00830 {
00831         const void **pptr = discard_const_p(const void *,_pptr);
00832         void *ret = _talloc_steal(new_ctx, *pptr);
00833         (*pptr) = NULL;
00834         return ret;
00835 }

size_t talloc_total_size ( const void *  ptr  ) 

talloc.c840 行で定義されています。

参照先 ctalloc_chunk::childtalloc_chunk::flagsnull_contexttalloc_chunk::sizetalloc_chunk_from_ptr()talloc_total_size()total.

参照元 free_pipe_context()msg_pool_usage_helper()talloc_report_depth_FILE_helper()talloc_report_null()talloc_report_null_full()talloc_total_size().

00841 {
00842         size_t total = 0;
00843         struct talloc_chunk *c, *tc;
00844 
00845         if (ptr == NULL) {
00846                 ptr = null_context;
00847         }
00848         if (ptr == NULL) {
00849                 return 0;
00850         }
00851 
00852         tc = talloc_chunk_from_ptr(ptr);
00853 
00854         if (tc->flags & TALLOC_FLAG_LOOP) {
00855                 return 0;
00856         }
00857 
00858         tc->flags |= TALLOC_FLAG_LOOP;
00859 
00860         total = tc->size;
00861         for (c=tc->child;c;c=c->next) {
00862                 total += talloc_total_size(TC_PTR_FROM_CHUNK(c));
00863         }
00864 
00865         tc->flags &= ~TALLOC_FLAG_LOOP;
00866 
00867         return total;
00868 }

size_t talloc_total_blocks ( const void *  ptr  ) 

talloc.c873 行で定義されています。

参照先 ctalloc_chunk::childtalloc_chunk::flagstalloc_chunk_from_ptr()talloc_total_blocks()total.

参照元 msg_pool_usage_helper()talloc_report_depth_FILE_helper()talloc_total_blocks().

00874 {
00875         size_t total = 0;
00876         struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr);
00877 
00878         if (tc->flags & TALLOC_FLAG_LOOP) {
00879                 return 0;
00880         }
00881 
00882         tc->flags |= TALLOC_FLAG_LOOP;
00883 
00884         total++;
00885         for (c=tc->child;c;c=c->next) {
00886                 total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c));
00887         }
00888 
00889         tc->flags &= ~TALLOC_FLAG_LOOP;
00890 
00891         return total;
00892 }

size_t talloc_reference_count ( const void *  ptr  ) 

talloc.c897 行で定義されています。

参照先 talloc_reference_handle::nexttalloc_chunk::refstalloc_chunk_from_ptr().

参照元 msg_pool_usage_helper()talloc_report_depth_FILE_helper().

00898 {
00899         struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
00900         struct talloc_reference_handle *h;
00901         size_t ret = 0;
00902 
00903         for (h=tc->refs;h;h=h->next) {
00904                 ret++;
00905         }
00906         return ret;
00907 }

void talloc_report_depth_cb ( const void *  ptr,
int  depth,
int  max_depth,
void(*)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data)  callback,
void *  private_data 
)

talloc.c912 行で定義されています。

参照先 ccallback()talloc_chunk::childtalloc_chunk::flagsnull_contexttalloc_reference_handle::ptrtalloc_chunk_from_ptr()talloc_report_depth_cb().

参照元 msg_pool_usage()talloc_report_depth_cb()talloc_report_depth_file().

00918 {
00919         struct talloc_chunk *c, *tc;
00920 
00921         if (ptr == NULL) {
00922                 ptr = null_context;
00923         }
00924         if (ptr == NULL) return;
00925 
00926         tc = talloc_chunk_from_ptr(ptr);
00927 
00928         if (tc->flags & TALLOC_FLAG_LOOP) {
00929                 return;
00930         }
00931 
00932         callback(ptr, depth, max_depth, 0, private_data);
00933 
00934         if (max_depth >= 0 && depth >= max_depth) {
00935                 return;
00936         }
00937 
00938         tc->flags |= TALLOC_FLAG_LOOP;
00939         for (c=tc->child;c;c=c->next) {
00940                 if (c->name == TALLOC_MAGIC_REFERENCE) {
00941                         struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c);
00942                         callback(h->ptr, depth + 1, max_depth, 1, private_data);
00943                 } else {
00944                         talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data);
00945                 }
00946         }
00947         tc->flags &= ~TALLOC_FLAG_LOOP;
00948 }

static void talloc_report_depth_FILE_helper ( const void *  ptr,
int  depth,
int  max_depth,
int  is_ref,
void *  _f 
) [static]

talloc.c950 行で定義されています。

参照先 fprintf()nametalloc_get_name()talloc_reference_count()talloc_total_blocks()talloc_total_size().

参照元 talloc_report_depth_file().

00951 {
00952         const char *name = talloc_get_name(ptr);
00953         FILE *f = (FILE *)_f;
00954 
00955         if (is_ref) {
00956                 fprintf(f, "%*sreference to: %s\n", depth*4, "", name);
00957                 return;
00958         }
00959 
00960         if (depth == 0) {
00961                 fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n", 
00962                         (max_depth < 0 ? "full " :""), name,
00963                         (unsigned long)talloc_total_size(ptr),
00964                         (unsigned long)talloc_total_blocks(ptr));
00965                 return;
00966         }
00967 
00968         fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n", 
00969                 depth*4, "",
00970                 name,
00971                 (unsigned long)talloc_total_size(ptr),
00972                 (unsigned long)talloc_total_blocks(ptr),
00973                 (int)talloc_reference_count(ptr), ptr);
00974 
00975 #if 0
00976         fprintf(f, "content: ");
00977         if (talloc_total_size(ptr)) {
00978                 int tot = talloc_total_size(ptr);
00979                 int i;
00980 
00981                 for (i = 0; i < tot; i++) {
00982                         if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) {
00983                                 fprintf(f, "%c", ((char *)ptr)[i]);
00984                         } else {
00985                                 fprintf(f, "~%02x", ((char *)ptr)[i]);
00986                         }
00987                 }
00988         }
00989         fprintf(f, "\n");
00990 #endif
00991 }

void talloc_report_depth_file ( const void *  ptr,
int  depth,
int  max_depth,
FILE *  f 
)

talloc.c996 行で定義されています。

参照先 talloc_report_depth_cb()talloc_report_depth_FILE_helper().

参照元 talloc_report()talloc_report_full().

00997 {
00998         talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f);
00999         fflush(f);
01000 }

void talloc_report_full ( const void *  ptr,
FILE *  f 
)

talloc.c1005 行で定義されています。

参照先 talloc_report_depth_file().

参照元 rpc_registry_dump()talloc_report_null_full()test_lifeless()test_loop()test_misc()test_ref1()test_ref2()test_ref3()test_ref4()test_steal()test_unlink1().

01006 {
01007         talloc_report_depth_file(ptr, 0, -1, f);
01008 }

void talloc_report ( const void *  ptr,
FILE *  f 
)

talloc.c1013 行で定義されています。

参照先 talloc_report_depth_file().

参照元 talloc_report_null()test_misc().

01014 {
01015         talloc_report_depth_file(ptr, 0, 1, f);
01016 }

static void talloc_report_null ( void   )  [static]

talloc.c1021 行で定義されています。

参照先 null_contexttalloc_report()talloc_total_size().

参照元 talloc_enable_leak_report().

01022 {
01023         if (talloc_total_size(null_context) != 0) {
01024                 talloc_report(null_context, stderr);
01025         }
01026 }

static void talloc_report_null_full ( void   )  [static]

talloc.c1031 行で定義されています。

参照先 null_contexttalloc_report_full()talloc_total_size().

参照元 talloc_enable_leak_report_full().

01032 {
01033         if (talloc_total_size(null_context) != 0) {
01034                 talloc_report_full(null_context, stderr);
01035         }
01036 }

void talloc_enable_null_tracking ( void   ) 

talloc.c1041 行で定義されています。

参照先 _talloc_named_const()null_context.

参照元 main()talloc_enable_leak_report()talloc_enable_leak_report_full()talloc_init().

01042 {
01043         if (null_context == NULL) {
01044                 null_context = _talloc_named_const(NULL, 0, "null_context");
01045         }
01046 }

void talloc_disable_null_tracking ( void   ) 

talloc.c1051 行で定義されています。

参照先 _talloc_free()null_context.

参照元 gfree_all()main().

01052 {
01053         _talloc_free(null_context);
01054         null_context = NULL;
01055 }

void talloc_enable_leak_report ( void   ) 

talloc.c1060 行で定義されています。

参照先 talloc_enable_null_tracking()talloc_report_null().

参照元 main()net_ads_dns_gethostbyname()net_ads_dns_register()test_misc().

01061 {
01062         talloc_enable_null_tracking();
01063         atexit(talloc_report_null);
01064 }

void talloc_enable_leak_report_full ( void   ) 

talloc.c1069 行で定義されています。

参照先 talloc_enable_null_tracking()talloc_report_null_full().

参照元 test_misc().

01070 {
01071         talloc_enable_null_tracking();
01072         atexit(talloc_report_null_full);
01073 }

void* _talloc_zero ( const void *  ctx,
size_t  size,
const char *  name 
)

talloc.c1078 行で定義されています。

参照先 _talloc_named_const().

参照元 _talloc_zero_array()_talloc_zero_array_zeronull().

01079 {
01080         void *p = _talloc_named_const(ctx, size, name);
01081 
01082         if (p) {
01083                 memset(p, '\0', size);
01084         }
01085 
01086         return p;
01087 }

void* _talloc_memdup ( const void *  t,
const void *  p,
size_t  size,
const char *  name 
)

talloc.c1092 行で定義されています。

参照先 _talloc_named_const().

01093 {
01094         void *newp = _talloc_named_const(t, size, name);
01095 
01096         if (likely(newp)) {
01097                 memcpy(newp, p, size);
01098         }
01099 
01100         return newp;
01101 }

char* talloc_strdup ( const void *  t,
const char *  p 
)

talloc.c1106 行で定義されています。

参照先 _talloc_set_name_const().

参照元 add_ccache_to_list()add_new_printer_key()add_string_to_array()ads_check_posix_schema_mapping()ads_dns_parse_query()ads_dns_parse_rr()ads_dns_parse_rr_ns()ads_dns_parse_rr_srv()ads_gpo_explode_filesyspath()ads_gpo_get_sysvol_gpt_version()ads_gpo_prepare_local_store()ads_modlist_add()ads_parse_gplink()ads_parse_gpo()ads_schema_path()ads_site_dn()ads_site_dn_for_machine()append_attr()atalk_build_paths()audit_policy_str()cac_LsaGetSidsFromNames()cac_MakeDomainInfo()cac_RegEnumKeys()cac_RegEnumValues()cac_RegQueryKeyInfo()cac_SamEnumAliases()cac_SamEnumGroups()cac_SamGetNamesFromRids()cac_SamGetRidsFromNames()cac_Shutdown()cac_SvcGetDisplayName()cli_get_ea_list()cli_get_server_name()clone_afs_ace()cmd_spoolss_addprinterdriver()copy_serverinfo()create_local_private_krb5_conf_for_domain()create_open_service_handle()create_token_from_username()create_vk_record()create_wks_info_100()dns_negotiate_sec_ctx()dom_sid_string()elog_open()fam_watch()fetch_database_to_ldif()fetch_group_mem_info()fill_displayentry()fill_sam_account()find_forced_group()generate_krb5_ccache()get_attr_list()get_credentials()get_share_list()get_share_mode_lock()getpwsid_queryuser_recv()gpo_sync_func()idmap_init()idmap_ldap_alloc_init()idmap_ldap_db_init()idmap_ldap_set_mapping()idmap_rid_initialize()idmap_tdb_open_db()init_service_op_table()inotify_watch()LabelList()ldapsam_create_dom_group()ldapsam_create_user()ldapsam_get_seq_num()ldapsam_lookup_rids()ldapsam_search_grouptype()ldapsam_search_users()log_nt_token()lookup_as_domain()lookup_builtin_rid()lookup_global_sam_rid()lookup_groupmem()lookup_name()lookup_name_smbconf()lookup_rids()lookup_sid()lookup_sids()lookup_useraliases()lookup_wellknown_name()lookup_wellknown_sid()lp_string()lsa_lookup_names()make_pipe_rec_key()make_server_info_info3()make_server_info_pw()make_server_info_sam()ndr_pull_charset()ndr_pull_string()net_ads_join()net_idmap_secret()net_rpc_lookup_name()net_sam_provision()net_set_machine_spn()net_set_machine_upn()net_set_os_attributes()net_sh_process()net_usershare_add()new_afs_ace()notify_filter_string()notify_fsp()nss_init()nss_template_get_info()ntlmssp_client_challenge()ntlmssp_set_domain()ntlmssp_set_username()ntlmssp_set_workstation()parent_dirname_talloc()parse_domain_user_talloc()parse_gpt_ini()parse_share_modes()pathtree_birth_child()pdb_default_add_groupmem()pdb_default_del_groupmem()pdb_default_delete_dom_group()pdb_init_ldapsam()pdb_init_ldapsam_common()pdb_init_ldapsam_compat()pdb_set_acct_desc()pdb_set_comment()pdb_set_dir_drive()pdb_set_domain()pdb_set_fullname()pdb_set_homedir()pdb_set_logon_script()pdb_set_munged_dial()pdb_set_nt_username()pdb_set_plaintext_pw_only()pdb_set_profile_path()pdb_set_username()pdb_set_workstations()procid_str()pull_domain_controller_info_from_getdcname_reply()query_user_list()read_init_file()regfio_write_key()regkey_open_internal()regsubkey_ctr_addkey()regval_convert_multi_sz()rename_share_filename()rids_to_names()rpc_share_add_internals()rpc_trustdom_list()rpc_trustdom_vampire()rpccli_lsa_enum_account_rights()rpccli_lsa_enum_privilege()rpccli_lsa_enum_trust_dom()rpccli_lsa_lookup_sids()rpccli_samr_enum_dom_users()rpccli_samr_lookup_rids()rpcstr_pull_unistr2_talloc()sam_account_ok()sam_query_user()sam_query_user_list()sam_trusted_domains()server_cryptkey()sid_to_name()smb_register_idmap()smb_register_idmap_alloc()smbcli_parse_unc()smbldap_init()str_list_make_internal()talloc_attrs()talloc_string_sub()talloc_sub_advanced()talloc_sub_basic()talloc_sub_specified()tcopy_passwd()test_free_parent_deny_child()test_lifeless()test_loop()test_misc()test_move()test_realloc_child()test_speed()timestring()trust_pw_change_and_store_it()trusted_domains()vfs_init_custom()wb_lookup_rids()winbind_lookup_rids()winbind_lookup_sid()winbind_pw_check()winbindd_add_memory_creds_internal()winbindd_dual_getsidaliases()winbindd_dual_list_trusted_domains()winbindd_dual_pam_auth()winbindd_getgroups()winbindd_lookupname_async()winbindd_raw_kerberos_login()winbindd_show_sequence().

01107 {
01108         char *ret;
01109         if (!p) {
01110                 return NULL;
01111         }
01112         ret = (char *)talloc_memdup(t, p, strlen(p) + 1);
01113         if (likely(ret)) {
01114                 _talloc_set_name_const(ret, ret);
01115         }
01116         return ret;
01117 }

char* talloc_append_string ( const void *  t,
char *  orig,
const char *  append 
)

talloc.c1122 行で定義されています。

01123 {
01124         char *ret;
01125         size_t olen = strlen(orig);
01126         size_t alenz;
01127 
01128         if (!append)
01129                 return orig;
01130 
01131         alenz = strlen(append) + 1;
01132 
01133         ret = talloc_realloc(t, orig, char, olen + alenz);
01134         if (!ret)
01135                 return NULL;
01136 
01137         /* append the string with the trailing \0 */
01138         memcpy(&ret[olen], append, alenz);
01139 
01140         return ret;
01141 }

char* talloc_strndup ( const void *  t,
const char *  p,
size_t  n 
)

talloc.c1146 行で定義されています。

参照先 __talloc()_talloc_set_name_const()len.

参照元 LabelList()lookup_name()net_usershare_add()notify_add()secrets_trusted_domains()test_misc().

01147 {
01148         size_t len;
01149         char *ret;
01150 
01151         for (len=0; len<n && p[len]; len++) ;
01152 
01153         ret = (char *)__talloc(t, len + 1);
01154         if (!ret) { return NULL; }
01155         memcpy(ret, p, len);
01156         ret[len] = 0;
01157         _talloc_set_name_const(ret, ret);
01158         return ret;
01159 }

char* talloc_vasprintf ( const void *  t,
const char *  fmt,
va_list  ap 
)

talloc.c1169 行で定義されています。

参照先 __talloc()_talloc_set_name_const()clenvsnprintf().

参照元 fprintf_attr()talloc_asprintf()talloc_set_name_v()talloc_vasprintf_append().

01170 {       
01171         int len;
01172         char *ret;
01173         va_list ap2;
01174         char c;
01175         
01176         /* this call looks strange, but it makes it work on older solaris boxes */
01177         va_copy(ap2, ap);
01178         len = vsnprintf(&c, 1, fmt, ap2);
01179         va_end(ap2);
01180         if (len < 0) {
01181                 return NULL;
01182         }
01183 
01184         ret = (char *)__talloc(t, len+1);
01185         if (ret) {
01186                 va_copy(ap2, ap);
01187                 vsnprintf(ret, len+1, fmt, ap2);
01188                 va_end(ap2);
01189                 _talloc_set_name_const(ret, ret);
01190         }
01191 
01192         return ret;
01193 }

char* talloc_asprintf ( const void *  t,
const char *  fmt,
  ... 
)

talloc.c1200 行で定義されています。

参照先 talloc_vasprintf().

参照元 _lsa_lookup_sids_internal()ads_add_gpo_link()ads_add_group_acct()ads_add_service_principal_name()ads_add_user_acct()ads_create_machine_acct()ads_dns_query_internal()ads_fetch_gpo_files()ads_get_attrname_by_oid()ads_get_attrnames_by_oids()ads_get_gpo()ads_gpo_explode_filesyspath()ads_gpo_get_sysvol_gpt_version()ads_pull_strings_range()ads_site_dn_for_machine()ads_upn_suffixes()append_ldap_suffix()atalk_build_paths()atalk_rmdir()atalk_rrmdir()audit_policy_str()cacl_get()cli_rpc_pipe_open_krb5()collect_onlinestatus()create_local_private_krb5_conf_for_domain()dns_negotiate_sec_ctx()enum_dom_groups()generate_krb5_ccache()get_kdc_ip_string()gpo_password_policy()GUID_string()GUID_string2()handle_trans()idmap_ad_initialize()idmap_ad_sids_to_unixids()idmap_ad_unixids_to_sids()idmap_cache_build_idkey()idmap_cache_build_sidkey()idmap_cache_set()idmap_cache_set_negative_id()idmap_cache_set_negative_sid()idmap_init()idmap_ldap_allocate_id()idmap_ldap_db_init()idmap_ldap_get_hwm()idmap_ldap_set_hwm()idmap_ldap_set_mapping()idmap_ldap_sids_to_unixids()idmap_ldap_unixids_to_sids()idmap_rid_initialize()idmap_tdb_db_init()idmap_tdb_id_to_sid()idmap_tdb_remove_mapping()idmap_tdb_set_mapping()idmap_tdb_sid_to_id()idmap_tdb_upgrade()ldapsam_change_groupmem()ldapsam_create_dom_group()ldapsam_create_user()ldapsam_delete_dom_group()ldapsam_delete_group_mapping_entry()ldapsam_delete_user()ldapsam_get_new_rid()ldapsam_lookup_rids()ldapsam_map_posixgroup()ldapsam_search_grouptype()ldapsam_set_primary_group()ldapsam_update_group_mapping_entry()local_pw_check()log_nt_token()lookup_groupmem()lookup_name_smbconf()lookup_useraliases()lookup_usergroups_member()make_server_info_pw()map_bool()map_dword()map_unix_group()msrpc_name_to_sid()net_ads_gpo_apply()net_ads_gpo_refresh()net_idmap_secret()net_rpc_join_newstyle()net_sam_provision()net_set_machine_spn()net_set_os_attributes()net_sh_process()netdom_join_domain()netdom_leave_domain()open_schannel_session_store()rpc_trustdom_del_internals()rpccli_lsa_open_policy2()rpccli_netlogon_dsr_getdcname()rpccli_netlogon_dsr_getdcnameex()rpccli_netlogon_dsr_getdcnameex2()rpccli_netlogon_sam_network_logon()rpccli_samr_chgpasswd3()rpccli_samr_chgpasswd_user()rpccli_samr_chng_pswd_auth_crap()sam_account_ok()secrets_restore_schannel_session_info()secrets_store_schannel_session_info()secrets_trusted_domains()sequence_recv()smbc_setxattr_ctx()test_misc()timestring()verify_idpool()winbindd_dual_list_trusted_domains()winbindd_dual_pam_auth_cached()winbindd_pam_auth_crap()winbindd_raw_kerberos_login().

01201 {
01202         va_list ap;
01203         char *ret;
01204 
01205         va_start(ap, fmt);
01206         ret = talloc_vasprintf(t, fmt, ap);
01207         va_end(ap);
01208         return ret;
01209 }

char* talloc_vasprintf_append ( char *  s,
const char *  fmt,
va_list  ap 
)

Realloc s to append the formatted result of fmt and ap, and return s, which may have moved.

Good for gradually accumulating output into a string buffer.

talloc.c1217 行で定義されています。

参照先 _talloc_set_name_const()clentalloc_chunk::sizetalloc_chunk_from_ptr()talloc_vasprintf()vsnprintf().

参照元 talloc_asprintf_append().

01218 {       
01219         struct talloc_chunk *tc;
01220         int len, s_len;
01221         va_list ap2;
01222         char c;
01223 
01224         if (s == NULL) {
01225                 return talloc_vasprintf(NULL, fmt, ap);
01226         }
01227 
01228         tc = talloc_chunk_from_ptr(s);
01229 
01230         s_len = tc->size - 1;
01231 
01232         va_copy(ap2, ap);
01233         len = vsnprintf(&c, 1, fmt, ap2);
01234         va_end(ap2);
01235 
01236         if (len <= 0) {
01237                 /* Either the vsnprintf failed or the format resulted in
01238                  * no characters being formatted. In the former case, we
01239                  * ought to return NULL, in the latter we ought to return
01240                  * the original string. Most current callers of this 
01241                  * function expect it to never return NULL.
01242                  */
01243                 return s;
01244         }
01245 
01246         s = talloc_realloc(NULL, s, char, s_len + len+1);
01247         if (!s) return NULL;
01248 
01249         va_copy(ap2, ap);
01250         vsnprintf(s+s_len, len+1, fmt, ap2);
01251         va_end(ap2);
01252         _talloc_set_name_const(s, s);
01253 
01254         return s;
01255 }

char* talloc_asprintf_append ( char *  s,
const char *  fmt,
  ... 
)

talloc.c1262 行で定義されています。

参照先 talloc_vasprintf_append().

参照元 ads_get_attrnames_by_oids()ads_gpo_prepare_local_store()collect_onlinestatus()idmap_ad_sids_to_unixids()idmap_ad_unixids_to_sids()idmap_ldap_sids_to_unixids()idmap_ldap_unixids_to_sids()ldapsam_lookup_rids()net_usershare_add()notify_filter_string()test_misc().

01263 {
01264         va_list ap;
01265 
01266         va_start(ap, fmt);
01267         s = talloc_vasprintf_append(s, fmt, ap);
01268         va_end(ap);
01269         return s;
01270 }

void* _talloc_array ( const void *  ctx,
size_t  el_size,
unsigned  count,
const char *  name 
)

talloc.c1275 行で定義されています。

参照先 _talloc_named_const().

01276 {
01277         if (count >= MAX_TALLOC_SIZE/el_size) {
01278                 return NULL;
01279         }
01280         return _talloc_named_const(ctx, el_size * count, name);
01281 }

void* _talloc_zero_array ( const void *  ctx,
size_t  el_size,
unsigned  count,
const char *  name 
)

talloc.c1286 行で定義されています。

参照先 _talloc_zero().

01287 {
01288         if (count >= MAX_TALLOC_SIZE/el_size) {
01289                 return NULL;
01290         }
01291         return _talloc_zero(ctx, el_size * count, name);
01292 }

void* _talloc_realloc_array ( const void *  ctx,
void *  ptr,
size_t  el_size,
unsigned  count,
const char *  name 
)

talloc.c1297 行で定義されています。

参照先 _talloc_realloc().

01298 {
01299         if (count >= MAX_TALLOC_SIZE/el_size) {
01300                 return NULL;
01301         }
01302         return _talloc_realloc(ctx, ptr, el_size * count, name);
01303 }

void* talloc_realloc_fn ( const void *  context,
void *  ptr,
size_t  size 
)

talloc.c1310 行で定義されています。

参照先 _talloc_realloc().

参照元 test_realloc_fn().

01311 {
01312         return _talloc_realloc(context, ptr, size, NULL);
01313 }

static int talloc_autofree_destructor ( void *  ptr  )  [static]

talloc.c1316 行で定義されています。

参照先 autofree_context.

参照元 talloc_autofree_context().

01317 {
01318         autofree_context = NULL;
01319         return 0;
01320 }

static void talloc_autofree ( void   )  [static]

talloc.c1322 行で定義されています。

参照先 _talloc_free()autofree_context.

参照元 talloc_autofree_context().

01323 {
01324         _talloc_free(autofree_context);
01325 }

void* talloc_autofree_context ( void   ) 

talloc.c1331 行で定義されています。

参照先 _talloc_named_const()autofree_contexttalloc_autofree()talloc_autofree_destructor().

参照元 test_autofree().

01332 {
01333         if (autofree_context == NULL) {
01334                 autofree_context = _talloc_named_const(NULL, 0, "autofree_context");
01335                 talloc_set_destructor(autofree_context, talloc_autofree_destructor);
01336                 atexit(talloc_autofree);
01337         }
01338         return autofree_context;
01339 }

size_t talloc_get_size ( const void *  context  ) 

talloc.c1341 行で定義されています。

参照先 talloc_chunk::sizetalloc_chunk_from_ptr().

参照元 test_talloc_ptrtype().

01342 {
01343         struct talloc_chunk *tc;
01344 
01345         if (context == NULL)
01346                 return 0;
01347 
01348         tc = talloc_chunk_from_ptr(context);
01349 
01350         return tc->size;
01351 }

void* talloc_find_parent_byname ( const void *  context,
const char *  name 
)

talloc.c1356 行で定義されています。

参照先 talloc_chunk::nametalloc_chunk::parenttalloc_chunk::prevtalloc_chunk_from_ptr().

01357 {
01358         struct talloc_chunk *tc;
01359 
01360         if (context == NULL) {
01361                 return NULL;
01362         }
01363 
01364         tc = talloc_chunk_from_ptr(context);
01365         while (tc) {
01366                 if (tc->name && strcmp(tc->name, name) == 0) {
01367                         return TC_PTR_FROM_CHUNK(tc);
01368                 }
01369                 while (tc && tc->prev) tc = tc->prev;
01370                 if (tc) {
01371                         tc = tc->parent;
01372                 }
01373         }
01374         return NULL;
01375 }

void talloc_show_parents ( const void *  context,
FILE *  file 
)

talloc.c1380 行で定義されています。

参照先 fprintf()talloc_chunk::parenttalloc_chunk::prevtalloc_chunk_from_ptr()talloc_get_name().

01381 {
01382         struct talloc_chunk *tc;
01383 
01384         if (context == NULL) {
01385                 fprintf(file, "talloc no parents for NULL\n");
01386                 return;
01387         }
01388 
01389         tc = talloc_chunk_from_ptr(context);
01390         fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context));
01391         while (tc) {
01392                 fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
01393                 while (tc && tc->prev) tc = tc->prev;
01394                 if (tc) {
01395                         tc = tc->parent;
01396                 }
01397         }
01398         fflush(file);
01399 }

int talloc_is_parent ( const void *  context,
const void *  ptr 
)

talloc.c1404 行で定義されています。

参照先 talloc_chunk_from_ptr().

参照元 _talloc_free().

01405 {
01406         struct talloc_chunk *tc;
01407 
01408         if (context == NULL) {
01409                 return 0;
01410         }
01411 
01412         tc = talloc_chunk_from_ptr(context);
01413         while (tc) {
01414                 if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;
01415                 while (tc && tc->prev) tc = tc->prev;
01416                 if (tc) {
01417                         tc = tc->parent;
01418                 }
01419         }
01420         return 0;
01421 }


変数

void* null_context [static]

talloc.c95 行で定義されています。

参照元 __talloc()_talloc_free()_talloc_steal()talloc_disable_null_tracking()talloc_enable_null_tracking()talloc_free_children()talloc_increase_ref_count()talloc_report_depth_cb()talloc_report_null()talloc_report_null_full()talloc_total_size()talloc_unlink()talloc_unreference().

void* autofree_context [static]

talloc.c96 行で定義されています。

参照元 talloc_autofree()talloc_autofree_context()talloc_autofree_destructor().


Sambaに対してSat Aug 29 21:23:39 2009に生成されました。  doxygen 1.4.7