Commit fa818d42 authored by winckel's avatar winckel

Added an action parameter to be performed when assert fails in AssertError.

Added a return status to itti_free.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4779 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 708013af
...@@ -34,38 +34,42 @@ ...@@ -34,38 +34,42 @@
#include <stdint.h> #include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#define _Assert_(cOND, eXIT, fORMAT, aRGS...) \ #define _Assert_Exit_ \
do { \ { \
if (!(cOND)) { \ fprintf(stderr, "\nExiting execution\n"); \
fprintf(stderr, "%s:%d:%s Assertion `"#cOND"` failed!\n" fORMAT, \
__FILE__, __LINE__, __FUNCTION__, ##aRGS); \
if (eXIT != 0) { \
fprintf(stderr, "Exiting execution\n"); \
fflush(stdout); \ fflush(stdout); \
fflush(stderr); \ fflush(stderr); \
abort(); \ abort(); \
} \ }
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
if (!(cOND)) { \
fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \
"In %s() %s:%d\n" fORMAT, \
__FUNCTION__, __FILE__, __LINE__, ##aRGS); \
aCTION; \
} \ } \
} while(0) } while(0)
#define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, 1, fORMAT, ##aRGS) #define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, _Assert_Exit_, fORMAT, ##aRGS)
#define AssertError(cOND, fORMAT, aRGS...) _Assert_(cOND, 0, fORMAT, ##aRGS) #define AssertError(cOND, aCTION, fORMAT, aRGS...) _Assert_(cOND, aCTION, fORMAT, ##aRGS)
#define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \ #define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \
_Assert_(cOND, 1, #vALUE1": %"PRIdMAX"\n"#vALUE2": %"PRIdMAX"\n"#vALUE3": %"PRIdMAX"\n\n", \ _Assert_(cOND, _Assert_Exit_, #vALUE1": %"PRIdMAX"\n"#vALUE2": %"PRIdMAX"\n"#vALUE3": %"PRIdMAX"\n\n", \
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3) (intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3)
#define DevCheck4(cOND, vALUE1, vALUE2, vALUE3, vALUE4) \ #define DevCheck4(cOND, vALUE1, vALUE2, vALUE3, vALUE4) \
_Assert_(cOND, 1, #vALUE1": %"PRIdMAX"\n"#vALUE2": %"PRIdMAX"\n"#vALUE3": %"PRIdMAX"\n"#vALUE4": %"PRIdMAX"\n\n", \ _Assert_(cOND, _Assert_Exit_, #vALUE1": %"PRIdMAX"\n"#vALUE2": %"PRIdMAX"\n"#vALUE3": %"PRIdMAX"\n"#vALUE4": %"PRIdMAX"\n\n", \
(intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3, (intmax_t)vALUE4) (intmax_t)vALUE1, (intmax_t)vALUE2, (intmax_t)vALUE3, (intmax_t)vALUE4)
#define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3) #define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3)
#define DevAssert(cOND) _Assert_(cOND, 1, "") #define DevAssert(cOND) _Assert_(cOND, _Assert_Exit_, "")
#define DevMessage(mESSAGE) _Assert_(0, 1, #mESSAGE) #define DevMessage(mESSAGE) _Assert_(0, _Assert_Exit_, #mESSAGE)
#endif /* ASSERTIONS_H_ */ #endif /* ASSERTIONS_H_ */
...@@ -39,35 +39,40 @@ ...@@ -39,35 +39,40 @@
#ifndef ASSERTIONS_H_ #ifndef ASSERTIONS_H_
#define ASSERTIONS_H_ #define ASSERTIONS_H_
#define _Assert_(cOND, eXIT, fORMAT, aRGS...) \ #define _Assert_Exit_ \
do { \ { \
if (!(cOND)) { \ fprintf(stderr, "\nExiting execution\n"); \
fprintf(stderr, "%s:%d:%s Assertion `"#cOND"` failed!\n" fORMAT, \
__FILE__, __LINE__, __FUNCTION__, ##aRGS); \
if (eXIT != 0) { \
display_backtrace(); \ display_backtrace(); \
fflush(stdout); \ fflush(stdout); \
fflush(stderr); \ fflush(stderr); \
exit(EXIT_FAILURE); \ exit(EXIT_FAILURE); \
} \ }
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
if (!(cOND)) { \
fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \
"In %s() %s:%d\n" fORMAT, \
__FUNCTION__, __FILE__, __LINE__, ##aRGS); \
aCTION; \
} \ } \
} while(0) } while(0)
#define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, 1, fORMAT, ##aRGS) #define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, _Assert_Exit_, fORMAT, ##aRGS)
#define AssertError(cOND, fORMAT, aRGS...) _Assert_(cOND, 0, fORMAT, ##aRGS) #define AssertError(cOND, aCTION, fORMAT, aRGS...) _Assert_(cOND, aCTION, fORMAT, ##aRGS)
#define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \ #define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \
_Assert_(cOND, 1, #vALUE1": %d\n"#vALUE2": %d\n"#vALUE3": %d\n\n", \ _Assert_(cOND, _Assert_Exit_, #vALUE1": %d\n"#vALUE2": %d\n"#vALUE3": %d\n\n", \
(int)vALUE1, (int)vALUE2, (int)vALUE3) (int)vALUE1, (int)vALUE2, (int)vALUE3)
#define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3) #define DevParam(vALUE1, vALUE2, vALUE3) DevCheck(0, vALUE1, vALUE2, vALUE3)
#define DevAssert(cOND) _Assert_(cOND, 1, "") #define DevAssert(cOND) _Assert_(cOND, _Assert_Exit_, "")
#define DevMessage(mESSAGE) _Assert_(0, 1, #mESSAGE) #define DevMessage(mESSAGE) _Assert_(0, _Assert_Exit_, #mESSAGE)
#define CHECK_INIT_RETURN(fCT) \ #define CHECK_INIT_RETURN(fCT) \
do { \ do { \
......
This diff is collapsed.
...@@ -232,7 +232,7 @@ void itti_send_terminate_message(task_id_t task_id); ...@@ -232,7 +232,7 @@ void itti_send_terminate_message(task_id_t task_id);
void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size); void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size);
void itti_free(task_id_t task_id, void *ptr); int itti_free(task_id_t task_id, void *ptr);
#endif /* INTERTASK_INTERFACE_H_ */ #endif /* INTERTASK_INTERFACE_H_ */
/* @} */ /* @} */
...@@ -69,14 +69,12 @@ static const int itti_dump_debug = 0; // 0x8 | 0x4 | 0x2; ...@@ -69,14 +69,12 @@ static const int itti_dump_debug = 0; // 0x8 | 0x4 | 0x2;
#ifdef RTAI #ifdef RTAI
# define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) rt_printk("[ITTI_DUMP][D]"x, ##args); } \ # define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) rt_printk("[ITTI_DUMP][D]"x, ##args); } \
while(0) while(0)
# define ITTI_DUMP_ERROR(x, args...) do { rt_printk("[ITTI_DUMP][E]"x, ##args); } \
while(0)
#else #else
# define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) fprintf(stdout, "[ITTI_DUMP][D]"x, ##args); } \ # define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) fprintf(stdout, "[ITTI_DUMP][D]"x, ##args); } \
while(0) while(0)
# define ITTI_DUMP_ERROR(x, args...) do { fprintf(stdout, "[ITTI_DUMP][E]"x, ##args); } \
while(0)
#endif #endif
#define ITTI_DUMP_ERROR(x, args...) do { fprintf(stdout, "[ITTI_DUMP][E]"x, ##args); } \
while(0)
#ifndef EFD_SEMAPHORE #ifndef EFD_SEMAPHORE
# define KERNEL_VERSION_PRE_2_6_30 1 # define KERNEL_VERSION_PRE_2_6_30 1
...@@ -165,11 +163,11 @@ static int itti_dump_send_message(int sd, itti_dump_queue_item_t *message) ...@@ -165,11 +163,11 @@ static int itti_dump_send_message(int sd, itti_dump_queue_item_t *message)
/* Allocate memory for message header and payload */ /* Allocate memory for message header and payload */
size_t size = sizeof(itti_dump_message_t) + message->data_size; size_t size = sizeof(itti_dump_message_t) + message->data_size;
AssertFatal (sd > 0, "Socket descriptor (%d) is invalid\n", sd); AssertFatal (sd > 0, "Socket descriptor (%d) is invalid!\n", sd);
AssertFatal (message != NULL, "Message is NULL\n"); AssertFatal (message != NULL, "Message is NULL!\n");
new_message = calloc(1, size); new_message = calloc(1, size);
AssertFatal (new_message != NULL, "New message allocation failed\n"); AssertFatal (new_message != NULL, "New message allocation failed!\n");
/* Preparing the header */ /* Preparing the header */
new_message->header.message_size = size; new_message->header.message_size = size;
...@@ -228,8 +226,8 @@ static int itti_dump_send_xml_definition(const int sd, const char *message_defin ...@@ -228,8 +226,8 @@ static int itti_dump_send_xml_definition(const int sd, const char *message_defin
ssize_t bytes_sent = 0, total_sent = 0; ssize_t bytes_sent = 0, total_sent = 0;
uint8_t *data_ptr; uint8_t *data_ptr;
AssertFatal (sd > 0, "Socket descriptor (%d) is invalid\n", sd); AssertFatal (sd > 0, "Socket descriptor (%d) is invalid!\n", sd);
AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL\n"); AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL!\n");
itti_dump_message_size = sizeof(itti_socket_header_t) + message_definition_xml_length; itti_dump_message_size = sizeof(itti_socket_header_t) + message_definition_xml_length;
...@@ -289,7 +287,7 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa ...@@ -289,7 +287,7 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
{ {
struct lfds611_freelist_element *new_queue_element = NULL; struct lfds611_freelist_element *new_queue_element = NULL;
int overwrite_flag; int overwrite_flag;
AssertFatal (new != NULL, "Message to queue is NULL\n"); AssertFatal (new != NULL, "Message to queue is NULL!\n");
#if defined(OAI_EMU) || defined(RTAI) #if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_IN); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
...@@ -324,7 +322,7 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa ...@@ -324,7 +322,7 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
/* Call to write for an event fd must be of 8 bytes */ /* Call to write for an event fd must be of 8 bytes */
write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter)); write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
AssertFatal (write_ret == sizeof(sem_counter), "Write to dump event failed (%ld/%ld)\n", write_ret, sizeof(sem_counter)); AssertFatal (write_ret == sizeof(sem_counter), "Write to dump event failed (%d/%d)!\n", (int) write_ret, (int) sizeof(sem_counter));
} }
#endif #endif
__sync_fetch_and_add (&pending_messages, 1); __sync_fetch_and_add (&pending_messages, 1);
...@@ -405,7 +403,7 @@ static int itti_dump_flush_ring_buffer(int flush_all) ...@@ -405,7 +403,7 @@ static int itti_dump_flush_ring_buffer(int flush_all)
} }
else else
{ {
AssertFatal (0, "Dump event with no data\n"); AssertFatal (0, "Dump event with no data!\n");
} }
} }
else else
...@@ -462,13 +460,13 @@ static int itti_dump_handle_new_connection(int sd, const char *xml_definition, u ...@@ -462,13 +460,13 @@ static int itti_dump_handle_new_connection(int sd, const char *xml_definition, u
ITTI_DUMP_DEBUG(0x2, " Found place to store new connection: %d\n", i); ITTI_DUMP_DEBUG(0x2, " Found place to store new connection: %d\n", i);
AssertFatal (i < ITTI_DUMP_MAX_CON, "No more connection available (%d/%d) for socked %d\n", i, ITTI_DUMP_MAX_CON, sd); AssertFatal (i < ITTI_DUMP_MAX_CON, "No more connection available (%d/%d) for socked %d!\n", i, ITTI_DUMP_MAX_CON, sd);
ITTI_DUMP_DEBUG(0x2, " Socket %d accepted\n", sd); ITTI_DUMP_DEBUG(0x2, " Socket %d accepted\n", sd);
/* Send the XML message definition */ /* Send the XML message definition */
if (itti_dump_send_xml_definition(sd, xml_definition, xml_definition_length) < 0) { if (itti_dump_send_xml_definition(sd, xml_definition, xml_definition_length) < 0) {
AssertError (0, " Failed to send XML definition\n"); AssertError (0, {}, "Failed to send XML definition!\n");
close (sd); close (sd);
return -1; return -1;
} }
...@@ -505,7 +503,7 @@ static void *itti_dump_socket(void *arg_p) ...@@ -505,7 +503,7 @@ static void *itti_dump_socket(void *arg_p)
ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT); ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT);
message_definition_xml = (char *)arg_p; message_definition_xml = (char *)arg_p;
AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL\n"); AssertFatal (message_definition_xml != NULL, "Message definition XML is NULL!\n");
message_definition_xml_length = strlen(message_definition_xml) + 1; message_definition_xml_length = strlen(message_definition_xml) + 1;
...@@ -626,7 +624,7 @@ static void *itti_dump_socket(void *arg_p) ...@@ -626,7 +624,7 @@ static void *itti_dump_socket(void *arg_p)
ITTI_DUMP_ERROR(" Failed read for semaphore: %s\n", strerror(errno)); ITTI_DUMP_ERROR(" Failed read for semaphore: %s\n", strerror(errno));
pthread_exit(NULL); pthread_exit(NULL);
} }
AssertFatal (read_ret == sizeof(sem_counter), "Failed to read from dump event FD (%ld/%ld)\n", read_ret, sizeof(sem_counter)); AssertFatal (read_ret == sizeof(sem_counter), "Failed to read from dump event FD (%d/%d)!\n", (int) read_ret, (int) sizeof(sem_counter));
#if defined(KERNEL_VERSION_PRE_2_6_30) #if defined(KERNEL_VERSION_PRE_2_6_30)
if (itti_dump_flush_ring_buffer(1) == 0) if (itti_dump_flush_ring_buffer(1) == 0)
#else #else
...@@ -644,7 +642,7 @@ static void *itti_dump_socket(void *arg_p) ...@@ -644,7 +642,7 @@ static void *itti_dump_socket(void *arg_p)
sem_counter = 1; sem_counter = 1;
/* Call to write for an event fd must be of 8 bytes */ /* Call to write for an event fd must be of 8 bytes */
write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter)); write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
AssertFatal (write_ret == sizeof(sem_counter), "Failed to write to dump event FD (%ld/%ld)\n", write_ret, sem_counter); AssertFatal (write_ret == sizeof(sem_counter), "Failed to write to dump event FD (%d/%d)!\n", (int) write_ret, (int) sem_counter);
} }
#endif #endif
} }
...@@ -702,7 +700,7 @@ static void *itti_dump_socket(void *arg_p) ...@@ -702,7 +700,7 @@ static void *itti_dump_socket(void *arg_p)
/* In case we don't find the matching sd in list of known /* In case we don't find the matching sd in list of known
* connections -> assert. * connections -> assert.
*/ */
AssertFatal (j < ITTI_DUMP_MAX_CON, "Connection index not found (%d/%d) for socked %d\n", j, ITTI_DUMP_MAX_CON, i); AssertFatal (j < ITTI_DUMP_MAX_CON, "Connection index not found (%d/%d) for socked %d!\n", j, ITTI_DUMP_MAX_CON, i);
/* Re-initialize the socket to -1 so we can accept new /* Re-initialize the socket to -1 so we can accept new
* incoming connections. * incoming connections.
...@@ -743,8 +741,8 @@ int itti_dump_queue_message(task_id_t sender_task, ...@@ -743,8 +741,8 @@ int itti_dump_queue_message(task_id_t sender_task,
itti_dump_queue_item_t *new; itti_dump_queue_item_t *new;
size_t message_name_length; size_t message_name_length;
AssertFatal (message_name != NULL, "Message name is NULL\n"); AssertFatal (message_name != NULL, "Message name is NULL!\n");
AssertFatal (message_p != NULL, "Message is NULL\n"); AssertFatal (message_p != NULL, "Message is NULL!\n");
#if defined(OAI_EMU) || defined(RTAI) #if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
...@@ -767,7 +765,7 @@ int itti_dump_queue_message(task_id_t sender_task, ...@@ -767,7 +765,7 @@ int itti_dump_queue_message(task_id_t sender_task,
new->message_number = message_number; new->message_number = message_number;
message_name_length = strlen(message_name) + 1; message_name_length = strlen(message_name) + 1;
AssertError (message_name_length <= SIGNAL_NAME_LENGTH, "Message name too long (%ld/%d)\n", message_name_length, SIGNAL_NAME_LENGTH); AssertError (message_name_length <= SIGNAL_NAME_LENGTH, {}, "Message name too long (%d/%d)!\n", (int) message_name_length, SIGNAL_NAME_LENGTH);
memcpy(new->message_name, message_name, message_name_length); memcpy(new->message_name, message_name, message_name_length);
itti_dump_enqueue_message(new, message_size, ITTI_DUMP_MESSAGE_TYPE); itti_dump_enqueue_message(new, message_size, ITTI_DUMP_MESSAGE_TYPE);
...@@ -823,7 +821,7 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons ...@@ -823,7 +821,7 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
NULL) != 1) NULL) != 1)
{ {
/* Always assert on this condition */ /* Always assert on this condition */
AssertFatal (0, " Failed to create ring buffer...\n"); AssertFatal (0, " Failed to create ring buffer!\n");
} }
#ifdef RTAI #ifdef RTAI
...@@ -836,7 +834,7 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons ...@@ -836,7 +834,7 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
# endif # endif
if (itti_dump_queue.event_fd == -1) { if (itti_dump_queue.event_fd == -1) {
/* Always assert on this condition */ /* Always assert on this condition */
AssertFatal (0, "eventfd failed: %s\n", strerror(errno)); AssertFatal (0, "eventfd failed: %s!\n", strerror(errno));
} }
#endif #endif
...@@ -850,22 +848,22 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons ...@@ -850,22 +848,22 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
/* initialized with default attributes */ /* initialized with default attributes */
ret = pthread_attr_init(&itti_dump_queue.attr); ret = pthread_attr_init(&itti_dump_queue.attr);
if (ret < 0) { if (ret < 0) {
AssertFatal (0, "pthread_attr_init failed (%d:%s)\n", errno, strerror(errno)); AssertFatal (0, "pthread_attr_init failed (%d:%s)!\n", errno, strerror(errno));
} }
ret = pthread_attr_setschedpolicy(&itti_dump_queue.attr, SCHED_FIFO); ret = pthread_attr_setschedpolicy(&itti_dump_queue.attr, SCHED_FIFO);
if (ret < 0) { if (ret < 0) {
AssertFatal (0, "pthread_attr_setschedpolicy (SCHED_IDLE) failed (%d:%s)\n", errno, strerror(errno)); AssertFatal (0, "pthread_attr_setschedpolicy (SCHED_IDLE) failed (%d:%s)!\n", errno, strerror(errno));
} }
ret = pthread_attr_setschedparam(&itti_dump_queue.attr, &scheduler_param); ret = pthread_attr_setschedparam(&itti_dump_queue.attr, &scheduler_param);
if (ret < 0) { if (ret < 0) {
AssertFatal (0, "pthread_attr_setschedparam failed (%d:%s)\n", errno, strerror(errno)); AssertFatal (0, "pthread_attr_setschedparam failed (%d:%s)!\n", errno, strerror(errno));
} }
ret = pthread_create(&itti_dump_queue.itti_acceptor_thread, &itti_dump_queue.attr, ret = pthread_create(&itti_dump_queue.itti_acceptor_thread, &itti_dump_queue.attr,
&itti_dump_socket, (void *)messages_definition_xml); &itti_dump_socket, (void *)messages_definition_xml);
if (ret < 0) { if (ret < 0) {
AssertFatal (0, "pthread_create failed (%d:%s)\n", errno, strerror(errno)); AssertFatal (0, "pthread_create failed (%d:%s)!\n", errno, strerror(errno));
} }
return 0; return 0;
......
This diff is collapsed.
...@@ -44,7 +44,7 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p ...@@ -44,7 +44,7 @@ int memory_pools_add_pool (memory_pools_handle_t memory_pools_handle, uint32_t p
memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1); memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_pools_handle, uint32_t item_size, uint16_t info_0, uint16_t info_1);
void memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0); int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, uint16_t info_0);
void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info); void memory_pools_set_info (memory_pools_handle_t memory_pools_handle, memory_pool_item_handle_t memory_pool_item_handle, int index, uint16_t info);
......
...@@ -147,7 +147,7 @@ int timer_setup( ...@@ -147,7 +147,7 @@ int timer_setup(
if (timer_id == NULL) { if (timer_id == NULL) {
return -1; return -1;
} }
AssertFatal (type < TIMER_TYPE_MAX, "Invalid timer type (%d/%d)\n", type, TIMER_TYPE_MAX); AssertFatal (type < TIMER_TYPE_MAX, "Invalid timer type (%d/%d)!\n", type, TIMER_TYPE_MAX);
/* Allocate new timer list element */ /* Allocate new timer list element */
timer_p = malloc(sizeof(struct timer_elm_s)); timer_p = malloc(sizeof(struct timer_elm_s));
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "assertions.h"
# include "intertask_interface.h" # include "intertask_interface.h"
# include "nas_ue_task.h" # include "nas_ue_task.h"
# include "UTIL/LOG/log.h" # include "UTIL/LOG/log.h"
...@@ -74,6 +75,7 @@ void *nas_ue_task(void *args_p) { ...@@ -74,6 +75,7 @@ void *nas_ue_task(void *args_p) {
const char *msg_name; const char *msg_name;
instance_t instance; instance_t instance;
unsigned int Mod_id; unsigned int Mod_id;
int result;
itti_mark_task_ready (TASK_NAS_UE); itti_mark_task_ready (TASK_NAS_UE);
...@@ -167,7 +169,8 @@ void *nas_ue_task(void *args_p) { ...@@ -167,7 +169,8 @@ void *nas_ue_task(void *args_p) {
nas_proc_establish_cnf(NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); nas_proc_establish_cnf(NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
/* TODO checks if NAS will free the nas message, better to do it there anyway! */ /* TODO checks if NAS will free the nas message, better to do it there anyway! */
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data); result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory!\n");
} }
break; break;
...@@ -196,7 +199,8 @@ void *nas_ue_task(void *args_p) { ...@@ -196,7 +199,8 @@ void *nas_ue_task(void *args_p) {
nas_proc_dl_transfer_ind (NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); nas_proc_dl_transfer_ind (NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length);
/* TODO checks if NAS will free the nas message, better to do it there anyway! */ /* TODO checks if NAS will free the nas message, better to do it there anyway! */
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data); result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory!\n");
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment