aboutsummaryrefslogtreecommitdiff
path: root/include/odp/api/spec/errno.h
blob: 85c002e2bdaa9f34b823978ee30a8e617781d536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright (c) 2015-2018 Linaro Limited
 */

/**
 * @file
 *
 * ODP errno API
 */

#ifndef ODP_API_SPEC_ERRNO_H_
#define ODP_API_SPEC_ERRNO_H_
#include <odp/visibility_begin.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @defgroup odp_errno ODP ERRNO
 * Error number.
 *
 * @details
 * <b> ODP errno </b>
 *
 * ODP errno (error number) is a thread local variable that any ODP function may
 * set on a failure. It expresses additional information about the cause of
 * the latest failure. A successful function call never sets errno. Application
 * may initialize errno to zero at anytime by calling odp_errno_zero(). Other
 * ODP functions never set errno to zero. Valid errno values are non-zero
 * and implementation specific. It's also implementation specific which
 * functions set errno. ODP errno is initially zero.
 *
 *  @{
 */

/**
* Latest ODP errno
*
* Returns the current ODP errno value on the calling thread. A non-zero value
* indicates cause of the latest errno setting failure.
*
* @return Latest ODP errno value
* @retval 0    Errno has not been set since the last initialization to zero
*/
int odp_errno(void);

/**
* Set ODP errno to zero
*
* Sets errno value to zero on the calling thread.
*/
void odp_errno_zero(void);

/**
* Print ODP errno
*
* Interprets the value of ODP errno as an error message, and prints it,
* optionally preceding it with the custom message specified in str.
*
* @param str   Pointer to the string to be appended, or NULL
*/
void odp_errno_print(const char *str);

/**
* Error message string
*
* Interprets the value of ODP errno, generating a string with a message that
* describes the error. Errno values and messages are implementation specific.
*
* @param errnum	 ODP errno value
*
* @retval Pointer to the error message string
*/
const char *odp_errno_str(int errnum);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#include <odp/visibility_end.h>
#endif