CVSROOT:        /cvs
Module name:    ports
Changes by:     aw...@cvs.openbsd.org   2020/07/09 15:10:21

Modified files:
        games/yquake2  : Makefile 
        games/yquake2/pkg: q2ded.rc 

Log message:
Fix CPU spin in games/yquake2 dedicated server

OK fcambus@

Initial diff by Tom Murphy who also helped debugging later iterations.
Thanks!

When daemonized as soon as STDIN goes away q2ded detects that and stops
waiting for input, this causes a CPU spin loop generating high server
loads by frequent calls to clock_gettime.

By adding daemon_flags to the rc.d script we flip the busywait flag
which causes q2ded to use a mechanism based on nanosleep that is
significantly lighter on load and has no noticeable impact on
performance for players.

While here we also set the dedicated flag as there is no point to run
the dedicated server outside of debugging without it.

This diff is tweaked compared to ports@ with gamedir being removed. This
final change has been OK'ed off list also by fcambus@.

The reasoning for that final change is as follows:

We do not need gamedir/datadir as we already set SYSTEMWIDE and
SYSTEMDIR during compilation. This solves pointing the game at the pak
files. Normally however we would still need to cd into the game
directory for dlopen to properly load renderers and game.so.

Upstream however has a backwards compatibility mechanism for game.so (so
older mods work) where all paths where game files are stored is searched
for game.so dlopen.  This includes SYSTEMDIR and that makes q2ded work
without having to cd into the binary directory. Since the server itself
does not need to load any renderers that is enough to have a fully
functioning q2ded.

Reply via email to