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 __rte_panic(const char *funcname, const char *format, ...) 18 { 19 va_list ap; 20 21 EAL_LOG(CRIT, "PANIC in %s():", funcname); 22 va_start(ap, format); 23 rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 24 va_end(ap); 25 rte_dump_stack(); 26 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 rte_exit(int exit_code, const char *format, ...) 35 { 36 va_list ap; 37 38 if (exit_code != 0) 39 EAL_LOG(CRIT, "Error - exiting with code: %d", exit_code); 40 41 va_start(ap, format); 42 rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 43 va_end(ap); 44 45 if (rte_eal_cleanup() != 0 && rte_errno != EALREADY) 46 EAL_LOG(CRIT, "EAL could not release all resources"); 47 exit(exit_code); 48 } 49