miragesdk: do not force the creation of pipes when linking with the SDK

Signed-off-by: Thomas Gazagnaire <thomas@gazagnaire.org>
This commit is contained in:
Thomas Gazagnaire
2017-04-03 11:46:50 +02:00
parent 4944652d37
commit 2dbcf99030
4 changed files with 95 additions and 70 deletions

View File

@@ -41,8 +41,10 @@ end
external bpf_filter: unit -> string = "bpf_filter"
let ctl = string_of_int Init.(Fd.to_int Pipe.(calf ctl))
let net = string_of_int Init.(Fd.to_int Pipe.(calf net))
let t = Init.Pipe.v ()
let ctl = string_of_int Init.(Fd.to_int Pipe.(calf @@ ctl t))
let net = string_of_int Init.(Fd.to_int Pipe.(calf @@ net t))
let default_cmd = [
"/dhcp-client-calf"; "--ctl="^ctl; "--net="^net
]
@@ -78,10 +80,10 @@ let read_cmd file =
"/nameservers/*"
] in
Ctl.v "/data" >>= fun ctl ->
let fd = Init.(Fd.fd @@ Pipe.(priv ctl)) in
let fd = Init.(Fd.fd @@ Pipe.(priv @@ ctl t)) in
let ctl () = Ctl.Server.listen ~routes ctl fd in
let handlers () = Handlers.watch path in
Init.run ~net ~ctl ~handlers cmd
Init.run t ~net ~ctl ~handlers cmd
)
(* CLI *)