xref: /haiku/src/system/libroot/posix/errno.c (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /*
2 ** Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 
6 /* Provides user space storage for "errno", located in TLS
7  */
8 
9 #include <errno.h>
10 
11 #include "support/TLS.h"
12 #include "tls.h"
13 
14 
15 int *
16 _errnop(void)
17 {
18 	return (int *)tls_address(TLS_ERRNO_SLOT);
19 }
20 
21 
22 // This is part of the Linuxbase binary specification
23 // and is referenced by some code in libgcc.a.
24 // ToDo: maybe we even want to include this always
25 #ifdef __linux__
26 extern int *(*__errno_location)(void) __attribute__ ((weak, alias("_errnop")));
27 #endif
28 
29