1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 /** 6 * @file 7 * 8 * API for error cause tracking 9 */ 10 11 #ifndef _RTE_ERRNO_H_ 12 #define _RTE_ERRNO_H_ 13 14 #include <rte_per_lcore.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 RTE_DECLARE_PER_LCORE(int, _rte_errno); /**< Per core error number. */ 21 22 /** 23 * Error number value, stored per-thread, which can be queried after 24 * calls to certain functions to determine why those functions failed. 25 * 26 * Uses standard values from errno.h wherever possible, with a small number 27 * of additional possible values for RTE-specific conditions. 28 */ 29 #define rte_errno RTE_PER_LCORE(_rte_errno) 30 31 /** 32 * Function which returns a printable string describing a particular 33 * error code. For non-RTE-specific error codes, this function returns 34 * the value from the libc strerror function. 35 * 36 * @param errnum 37 * The error number to be looked up - generally the value of rte_errno 38 * @return 39 * A pointer to a thread-local string containing the text describing 40 * the error. 41 */ 42 const char *rte_strerror(int errnum); 43 44 #ifndef __ELASTERROR 45 /** 46 * Check if we have a defined value for the max system-defined errno values. 47 * if no max defined, start from 1000 to prevent overlap with standard values 48 */ 49 #define __ELASTERROR 1000 50 #endif 51 52 /** Error types */ 53 enum { 54 RTE_MIN_ERRNO = __ELASTERROR, /**< Start numbering above std errno vals */ 55 56 E_RTE_SECONDARY, /**< Operation not allowed in secondary processes */ 57 E_RTE_NO_CONFIG, /**< Missing rte_config */ 58 59 RTE_MAX_ERRNO /**< Max RTE error number */ 60 }; 61 62 #ifdef __cplusplus 63 } 64 #endif 65 66 #endif /* _RTE_ERRNO_H_ */ 67