aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_errno.c
blob: 71fc2da77610de2d7211f31f466c29bd305b2ab3 (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
/* Copyright (c) 2015-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:	BSD-3-Clause
 */

#include <odp/api/errno.h>
#include <string.h>
#include <stdio.h>
#include <odp_debug_internal.h>

__thread int _odp_errno;

int odp_errno(void)
{
	return _odp_errno;
}

void odp_errno_zero(void)
{
	_odp_errno = 0;
}

void odp_errno_print(const char *str)
{
	if (str != NULL)
		ODP_PRINT("%s %s\n", str, strerror(_odp_errno));
	else
		ODP_PRINT("%s\n", strerror(_odp_errno));
}

const char *odp_errno_str(int errnum)
{
	return strerror(errnum);
}