mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-03 07:54:40 +08:00
On Linux, an fs stream's read or write of a regular file first tries preadv2/pwritev2 with RWF_NOWAIT on the loop thread. When the page cache holds the data, the step completes there and its completion waits for the next loop turn (scr_work_submit_done), as a pool job's completion does, so timers and I/O still run between steps. EAGAIN, a kernel or file system without RWF_NOWAIT, and other files take the pool as before. - A read the cache holds only part of finishes on the pool, so each chunk is the one a single read() returns. - A partial write completes with the bytes written; the stream submits the rest, as after any partial write. - Writes stay on the pool when RLIMIT_FSIZE is finite, so SIGXFSZ cannot reach the loop thread. scr_work_submit_done queues a completed job on a list the loop moves to the done queue at its next sleep step, which is skipped while jobs wait. Corpus 8530 covers a positioned read with a small highWaterMark, a write stream with a start position into an existing file, and an append stream over cached files, against Node.