Incorporate more small improvements

This commit is contained in:
Justine Tunney 2023-07-23 10:57:18 -07:00
parent 1d4eb08fa1
commit f83eb440f7
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
20 changed files with 121 additions and 256 deletions

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/errno.h"
#include "libc/thread/tls.h"
/**
* Global variable for last error.
@ -31,3 +32,14 @@
* @see __errno_location() stable abi
*/
errno_t __errno;
/**
* Returns address of `errno` variable.
*/
errno_t *__errno_location(void) {
if (__tls_enabled) {
return &__get_tls()->tib_errno;
} else {
return &__errno;
}
}