Skip to content

Commit 15e852c

Browse files
gearhandi.k.stepanenko
andauthored
Add inherit_network and allow_ip_name_lookup to C API (#13145)
* Added inherit_network and allow_ip_name_lookup to api exports * Removed README changes * Fix rustfmt and clangformat checks --------- Co-authored-by: i.k.stepanenko <i.k.stepanenko@tbank.ru>
1 parent 305b0d0 commit 15e852c

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

crates/c-api/include/wasi.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ WASI_DECLARE_OWN(config)
5050
*/
5151
WASI_API_EXTERN own wasi_config_t *wasi_config_new();
5252

53+
/**
54+
* \brief Allow all network addresses accessible to the host.
55+
*
56+
* This method will inherit all network addresses meaning that any address
57+
* can be bound by the guest or connected to by the guest using any
58+
* protocol.
59+
*/
60+
WASI_API_EXTERN void wasi_config_inherit_network(wasi_config_t *config);
61+
62+
/**
63+
* \brief Allow usage of `wasi:sockets/ip-name-lookup`
64+
*
65+
* By default this is disabled.
66+
*/
67+
WASI_API_EXTERN void wasi_config_allow_ip_name_lookup(wasi_config_t *config,
68+
bool enable);
69+
5370
/**
5471
* \brief Sets the argv list for this configuration object.
5572
*

crates/c-api/src/wasi.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ pub extern "C" fn wasi_config_new() -> Box<wasi_config_t> {
5050
})
5151
}
5252

53+
#[unsafe(no_mangle)]
54+
pub unsafe extern "C" fn wasi_config_inherit_network(config: &mut wasi_config_t) {
55+
config.builder.inherit_network();
56+
}
57+
58+
#[unsafe(no_mangle)]
59+
pub unsafe extern "C" fn wasi_config_allow_ip_name_lookup(
60+
config: &mut wasi_config_t,
61+
enable: bool,
62+
) {
63+
config.builder.allow_ip_name_lookup(enable);
64+
}
65+
5366
#[unsafe(no_mangle)]
5467
pub unsafe extern "C" fn wasi_config_set_argv(
5568
config: &mut wasi_config_t,

crates/jit-debug/gdbjit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ __declspec(dllexport)
1717
// `asm` statement.
1818
__attribute__((weak, noinline))
1919
#endif
20-
void __jit_debug_register_code() {
20+
void __jit_debug_register_code() {
2121
#ifndef CFG_TARGET_OS_windows
2222
__asm__("");
2323
#endif

0 commit comments

Comments
 (0)