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 RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n" 40 " Cause: ", exit_code); 41 42 va_start(ap, format); 43 rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap); 44 va_end(ap); 45 46 if (rte_eal_cleanup() != 0 && rte_errno != EALREADY) 47 EAL_LOG(CRIT, 48 "EAL could not release all resources"); 49 exit(exit_code); 50 } 51