libvirt/SOURCES/libvirt-vircgroup-include-system-headers-only-on-linux.patch
2021-09-10 11:57:18 +00:00

84 lines
2.3 KiB
Diff

From 05df743686ad42fa006877341b7719ff4a890a70 Mon Sep 17 00:00:00 2001
Message-Id: <05df743686ad42fa006877341b7719ff4a890a70@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Mon, 1 Jul 2019 17:07:09 +0200
Subject: [PATCH] vircgroup: include system headers only on linux
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
All the system headers are used only if we are compiling on linux
and they all are present otherwise we would have seen build errors
because in our tests/vircgrouptest.c we use only __linux__ to check
whether to skip the cgroup tests or not.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 6ef37ed3b8e7cc5fd83ff2b84bf08deea62d3bd0)
Conflicts:
src/util/vircgroup.c - missing commits 9403b63102 5165ff0971
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Message-Id: <78f1905b381e5d9dce9daeabcf157e2fe65ddffe.1561993100.git.phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/util/vircgroup.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index f1ecb1dbeb..a376b9b89a 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -23,28 +23,27 @@
*/
#include <config.h>
-#include <stdio.h>
-#if defined HAVE_MNTENT_H && defined HAVE_SYS_MOUNT_H \
- && defined HAVE_GETMNTENT_R
+#ifdef __linux__
+# include <stdio.h>
# include <mntent.h>
# include <sys/mount.h>
-#endif
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/stat.h>
+# include <fcntl.h>
+# include <string.h>
+# include <errno.h>
+# include <stdlib.h>
+# include <sys/stat.h>
-#ifdef MAJOR_IN_MKDEV
-# include <sys/mkdev.h>
-#elif MAJOR_IN_SYSMACROS
-# include <sys/sysmacros.h>
-#endif
+# ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+# elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+# endif
-#include <sys/types.h>
-#include <signal.h>
-#include <dirent.h>
-#include <unistd.h>
+# include <sys/types.h>
+# include <signal.h>
+# include <dirent.h>
+# include <unistd.h>
+#endif /* __linux__ */
#define __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
#include "vircgrouppriv.h"
--
2.22.0