See the discussion about pthread_atfork(3C) in Solution: pthread_atfork.
int pthread_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void) );
pthread_atfork() returns zero when the call completes successfully. Any other return value indicates that an error occurred. When the following condition occurs, pthread_atfork() fails and returns the corresponding value.
ENOMEM
Description:Insufficient table space exists to record the fork handler addresses.