raz / commit cf05cd16

commit
cf05cd16e4fedd742aed94546cd6ea3c1b6946b2
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
2044831e
PROPOSALS.md: Sys.blocking, a descriptor's blocking flag read, met in rnet

patch · log

1 file changed, +23 -0

PROPOSALS.md modified +23 -0

@@ -1237,3 +1237,26 @@
12371237 Met in moss (`docs/raz-port.md`): its stored programs get a guarded
12381238 64 KiB stack, and a native compiler must fit, or the stack must grow
12391239 (2026-10-22).
1240+
1241+## `Sys.blocking`: whether a descriptor's reads and writes wait
1242+
1243+Library growth that breaks no program: one procedure, beside
1244+`setBlocking`, in `Sys.raz` (C's `fcntl` with `F_GETFL`) and
1245+`Sys.linux-x86_64.raz` (system call 72, `F_GETFL`, as `setBlocking`
1246+already makes it).
1247+
1248+ (* Whether reads and writes on fd wait, as they do at first: 1 if
1249+ they do, 0 if they return -11 (EAGAIN) at once, or minus an
1250+ errno. *)
1251+ proc blocking*(fd: INT): INT;
1252+
1253+`setBlocking` sets the flag but nothing reads it, so a library that
1254+must make a caller's descriptor non-blocking for a while can't put it
1255+back as it found it: it can only guess. rnet's `Tls.accept` makes the
1256+socket it is given non-blocking for the handshake and, on failure,
1257+makes it blocking again, as `Sys.accept` gives it; a caller that gave
1258+it a non-blocking one gets it back changed. With `blocking`, it would
1259+note the flag first and restore that. A test, too, can't check that a
1260+descriptor was put back without it.
1261+
1262+Met in rnet, after a review of its STARTTLS (2026-10-22).