[Xastir-dev] PID_FILE_CHECK patch to main.c

Dan Brown brown at brauhaus.org
Tue Mar 8 16:19:18 EST 2005


On Tue, 8 Mar 2005, Curt, WE7U wrote:

> On Tue, 8 Mar 2005, Curt, WE7U wrote:
> 
> > It definitely prevents more than one copy per user of Xastir from
> > running.
> >
> > Does someone want to test it on Cygwin?  If it works well there
> > also, we'll get it checked in to CVS and make it the default.
> 
> Ah heck, I'll check it into CVS as it stands now.  It's not enabled
> by default.  That'll let more people do testing.  Once we know it
> works on all/most systems, it can become a default.

I did a quick compile and test on Cygwin, before I sent it. 

My tests, on RH9, MacOS-X and cygwin were: 

- Does it build/install

- Does it startup and create the xastir.pid

- Does it prevent a 2nd instance startup with one running

- Does it check for the other process and carry on if it finds the
    xastir.pid file, but the other proc doesn't respond to the kill 0 signal


For the last test, I simply copied the xastir.pid to a temp file, while the
process was running, then quit xastir, then moved the .pid tmp file back,
then restarted it and watched the debug.  Took a few tries to get it right. 
It didn't want to clean up the old file, even though fopen( ..., "w")
should truncate. 
   
> Then again, if it were the default in its present state some people
> that run multiple Xastirs as a single user might get a little peeved

Do many people do this? Without corrupting files? 

> when they can't do it anymore.  That's even though we'd be
> protecting them from themselves (protecting their files from getting
> corrupted).
> 
> Once the rest of the things get implemented that we talked about,
> running multiple instances won't be a problem.

Next incremental step might be just to add a command line option to specify
alternate config file dirs...  though, as has been noted, that quickly
opens the can of worms of having to check to see who's using every
port/device/etc, etc. 



--
Dan Brown 
brown at brauhausdc.org




More information about the Xastir-dev mailing list