Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] backgrounding civserver causes weird problems
Home

Re: [Freeciv-Dev] backgrounding civserver causes weird problems

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gary Moyer <garymoyer@xxxxxxxx>
Cc: "freeciv-dev@xxxxxxxxxxx" <freeciv-dev@xxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] backgrounding civserver causes weird problems
From: Greg Wooledge <wooledge@xxxxxxxxxxx>
Date: Mon, 23 Aug 1999 21:33:40 -0400

Gary Moyer (garymoyer@xxxxxxxx) wrote:

> I've noticed that if the server is backgrounded (and nohup'd) the server
> hangs the next time input occurs on the same tty on which the game was
> started.

> I looked at sniff_packets() and it adds descriptor 0 to the file
> descriptor set which is used by select().  Isn't there a programatic way
> of determining if the process has been nohup'd and essentially not
> adding this descriptor to the descriptor set for use by select()?

You can check to see whether signal 1 is being handled by the default
signal handler (process death), but what you really want to know is
whether the process is running in the background.

As far as I know, there's no way to do this.  (Corrections are welcome.)

It would probably make more sense to add a command-line switch to the
server which omits 0 from the select() list, for background running.
You could even make the server put itself in the background when this
switch is specified, making the "nohup" and "&" unnecessary -- much like
a traditional Unix daemon.

-- 
Greg Wooledge                    | Distributed.NET http://www.distributed.net/
wooledge@xxxxxxxxxxx             | because a CPU is a terrible thing to waste.
http://www.kellnet.com/wooledge/ |

[Prev in Thread] Current Thread [Next in Thread]