From 83467de3ed47351e34a7854a22ebebfc1f45af0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 6 Jan 2009 17:46:46 +0000 Subject: [PATCH] add virKillProcess --- ChangeLog | 6 ++++++ src/libvirt_private.syms | 1 + src/util.c | 11 +++++++++++ src/util.h | 2 ++ 4 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 30b5228471..f777e1ec29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 6 18:44:34 CET 2009 Guido Günther + + add virKillProcess + * src/util.[ch] (virKillProcess): new function + * src/libvirt_private.syms: add symbol + Tue Jan 6 18:14:31 CET 2009 Guido Günther trivial cleanups diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 90bcc681a4..f502e12e7e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -292,6 +292,7 @@ virParseNumber; virAsprintf; virRun; virSkipSpaces; +virKillProcess; # uuid.h diff --git a/src/util.c b/src/util.c index f324bdf7c2..dd18522635 100644 --- a/src/util.c +++ b/src/util.c @@ -1337,3 +1337,14 @@ int virDiskNameToIndex(const char *name) { return idx; } + +/* send signal to a single process */ +int virKillProcess(pid_t pid, int sig) +{ + if (pid < 1) { + errno = ESRCH; + return -1; + } + + return kill(pid, sig); +} diff --git a/src/util.h b/src/util.h index 87ac908714..f622bad06c 100644 --- a/src/util.h +++ b/src/util.h @@ -166,4 +166,6 @@ static inline int getuid (void) { return 0; } static inline int getgid (void) { return 0; } #endif +int virKillProcess(pid_t pid, int sig); + #endif /* __VIR_UTIL_H__ */ -- GitLab