aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2022-01-23 16:36:06 -0800
committerAndrew G. Morgan <morgan@kernel.org>2022-01-23 16:36:06 -0800
commite1bd9ac089cc7d6535d28296e0730f7d54df7097 (patch)
tree6f08fc0161427b7a7a0630da81604139f0def4b4
parentbbabfb4cf4280825b5aeb96bf5354d654efa246e (diff)
downloadlibcap-e1bd9ac089cc7d6535d28296e0730f7d54df7097.tar.gz
Trim includes.
I've upgraded one of my systems to Fedora 35 and I found trimming the headers in this way made the three compilations of libcap, used by `make distcheck`, work with standard Fedora 35 compiler packages. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r--Make.Rules2
-rw-r--r--Makefile2
-rw-r--r--libcap/cap_file.c1
-rw-r--r--libcap/cap_proc.c2
-rw-r--r--libcap/include/sys/capability.h3
-rw-r--r--libcap/include/uapi/linux/capability.h5
6 files changed, 6 insertions, 9 deletions
diff --git a/Make.Rules b/Make.Rules
index cd4dd01..750232b 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -148,7 +148,7 @@ ifeq ($(CGO_REQUIRED),1)
# vestige of legacy workarounds then.
CGO_LDFLAGS_ALLOW := CGO_LDFLAGS_ALLOW="-Wl,-?-wrap[=,][^-.@][^,]*"
endif
-CGO_CFLAGS := -I$(topdir)/libcap/include
+CGO_CFLAGS := $(LIBCAP_INCLUDES)
CGO_LDFLAGS := -L$(topdir)/libcap
GO_BUILD_FLAGS :=
endif
diff --git a/Makefile b/Makefile
index 256c339..84c90c8 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ distcheck:
$(MAKE) DYNAMIC=no COPTS="-D_FORTIFY_SOURCE=2 -O1 -g" clean test
$(MAKE) DYNAMIC=yes clean all test sudotest
$(MAKE) DYNAMIC=no COPTS="-O2 -std=c89" clean all test sudotest
- $(MAKE) PAM_CAP=no CC=/usr/local/musl/bin/musl-gcc clean all test sudotest
+ $(MAKE) PAM_CAP=no CC=musl-gcc clean all test sudotest
$(MAKE) CC=clang clean all test sudotest
$(MAKE) clean all test sudotest
$(MAKE) distclean
diff --git a/libcap/cap_file.c b/libcap/cap_file.c
index 4178705..0bc07f7 100644
--- a/libcap/cap_file.c
+++ b/libcap/cap_file.c
@@ -12,7 +12,6 @@
#include <byteswap.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <linux/xattr.h>
/*
* We hardcode the prototypes for the Linux system calls here since
diff --git a/libcap/cap_proc.c b/libcap/cap_proc.c
index db947f4..65204bf 100644
--- a/libcap/cap_proc.c
+++ b/libcap/cap_proc.c
@@ -18,8 +18,6 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include <linux/limits.h>
-
#include "libcap.h"
/*
diff --git a/libcap/include/sys/capability.h b/libcap/include/sys/capability.h
index cb96d82..c85413b 100644
--- a/libcap/include/sys/capability.h
+++ b/libcap/include/sys/capability.h
@@ -2,7 +2,7 @@
* <sys/capability.h>
*
* Copyright (C) 1997 Aleph One
- * Copyright (C) 1997,8, 2008,19,20 Andrew G. Morgan <morgan@kernel.org>
+ * Copyright (C) 1997,8, 2008,19-22 Andrew G. Morgan <morgan@kernel.org>
*
* defunct POSIX.1e Standard: 25.2 Capabilities <sys/capability.h>
*/
@@ -21,7 +21,6 @@ extern "C" {
#include <sys/types.h>
#include <stdint.h>
-#include <linux/types.h>
#ifndef __user
#define __user
diff --git a/libcap/include/uapi/linux/capability.h b/libcap/include/uapi/linux/capability.h
index 09b5563..56c9180 100644
--- a/libcap/include/uapi/linux/capability.h
+++ b/libcap/include/uapi/linux/capability.h
@@ -14,7 +14,9 @@
#ifndef _UAPI_LINUX_CAPABILITY_H
#define _UAPI_LINUX_CAPABILITY_H
-#include <linux/types.h>
+#include <stdint.h>
+#define __u32 uint32_t
+#define __le32 __u32
/* User-level do most of the mapping between kernel and user
capabilities based on the version tag given by the kernel. The
@@ -422,5 +424,4 @@ struct vfs_ns_cap_data {
#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
#define CAP_TO_MASK(x) (1u << ((x) & 31)) /* mask for indexed __u32 */
-
#endif /* _UAPI_LINUX_CAPABILITY_H */