Skip to content

Commit 1c7a07b

Browse files
authored
c-api: support disabling mach ports use on macos (#7595)
1 parent ad4b7c5 commit 1c7a07b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/c-api/include/wasmtime/config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t*, const
367367
*/
368368
WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t*, const char *key, const char *value);
369369

370+
/**
371+
* \brief Configures whether, when on macOS, Mach ports are used for exception handling
372+
* instead of traditional Unix-based signal handling.
373+
*
374+
* This option defaults to true, using Mach ports by default.
375+
*
376+
* For more information see the Rust documentation at
377+
* https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.macos_use_mach_ports
378+
*/
379+
WASMTIME_CONFIG_PROP(void, macos_use_mach_ports, bool)
380+
370381

371382
/**
372383
* Return the data from a LinearMemory instance.

crates/c-api/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ pub unsafe extern "C" fn wasmtime_config_target_set(
240240
handle_result(c.config.target(target), |_cfg| {})
241241
}
242242

243+
#[no_mangle]
244+
pub extern "C" fn wasmtime_config_macos_use_mach_ports_set(c: &mut wasm_config_t, enabled: bool) {
245+
c.config.macos_use_mach_ports(enabled);
246+
}
247+
243248
#[no_mangle]
244249
pub unsafe extern "C" fn wasmtime_config_cranelift_flag_enable(
245250
c: &mut wasm_config_t,

0 commit comments

Comments
 (0)