summaryrefslogtreecommitdiff
path: root/src/arch.c
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2012-03-07 10:54:47 -0500
committerPaul Moore <pmoore@redhat.com>2012-03-09 11:47:53 -0500
commit177ca32a687e02313da118e1fd25d87911745255 (patch)
tree8658e77315e66f126b34fc4dbbd742d174cc562f /src/arch.c
parent3cadb3d52472e05f4489a36a63ce9835e3619b2f (diff)
downloadlibseccomp-177ca32a687e02313da118e1fd25d87911745255.tar.gz
arch: set the arch_def->token value
Unfortunately, there doesn't appear to be a great way to detect this, so we need to depend on some GCC specific pre-processor #defines. For reasons that should be obvious, we also change the default compiler from whatever make provides via "$(CC)" to "gcc". Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'src/arch.c')
-rw-r--r--src/arch.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/arch.c b/src/arch.c
index 9895ca3..0c6551a 100644
--- a/src/arch.c
+++ b/src/arch.c
@@ -21,11 +21,19 @@
#include <stdlib.h>
#include <asm/bitsperlong.h>
+#include <linux/audit.h>
#include "arch.h"
const struct arch_def arch_def_native = {
- .token = 0,
+#if __i386__
+ .token = AUDIT_ARCH_I386,
+#elif __x86_64__
+ .token = AUDIT_ARCH_X86_64,
+#else
+#error the arch code needs to know about your machine type
+#endif /* machine type guess */
+
#if __BITS_PER_LONG == 32
.size = ARCH_SIZE_32,
#elif __BITS_PER_LONG == 64
@@ -33,6 +41,7 @@ const struct arch_def arch_def_native = {
#else
.size = ARCH_SIZE_UNSPEC,
#endif /* BITS_PER_LONG */
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
.endian = ARCH_ENDIAN_LITTLE,
#elif __BYTE_ORDER == __BIG_ENDIAN