PatchworkOS
Loading...
Searching...
No Matches
errno.c
Go to the documentation of this file.
1#include <errno.h>
2
3#ifdef __KERNEL__
6#else
8#include <sys/proc.h>
9#endif
10
11int* _errno_get(void)
12{
13 static int garbage;
14
15#ifdef __KERNEL__
16 thread_t* thread = sched_thread();
17 if (thread == NULL)
18 {
19 return &garbage;
20 }
21
22 return &thread->error;
23#else
24 _thread_t* thread = _thread_get(gettid());
25 if (thread == NULL)
26 {
27 return &garbage;
28 }
29 return &thread->err;
30#endif
31}
int * _errno_get(void)
Definition errno.c:11
thread_t * sched_thread(void)
Retrieves the currently running thread.
Definition sched.c:157
tid_t gettid(void)
System call to retrieve the current tid.
Definition gettid.c:6
#define NULL
Pointer error value.
Definition NULL.h:23
_thread_t * _thread_get(tid_t id)
Definition thread.c:72
Thread of execution structure.
Definition thread.h:55
errno_t error
Definition thread.h:67