Wrap the file-descriptor I/O surface: open, read, write, lseek and friends #8

Open
opened 2026-08-02 18:53:21 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.md §4.1 (at 669b2b3)

The most likely next surface. Nothing here is blocked; it is simply not written.

unistd.h / fcntl.h

  • open, close, read, write, pread, pwrite, lseek
  • readv, writev
  • dup, dup2, pipe, fcntl
  • fsync, fdatasync, truncate, ftruncate
  • unlink, link, symlink, readlink, rmdir, mkdir
  • access, faccessat, chmod, fchmod, chown, fchown, umask
  • chdir, fchdir, getcwd
  • isatty, ttyname_r
  • sysconf, pathconf
  • sleep, usleep, nanosleep

The short-read/short-write contract is the interesting part, and it is the
design decision this issue turns on: read(2) returning fewer bytes than asked
for is normal on a pipe or a socket and a failure on a regular file. The
wrapper needs the same transferred-count out-param aksl_fread has, and callers
need to be told which case they are in.

Files: src/ (new translation unit), include/akstdlib.h


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md §4.1 (at 669b2b3) The most likely next surface. Nothing here is blocked; it is simply not written. **`unistd.h` / `fcntl.h`** - [ ] `open`, `close`, `read`, `write`, `pread`, `pwrite`, `lseek` - [ ] `readv`, `writev` - [ ] `dup`, `dup2`, `pipe`, `fcntl` - [ ] `fsync`, `fdatasync`, `truncate`, `ftruncate` - [ ] `unlink`, `link`, `symlink`, `readlink`, `rmdir`, `mkdir` - [ ] `access`, `faccessat`, `chmod`, `fchmod`, `chown`, `fchown`, `umask` - [ ] `chdir`, `fchdir`, `getcwd` - [ ] `isatty`, `ttyname_r` - [ ] `sysconf`, `pathconf` - [ ] `sleep`, `usleep`, `nanosleep` **The short-read/short-write contract is the interesting part**, and it is the design decision this issue turns on: `read(2)` returning fewer bytes than asked for is *normal* on a pipe or a socket and a **failure** on a regular file. The wrapper needs the same transferred-count out-param `aksl_fread` has, and callers need to be told which case they are in. **Files:** `src/` (new translation unit), `include/akstdlib.h` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 0.3.0 milestone 2026-08-02 18:53:21 -04:00
tachikoma added the api-gapblast-radius:highstatus::grooming labels 2026-08-02 18:53:21 -04:00
Sign in to join this conversation.