Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low risk Unix.select changes #5640

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/libs/stunnel/stunnel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ let rec retry f = function
try f ()
with Stunnel_initialisation_failed ->
(* Leave a few seconds between each attempt *)
ignore (Unix.select [] [] [] 3.) ;
Thread.delay 3. ;
retry f (n - 1)
)

Expand Down
4 changes: 2 additions & 2 deletions ocaml/squeezed/src/squeeze_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ let make_host ~verbose ~xc =
1024L
<> 0L
do
ignore (Unix.select [] [] [] 0.25)
Thread.delay 0.25
done ;

(* Some VMs are considered by us (but not by xen) to have an
Expand Down Expand Up @@ -857,7 +857,7 @@ let io ~xc ~verbose =
(fun domid kib ->
execute_action ~xc {Squeeze.action_domid= domid; new_target_kib= kib}
)
; wait= (fun delay -> ignore (Unix.select [] [] [] delay))
; wait= (fun delay -> Thread.delay delay)
; execute_action= (fun action -> execute_action ~xc action)
; target_host_free_mem_kib
; free_memory_tolerance_kib
Expand Down
10 changes: 1 addition & 9 deletions ocaml/xe-cli/newcli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,6 @@ let main_loop ifd ofd permitted_filenames =
marshal_protocol ofd ;
let exit_code = ref None in
while !exit_code = None do
(* Wait for input asynchronously so that we can check the status
of Stunnel every now and then, for better debug/dignosis.
*)
while
match Unix.select [ifd] [] [] 5.0 with _ :: _, _, _ -> false | _ -> true
do
()
done ;
let cmd = try unmarshal ifd with e -> handle_unmarshal_failure e ifd in
debug "Read: %s\n%!" (string_of_message cmd) ;
flush stderr ;
Expand Down Expand Up @@ -633,7 +625,7 @@ let main_loop ifd ofd permitted_filenames =
with
| Unix.Unix_error (_, _, _)
when !delay <= long_connection_retry_timeout ->
ignore (Unix.select [] [] [] !delay) ;
Unix.sleepf !delay ;
delay := !delay *. 2. ;
keep_connection ()
| e ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/cli/xn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ let raw_console_proxy sockaddr =
(fun () -> Unix.close s)
with
| Unix.Unix_error (_, _, _) when !delay <= long_connection_retry_timeout ->
ignore (Unix.select [] [] [] !delay) ;
Unix.sleepf !delay ;
delay := !delay *. 2. ;
keep_connection ()
| e ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/xc/memory_breakdown.ml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ let print_memory_field_values xc xs =
flush stdout

(** Sleeps for the given time period in seconds. *)
let sleep time_period_seconds = ignore (Unix.select [] [] [] time_period_seconds)
let sleep time_period_seconds = Unix.sleepf time_period_seconds

(** Prints a header line of memory field names, and then periodically prints a
line of memory field values. *)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/xc/memory_summary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let _ =
let finished = ref false in
while not !finished do
finished := !delay < 0. ;
if !delay > 0. then ignore (Unix.select [] [] [] !delay) ;
if !delay > 0. then Unix.sleepf !delay ;
flush stdout ;
let physinfo = Xenctrl.physinfo xc in
let one_page = 4096L in
Expand Down
Loading