Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-17 Thread Daniel P. Berrange
On Wed, Aug 17, 2011 at 11:34:34AM -0600, Eric Blake wrote: > On 08/12/2011 08:07 AM, Daniel P. Berrange wrote: > >From: "Daniel P. Berrange" > > > >In some cases the caller of virPidFileRead might like extra checks > >to determine whether the pid just read is really the one they are > >expecting.

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-17 Thread Eric Blake
On 08/12/2011 08:07 AM, Daniel P. Berrange wrote: From: "Daniel P. Berrange" In some cases the caller of virPidFileRead might like extra checks to determine whether the pid just read is really the one they are expecting. This adds virPidFileReadIfAlive which will check whether the pid is still a

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Jiri Denemark
On Fri, Aug 12, 2011 at 15:07:21 +0100, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" > > In some cases the caller of virPidFileRead might like extra checks > to determine whether the pid just read is really the one they are > expecting. This adds virPidFileReadIfAlive which will check w

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Jiri Denemark
On Fri, Aug 12, 2011 at 14:46:35 +0100, Daniel P. Berrange wrote: > On Fri, Aug 12, 2011 at 02:10:00PM +0200, Jiri Denemark wrote: ... > > > +if (virAsprintf(&procpath, "/proc/%d/exe", *pid) < 0) { > > > +*pid = -1; > > > +return 0; > > > +} > > > +#ifdef __linux__ > > > +

[libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Daniel P. Berrange
From: "Daniel P. Berrange" In some cases the caller of virPidFileRead might like extra checks to determine whether the pid just read is really the one they are expecting. This adds virPidFileReadIfAlive which will check whether the pid is still alive with kill(0, -1), and (on linux only) will loo

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Daniel P. Berrange
On Fri, Aug 12, 2011 at 02:10:00PM +0200, Jiri Denemark wrote: > Eh, I forgot to add some more notes... > > ... > > diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c > > index 25c3272..dc92868 100644 > > --- a/src/util/virpidfile.c > > +++ b/src/util/virpidfile.c > > @@ -24,6 +24,7 @@ > >

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Jiri Denemark
Eh, I forgot to add some more notes... ... > diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c > index 25c3272..dc92868 100644 > --- a/src/util/virpidfile.c > +++ b/src/util/virpidfile.c > @@ -24,6 +24,7 @@ > #include > > #include > +#include > > #include "virpidfile.h" > #incl

Re: [libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-12 Thread Jiri Denemark
On Wed, Aug 10, 2011 at 16:37:26 +0100, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" > > In some cases the caller of virPidFileRead might like extra checks > to determine whether the pid just read is really the one they are > expecting. This adds virPidFileReadIfValid which will check w

[libvirt] [PATCH 3/5] Introduce functions for checking whether a pidfile is valid

2011-08-10 Thread Daniel P. Berrange
From: "Daniel P. Berrange" In some cases the caller of virPidFileRead might like extra checks to determine whether the pid just read is really the one they are expecting. This adds virPidFileReadIfValid which will check whether the pid is still alive with kill(0, -1), and (on linux only) will loo