Skip to content

Commit

Permalink
fixup! Unix.time_limited_{read,write}: replace select with Polly
Browse files Browse the repository at this point in the history
  • Loading branch information
edwintorok committed Jan 30, 2024
1 parent 23243c3 commit ef558be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/unixext.ml
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@ let with_polly_wait kind fd f =
| S_LNK ->
(* should never happen, the file is already open and OCaml doesn't support O_SYMLINK to open the link itself *)
failwith "cannot read/write into a symbolic link"
| S_REG ->
| S_REG | S_BLK ->
(* the best we can do is to split up the read/write operation into 64KiB chunks,
and check the timeout after each chunk.
select() would've silently succeeded here, whereas epoll() is stricted and returns EPERM
*)
let wait remaining_time = if remaining_time < 0. then raise Timeout in
f wait fd
| S_BLK | S_CHR | S_FIFO | S_SOCK ->
| S_CHR | S_FIFO | S_SOCK ->
with_polly @@ fun polly ->
Polly.add polly fd kind ;
let wait remaining_time =
Expand Down

0 comments on commit ef558be

Please sign in to comment.