diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/agi.h | 6 | ||||
-rw-r--r-- | include/asterisk/ari.h | 10 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 8 | ||||
-rw-r--r-- | include/asterisk/linkedlists.h | 2 | ||||
-rw-r--r-- | include/asterisk/lock.h | 92 | ||||
-rw-r--r-- | include/asterisk/res_mwi_external.h | 16 | ||||
-rw-r--r-- | include/asterisk/res_pjproject.h | 22 | ||||
-rw-r--r-- | include/asterisk/res_pjsip.h | 31 | ||||
-rw-r--r-- | include/asterisk/res_pjsip_pubsub.h | 9 | ||||
-rw-r--r-- | include/asterisk/res_pjsip_session.h | 21 | ||||
-rw-r--r-- | include/asterisk/stasis_app.h | 30 |
11 files changed, 33 insertions, 214 deletions
diff --git a/include/asterisk/agi.h b/include/asterisk/agi.h index cb80f9570..568cd5d11 100644 --- a/include/asterisk/agi.h +++ b/include/asterisk/agi.h @@ -82,13 +82,12 @@ AST_OPTIONAL_API(int, ast_agi_register, * * Unregisters an AGI command. * - * \param mod Pointer to the module_info structure for the module that is unregistering the command * \param cmd Pointer to the descriptor for the command * \return 1 on success, 0 if the command was not already registered * */ AST_OPTIONAL_API(int, ast_agi_unregister, - (struct ast_module *mod, agi_command *cmd), + (agi_command *cmd), { return AST_OPTIONAL_API_UNAVAILABLE; }); /*! @@ -116,7 +115,6 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple, * Unregisters a group of AGI commands, provided as an array of struct agi_command * entries. * - * \param mod Pointer to the module_info structure for the module that is unregistering the commands * \param cmd Pointer to the first entry in the array of command descriptors * \param len Length of the array (use the ARRAY_LEN macro to determine this easily) * \return 0 on success, -1 on failure, AST_OPTIONAL_API_UNAVAILABLE if res_agi is not loaded @@ -125,7 +123,7 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple, * remaining commands in the array; it will not reregister the already-unregistered commands. */ AST_OPTIONAL_API(int, ast_agi_unregister_multiple, - (struct ast_module *mod, struct agi_command *cmd, unsigned int len), + (struct agi_command *cmd, unsigned int len), { return AST_OPTIONAL_API_UNAVAILABLE; }); /*! diff --git a/include/asterisk/ari.h b/include/asterisk/ari.h index f83d5963f..865b4b00c 100644 --- a/include/asterisk/ari.h +++ b/include/asterisk/ari.h @@ -268,14 +268,4 @@ void ast_ari_response_created(struct ast_ari_response *response, */ void ast_ari_response_alloc_failed(struct ast_ari_response *response); -/*! \brief Determines whether the res_ari module is loaded */ -#define CHECK_ARI_MODULE_LOADED() \ - do { \ - if (!ast_module_check("res_ari.so") \ - || !ast_ari_oom_json()) { \ - return AST_MODULE_LOAD_DECLINE; \ - } \ - } while(0) - - #endif /* _ASTERISK_ARI_H */ diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index f8bd0e376..b95d52693 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -188,6 +188,9 @@ /* Define to 1 if you have the curses library. */ #undef HAVE_CURSES +/* Define to 1 if your C compiler provides __atomic operations. */ +#undef HAVE_C_ATOMICS + /* Define if your system has the DAHDI headers. */ #undef HAVE_DAHDI @@ -292,7 +295,7 @@ /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE -/* Define to 1 if your GCC C compiler provides atomic operations. */ +/* Define to 1 if your GCC C compiler provides __sync atomic operations. */ #undef HAVE_GCC_ATOMICS /* Define to 1 if you have the `getcwd' function. */ @@ -600,9 +603,6 @@ /* Define to 1 if you have the Open Sound System library. */ #undef HAVE_OSS -/* Define to 1 if OSX atomic operations are supported. */ -#undef HAVE_OSX_ATOMICS - /* Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h */ #undef HAVE_O_EVTONLY diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 8715cf1ad..5f50c7535 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -854,7 +854,7 @@ struct { \ */ #define AST_LIST_REMOVE(head, elm, field) \ ({ \ - __typeof(elm) __elm = (elm); \ + typeof(elm) __elm = (elm); \ if (__elm) { \ if ((head)->first == __elm) { \ (head)->first = __elm->field.next; \ diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 58c9a8383..c3dd691a8 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -617,97 +617,39 @@ static void __attribute__((destructor)) fini_##rwlock(void) \ #define pthread_create __use_ast_pthread_create_instead__ #endif -/* - * Support for atomic instructions. - * For platforms that have it, use the native cpu instruction to - * implement them. For other platforms, resort to a 'slow' version - * (defined in utils.c) that protects the atomic instruction with - * a single lock. - * The slow versions is always available, for testing purposes, - * as ast_atomic_fetchadd_int_slow() - */ - -int ast_atomic_fetchadd_int_slow(volatile int *p, int v); +/* Support for atomic instructions. */ #include "asterisk/inline_api.h" -#if defined(HAVE_OSX_ATOMICS) -#include "libkern/OSAtomic.h" +#if defined(HAVE_C_ATOMICS) +#define ast_atomic_fetch_add(p, v, memorder) __atomic_fetch_add(p, v, memorder) +#define ast_atomic_sub_fetch(p, v, memorder) __atomic_sub_fetch(p, v, memorder) +#elif defined(HAVE_GCC_ATOMICS) +#define ast_atomic_fetch_add(p, v, memorder) __sync_fetch_and_add(p, v) +#define ast_atomic_sub_fetch(p, v, memorder) __sync_sub_and_fetch(p, v) +#else +#error "Atomics not available." #endif -/*! \brief Atomically add v to *p and return * the previous value of *p. +/*! + * \brief Atomically add v to *p and return the previous value of *p. + * * This can be used to handle reference counts, and the return value * can be used to generate unique identifiers. */ - -#if defined(HAVE_GCC_ATOMICS) -AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), -{ - return __sync_fetch_and_add(p, v); -}) -#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4) -AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), -{ - return OSAtomicAdd32(v, (int32_t *) p) - v; -}) -#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8) -AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), -{ - return OSAtomicAdd64(v, (int64_t *) p) - v; -}) -#elif defined (__i386__) || defined(__x86_64__) -#ifdef sun -AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), -{ - __asm __volatile ( - " lock; xaddl %0, %1 ; " - : "+r" (v), /* 0 (result) */ - "=m" (*p) /* 1 */ - : "m" (*p)); /* 2 */ - return (v); -}) -#else /* ifndef sun */ AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), { - __asm __volatile ( - " lock xaddl %0, %1 ; " - : "+r" (v), /* 0 (result) */ - "=m" (*p) /* 1 */ - : "m" (*p)); /* 2 */ - return (v); + return ast_atomic_fetch_add(p, v, __ATOMIC_RELAXED); }) -#endif -#else /* low performance version in utils.c */ -AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), -{ - return ast_atomic_fetchadd_int_slow(p, v); -}) -#endif -/*! \brief decrement *p by 1 and return true if the variable has reached 0. +/*! + * \brief decrement *p by 1 and return true if the variable has reached 0. + * * Useful e.g. to check if a refcount has reached 0. */ -#if defined(HAVE_GCC_ATOMICS) -AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), -{ - return __sync_sub_and_fetch(p, 1) == 0; -}) -#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4) AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), { - return OSAtomicAdd32( -1, (int32_t *) p) == 0; + return ast_atomic_sub_fetch(p, 1, __ATOMIC_RELAXED) == 0; }) -#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8) -AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), -{ - return OSAtomicAdd64( -1, (int64_t *) p) == 0; -}) -#else -AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p), -{ - int a = ast_atomic_fetchadd_int(p, -1); - return a == 1; /* true if the value is 0 now (so it was 1 previously) */ -}) -#endif #endif /* _ASTERISK_LOCK_H */ diff --git a/include/asterisk/res_mwi_external.h b/include/asterisk/res_mwi_external.h index 7698a1bd6..25de70003 100644 --- a/include/asterisk/res_mwi_external.h +++ b/include/asterisk/res_mwi_external.h @@ -36,22 +36,6 @@ extern "C" /* ------------------------------------------------------------------- */ -/*! - * \brief Increase the external MWI resource module reference count. - * \since 12.1.0 - * - * \return Nothing - */ -void ast_mwi_external_ref(void); - -/*! - * \brief Decrease the external MWI resource module reference count. - * \since 12.1.0 - * - * \return Nothing - */ -void ast_mwi_external_unref(void); - struct ast_mwi_mailbox_object; /*! \brief Convienience unref function for mailbox object. */ diff --git a/include/asterisk/res_pjproject.h b/include/asterisk/res_pjproject.h index 8828b340c..4993be610 100644 --- a/include/asterisk/res_pjproject.h +++ b/include/asterisk/res_pjproject.h @@ -19,14 +19,6 @@ #ifndef _RES_PJPROJECT_H #define _RES_PJPROJECT_H -/*! \brief Determines whether the res_pjproject module is loaded */ -#define CHECK_PJPROJECT_MODULE_LOADED() \ - do { \ - if (!ast_module_check("res_pjproject.so")) { \ - return AST_MODULE_LOAD_DECLINE; \ - } \ - } while(0) - /*! * \brief Retrieve a pjproject build option * @@ -79,18 +71,4 @@ void ast_pjproject_log_intercept_begin(int fd); */ void ast_pjproject_log_intercept_end(void); -/*! - * \brief Increment the res_pjproject reference count. - * - * This ensures graceful shutdown happens in the proper order. - */ -void ast_pjproject_ref(void); - -/*! - * \brief Decrement the res_pjproject reference count. - * - * This ensures graceful shutdown happens in the proper order. - */ -void ast_pjproject_unref(void); - #endif /* _RES_PJPROJECT_H */ diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index 66b99b8f7..a3bd78222 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -933,9 +933,7 @@ enum ast_sip_contact_filter { * \retval 0 Success * \retval -1 Failure */ -#define ast_sip_register_service(module) \ - __ast_sip_register_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__) -int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func); +int ast_sip_register_service(pjsip_module *module); /*! * This is the opposite of ast_sip_register_service(). Unregistering a @@ -944,9 +942,7 @@ int __ast_sip_register_service(pjsip_module *module, const char *file, int line, * * \param module The PJSIP module to unregister */ -#define ast_sip_unregister_service(module) \ - __ast_sip_unregister_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__) -void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func); +void ast_sip_unregister_service(pjsip_module *module); /*! * \brief Register a SIP authenticator @@ -2448,10 +2444,8 @@ struct ast_sip_endpoint_formatter { * \brief Register an endpoint formatter. * * \param obj the formatter to register - * \retval 0 Success - * \retval -1 Failure */ -int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj); +void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj); /*! * \brief Unregister an endpoint formatter. @@ -2627,20 +2621,14 @@ struct ast_sip_supplement { * \retval 0 Success * \retval -1 Failure */ -#define ast_sip_register_supplement(supplement) \ - __ast_sip_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__) -int __ast_sip_register_supplement(struct ast_sip_supplement *supplement, - const char *file, int line, const char *func); +void ast_sip_register_supplement(struct ast_sip_supplement *supplement); /*! * \brief Unregister a an supplement to SIP out of dialog processing * * \param supplement The supplement to unregister */ -#define ast_sip_unregister_supplement(supplement) \ - __ast_sip_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__) -void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement, - const char *file, int line, const char *func); +void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement); /*! * \brief Retrieve the global MWI taskprocessor high water alert trigger level. @@ -2764,15 +2752,6 @@ void ast_sip_get_default_realm(char *realm, size_t size); */ void ast_sip_get_default_from_user(char *from_user, size_t size); -/*! \brief Determines whether the res_pjsip module is loaded */ -#define CHECK_PJSIP_MODULE_LOADED() \ - do { \ - if (!ast_module_check("res_pjsip.so") \ - || !ast_sip_get_pjsip_endpoint()) { \ - return AST_MODULE_LOAD_DECLINE; \ - } \ - } while(0) - /*! * \brief Retrieve the system keep alive interval setting. * diff --git a/include/asterisk/res_pjsip_pubsub.h b/include/asterisk/res_pjsip_pubsub.h index cb51db31f..e9d59a085 100644 --- a/include/asterisk/res_pjsip_pubsub.h +++ b/include/asterisk/res_pjsip_pubsub.h @@ -754,13 +754,4 @@ const char *ast_sip_subscription_get_body_subtype(struct ast_sip_subscription *s */ void ast_sip_subscription_destroy(struct ast_sip_subscription *sub); -/*! \brief Determines whether the res_pjsip_pubsub module is loaded */ -#define CHECK_PJSIP_PUBSUB_MODULE_LOADED() \ - do { \ - CHECK_PJSIP_MODULE_LOADED(); \ - if (!ast_module_check("res_pjsip_pubsub.so")) { \ - return AST_MODULE_LOAD_DECLINE; \ - } \ - } while(0) - #endif /* RES_PJSIP_PUBSUB_H */ diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h index 65d463821..f6ee0f00b 100644 --- a/include/asterisk/res_pjsip_session.h +++ b/include/asterisk/res_pjsip_session.h @@ -579,23 +579,15 @@ void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler * * a module could reject an incoming request if desired. * * \param supplement The supplement to register - * \retval 0 Success - * \retval -1 Failure */ -#define ast_sip_session_register_supplement(supplement) \ - __ast_sip_session_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__) -int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement, - const char *file, int line, const char *func); +void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement); /*! * \brief Unregister a an supplement to SIP session processing * * \param supplement The supplement to unregister */ -#define ast_sip_session_unregister_supplement(supplement) \ - __ast_sip_session_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__) -void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement, - const char *file, int line, const char *func); +void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement); /*! * \brief Add supplements to a SIP session @@ -894,13 +886,4 @@ int ast_sip_session_media_set_write_callback(struct ast_sip_session *session, st */ struct ast_sip_session_media *ast_sip_session_media_get_transport(struct ast_sip_session *session, struct ast_sip_session_media *session_media); -/*! \brief Determines whether the res_pjsip_session module is loaded */ -#define CHECK_PJSIP_SESSION_MODULE_LOADED() \ - do { \ - CHECK_PJSIP_MODULE_LOADED(); \ - if (!ast_module_check("res_pjsip_session.so")) { \ - return AST_MODULE_LOAD_DECLINE; \ - } \ - } while(0) - #endif /* _RES_PJSIP_SESSION_H */ diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h index 8ef2bda1c..b0829ab73 100644 --- a/include/asterisk/stasis_app.h +++ b/include/asterisk/stasis_app.h @@ -46,8 +46,8 @@ * functions. * * Since module unload order is based on reference counting, any module that - * uses the API defined in this file must call stasis_app_ref() when loaded, - * and stasis_app_unref() when unloaded. + * uses the API defined in this file must list "res_stasis" in the requires + * field. */ #include "asterisk/channel.h" @@ -229,18 +229,6 @@ void stasis_app_register_event_source(struct stasis_app_event_source *obj); void stasis_app_register_event_sources(void); /*! - * \brief Checks to see if the given object is a core event source - * - * \note core event sources are currently only endpoint, bridge, and channel. - * - * \param obj event source object to check - * - * \return non-zero if core event source, otherwise 0 (false) - - */ -int stasis_app_is_core_event_source(struct stasis_app_event_source *obj); - -/*! * \brief Unregister an application event source. * * \param obj the event source to unregister @@ -850,20 +838,6 @@ struct ast_bridge *stasis_app_get_bridge(struct stasis_app_control *control); void stasis_app_bridge_destroy(const char *bridge_id); /*! - * \brief Increment the res_stasis reference count. - * - * This ensures graceful shutdown happens in the proper order. - */ -void stasis_app_ref(void); - -/*! - * \brief Decrement the res_stasis reference count. - * - * This ensures graceful shutdown happens in the proper order. - */ -void stasis_app_unref(void); - -/*! * \brief Get the Stasis message sanitizer for app_stasis applications * * \retval The stasis message sanitizer |