* KJ Tsanaktsidis <ktsanaktsidis@xxxxxxxxxxx>, 2018-08-17, 23:50:
The clone(2) syscall (and consequently pthread_create(3)) can return the error ENOSPC when there are no more available PIDs on the system because the limit in /proc/sys/kernel/pid_max has been exceeded.
I reproduced this on Linux 4.17. As one would expect, this happens also with fork(2).
This seems to contradict the fork(2) man page, which says that EAGAIN is returned when “the maximum number of PIDs, /proc/sys/kernel/pid_max, was reached”.
-- Jakub Wilk