Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/bashkit-capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ crate-type = ["cdylib", "rlib"]
# `tzdata` is listed explicitly: the C ABI is a general-purpose embedding
# surface, so `date` must keep honouring named `TZ=` zones the way it did
# before that became a feature.
bashkit = { path = "../bashkit", default-features = false, features = ["git", "jq", "tzdata"] }
bashkit = { path = "../bashkit", default-features = false, features = ["git", "jq", "tzdata", "realfs"] }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
2 changes: 2 additions & 0 deletions crates/bashkit-capi/include/bashkit.def
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ EXPORTS
bashkit_execute
bashkit_free
bashkit_mkdir
bashkit_mount
bashkit_read_file
bashkit_remove
bashkit_result_exit_code
Expand All @@ -20,5 +21,6 @@ EXPORTS
bashkit_result_free
bashkit_result_stderr
bashkit_result_stdout
bashkit_unmount
bashkit_version
bashkit_write_file
23 changes: 23 additions & 0 deletions crates/bashkit-capi/include/bashkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef uint32_t BashkitStatus;
#define BASHKIT_EXECUTION_ERROR 4u
#define BASHKIT_IO_ERROR 5u
#define BASHKIT_UNSUPPORTED 6u
#define BASHKIT_CANCELLED 7u
#define BASHKIT_INTERNAL_ERROR 255u

/* Static views returned by these functions remain valid for process lifetime. */
Expand All @@ -61,6 +62,13 @@ BASHKIT_API BashkitStatus bashkit_execute(
BashkitResult **out_result,
BashkitError **out_error);

/* Cancellation requires the `cancellation` capability. Both are lock-free and
safe to call from any thread while bashkit_execute is blocked on the same
handle; execution aborts at the next command boundary with
BASHKIT_CANCELLED. The flag is sticky until bashkit_clear_cancel. */
BASHKIT_API BashkitStatus bashkit_cancel(Bashkit *bash);
BASHKIT_API BashkitStatus bashkit_clear_cancel(Bashkit *bash);

/* Result byte views remain valid until bashkit_result_free(result). */
BASHKIT_API int32_t bashkit_result_exit_code(const BashkitResult *result);
BASHKIT_API BashkitBytes bashkit_result_stdout(const BashkitResult *result);
Expand Down Expand Up @@ -91,6 +99,21 @@ BASHKIT_API BashkitStatus bashkit_remove(
uint32_t recursive,
BashkitError **out_error);

/* Mounts require the `realfs-mounts` capability; host roots must resolve under
an `allowed_mount_paths` prefix from the session config. Sensitive host
paths (home trees, `/etc`, `.ssh`, ...) are refused unless the allowlist
names the root exactly (TM-FS-013). */
BASHKIT_API BashkitStatus bashkit_mount(
Bashkit *bash,
BashkitBytes vfs_path,
BashkitBytes host_root,
uint32_t writable,
BashkitError **out_error);
BASHKIT_API BashkitStatus bashkit_unmount(
Bashkit *bash,
BashkitBytes vfs_path,
BashkitError **out_error);

/* Buffer byte views remain valid until bashkit_buffer_free(buffer). */
BASHKIT_API BashkitBytes bashkit_buffer_bytes(const BashkitBuffer *buffer);
BASHKIT_API void bashkit_buffer_free(BashkitBuffer *buffer);
Expand Down
Loading