Closed kit-ty-kate closed 7 months ago
We probably can use optional argument for Miou_unix.read
and Miou_unix.write
which infer the length of the buffer like:
let read fd ?(off= 0) ?len buf =
let len = match len with
| Some len -> len
| None -> Bytes.length buf - off in
blocking_read fd;
Unix.read fd buf off len
It breaks the API but I already broke it with Miou.{set,sys}_signal
.
EDIT: but yeah, really_read
is still needed which fullfills the given buffer.
Remplaced by https://git.robur.coop/robur/miou/pulls/52, thanks!
I'm not sure to understand the implementation that you chose. In particular:
if len - len' <= 0 then
really_read file_descr ~off:(off + len') ~len:(len - len') buf
it looks to me like you'd want the opposite:
if len - len' > 0 then
or simply:
if len - len' <> 0 then
like i did in this here PR
Yes, it was fixed by this commit
Similar to
Stdlib.really_read
Sits on top of #18