PatchworkOS  19e446b
A non-POSIX operating system.
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 = thread_current();
17 if (thread == NULL)
18 {
19 return &garbage;
20 }
21
22 return &thread->error;
23#else
24 return &_THREAD_SELF->self->err;
25#endif
26}
int * _errno_get(void)
Definition errno.c:11
static thread_t * thread_current(void)
Retrieves the currently running thread.
Definition thread.h:126
#define _THREAD_SELF
Definition threading.h:53
#define NULL
Pointer error value.
Definition NULL.h:25
Thread of execution structure.
Definition thread.h:61
errno_t error
Definition thread.h:72