Commit 3267aece authored by wujing's avatar wujing

change exit to exit_func

parent c6687ab5
......@@ -202,7 +202,8 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
if ( strstr(argv[i], "help_config") != NULL ) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME);
exit(0);
//exit(0);
exit_fun("exit0");
}
if ( (strcmp(argv[i]+1, "h") == 0) || (strstr(argv[i]+1, "help_") != NULL ) ) {
......@@ -236,7 +237,8 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
if (i< 0) {
fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno));
exit(-1) ;
//exit(-1) ;
exit_fun("sscanf error");
} else if ( i == 1 ) {
/* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig
with one parameter, the path to the configuration file cfgmode must not be NULL */
......
......@@ -246,7 +246,8 @@ void log_getconfig(log_t *g_log) {
break;
} else if (log_options[j+1].name == NULL) {
fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]);
exit(-1);
//exit(-1);
exit_fun("log_getconfig Unknown log option");
}
}
}
......
......@@ -215,7 +215,8 @@ void init_server_eventfd(int *watch_fd_list, int client_num, char *path)
if ((conn_socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
{
perror("socket (init_server_eventfd)\n");
exit(1);
//exit(1);
exit_fun("init_server_eventfd fatal: socket err");
}
addr.sun_family = AF_UNIX;
......@@ -226,7 +227,8 @@ void init_server_eventfd(int *watch_fd_list, int client_num, char *path)
if (bind(conn_socket, (const struct sockaddr *)&addr, sizeof(struct sockaddr_un)) == -1)
{
perror("bind (init_server_eventfd)\n");
exit(1);
//exit(1);
exit_fun("init_server_eventfd fatal: bind err");
}
printf("bind completed (init_server_eventfd) \n");
......@@ -235,7 +237,8 @@ void init_server_eventfd(int *watch_fd_list, int client_num, char *path)
if (listen(conn_socket, 16) == -1)
{
perror("listen (init_server_eventfd)");
exit(1);
//exit(1);
exit_fun("init_server_eventfd fatal: listen err");
}
printf("init_server_eventfd : now listening\n");
......@@ -246,6 +249,7 @@ void init_server_eventfd(int *watch_fd_list, int client_num, char *path)
{
perror("accept (init_server_eventfd)\n");
exit(1);
exit_fun("init_server_eventfd fatal: accept err");
}
printf("accept completed (init_server_eventfd)\n");
......
......@@ -3151,7 +3151,8 @@ void dft128(int16_t *x,int16_t *y,int scale)
}
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128out.m","dft128",y,128,1,1);
exit(-1);
//exit(-1);
exit_fun("DEBUG DFT128out.m");
}
_mm_empty();
_m_empty();
......@@ -3222,7 +3223,8 @@ void dft128(int16_t *x,int16_t *y,int scale)
}
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128.m","dft",y256,128,1,1);
exit(-1);
//exit(-1);
exit_fun("DEBUG DFT128.m");
}
}
......
......@@ -2715,7 +2715,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
if (t_reloc_prep <= 0 || t_reloc_prep > 10000 ||
tx2_reloc_overall <= 0 || tx2_reloc_overall > 20000) {
LOG_E(X2AP, "timers in configuration file have wrong values. We must have [0 < t_reloc_prep <= 10000] and [0 < tx2_reloc_overall <= 20000]\n");
exit(1);
//exit(1);
exit_fun("X2AP config error. t_reloc_prep or tx2_reloc_overall error");
}
X2AP_REGISTER_ENB_REQ (msg_p).t_reloc_prep = t_reloc_prep;
......@@ -2739,7 +2740,8 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
if ((NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr == NULL) || (X2AP_REGISTER_ENB_REQ (msg_p).enb_port_for_X2C == 0)) {
LOG_E(RRC,"Add eNB IPv4 address and/or port for X2C in the CONF file!\n");
exit(1);
//exit(1);
exit_fun("X2AP config error. target ip format invalid");
}
cidr = *(NETParams[ENB_IPV4_ADDR_FOR_X2C_IDX].strptr);
......
......@@ -1276,7 +1276,7 @@ schedule_ulsch(module_id_t module_idP,
case 25: first_rb[CC_id] = 1; break; // leave out first RB for PUCCH
case 50: first_rb[CC_id] = 2; break; // leave out first RB for PUCCH
case 100: first_rb[CC_id] = 3; break; // leave out first RB for PUCCH
default: LOG_E(MAC, "nb RBs not handled, todo.\n"); exit(1);
default: LOG_E(MAC, "nb RBs not handled, todo.\n"); exit_fun("RB set error. not in [25, 50, 100]"); //exit(1);
}
#endif
RA_t *ra_ptr = cc->ra;
......@@ -1416,7 +1416,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
case 25: n_rb_ul_tab[CC_id] -= 1; break;
case 50: n_rb_ul_tab[CC_id] -= 2; break;
case 100: n_rb_ul_tab[CC_id] -= 3; break;
default: LOG_E(MAC, "RBs setting not handled. Todo.\n"); exit(1);
default: LOG_E(MAC, "RBs setting not handled. Todo.\n"); exit_fun("RB set error. not in [25, 50, 100]"); //exit(1);
}
UE_list->first_rb_offset[CC_id][slice_idx] = cmin(n_rb_ul_tab[CC_id], sli->ul[slice_idx].first_rb);
}
......
......@@ -351,7 +351,8 @@ static int maxsize = SMAX;
static void put(char x) {
if (size == maxsize) {
printf("incrase SMAX\n");
exit(1);
//exit(1);
exit_fun("incrase SMAX");
}
s[size++] = x;
......
......@@ -36,6 +36,8 @@
#include <string.h>
#include <pthread.h>
extern void exit_function(const char *file, const char *function, const int line, const char *s);
message_queue_t *new_message_queue(void)
{
message_queue_t *ret = NULL;
......@@ -102,11 +104,13 @@ int message_put(message_queue_t *queue, void *data, int size, int priority)
if (pthread_cond_signal(queue->cond)) {
LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
pthread_mutex_unlock(queue->mutex);
exit(1);
//exit(1);
exit_function(__FILE__, __FUNCTION__, __LINE__, "message_put fatal: pthread_cond_signal error");
}
if (pthread_mutex_unlock(queue->mutex)) {
LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
//exit(1);
exit_function(__FILE__, __FUNCTION__, __LINE__, "message_put fatal: pthread_mutex_unlock error");
}
return 0;
......
......@@ -269,7 +269,8 @@ sctp_handle_new_association_req_multi(
sctp_new_association_req_p->remote_address.ipv6_address);
//close(sd);
//return;
exit(1);
//exit(1);
exit_fun("sctp_handle_new_association_req_multi fatal: inet_pton error");
}
SCTP_DEBUG("Converted ipv6 address %*s to network type\n",
......@@ -289,7 +290,8 @@ sctp_handle_new_association_req_multi(
sctp_new_association_req_p->remote_address.ipv4_address);
//close(sd);
//return;
exit(1);
//exit(1);
exit_fun("sctp_handle_new_association_req_multi fatal: inet_pton error");
}
SCTP_DEBUG("Converted ipv4 address %*s to network type\n",
......@@ -328,7 +330,8 @@ sctp_handle_new_association_req_multi(
if (ns == -1) {
perror("sctp_peeloff");
printf("sctp_peeloff: sd=%d assoc_id=%d\n", sd, assoc_id);
exit(1);
//exit(1);
exit_fun("sctp_handle_new_association_req_multi fatal: sctp_peeloff error");
}
sctp_cnx = calloc(1, sizeof(*sctp_cnx));
......
......@@ -236,7 +236,8 @@ void trx_brf_end(openair0_device *device) {
fprintf(stderr, "Failed to disable TX module: %s\n", bladerf_strerror(status));
}
bladerf_close(brf->dev);
exit(1);
//exit(1);
exit_fun("trx_brf_end exiting." );
}
/*! \brief print the BladeRF statistics
......
......@@ -698,7 +698,8 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
free(ms_sample);
ms_sample = NULL;
iqfd = 0;
exit(-1);
//exit(-1);
exit_fun("USRP read failure");
}
if (cur_samples < nb_samples) {
......@@ -804,7 +805,8 @@ int trx_usrp_set_gains(openair0_device *device,
if (openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] > gain_range.stop()) {
LOG_E(PHY,"RX Gain 0 too high, reduce by %f dB\n",
openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] - gain_range.stop());
exit(-1);
//exit(-1);
exit_fun("fatal: RX Gain 0 too high" );
}
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
......@@ -1381,7 +1383,8 @@ extern "C" {
if (s->use_gps == 1) {
if (sync_to_gps(device)) {
LOG_I(PHY,"USRP fails to sync with GPS...\n");
exit(0);
//exit(0);
exit_fun("fatal: USRP fails to sync with GPS..." );
}
}
......@@ -1396,7 +1399,8 @@ extern "C" {
if (ms_sample == NULL) {
std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
exit(-1);
//exit(-1);
exit_fun("fatal: Memory allocation failed for subframe record or replay mode." );
}
memset(ms_sample, 0, u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
......@@ -1420,16 +1424,19 @@ extern "C" {
if (aligned == 0) {
std::cerr<< "mmap address is not 32 bytes aligned, exiting." << std::endl;
close(mmapfd);
exit(-1);
//exit(-1);
exit_fun("fatal: mmap address is not 32 bytes aligned, exiting." );
}
} else {
std::cerr << "Cannot mmap file, exiting." << std::endl;
close(mmapfd);
exit(-1);
//exit(-1);
exit_fun("fatal: Cannot mmap file, exiting." );
}
} else {
std::cerr << "Cannot open " << u_sf_filename << " , exiting." << std::endl;
exit(-1);
//exit(-1);
exit_fun("fatal: open error , exiting." );
}
} else {
iqfd = open(u_sf_filename, O_RDONLY | O_LARGEFILE);
......@@ -1445,7 +1452,8 @@ extern "C" {
if (ms_sample == NULL) {
std::cerr<< "Memory allocation failed for individual subframe replay mode." << std::endl;
close(iqfd);
exit(-1);
//exit(-1);
exit_fun("fatal: Memory allocation failed for individual subframe replay mode." );
}
memset(ms_sample, 0, sizeof(iqrec_t));
......@@ -1458,7 +1466,8 @@ extern "C" {
}
} else {
std::cerr << "Cannot open " << u_sf_filename << " , exiting." << std::endl;
exit(-1);
//exit(-1);
exit_fun("fatal: open error , exiting." );
}
}
}
......
......@@ -1200,7 +1200,8 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF) {
if (!eNB->dlsch[i][j]) {
LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
exit(-1);
//exit(-1);
exit_fun("Can't get eNB dlsch structures" );
} else {
eNB->dlsch[i][j]->rnti=0;
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
......@@ -1212,7 +1213,8 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF) {
if (!eNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
//exit(-1);
exit_fun("Can't get eNB ulsch structures" );
}
// this is the transmission mode for the signalling channels
......@@ -1225,7 +1227,8 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF) {
if (!eNB->ulsch[0]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
//exit(-1);
exit_fun("Can't get eNB ulsch structures" );
}
eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp);
......
......@@ -1661,7 +1661,8 @@ void *ru_thread( void *param ) {
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize RU Buffers" );
}
LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
......@@ -1685,7 +1686,8 @@ void *ru_thread( void *param ) {
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize RU Buffers" );
}
AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret);
RC.ru_mask &= ~(1<<ru->idx);
......@@ -1955,7 +1957,8 @@ void *ru_thread_synch(void *arg) {
LOG_M("ru_sync_corr.m","sync_corr",ru->dmrs_corr,LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,6);
LOG_M("ru_dmrs.m","rudmrs",&ru->dmrssync[0],fp->ofdm_symbol_size,1,1);
exit(-1);
//exit(-1);
exit_fun("Exiting, Cannot find synch reference" );
}
}
} // ru->in_synch==0
......@@ -2318,7 +2321,8 @@ void init_RU_proc(RU_t *ru) {
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize RU Buffers" );
}
}
......@@ -2528,7 +2532,8 @@ void set_function_spec_param(RU_t *ru) {
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize transport protocol" );
}
} else if (ru->function == NGFI_RRU_IF4p5) {
ru->do_prach = 1; // do part of prach processing in RU
......@@ -2552,7 +2557,8 @@ void set_function_spec_param(RU_t *ru) {
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize transport protocol" );
}
malloc_IF4p5_buffer(ru);
......@@ -2611,7 +2617,8 @@ void set_function_spec_param(RU_t *ru) {
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize transport protocol" );
}
break;
......@@ -2637,7 +2644,8 @@ void set_function_spec_param(RU_t *ru) {
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize transport protocol" );
}
malloc_IF4p5_buffer(ru);
break;
......
......@@ -543,7 +543,8 @@ int main( int argc, char **argv ) {
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
exit(-1);
//exit(-1);
exit_fun("Getting configuration failed" );
}
#if T_TRACER
......@@ -598,7 +599,8 @@ int main( int argc, char **argv ) {
if (create_tasks(1) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1);
//exit(-1);
exit_fun("cannot create ITTI tasks" );
}
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) {
......
......@@ -285,7 +285,8 @@ void thread_top_init(char *thread_name,
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n");
fprintf(stderr,"sched_setattr Error = %s",strerror(errno));
exit(1);
//exit(1);
exit_fun("eNB tx thread: sched_setattr failed" );
}
#else //LOW_LATENCY
......
......@@ -598,7 +598,8 @@ void* ru_thread_control( void* param ) {
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize RU Buffers" );
}
// send CONFIG_OK
......@@ -621,7 +622,8 @@ void* ru_thread_control( void* param ) {
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
//exit(-1);
exit_fun("Exiting, cannot initialize RU Buffers" );
}
// Set state to RUN for Master RU, Others on SYNC
......
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