diff options
Diffstat (limited to 'samples/seccomp/bpf-direct.c')
-rw-r--r-- | samples/seccomp/bpf-direct.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/samples/seccomp/bpf-direct.c b/samples/seccomp/bpf-direct.c index 26f523e6ed74..151ec3f52189 100644 --- a/samples/seccomp/bpf-direct.c +++ b/samples/seccomp/bpf-direct.c | |||
@@ -8,6 +8,11 @@ | |||
8 | * and can serve as a starting point for developing | 8 | * and can serve as a starting point for developing |
9 | * applications using prctl(PR_SET_SECCOMP, 2, ...). | 9 | * applications using prctl(PR_SET_SECCOMP, 2, ...). |
10 | */ | 10 | */ |
11 | #if defined(__i386__) || defined(__x86_64__) | ||
12 | #define SUPPORTED_ARCH 1 | ||
13 | #endif | ||
14 | |||
15 | #if defined(SUPPORTED_ARCH) | ||
11 | #define __USE_GNU 1 | 16 | #define __USE_GNU 1 |
12 | #define _GNU_SOURCE 1 | 17 | #define _GNU_SOURCE 1 |
13 | 18 | ||
@@ -43,8 +48,6 @@ | |||
43 | #define REG_ARG3 REG_R10 | 48 | #define REG_ARG3 REG_R10 |
44 | #define REG_ARG4 REG_R8 | 49 | #define REG_ARG4 REG_R8 |
45 | #define REG_ARG5 REG_R9 | 50 | #define REG_ARG5 REG_R9 |
46 | #else | ||
47 | #error Unsupported platform | ||
48 | #endif | 51 | #endif |
49 | 52 | ||
50 | #ifndef PR_SET_NO_NEW_PRIVS | 53 | #ifndef PR_SET_NO_NEW_PRIVS |
@@ -174,3 +177,14 @@ int main(int argc, char **argv) | |||
174 | payload("Error message going to STDERR\n")); | 177 | payload("Error message going to STDERR\n")); |
175 | return 0; | 178 | return 0; |
176 | } | 179 | } |
180 | #else /* SUPPORTED_ARCH */ | ||
181 | /* | ||
182 | * This sample is x86-only. Since kernel samples are compiled with the | ||
183 | * host toolchain, a non-x86 host will result in using only the main() | ||
184 | * below. | ||
185 | */ | ||
186 | int main(void) | ||
187 | { | ||
188 | return 1; | ||
189 | } | ||
190 | #endif /* SUPPORTED_ARCH */ | ||