posix: pthread: implement pthread_atfork()

pthread_atfork() is required by the POSIX_THREADS_BASE
Option Group as detailed in Section E.1 of IEEE-1003.1-2017.

The POSIX_THREADS_BASE Option Group is required for PSE51,
PSE52, PSE53, and PSE54 conformance, and is otherwise
mandatory for any POSIX conforming system as per Section
A.2.1.3 of IEEE-1003-1.2017.

Since Zephyr does not yet support processes and (by extension)
fork(), this implementation includes a deviation and should be
categorized as producing undefined behaviour.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
Christopher Friedt 2023-11-22 21:29:00 -05:00 committed by Chris Friedt
parent 3b45235887
commit a0c307c0a5
2 changed files with 10 additions and 0 deletions

View file

@ -473,6 +473,7 @@ int pthread_key_create(pthread_key_t *key,
int pthread_key_delete(pthread_key_t key);
int pthread_setspecific(pthread_key_t key, const void *value);
void *pthread_getspecific(pthread_key_t key);
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
/* Glibc / Oracle Extension Functions */

View file

@ -954,6 +954,15 @@ int pthread_getname_np(pthread_t thread, char *name, size_t len)
#endif
}
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
ARG_UNUSED(prepare);
ARG_UNUSED(parent);
ARG_UNUSED(child);
return ENOSYS;
}
static int posix_thread_pool_init(void)
{
size_t i;