22typedef enum : uint8_t {
39 ssize_t (*
read_fn)(
int fd,
void* buf,
size_t count);
40 ssize_t (*
write_fn)(
int fd,
const void* buf,
size_t count);
41 ssize_t (*
pread_fn)(
int fd,
void* buf,
size_t count, off_t offset);
42 ssize_t (*
pwrite_fn)(
int fd,
const void* buf,
size_t count, off_t off);
emu_io_result_t priv_emu_io_err_text(const char *text)
Write a NUL-terminated literal to the injected error descriptor.
emu_io_status_t
Result status for an emulator host-I/O operation.
@ k_emu_io_eof
Input ended before the requested byte count.
@ k_emu_io_ok
The complete operation succeeded.
@ k_emu_io_error
A host syscall failed; os_error carries errno.
@ k_emu_io_invalid
A pointer, descriptor, size, or path was invalid.
@ k_emu_io_truncated
Formatted text exceeded the bounded scratch buffer.
emu_io_result_t priv_emu_io_out_text(const char *text)
Write a NUL-terminated literal to the injected output descriptor.
emu_io_result_t priv_emu_io_write_exact(int fd, const void *buf, size_t count)
Write exactly count sequential bytes or report fault progress.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
emu_io_result_t priv_emu_io_pread_exact(int fd, void *buf, size_t count, off_t offset)
Read exactly count bytes at offset without changing the cursor.
emu_io_result_t priv_emu_io_pwrite_exact(int fd, const void *buf, size_t count, off_t offset)
Write exactly count bytes at offset without changing the cursor.
emu_io_result_t priv_emu_io_outf(const char *format,...)
Format bounded text and write it to the injected output descriptor.
emu_io_result_t priv_emu_io_filef(int fd, const char *format,...)
Format bounded text and write it to an explicit raw descriptor.
emu_io_result_t priv_emu_io_read_exact(int fd, void *buf, size_t count)
Read exactly count sequential bytes or report EOF/fault progress.
void priv_emu_io_configure(int out_fd, int err_fd, const emu_io_ops_t *ops)
Inject process output descriptors and optional raw transfer hooks.
emu_io_result_t priv_emu_io_err_bytes(const void *bytes, size_t length)
Write an exact non-NUL-terminated byte fragment to the error sink.
void priv_emu_io_txn_abort(emu_io_txn_t *txn)
Close and unlink an active sibling transaction without publication.
emu_io_result_t priv_emu_io_file_char(int fd, char value)
Write one byte to an explicit raw descriptor.
emu_io_result_t priv_emu_io_txn_commit(emu_io_txn_t *txn)
Sync, close, and atomically rename an active sibling transaction.
emu_io_result_t priv_emu_io_close(emu_io_file_t *file)
Close and invalidate an owned raw file descriptor.
emu_io_result_t priv_emu_io_file_text(int fd, const char *text)
Write a NUL-terminated literal to an explicit raw descriptor.
emu_io_result_t priv_emu_io_txn_begin(const char *path, emu_io_txn_t *txn)
Create a sibling temporary output for failure-atomic publication.
emu_io_result_t priv_emu_io_open_read(const char *path, emu_io_file_t *file)
Open and stat a regular file for bounded raw reading.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Raw descriptor plus its stat-derived byte length.
int64_t size
Non-negative regular-file length.
int fd
Owned descriptor, or -1 when closed.
Injectable raw operations used by the exact-transfer loops.
ssize_t(* read_fn)(int fd, void *buf, size_t count)
read().
ssize_t(* write_fn)(int fd, const void *buf, size_t count)
write().
ssize_t(* pwrite_fn)(int fd, const void *buf, size_t count, off_t off)
pwrite().
ssize_t(* pread_fn)(int fd, void *buf, size_t count, off_t offset)
pread().
Complete, caller-visible result of a raw host-I/O operation.
size_t transferred
Bytes transferred before completion/failure.
int os_error
Captured errno for k_emu_io_error, else zero.
emu_io_status_t status
Semantic completion status.
Sibling temporary file used for failure-atomic publication.
char temp[544]
Sibling mkstemp template / active temporary path.
int fd
Owned temporary descriptor, or -1 when inactive.