Skip to content

Commit fa9f7b7

Browse files
committed
posix: semaphores: use a default minimal heap-add for semaphores
The implementation of POSIX_SEMAPHORES historically used heap allocation and was never transitioned to a pool allocator because it seemed to work fine. However, since 590258b, the default heap-add with CONFIG_POSIX_API has been reduced from 1 kiB which causes tests/posix/semaphores to fail due to NULL being returned from a call to k_calloc(). Create a minimal heap-add for the POSIX_SEMAPHORES Option Group. This can be removed at a future date if semaphores are changed to use a pooled allocator and fixed-size name, rather than heap allocation. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent e41909a commit fa9f7b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/posix/options/Kconfig.semaphore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ config POSIX_SEM_NAMELEN_MAX
3333
Maximum length of name for a named semaphore.
3434
The max value of 255 corresponds to {NAME_MAX}.
3535

36+
config HEAP_MEM_POOL_ADD_SIZE_POSIX_SEMAPHORES
37+
# This seems to be sufficient so that tests/posix/semaphores pass
38+
# with otherwise default configurations. Note: posix semaphores have
39+
# historically been allocated from the heap and no effort has been
40+
# made to convert them to optionally use pooled allocators.
41+
def_int 256
42+
3643
endif # POSIX_SEMAPHORES

0 commit comments

Comments
 (0)