Expose the per-thread errno variable
This commit is contained in:
parent
7bc8169ff2
commit
9219d330e9
@ -2,6 +2,11 @@
|
||||
#ifndef __ERRNO_H__
|
||||
#define __ERRNO_H__
|
||||
|
||||
#ifndef _KERNEL
|
||||
int *__error();
|
||||
#define errno (* __error())
|
||||
#endif
|
||||
|
||||
#define EIO 0x1BAD0001
|
||||
#define EBADF 0x1BAD0002
|
||||
#define EINVAL 0x1BAD0003
|
||||
|
@ -20,7 +20,7 @@ struct pthread_attr {
|
||||
|
||||
struct pthread {
|
||||
uint64_t tid;
|
||||
int errno;
|
||||
int error; // errno
|
||||
TAILQ_ENTRY(pthread) threadTable;
|
||||
|
||||
// Initialization
|
||||
@ -41,6 +41,14 @@ typedef TAILQ_HEAD(pthreadList, pthread) pthreadList;
|
||||
static CoreMutex __threadTableLock;
|
||||
static pthreadList __threads[THREAD_HASH_SLOTS];
|
||||
|
||||
int *
|
||||
__error(void)
|
||||
{
|
||||
struct pthread *pth = pthread_self();
|
||||
|
||||
return &(pth->error);
|
||||
}
|
||||
|
||||
void
|
||||
__pthread_init(void)
|
||||
{
|
||||
@ -56,6 +64,7 @@ __pthread_init(void)
|
||||
}
|
||||
|
||||
thr->tid = OSGetTID();
|
||||
thr->error = 0;
|
||||
thr->entry = NULL;
|
||||
thr->arg = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user