PatchworkOS
Loading...
Searching...
No Matches
errno.c
Go to the documentation of this file.
1
#include <
errno.h
>
2
3
#ifdef __KERNEL__
4
#include <
kernel/sched/sched.h
>
5
#include <
kernel/sched/thread.h
>
6
#else
7
#include "
user/common/thread.h
"
8
#include <
sys/proc.h
>
9
#endif
10
11
int
*
_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
}
_errno_get
int * _errno_get(void)
Definition
errno.c:11
errno.h
sched_thread
thread_t * sched_thread(void)
Retrieves the currently running thread.
Definition
sched.c:157
gettid
tid_t gettid(void)
System call to retrieve the current tid.
Definition
gettid.c:6
NULL
#define NULL
Pointer error value.
Definition
NULL.h:23
thread.h
_thread_get
_thread_t * _thread_get(tid_t id)
Definition
thread.c:72
proc.h
sched.h
thread.h
_thread_t
Definition
thread.h:24
thread_t
Thread of execution structure.
Definition
thread.h:55
thread_t::error
errno_t error
Definition
thread.h:67
src
libstd
functions
errno
errno.c
Generated by
1.9.8