posix: implement pthread_getguardsize() pthread_setguardsize()

Implement pthread_getguardsize() and pthread_setguardsize().

pthread_getguardsize() and pthread_setguardsize() are required
by the POSIX_THREADS_EXT Option Group as detailed in Section
E.1 of IEEE-1003.1-2017. However, they were formerly part of
XSI_THREADS_EXT.

The XSI_THREADS_EXT Option Group was required for PSE51, PSE52,
PSE53, and PSE54 conformance.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
Christopher Friedt 2023-12-13 20:10:17 -05:00 committed by Fabio Baltieri
commit a7d2c5cb32
4 changed files with 59 additions and 2 deletions

View file

@ -27,4 +27,17 @@ config PTHREAD_RECYCLER_DELAY_MS
Note: this option should be considered temporary and will likely be
removed once a more synchronous solution is available.
config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT
int "Default size of stack guard area"
range 0 65536
default 0
help
This is the default amount of space to reserve at the overflow end of a
pthread stack. Since Zephyr already supports both software-based stack
protection (canaries) and hardware-based stack protection (MMU or MPU),
this is set to 0 by default. However, a conforming application would be
required to set this to PAGESIZE. Eventually, this option might
facilitate a more dynamic approach to guard areas (via software or
hardware) but for now it simply increases the size of thread stacks.
endif