| | @@ -1237,3 +1237,26 @@ |
| 1237 | 1237 | Met in moss (`docs/raz-port.md`): its stored programs get a guarded |
| 1238 | 1238 | 64 KiB stack, and a native compiler must fit, or the stack must grow |
| 1239 | 1239 | (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). |