This part implements the periodic services. The steps taken are straightforward: After setting up various things, the endless loop is entered (while(1)). This will give an outline on the normal case (using select()), the other case is essentially the same.
if( mount_table_size <= already_mounted) checks if all known devices are already mounted. If so, the select call is set up for endless sleep, as this state can only change via data arriving from a client (tt eject or volcheck) or when SIGHUP is received. Either will cause select to return.
When SIGHUP is received, rereadinit_flag is set by the signal handler. This condition is checked now. When set, the initialization file is read once again.
The next thing is to check the fifo for data. This step is skipped if select did not return because data arrived at the fifo. After processing the client requests (in function check_fifo()), the mount count is adjusted.
After this that mount table is scanned and every device that's poll flag is set to YES will receive its mount try. When checkrequest is set, the setting of the poll flag is ignored. Note that there is are two possibilities for the device status that will prevent a mount call: The device is already mounted (mounted is set to YES) or an unrecoverable error accurred during an earlier mount call (mounted set to ERROR). The structure used for the entries in the mount table (struct mount_entry) is defined in typedef.h.
After this, the checkrequest flag is reset and the loop starts over.