If ioq3ded is run with stdin not being a tty, it loops soon after printing "stdin is not a tty, tty console mode disabled". strace shows repeated recvfrom() calls, with result being EAGAIN. The problem disappears if +map is added to command line.
Test case:
ioq3ded < /dev/null
Platform:
x86_64 Gentoo Linux
Comment 1Guillaume Bougard
2009-11-19 11:22:45 EST
Created attachment 2205[details]
Working work-around + fix com_speeds output on dedicated server
You made me curious even if that case isn't so important.
I found 2 problems.
Firstly, when STDIN is /dev/null, a select on it returns immediately. So in Com_Frame(), Com_Event_Loop() checks are returning after no event found giving many times in the same ms. So it mostly results with a 0ms delay and then will loop checking for new event. Then Com_Event_Loop() will be called as most as possible during 1 ms.
I tried to force a Sys_Sleep() in the loop, but that did nothing... And I found in fact, on Unix, Sys_Sleep() is based on waiting event on STDIN with a timeout. When STDIN is /dev/null, as I said, it returns immediately... So Sys_Sleep() is not useable when stdin is set to /dev/null.
I finally found a way to fix that case when console is disabled using "nanosleep" calls only when console is disabled. It is working on my linux x86_64 system (Fedora 11). I attached the patch. I don't think it is the best, so feel free to enhance it.
Also, I saw com_speeds usage is providing wrong output on dedicated server. The patch contains also a fix for this minor case.
Created attachment 2205 [details] Working work-around + fix com_speeds output on dedicated server You made me curious even if that case isn't so important. I found 2 problems. Firstly, when STDIN is /dev/null, a select on it returns immediately. So in Com_Frame(), Com_Event_Loop() checks are returning after no event found giving many times in the same ms. So it mostly results with a 0ms delay and then will loop checking for new event. Then Com_Event_Loop() will be called as most as possible during 1 ms. I tried to force a Sys_Sleep() in the loop, but that did nothing... And I found in fact, on Unix, Sys_Sleep() is based on waiting event on STDIN with a timeout. When STDIN is /dev/null, as I said, it returns immediately... So Sys_Sleep() is not useable when stdin is set to /dev/null. I finally found a way to fix that case when console is disabled using "nanosleep" calls only when console is disabled. It is working on my linux x86_64 system (Fedora 11). I attached the patch. I don't think it is the best, so feel free to enhance it. Also, I saw com_speeds usage is providing wrong output on dedicated server. The patch contains also a fix for this minor case.