Fixes to make seccomp compile on OSX
MODIFY
frida_mode/src/seccomp/seccomp_atomic.c
frida_mode/src/seccomp/seccomp_atomic.c
+#ifndef __APPLE__
+
#include <stdbool.h>
#include <stdio.h>
#include "debug.h"
-#ifndef __APPLE__
-
void seccomp_atomic_set(volatile bool *ptr, bool val) {
if (!__sync_bool_compare_and_swap(ptr, !val, val)) {

MODIFY
frida_mode/src/seccomp/seccomp_callback.c
frida_mode/src/seccomp/seccomp_callback.c
+#ifndef __APPLE__
+
#include <execinfo.h>
#include <fcntl.h>
#include "debug.h"
-#ifndef __APPLE__
-
static void seccomp_callback_filter(struct seccomp_notif * req,
struct seccomp_notif_resp *resp,
GumReturnAddressArray * frames) {

MODIFY
frida_mode/src/seccomp/seccomp_child.c
frida_mode/src/seccomp/seccomp_child.c
+#ifndef __APPLE__
+
#include <fcntl.h>
#include <sched.h>
#include <signal.h>
#include "seccomp.h"
-#ifndef __APPLE__
-
#define SECCOMP_CHILD_STACK_SIZE (1UL << 20)
typedef void (*seccomp_child_func_t)(int event_fd, void *ctx);

MODIFY
frida_mode/src/seccomp/seccomp_event.c
frida_mode/src/seccomp/seccomp_event.c
+#ifndef __APPLE__
+
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include "seccomp.h"
-#ifndef __APPLE__
-
int seccomp_event_create(void) {
int fd = syscall(SYS_eventfd, 0, 0);

MODIFY
frida_mode/src/seccomp/seccomp_filter.c
frida_mode/src/seccomp/seccomp_filter.c
+#ifndef __APPLE__
+
#include <alloca.h>
#include <errno.h>
#include <execinfo.h>
#include "seccomp.h"
#include "util.h"
-#ifndef __APPLE__
-
#define SECCOMP_FILTER_NUM_FRAMES 512
extern void gum_linux_parse_ucontext(const ucontext_t *uc, GumCpuContext *ctx);

MODIFY
frida_mode/src/seccomp/seccomp_print.c
frida_mode/src/seccomp/seccomp_print.c
+#ifndef __APPLE__
+
#include <stdarg.h>
#include "seccomp.h"
#include "util.h"
-#ifndef __APPLE__
-
static void seccomp_print_v(int fd, char *format, va_list ap) {
char buffer[4096] = {0};

MODIFY
frida_mode/src/seccomp/seccomp_socket.c
frida_mode/src/seccomp/seccomp_socket.c
+#ifndef __APPLE__
+
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include "seccomp.h"
-#ifndef __APPLE__
-
union cmsg {
char buf[CMSG_SPACE(sizeof(int))];

MODIFY
frida_mode/src/seccomp/seccomp_syscall.c
frida_mode/src/seccomp/seccomp_syscall.c
+#ifndef __APPLE__
+
#include <limits.h>
#include <stdio.h>
#include "seccomp.h"
-#ifndef __APPLE__
-
typedef struct {
int id;

Fixes to make seccomp compile on OSX