Hi,

On Wed, Jun 24, 2020, at 10:57 AM, Tom Murphy wrote:
> Hi,
> 
>   Running q2ded in a tty/tmux window, and then if that tty disappears,
>   q2ded begins spinning the CPU taking up sometimes 97% of the CPU.
>   The process is constantly polling for input, but if the tty is 
>   marked 'bad' in fstat, the program can't cope.
> 
>   Setting 'busywait' variable to 1 allows q2ded to use nanosleep and
>   stop spinning the cpu.
> 

Great find.

>   I've improved the rc script to include the busywait variable and
>   also removed the cd into the shared yquake2 directory since setting
>   +set basedir to that path does the same thing and is cleaner.
> 
>   I've used the following flags for testing:
> 
>   q2ded_flags="+set dedicated 1 +set game holywars +exec server.cfg"
> 
>   It might be worth also hard coding +set dedicated 1 as well in the
>   rc script? What do you think?
> 

I think it makes sense for the rc.d script. If someone wants to run it in the 
foreground
he/she can cd to the game directory manually and execute the binary directly. 
That
is the reason we documented in the commit msg for not providing a q2ded wrapper
like we do for the game executable itself. 

One additional comment inline the diff.

>   Diff is attached.
> 
>   Thanks,
>   Tom
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/yquake2/Makefile,v
> retrieving revision 1.21
> diff -u -p -r1.21 Makefile
> --- Makefile  25 Mar 2020 21:22:59 -0000      1.21
> +++ Makefile  24 Jun 2020 08:49:24 -0000
> @@ -8,7 +8,7 @@ V=            7.43
>  PKGNAME=     ${N}-${V}
>  DISTNAME=    quake2-${V}
>  CATEGORIES=  games
> -REVISION=    0
> +REVISION=    1
>  
>  HOMEPAGE=    https://www.yamagi.org/quake2/
>  MAINTAINER=  Adam Wolk <aw...@openbsd.org>
> Index: pkg/q2ded.rc
> ===================================================================
> RCS file: /cvs/ports/games/yquake2/pkg/q2ded.rc,v
> retrieving revision 1.5
> diff -u -p -r1.5 q2ded.rc
> --- pkg/q2ded.rc      11 Jan 2018 19:27:02 -0000      1.5
> +++ pkg/q2ded.rc      24 Jun 2020 08:49:24 -0000
> @@ -12,7 +12,7 @@ rc_bg=YES
>  rc_reload=NO
>  
>  rc_start() {
> -     ${rcexec} "cd ${TRUEPREFIX}/share/yquake2; ${daemon} ${daemon_flags}"
> +     ${rcexec} "${daemon} +set gamedir ${TRUEPREFIX}/share/yquake2 +set 
> busywait 0 ${daemon_flags}"

I think I don't like having this explicitly added to the command here. That way 
no one
can override those flags even for testing. I think a cleaner solution would be 
to define
daemon_flags and have those as default like we do for ie. postgresql. That way 
people
who want to override them just define their own in rc.conf.local and I think 
it's reasonable
to expect them to understand why they should copy the existing ones. I think 
this
would also allow us to remove the whole rc_start definition.

>  }
>  
>  rc_cmd $1
> 
>

Reply via email to