From 3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 11 Jul 2026 22:48:30 +0800 Subject: lib: establish Zircon libc++ and KTL foundation --- lib/libc/include/stdlib.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lib/libc/include/stdlib.h (limited to 'lib/libc/include/stdlib.h') diff --git a/lib/libc/include/stdlib.h b/lib/libc/include/stdlib.h new file mode 100644 index 0000000..45c5a21 --- /dev/null +++ b/lib/libc/include/stdlib.h @@ -0,0 +1,36 @@ +// Copyright 2016 The Fuchsia Authors +// Copyright (c) 2008-2014 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 + +#ifndef ZIRCON_KERNEL_LIB_LIBC_INCLUDE_STDLIB_H_ +#define ZIRCON_KERNEL_LIB_LIBC_INCLUDE_STDLIB_H_ + +#include +#include +#include + +#ifdef _KERNEL +#include // lib/heap provides malloc/free definitions. +#endif + +__BEGIN_CDECLS + +long strtol(const char *nptr, char **endptr, int base); +unsigned long int strtoul(const char *nptr, char **endptr, int base); + +void abort(void) __attribute__((noreturn)); + +#define RAND_MAX (0x7fffffff) + +int rand(void); +void srand(unsigned int seed); + +// Note: POSIX.1 specifies unsigned int, but we use uintptr_t instead. +int rand_r(uintptr_t *seed); + +__END_CDECLS + +#endif // ZIRCON_KERNEL_LIB_LIBC_INCLUDE_STDLIB_H_ -- cgit v1.2.3