ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_stream_posix.h File Reference

Borrowed raw-descriptor backend for the portable byte-stream facade. More...

#include "ra8_io_stream.h"
Include dependency graph for ra8_io_stream_posix.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_io_stream_posix_state_t
 Caller-owned state retained by one POSIX stream binding. More...

Functions

ra8_err_t ra8_io_stream_posix_init (ra8_io_stream_t *stream, ra8_io_stream_posix_state_t *state, int fd)
 Bind a borrowed writable descriptor as a byte-stream sink.

Detailed Description

Borrowed raw-descriptor backend for the portable byte-stream facade.

Tag
[Ring 4 / Host Port] {World: Host}

Binds a caller-owned ra8_io_stream_t to an already-open POSIX descriptor. Writes use the kernel descriptor API directly, so the adapter owns no FILE, C-runtime buffering, allocation, path, or descriptor lifetime. Composition may bind stdout, stderr, a pipe, or another blocking descriptor; the caller remains responsible for opening and closing it.

Since
0.1.0

Definition in file ra8_io_stream_posix.h.

Function Documentation

◆ ra8_io_stream_posix_init()

ra8_err_t ra8_io_stream_posix_init ( ra8_io_stream_t * stream,
ra8_io_stream_posix_state_t * state,
int fd )
nodiscard

Bind a borrowed writable descriptor as a byte-stream sink.

Parameters
[out]streamStream handle to initialize.
[out]stateCaller-owned adapter state retained by stream.
[in]fdOpen writable descriptor borrowed for the binding lifetime.
Returns
Canonical binding status.
Return values
k_ra8_okThe stream is bound to fd.
k_ra8_err_null_ptrA required pointer is null.
k_ra8_err_invalid_argfd is negative.
Precondition
fd remains open and writable until the last operation through stream has completed.
The caller exclusively owns stream and state while binding.
Postcondition
Success initializes both stream and state.
Failure leaves both objects unchanged.
Note
Thread-safe across distinct descriptors and state objects.
Since
0.1.0

Definition at line 249 of file ra8_io_stream_posix.c.

References k_ra8_err_invalid_arg, k_ra8_err_null_ptr, k_ra8_ok, ra8_io_stream_bind(), and s_posix_stream_iface.

Referenced by internal_bind_diagnostic(), internal_output_init(), internal_output_init(), and main().