Files
lk/lib/libc/errno.c
Matt Schulte e51cf68c3c [lib][libc] Make errno thread safe using TLS APIs
Before this change, errno was "completely un-threadsafe" as the comment
states.

This changes errno to be threadsafe by making errno a thread local
variable.
2025-07-10 15:37:43 -07:00

16 lines
318 B
C

/*
* Copyright (c) 2015 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <errno.h>
#include <kernel/thread.h>
int *__geterrno(void) {
return (int*)tls_get(TLS_ENTRY_ERRNO);
}