Merged revisions 44390 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44390 | kpfleming | 2006-10-04 16:04:21 -0500 (Wed, 04 Oct 2006) | 2 lines

make LOW_MEMORY builds actually work

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Kevin P. Fleming 19 years ago
parent 3c876af5cf
commit c28461197b

@ -101,6 +101,7 @@ int ast_register_atexit(void (*func)(void));
*/ */
void ast_unregister_atexit(void (*func)(void)); void ast_unregister_atexit(void (*func)(void));
#if !defined(LOW_MEMORY)
/*! /*!
* \brief Register the version of a source code file with the core. * \brief Register the version of a source code file with the core.
* \param file the source file name * \param file the source file name
@ -123,25 +124,6 @@ void ast_register_file_version(const char *file, const char *version);
*/ */
void ast_unregister_file_version(const char *file); void ast_unregister_file_version(const char *file);
/*!
* \brief support for event profiling
*
* (note, this must be documented a lot more)
* ast_add_profile allocates a generic 'counter' with a given name,
* which can be shown with the command 'show profile <name>'
*
* The counter accumulates positive or negative values supplied by
* ast_add_profile(), dividing them by the 'scale' value passed in the
* create call, and also counts the number of 'events'.
* Values can also be taked by the TSC counter on ia32 architectures,
* in which case you can mark the start of an event calling ast_mark(id, 1)
* and then the end of the event with ast_mark(id, 0).
* For non-i386 architectures, these two calls return 0.
*/
int ast_add_profile(const char *, uint64_t scale);
int64_t ast_profile(int, int64_t);
int64_t ast_mark(int, int start1_stop0);
/*! /*!
* \brief Register/unregister a source code file with the core. * \brief Register/unregister a source code file with the core.
* \param file the source file name * \param file the source file name
@ -163,7 +145,6 @@ int64_t ast_mark(int, int start1_stop0);
* not be present and CVS would expand the Revision keyword into the file's * not be present and CVS would expand the Revision keyword into the file's
* revision number. * revision number.
*/ */
#if defined(__GNUC__) && !defined(LOW_MEMORY)
#ifdef MTX_PROFILE #ifdef MTX_PROFILE
#define HAVE_MTX_PROFILE /* used in lock.h */ #define HAVE_MTX_PROFILE /* used in lock.h */
#define ASTERISK_FILE_VERSION(file, version) \ #define ASTERISK_FILE_VERSION(file, version) \
@ -177,7 +158,7 @@ int64_t ast_mark(int, int start1_stop0);
{ \ { \
ast_unregister_file_version(file); \ ast_unregister_file_version(file); \
} }
#else #else /* !MTX_PROFILE */
#define ASTERISK_FILE_VERSION(file, version) \ #define ASTERISK_FILE_VERSION(file, version) \
static void __attribute__((constructor)) __register_file_version(void) \ static void __attribute__((constructor)) __register_file_version(void) \
{ \ { \
@ -187,11 +168,34 @@ int64_t ast_mark(int, int start1_stop0);
{ \ { \
ast_unregister_file_version(file); \ ast_unregister_file_version(file); \
} }
#endif #endif /* !MTX_PROFILE */
#elif !defined(LOW_MEMORY) /* ! __GNUC__ && ! LOW_MEMORY*/
#define ASTERISK_FILE_VERSION(file, x) static const char __file_version[] = x;
#else /* LOW_MEMORY */ #else /* LOW_MEMORY */
#define ASTERISK_FILE_VERSION(file, x) #define ASTERISK_FILE_VERSION(file, x)
#endif /* __GNUC__ */ #endif /* LOW_MEMORY */
#if !defined(LOW_MEMORY)
/*!
* \brief support for event profiling
*
* (note, this must be documented a lot more)
* ast_add_profile allocates a generic 'counter' with a given name,
* which can be shown with the command 'show profile <name>'
*
* The counter accumulates positive or negative values supplied by
* ast_add_profile(), dividing them by the 'scale' value passed in the
* create call, and also counts the number of 'events'.
* Values can also be taked by the TSC counter on ia32 architectures,
* in which case you can mark the start of an event calling ast_mark(id, 1)
* and then the end of the event with ast_mark(id, 0).
* For non-i386 architectures, these two calls return 0.
*/
int ast_add_profile(const char *, uint64_t scale);
int64_t ast_profile(int, int64_t);
int64_t ast_mark(int, int start1_stop0);
#else /* LOW_MEMORY */
#define ast_add_profile(a, b) 0
#define ast_profile(a, b) do { } while (0)
#define ast_mark(a, b) do { } while (0)
#endif /* LOW_MEMORY */
#endif /* _ASTERISK_H */ #endif /* _ASTERISK_H */

@ -509,6 +509,7 @@ int ast_utils_init(void)
#undef pthread_create /* For ast_pthread_create function only */ #undef pthread_create /* For ast_pthread_create function only */
#endif /* !__linux__ */ #endif /* !__linux__ */
#if !defined(LOW_MEMORY)
/* /*
* support for 'show threads'. The start routine is wrapped by * support for 'show threads'. The start routine is wrapped by
* dummy_start(), so that ast_register_thread() and * dummy_start(), so that ast_register_thread() and
@ -546,11 +547,15 @@ static void *dummy_start(void *data)
return ret; return ret;
} }
#endif /* !LOW_MEMORY */
int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *),
void *data, size_t stacksize, const char *file, const char *caller, void *data, size_t stacksize, const char *file, const char *caller,
int line, const char *start_fn) int line, const char *start_fn)
{ {
#if !defined(LOW_MEMORY)
struct thr_arg *a; struct thr_arg *a;
#endif
if (!attr) { if (!attr) {
attr = alloca(sizeof(*attr)); attr = alloca(sizeof(*attr));
@ -575,6 +580,7 @@ int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*st
if ((errno = pthread_attr_setstacksize(attr, stacksize ? stacksize : AST_STACKSIZE))) if ((errno = pthread_attr_setstacksize(attr, stacksize ? stacksize : AST_STACKSIZE)))
ast_log(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(errno)); ast_log(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(errno));
#if !defined(LOW_MEMORY)
if ((a = ast_malloc(sizeof(*a)))) { if ((a = ast_malloc(sizeof(*a)))) {
a->start_routine = start_routine; a->start_routine = start_routine;
a->data = data; a->data = data;
@ -583,6 +589,7 @@ int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*st
start_fn, line, file, caller); start_fn, line, file, caller);
data = a; data = a;
} }
#endif /* !LOW_MEMORY */
return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */ return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
} }

Loading…
Cancel
Save