summaryrefslogtreecommitdiff
path: root/src/errno/__errno.c
blob: 17a9b216896d19aaf3901d791a785229570eeb8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "_perthread.h"
#include "_safety.h"

/*
This version of __errno() is for single-threaded programs and those compiled
with _Thread_local support from C11 or later.

For programs that require per-thread errno without language support (i.e.
using pthreads), there is an identically signatured version of this function
in pthread/__pt_errno.c which uses pthread keys.
*/

int *__errno(void)
{
	THREAD_LOCAL int e = 0;
	SIGNAL_SAFE(1);
        return &e;
}

/*
STDC(0)
*/