Asterisk - The Open Source Telephony Project GIT-master-f36a736
astobj2_private.h
Go to the documentation of this file.
1/*
2 * astobj2 - replacement containers for asterisk data structures.
3 *
4 * Copyright (C) 2006 Marta Carbone, Luigi Rizzo - Univ. di Pisa, Italy
5 *
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
11 *
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
15 */
16
17/*! \file
18 *
19 * \brief Common, private definitions for astobj2.
20 *
21 * \author Richard Mudgett <rmudgett@digium.com>
22 */
23
24#ifndef ASTOBJ2_PRIVATE_H_
25#define ASTOBJ2_PRIVATE_H_
26
27#include "asterisk/astobj2.h"
28
29#if defined(AO2_DEBUG)
30#define AO2_DEVMODE_STAT(stat) stat
31#else
32#define AO2_DEVMODE_STAT(stat)
33#endif /* defined(AO2_DEBUG) */
34
35#ifdef AO2_DEBUG
36struct ao2_stats {
37 volatile int total_objects;
38 volatile int total_mem;
39 volatile int total_containers;
40 volatile int total_refs;
41 volatile int total_locked;
42};
43extern struct ao2_stats ao2;
44#endif /* defined(AO2_DEBUG) */
45
46void log_bad_ao2(void *user_data, const char *file, int line, const char *func);
47int internal_is_ao2_object(void *user_data);
48
49#define __is_ao2_object(user_data, file, line, func) \
50 ({ \
51 int ret ## __LINE__ = 0; \
52 if (user_data) { \
53 ret ## __LINE__ = internal_is_ao2_object(user_data); \
54 } \
55 if (!ret ## __LINE__) { \
56 log_bad_ao2(user_data, file, line, func); \
57 } \
58 (ret ## __LINE__); \
59 })
60
61#define is_ao2_object(user_data) \
62 __is_ao2_object(user_data, __FILE__, __LINE__, __PRETTY_FUNCTION__)
63
64enum ao2_lock_req __adjust_lock(void *user_data, enum ao2_lock_req lock_how, int keep_stronger);
65
66#endif /* ASTOBJ2_PRIVATE_H_ */
ao2_lock_req
Which lock to request.
Definition: astobj2.h:700
enum ao2_lock_req __adjust_lock(void *user_data, enum ao2_lock_req lock_how, int keep_stronger)
Definition: astobj2.c:425
void log_bad_ao2(void *user_data, const char *file, int line, const char *func)
Definition: astobj2.c:206
int internal_is_ao2_object(void *user_data)
Definition: astobj2.c:193