api
utils.ch
Declarations in utils.ch
4 declarationstest
Declarations
Public only
read_exact#
function
func read_exact(fd : int, buf : *void, count : size_t) : ssize_t
read exactly `count` bytes from fd into buf, handling EINTR and partial reads.
returns number of bytes read (should be == count), 0 on EOF (if first read returns 0),
-1 on error.
write_exact#
function
func write_exact(fd : int, buf : *void, count : size_t) : int
write exactly `count` bytes from buf to fd, handling EINTR and partial writes.
returns 0 on success, -1 on error.
send_message_fd#
function
func send_message_fd(fd : int, data : *void, len : uint32_t) : int
Send a length-prefixed message on fd.
Format: 4-byte big-endian length (uint32_t), then payload (len bytes).
Returns 0 on success, -1 on error.
send_message_str#
function
func send_message_str(fd : int, s : *char) : int
Convenience: send a NUL-terminated string as a message