1# Copyright (c) 2023 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4config COMMON_LIBC_ABORT
5	bool
6	help
7	  common implementation of abort().
8
9config COMMON_LIBC_ASCTIME
10	bool
11	help
12	  common implementation of asctime().
13
14config COMMON_LIBC_ASCTIME_R
15	bool "Thread-safe version of asctime()"
16	select COMMON_LIBC_ASCTIME
17	help
18	  common implementation of asctime_r().
19
20config COMMON_LIBC_CTIME
21	bool
22	select COMMON_LIBC_LOCALTIME_R_UTC
23	help
24	  common implementation of ctime().
25
26config COMMON_LIBC_CTIME_R
27	bool "Thread-safe version of ctime()"
28	select COMMON_LIBC_CTIME
29	help
30	  common implementation of ctime_r().
31
32config COMMON_LIBC_GMTIME_R
33	bool
34	help
35	  common implementation of gmtime_r().
36
37config COMMON_LIBC_LOCALTIME_R_UTC
38	bool
39	select COMMON_LIBC_GMTIME_R
40	help
41	  Simple implementation of localtime() & localtime_r().
42	  This option just wraps around the gmtime(), the result is always expressed as
43	  Coordinated Universal Time (UTC).
44
45config COMMON_LIBC_TIME
46	bool
47	help
48	  common implementation of time().
49
50config COMMON_LIBC_MALLOC
51	bool "Common C library malloc implementation"
52	select NEED_LIBC_MEM_PARTITION if COMMON_LIBC_MALLOC_ARENA_SIZE != 0
53	help
54	  Common implementation of malloc family that uses the kernel heap
55	  API.
56
57config COMMON_LIBC_MALLOC_ARENA_SIZE
58	int "Size of the common C library malloc arena"
59	depends on COMMON_LIBC_MALLOC
60	default 0 if MINIMAL_LIBC
61	default 16384 if MMU
62	default 2048 if USERSPACE && MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
63	default 16384 if ARCH_POSIX
64	default -1
65	help
66	  Indicate the size in bytes of the memory arena used for
67	  common C library malloc() implementation.
68
69	  If set to zero, then no malloc() heap will be available.
70
71	  If set to -1, then all remaining system RAM will be used for this
72	  area.
73
74	  If user mode is enabled, and MPU hardware has requirements that
75	  regions be sized to a power of two and aligned to their size,
76	  then this must be defined as a power of two or a compile error
77	  will result.
78
79	  When using the minimal C library, the default is to have no
80	  malloc heap. Otherwise, on systems with an MMU the default is
81	  16kB and all other systems will default to using all remaining
82	  ram for the malloc heap.
83
84config COMMON_LIBC_CALLOC
85	bool "Common C library calloc"
86	depends on COMMON_LIBC_MALLOC
87	default n if MINIMAL_LIBC
88	default y
89	help
90	  Enable the common C library trivial implementation of calloc,
91	  which forwards to malloc and memset.
92
93config COMMON_LIBC_REALLOCARRAY
94	bool "Common C library reallocarray"
95	depends on COMMON_LIBC_MALLOC
96	default n if MINIMAL_LIBC
97	default y
98	help
99	  Enable the common C library trivial implementation of
100	  reallocarray, which forwards to realloc.
101
102config COMMON_LIBC_STRNLEN
103	bool
104	help
105	  common implementation of strnlen().
106
107config COMMON_LIBC_THRD
108	bool "C11 <threads.h> API support"
109	depends on DYNAMIC_THREAD
110	# Note: the POSIX_API dependency is only necessary until common elements
111	# of C11 threads and POSIX API can be abstracted out to a common library.
112	depends on POSIX_API
113	default y
114	help
115	  Common implementation of C11 <threads.h> API.
116
117config COMMON_LIBC_REMOVE
118	bool "Common C library remove"
119	depends on !SEMIHOST
120	default y if FILE_SYSTEM
121	help
122	  Common implementation of remove().
123