LibC: Fix errno to work with shared libraries
This commit is contained in:
		
							parent
							
								
									1138ec77ca
								
							
						
					
					
						commit
						0bb44d7b75
					
				|  | @ -4,6 +4,7 @@ set(LIBC_SOURCES | |||
| 	ctype.cpp | ||||
| 	dirent.cpp | ||||
| 	dlfcn.cpp | ||||
| 	errno.cpp | ||||
| 	fcntl.cpp | ||||
| 	ftw.cpp | ||||
| 	grp.cpp | ||||
|  |  | |||
|  | @ -0,0 +1,8 @@ | |||
| #include <errno.h> | ||||
| 
 | ||||
| static int s_errno = 0; | ||||
| 
 | ||||
| int* __errno_location() | ||||
| { | ||||
| 	return &s_errno; | ||||
| } | ||||
|  | @ -93,9 +93,9 @@ __BEGIN_DECLS | |||
| 
 | ||||
| #define EUNKNOWN		0xFF | ||||
| 
 | ||||
| #define errno __errno | ||||
| #define errno (*__errno_location()) | ||||
| 
 | ||||
| extern int __errno; | ||||
| int* __errno_location(void); | ||||
| 
 | ||||
| __END_DECLS | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,8 +8,6 @@ | |||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| int errno = 0; | ||||
| 
 | ||||
| void* memccpy(void* __restrict s1, const void* __restrict s2, int c, size_t n) | ||||
| { | ||||
| 	unsigned char* dst = static_cast<unsigned char*>(s1); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue