Re: [PATCH v2 1/2] util: Introduce virPidFileForceCleanupPath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/12/14 14:12, Martin Kletzander wrote:
> This function is used to cleanup a pidfile doing whatever it takes, even
> killing the owning process.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
> v2:
>  - Don't use "/proc", but simply just try to acquire the pidfile.
>  - https://www.redhat.com/archives/libvir-list/2014-October/msg00320.html
> 
>  src/libvirt_private.syms |  1 +
>  src/util/virpidfile.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
>  src/util/virpidfile.h    |  2 ++
>  3 files changed, 45 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index d6265ac..30d100d 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1810,6 +1810,7 @@ virPidFileBuildPath;
>  virPidFileConstructPath;
>  virPidFileDelete;
>  virPidFileDeletePath;
> +virPidFileForceCleanupPath;
>  virPidFileRead;
>  virPidFileReadIfAlive;
>  virPidFileReadPath;
> diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
> index a3b8846..a64a1cf 100644
> --- a/src/util/virpidfile.c
> +++ b/src/util/virpidfile.c
> @@ -37,6 +37,7 @@
>  #include "c-ctype.h"
>  #include "areadlink.h"
>  #include "virstring.h"
> +#include "virprocess.h"
> 
>  #define VIR_FROM_THIS VIR_FROM_NONE
> 
> @@ -567,3 +568,44 @@ virPidFileConstructPath(bool privileged,
>      VIR_FREE(rundir);
>      return ret;
>  }
> +
> +
> +/**
> + * virPidFileForceCleanupPath:
> + *
> + * Check if the pidfile is left around and clean it up whatever it
> + * takes.  This doesn't raise an error.  This function must not be
> + * called multiple times with the same path, be it in threads or
> + * processes.
> + *
> + * Returns 0 if the pidfile was successfully cleaned up, -1 otherwise.

Possibly worth mentioning that this function doesn't set libvirt errors.

> + */
> +int
> +virPidFileForceCleanupPath(const char *path)

ACK,

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]