genode/repos/libports/src/lib/libc/errno.cc
Sebastian Sumpf 9c372c36c1 libc: thread local errno support
Store errno in pthread objects, return member upon call to '__error()'.
This became necessary in order to make errno thread-safe.

Note, any call to libc code from a non-pthread (beside the first
entrypoint) is not supported.

issue #3568
2019-12-19 17:01:42 +01:00

22 lines
431 B
C++

/*
* \brief C-library back end
* \author Norman Feske
* \date 2008-11-11
*
* Note: this version not thread safe
*/
/*
* Copyright (C) 2008-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <internal/pthread.h>
extern "C" int *__error(void)
{
return &pthread_self()->thread_local_errno;
}