Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2010-2014 Intel Corporation 3 : : */ 4 : : 5 : : #include <stdarg.h> 6 : : #include <stdlib.h> 7 : : #include <errno.h> 8 : : 9 : : #include <rte_eal.h> 10 : : #include <rte_log.h> 11 : : #include <rte_debug.h> 12 : : #include <rte_errno.h> 13 : : 14 : : #include "eal_private.h" 15 : : 16 : : void 17 : 0 : __rte_panic(const char *funcname, const char *format, ...) 18 : : { 19 : : va_list ap; 20 : : 21 : 0 : EAL_LOG(CRIT, "PANIC in %s():", funcname); 22 : 0 : va_start(ap, format); 23 : 0 : rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 24 : 0 : va_end(ap); 25 : 0 : rte_dump_stack(); 26 : 0 : abort(); /* generate a coredump if enabled */ 27 : : } 28 : : 29 : : /* 30 : : * Like rte_panic this terminates the application. However, no traceback is 31 : : * provided and no core-dump is generated. 32 : : */ 33 : : void 34 : 5 : rte_exit(int exit_code, const char *format, ...) 35 : : { 36 : : va_list ap; 37 : : 38 [ + + ]: 5 : if (exit_code != 0) 39 : 4 : EAL_LOG(CRIT, "Error - exiting with code: %d", exit_code); 40 : : 41 : 5 : va_start(ap, format); 42 : 5 : rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 43 : 5 : va_end(ap); 44 : : 45 [ - + - - ]: 5 : if (rte_eal_cleanup() != 0 && rte_errno != EALREADY) 46 : 0 : EAL_LOG(CRIT, "EAL could not release all resources"); 47 : 5 : exit(exit_code); 48 : : }