From 6d70cadbba0dcaa51e15af9f87058d7f0a8f8e90 Mon Sep 17 00:00:00 2001 From: Harry Mallon Date: Fri, 17 Nov 2023 15:46:32 +0000 Subject: [PATCH] Filter symbols which are available in bindings --- xpc-sys/build.rs | 7 +++++++ xpc-sys/src/lib.rs | 1 + 2 files changed, 8 insertions(+) diff --git a/xpc-sys/build.rs b/xpc-sys/build.rs index 3f24a7d..4b7932a 100644 --- a/xpc-sys/build.rs +++ b/xpc-sys/build.rs @@ -25,6 +25,13 @@ fn main() { // bindings for. .header(xpc_path) .header(bootstrap_path) + // Filter the results to only relevant symbols + .allowlist_function("^xpc_.*") + .allowlist_var("^_xpc_.*") + .allowlist_var("^bootstrap_port") + // The following symbols should probably be in libc or mach2, but are not + .allowlist_function("^mach_port.*") + .allowlist_function("^vm_allocate") // Tell cargo to invalidate the built crate whenever any of the // included header files changed. .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) diff --git a/xpc-sys/src/lib.rs b/xpc-sys/src/lib.rs index 1ea3a32..401a2f2 100644 --- a/xpc-sys/src/lib.rs +++ b/xpc-sys/src/lib.rs @@ -8,6 +8,7 @@ extern crate lazy_static; #[macro_use] extern crate bitflags; +pub use libc::MAP_SHARED; use libc::{geteuid, mach_task_self_, strerror, sysctlbyname, KERN_SUCCESS, MACH_PORT_NULL}; use std::ffi::{CStr, CString}; use std::os::raw::{c_char, c_int, c_long, c_void};