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

CP-39551: avoid warnings in xenopsd/xc and libs #4683

Merged
merged 3 commits into from
Apr 13, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ jobs:
# On top of this it's difficult to make it just run once on CI
# without adding changes to more than a single file
run: |
ERR=$(egrep 'Error |Warning ' -c make-check.log)
ERR=$(egrep 'Error \(|Warning \(' -c make-check.log)
echo ERR=$ERR
test 5 -eq "$ERR"
test 1 -eq "$ERR"

- name: Check all code in release mode
# This should be removed when the preceding passes succeed
Expand Down
30 changes: 2 additions & 28 deletions ocaml/libs/http-svr/server_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,7 @@ exception PleaseClose

let set_intersect a b = List.filter (fun x -> List.mem x b) a

(** Establish a server; handler is either 'by_thread' or 'in_this_thread' *)
type sock_or_addr =
| Server_sockaddr of Unix.sockaddr
| Server_fd of Unix.file_descr

let establish_server ?(signal_fds = []) forker sockoraddr =
let sock =
match sockoraddr with
| Server_sockaddr sockaddr ->
let domain =
match sockaddr with
| ADDR_UNIX _ ->
debug "Establishing Unix domain server" ;
Unix.PF_UNIX
| ADDR_INET (_, _) ->
debug "Establishing inet domain server" ;
Unix.PF_INET
in
let sock = Unix.socket domain Unix.SOCK_STREAM 0 in
Unix.set_close_on_exec sock ;
Unix.setsockopt sock Unix.SO_REUSEADDR true ;
Unix.bind sock sockaddr ;
Unix.listen sock 5 ;
sock
| Server_fd fd ->
fd
in
let establish_server ?(signal_fds = []) forker sock =
while true do
try
let r, _, _ = Unix.select ([sock] @ signal_fds) [] [] (-1.) in
Expand Down Expand Up @@ -117,7 +91,7 @@ let server handler sock =
try
establish_server ~signal_fds:[status_out]
(handler_by_thread handler)
(Server_fd sock)
sock
with PleaseClose -> debug "Server thread exiting"
)
()
Expand Down
12 changes: 3 additions & 9 deletions ocaml/libs/stunnel/stunnel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,9 @@ module Unsafe = struct

(* File descriptor operations to be performed after a fork.
* These are all safe in the presence of threads *)
type fd_operation =
| Dup2 of Unix.file_descr * Unix.file_descr
| Close of Unix.file_descr

let do_fd_operation = function
| Dup2 (a, b) ->
Unix.dup2 a b
| Close a ->
Unix.close a
type fd_operation = Dup2 of Unix.file_descr * Unix.file_descr

let do_fd_operation = function Dup2 (a, b) -> Unix.dup2 a b
end

type pid =
Expand Down
4 changes: 2 additions & 2 deletions ocaml/xenopsd/xc/device.ml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ module Generic = struct

let is_backend backend_type path =
let affix = Printf.sprintf "backend/%s/" backend_type in
Astring.String.is_infix affix path
Astring.String.is_infix ~affix path

let is_qdisk_or_9pfs x =
let path = Hotplug.path_written_by_hotplug_scripts x in
Expand Down Expand Up @@ -708,7 +708,7 @@ module Vbd_Common = struct
("physical-device", physical_device)
; ("physical-device-path", physical_device_path)
]
| [vdi; tag; security_model; path] ->
| [_vdi; tag; security_model; path] ->
List.iter
(fun (k, v) -> Hashtbl.replace back_tbl k v)
[("security_model", security_model); ("path", path)] ;
Expand Down