[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: correct pid-file behaviour
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2003-04-29 2:46:10
[Download RAW message or body]

On Mon, Apr 28, 2003 at 10:34:56PM +0200, Alexander Neundorf wrote:
> a user of the lisa daemon(kdenetwork/lanbrowsing/lisa) asked for a pid-file 
> feature for lisa.
> How do I implement this correctly ?
>
i suggest you look at kdm/backend/dm.c

> On my system a bunch of pidfiles are under /var/run/.
>
yes

> AFAIK a pidfile is a simple text file which contains the pid of the daemon 
> process.
>
yup

> I guess I should create it as soon as the daemon starts
>
... and lock it ...

> and write the pid
>
yup

> and delete it when the daemon is killed ?
>
no need to. it can't hurt, though.

> Then the pidfile will be left over when the daemon was killed by
> SIGKILL. Is this the correct behaviour ?
> 
yes. that's why you should rely on locking and not on existence. locks
are bound to processes, files aren't.

> I guess "normal" ownership and 0644 permissions should be ok, right ?
> 
sure

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic