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

[libvirt] [PATCH] Add check for kill() to fix build of cgroups on win32



The kill() function doesn't exist on Win32, so it needs to be
checked for at build time & code disabled in cgroups

* configure.ac: Check for kill()
* src/util/cgroup.c: Stub out virCGroupKill* functions
  when kill() isn't available
---
 configure.ac      |    2 +-
 src/util/cgroup.c |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index bd509f3..a58ee4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,7 +120,7 @@ AC_MSG_RESULT([$have_cpuid])
 dnl Availability of various common functions (non-fatal if missing),
 dnl and various less common threadsafe functions
 AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid \
- initgroups posix_fallocate mmap \
+ initgroups posix_fallocate mmap kill \
  getmntent_r getgrnam_r getpwuid_r])
 
 dnl Availability of pthread functions (if missing, win32 threading is
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 6af3af1..c5b8cdd 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -1307,6 +1307,8 @@ int virCgroupGetFreezerState(virCgroupPtr group, char **state)
                                 "freezer.state", state);
 }
 
+
+#ifdef HAVE_KILL
 static int virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
 {
     int rc;
@@ -1520,3 +1522,21 @@ int virCgroupKillPainfully(virCgroupPtr group)
     VIR_DEBUG("Complete %d", rc);
     return rc;
 }
+
+#else /* HAVE_KILL */
+int virCgroupKill(virCgroupPtr group ATTRIBUTE_UNUSED,
+                  int signum ATTRIBUTE_UNUSED)
+{
+    return -ENOSYS;
+}
+int virCgroupKillRecursive(virCgroupPtr group ATTRIBUTE_UNUSED,
+                           int signum ATTRIBUTE_UNUSED)
+{
+    return -ENOSYS;
+}
+
+int virCgroupKillPainfully(virCgroupPtr group ATTRIBUTE_UNUSED)
+{
+    return -ENOSYS;
+}
+#endif /* HAVE_KILL */
-- 
1.7.4


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