Std.Async: Unix domain stream sockets (listen, connect, accept, peer credentials)

Aperta
#16,867 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
backend

Direzione di ricerca

Read the Std.Async and Std.Internal.UV socket implementations and RFC #13638, which the issue identifies as the proposed Pipe wrapper. Trace how uv_pipe_t supports binding, connecting, listening, accepting, and peer credentials across the stated platforms. Done means the requested server and client APIs, including receive selectors and credentials, are available; arbitrary SCM_RIGHTS transfer is out of scope.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

Std.Async has TCP and UDP sockets but no Unix domain sockets. Local servers commonly need them: a Wayland compositor, a daemon's control socket, a socket behind a login proxy. Two Lean projects, Aether (github.com/Verilean/aether) and lean-tea (github.com/Verilean/lean-tea), each carry their own C binding for socket(AF_UNIX) / bind / listen / accept / connect.

What they need:

  1. Listen on a path, with the socket's file mode set before listen, so no client connects through a looser mode. Replacing a stale socket file at the path is a common convenience.
  2. Connect to a path.
  3. Accept, recv and send with the same API as Std.Async.TCP.Socket.Client, including recvSelector.
  4. The peer's credentials (SO_PEERCRED on Linux, getpeereid on BSD/macOS): uid, and pid where available.

libuv's uv_pipe_t already provides 1–3 (uv_pipe_bind, uv_pipe_connect, uv_listen, uv_accept, and uv_pipe_chmod; on Windows, named pipes). RFC #13638 proposes a Pipe wrapper around uv_pipe_t for anonymous and named pipes; this request is for its socket server/client side.

Out of scope, for completeness: passing arbitrary file descriptors with SCM_RIGHTS (Wayland sends shared-memory fds this way). libuv only passes its own handles over IPC pipes, so we do not expect this in Std.Async.

Steps to Reproduce

Search Std.Internal.UV and Std.Async in v4.36.0 for AF_UNIX or uv_pipe: there is none.

Expected behavior: a Std.Async Unix-socket (or Pipe) server and client.

Actual behavior: projects write and maintain C bindings and, because those block, run one dedicated task per connection.

Versions

Lean 4.36.0 (x86_64-unknown-linux-gnu), also checked against v4.37.0-rc1.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this issue, please add 👍 to it.

Lingua principale
Lean
Stelle
10.3k
Fork
1.1k
Merge medio
16h 45m
PR unite (30g)
361

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di leanprover/lean4

Tutte le issue di leanprover/lean4

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.