History log of /haiku/headers/private/kernel/stdlib.h
Revision Date Author Comments
# 3fb09297 24-Jun-2023 Niels Sascha Reedijk <niels.reedijk@gmail.com>

kernel: provide kernel-level equivalents for math.h and stdlib.h

GCC 13 is more strict about what C++ features are available in a freestanding
(= build without standard library) build. The `stdlib.h` and `math.h` headers
are redefined as part of libstdc++. If the object is built as freestanding, it
should be assumed that none of the standard library functions are available.

The solution in Haiku has been to add part of the standard library into the
kernel shared object. The method of exposing them has been to allow the
use of `stdlib.h` and `math.h` in the kernel and in kernel add-ons.

This change allows that approach to continue. What it does, is that it defines
specific headers which will be picked up when a module is built using private
kernel headers. When building for the kernel (or for the boot module), it will
bypass GCC 13's libstdc++ default behaviour of not including the POSIX/platform
header with all the function definitions.

An alternative to be considered for the longer term is to specifically define
the parts of the C/C++ standard library that is available in the kernel in
these headers, or create custom headers when building kernel modules (which is
how Linux approaches it).

Change-Id: Icab4614f642219fa77732b02401570708ee9a963
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6645
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 2917ddc323484867df748335880165dc8969ad4d 25-Oct-2002 Daniel Reinhold <danielre@nowhere.fake>

replaced stdlib.h in 'headers/private/kernel' with a better one in the more standard location 'headers/posix'


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cedc441e4a5f624cdfb573e6cd47eaef8377cd09 20-Aug-2002 Axel Dörfler <axeld@pinc-software.de>

Added the realpath() prototype.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96