Moved the errnop() function to the new TLS stuff.

We now have a separate errnop() for the kernel, which just references
a field in the thread structure.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-01-07 09:08:44 +00:00
parent 2d6ab447f9
commit ccfdaba3e9
3 changed files with 37 additions and 8 deletions

View File

@ -13,8 +13,13 @@ KernelMergeObject posix_main.o :
-fPIC -DPIC
;
# extra kernel objects needed
KernelObjects
<$(SOURCE_GRIST)>kerrno.c
;
MergeObjectFromObjects kernel_posix_main.o :
<$(SOURCE_GRIST)>errno.o
<$(SOURCE_GRIST)>kerrno.o
<$(SOURCE_GRIST)>poll.o
<$(SOURCE_GRIST)>utime.o
;

View File

@ -1,17 +1,20 @@
/* errno.c
*
* Simple file to get errno defined!!
/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
/* Provides user space storage for "errno", located in TLS
*/
#include <errno.h>
/* XXX - Fix this once TLS works */
#include "support/TLS.h"
#include "tls.h"
static int errno_storage;
int*
int *
_errnop(void)
{
return &errno_storage;
return (int *)tls_address(TLS_ERRNO_SLOT);
}

View File

@ -0,0 +1,21 @@
/*
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
/* Kernel space storage for "errno", located in the thread structure
* (user "errno" can't be changed from kernel internal POSIX calls)
*/
#include <errno.h>
#include "thread.h"
int *
_errnop(void)
{
struct thread *thread = thread_get_current_thread();
return &thread->kernel_errno;
}