[Installit-dev] "package manager " becomes "InstallIt"

Jannis Pohlmann info at sten-net.de
Thu Sep 8 18:20:43 CEST 2005


Benedikt Meurer schrieb:
> Jannis Pohlmann wrote:
> 
>>>>>>Use kill($PID, 0) rather than /proc/$PID and you're ok. Trust me, it's 
>>>>>>really not worth the trouble with fcntl()/lockf() locking. And we're not 
>>>>>>developing a critical database, so if a user manages to start two 
>>>>>>instances of InstallIt, then he'll run into trouble and may remember to 
>>>>>>read the documentation when he uses a software next time. ;-)
>>>>>
>>>>>i tried this (it's in SVN, see Core/LockFile and i2t for the usage). It
>>>>>doesn't really work at all. What did you expect it to do?
>>>>
>>>>
>>>>Just checked it. Seems to work fine, except that you still use /proc
>>>>instead of kill().
>>
>>yes, I commented out the kill() thing for one reason: It didn't do
>>anything useful. I asked myself what you could have meant by suggesting
>>kill() and came to the conclusion that your intend was to kill the
>>running instance before starting the new one, right? Well, I'd prefer
>>aborting the program if another instance already is running.
>>
>>I couldn't find a platform-independent way for determining if a process
>>with a certain PID is running or not, this is why I used /proc. I'm
>>still not sure about this, perhaps fcntl/lockf is better anyway.
> 
> 
> The platform independent way is to use kill(pid, 0). 0 is a special
> signal, that is not delivered to the target process, but is handled by
> the kernel completely. The kernel will check if the process with the
> given pid is still alive and if so, respond with 0, else it responds
> with an error, telling you that the process is gone (or you don't have
> permission to talk to the process).

Okay, fixed. I'll commit it later this day.

Regards,
Jannis



More information about the Installit-dev mailing list