Files
systemd/src/basic
Daan De Meyer cf4c65afa8 sd-future: add fiber-aware non-blocking I/O wrappers
Add a family of sd_fiber_*() I/O wrappers that, when called from a
fiber, behave like blocking I/O from the caller's perspective but
yield to the event loop instead of blocking the thread:

  sd_fiber_read / sd_fiber_write
  sd_fiber_readv / sd_fiber_writev
  sd_fiber_recv / sd_fiber_send
  sd_fiber_connect
  sd_fiber_recvmsg / sd_fiber_sendmsg
  sd_fiber_recvfrom / sd_fiber_sendto
  sd_fiber_accept
  sd_fiber_ppoll

Most of them share a single helper, fiber_io_operation(), which when
invoked outside a fiber falls through to the underlying syscall
directly, preserving the regular blocking behaviour. Inside a fiber
the helper flips the fd to non-blocking (restoring its original mode
on return), tries the syscall once on the fast path, and on EAGAIN/
EWOULDBLOCK creates an sd-event-backed IO future via future_new_io(),
suspends the fiber, and retries the syscall once the event source
fires.

future_new_io() itself is added to sd-event/event-future.{c,h} as a
new IoFuture kind. It wraps sd_event_add_io() into an sd_future:
oneshot enable, EPOLLERR translated via SO_ERROR (suppressed for
non-sockets), and the fd duplicated with F_DUPFD_CLOEXEC to avoid
EEXIST when multiple sources watch the same descriptor.

Together these let fiber-using code write straight-line socket and
pipe I/O without bundling state into callbacks.
2026-05-21 09:55:04 +00:00
..
2026-05-14 23:40:25 +09:00
2026-01-06 10:34:02 +01:00
2026-05-12 14:43:39 +02:00
2026-04-03 23:22:14 +02:00
2025-09-19 16:46:07 +02:00
2026-04-26 21:21:49 +02:00
2026-03-03 22:18:26 +01:00
2025-05-25 10:06:07 +02:00
2026-02-05 16:18:35 +01:00
2026-03-31 18:30:40 +02:00
2026-04-09 22:47:10 +02:00
2026-04-09 22:47:10 +02:00
2025-12-15 08:50:13 +09:00
…
2026-05-05 15:09:47 +02:00
2026-05-05 15:09:47 +02:00
2025-12-15 08:50:13 +09:00