Changed to account for libio's maximum_semaphores as well as its memory requirements.
Also added variable to tell libio how many file descriptors to allocate.