Really fix gathering pid list on mac os x. #3725

When sysctl() fails on mac os x due to the buffer being too small, retry
several times. The previous attempt at this fix assumed that sysctl()
returns -1 and sets errno=ENOMEM in this situation (as the man page
says). In reality, it returns 0 and sets the oldlenp pointer parameter
to 0.