aboutsummaryrefslogtreecommitdiffstats
path: root/consts.c
blob: 567a6e7a64fd6bfa82efe704dbe6dd3424b28138 (plain) (blame)
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
/* See LICENSE file for copyright and license details. */
#include "common.h"


const char *
get_errno_name(int err)
{
	static char buf[3 * sizeof(err) + 2];

#define X(N) if (err == N) return #N;
	LIST_ERRNOS(X)
#ifdef ALSO_ERESTARTSYS
	X(ERESTARTSYS)
#endif
#ifdef ALSO_ERESTARTNOINTR
	X(ERESTARTNOINTR)
#endif
#ifdef ALSO_ERESTARTNOHAND
	X(ERESTARTNOHAND)
#endif
#ifdef ALSO_ERESTART_RESTARTBLOCK
	X(ERESTART_RESTARTBLOCK)
#endif
#undef X

	sprintf(buf, "%i", err);
	return buf;
}