Skip to content

Commit

Permalink
Rename wasi_config_set_std[in|out|err].
Browse files Browse the repository at this point in the history
This commit renames `wasi_config_set_std[in|out|err]` to
`wasi_config_set_std[in|out|err]_file` so we can reserve the former for
when the C API supports a stream abstraction.
  • Loading branch information
peterhuene committed Feb 25, 2020
1 parent d1f7d4c commit d0a8e57
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions crates/c-api/include/wasi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ WASI_API_EXTERN void wasi_config_inherit_argv(wasi_config_t* config);
WASI_API_EXTERN void wasi_config_set_env(wasi_config_t* config, int envc, const char* names[], const char* values[]);
WASI_API_EXTERN void wasi_config_inherit_env(wasi_config_t* config);

WASI_API_EXTERN bool wasi_config_set_stdin(wasi_config_t* config, const char* path);
WASI_API_EXTERN bool wasi_config_set_stdin_file(wasi_config_t* config, const char* path);
WASI_API_EXTERN void wasi_config_inherit_stdin(wasi_config_t* config);

WASI_API_EXTERN bool wasi_config_set_stdout(wasi_config_t* config, const char* path);
WASI_API_EXTERN bool wasi_config_set_stdout_file(wasi_config_t* config, const char* path);
WASI_API_EXTERN void wasi_config_inherit_stdout(wasi_config_t* config);

WASI_API_EXTERN bool wasi_config_set_stderr(wasi_config_t* config, const char* path);
WASI_API_EXTERN bool wasi_config_set_stderr_file(wasi_config_t* config, const char* path);
WASI_API_EXTERN void wasi_config_inherit_stderr(wasi_config_t* config);

WASI_API_EXTERN bool wasi_config_preopen_dir(wasi_config_t* config, const char* path, const char* guest_path);
Expand Down
6 changes: 3 additions & 3 deletions crates/c-api/src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub unsafe extern "C" fn wasi_config_inherit_env(config: *mut wasi_config_t) {
}

#[no_mangle]
pub unsafe extern "C" fn wasi_config_set_stdin(
pub unsafe extern "C" fn wasi_config_set_stdin_file(
config: *mut wasi_config_t,
path: *const c_char,
) -> bool {
Expand All @@ -103,7 +103,7 @@ pub unsafe extern "C" fn wasi_config_inherit_stdin(config: *mut wasi_config_t) {
}

#[no_mangle]
pub unsafe extern "C" fn wasi_config_set_stdout(
pub unsafe extern "C" fn wasi_config_set_stdout_file(
config: *mut wasi_config_t,
path: *const c_char,
) -> bool {
Expand All @@ -123,7 +123,7 @@ pub unsafe extern "C" fn wasi_config_inherit_stdout(config: *mut wasi_config_t)
}

#[no_mangle]
pub unsafe extern "C" fn wasi_config_set_stderr(
pub unsafe extern "C" fn wasi_config_set_stderr_file(
config: *mut wasi_config_t,
path: *const c_char,
) -> bool {
Expand Down
6 changes: 3 additions & 3 deletions crates/misc/dotnet/src/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ public static extern unsafe void wasi_config_set_env(
public static extern void wasi_config_inherit_env(WasiConfigHandle config);

[DllImport(LibraryName)]
public static extern bool wasi_config_set_stdin(
public static extern bool wasi_config_set_stdin_file(
WasiConfigHandle config,
[MarshalAs(UnmanagedType.LPUTF8Str)] string path
);
Expand All @@ -863,7 +863,7 @@ public static extern bool wasi_config_set_stdin(
public static extern void wasi_config_inherit_stdin(WasiConfigHandle config);

[DllImport(LibraryName)]
public static extern bool wasi_config_set_stdout(
public static extern bool wasi_config_set_stdout_file(
WasiConfigHandle config,
[MarshalAs(UnmanagedType.LPUTF8Str)] string path
);
Expand All @@ -872,7 +872,7 @@ public static extern bool wasi_config_set_stdout(
public static extern void wasi_config_inherit_stdout(WasiConfigHandle config);

[DllImport(LibraryName)]
public static extern bool wasi_config_set_stderr(
public static extern bool wasi_config_set_stderr_file(
WasiConfigHandle config,
[MarshalAs(UnmanagedType.LPUTF8Str)] string path
);
Expand Down
6 changes: 3 additions & 3 deletions crates/misc/dotnet/src/WasiBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private void SetStandardIn(Interop.WasiConfigHandle config)

if (!string.IsNullOrEmpty(_standardInputPath))
{
if (!Interop.wasi_config_set_stdin(config, _standardInputPath))
if (!Interop.wasi_config_set_stdin_file(config, _standardInputPath))
{
throw new InvalidOperationException($"Failed to set stdin to file '{_standardInputPath}'.");
}
Expand All @@ -359,7 +359,7 @@ private void SetStandardOut(Interop.WasiConfigHandle config)

if (!string.IsNullOrEmpty(_standardOutputPath))
{
if (!Interop.wasi_config_set_stdout(config, _standardOutputPath))
if (!Interop.wasi_config_set_stdout_file(config, _standardOutputPath))
{
throw new InvalidOperationException($"Failed to set stdout to file '{_standardOutputPath}'.");
}
Expand All @@ -376,7 +376,7 @@ private void SetStandardError(Interop.WasiConfigHandle config)

if (!string.IsNullOrEmpty(_standardErrorPath))
{
if (!Interop.wasi_config_set_stderr(config, _standardErrorPath))
if (!Interop.wasi_config_set_stderr_file(config, _standardErrorPath))
{
throw new InvalidOperationException($"Failed to set stderr to file '{_standardErrorPath}'.");
}
Expand Down

0 comments on commit d0a8e57

Please sign in to comment.