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_export.h> 15 : : #include "eal_private.h" 16 : : 17 : : RTE_EXPORT_SYMBOL(__rte_panic) 18 : : void 19 : 0 : __rte_panic(const char *funcname, const char *format, ...) 20 : : { 21 : : va_list ap; 22 : : 23 : 0 : EAL_LOG(CRIT, "PANIC in %s():", funcname); 24 : 0 : va_start(ap, format); 25 : 0 : rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 26 : 0 : va_end(ap); 27 : 0 : rte_dump_stack(); 28 : 0 : abort(); /* generate a coredump if enabled */ 29 : : } 30 : : 31 : : /* 32 : : * Like rte_panic this terminates the application. However, no traceback is 33 : : * provided and no core-dump is generated. 34 : : */ 35 : : RTE_EXPORT_SYMBOL(rte_exit) 36 : : void 37 : 5 : rte_exit(int exit_code, const char *format, ...) 38 : : { 39 : : va_list ap; 40 : : 41 [ + + ]: 5 : if (exit_code != 0) 42 : 4 : EAL_LOG(CRIT, "Error - exiting with code: %d", exit_code); 43 : : 44 : 5 : va_start(ap, format); 45 : 5 : rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 46 : 5 : va_end(ap); 47 : : 48 [ - + - - ]: 5 : if (rte_eal_cleanup() != 0 && rte_errno != EALREADY) 49 : 0 : EAL_LOG(CRIT, "EAL could not release all resources"); 50 : 5 : exit(exit_code); 51 : : }