Skip to content

Commit

Permalink
c-api: support disabling mach ports use on macos (#7595)
Browse files Browse the repository at this point in the history
  • Loading branch information
casimiro authored Nov 28, 2023
1 parent ad4b7c5 commit 1c7a07b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/c-api/include/wasmtime/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ WASM_API_EXTERN void wasmtime_config_cranelift_flag_enable(wasm_config_t*, const
*/
WASM_API_EXTERN void wasmtime_config_cranelift_flag_set(wasm_config_t*, const char *key, const char *value);

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


/**
* Return the data from a LinearMemory instance.
Expand Down
5 changes: 5 additions & 0 deletions crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ pub unsafe extern "C" fn wasmtime_config_target_set(
handle_result(c.config.target(target), |_cfg| {})
}

#[no_mangle]
pub extern "C" fn wasmtime_config_macos_use_mach_ports_set(c: &mut wasm_config_t, enabled: bool) {
c.config.macos_use_mach_ports(enabled);
}

#[no_mangle]
pub unsafe extern "C" fn wasmtime_config_cranelift_flag_enable(
c: &mut wasm_config_t,
Expand Down

0 comments on commit 1c7a07b

Please sign in to comment.