mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2024-10-01 01:05:39 -04:00
revert bc7706cc97
, mirage-xen since 5.0.0 reverted the split of OS into Os_xen
This commit is contained in:
parent
e8f62b8532
commit
c66ee54a9f
@ -4,7 +4,7 @@
|
|||||||
open Lwt.Infix
|
open Lwt.Infix
|
||||||
open Fw_utils
|
open Fw_utils
|
||||||
|
|
||||||
module Netback = Netchannel.Backend.Make(Netchannel.Xenstore.Make(Os_xen.Xs))
|
module Netback = Netchannel.Backend.Make(Netchannel.Xenstore.Make(OS.Xs))
|
||||||
module ClientEth = Ethernet.Make(Netback)
|
module ClientEth = Ethernet.Make(Netback)
|
||||||
|
|
||||||
let src = Logs.Src.create "client_net" ~doc:"Client networking"
|
let src = Logs.Src.create "client_net" ~doc:"Client networking"
|
||||||
|
@ -33,7 +33,7 @@ let main =
|
|||||||
package "mirage-qubes";
|
package "mirage-qubes";
|
||||||
package "mirage-nat" ~min:"1.2.0";
|
package "mirage-nat" ~min:"1.2.0";
|
||||||
package "mirage-logs";
|
package "mirage-logs";
|
||||||
package "mirage-xen" ~min:"4.0.0";
|
package "mirage-xen" ~min:"5.0.0";
|
||||||
]
|
]
|
||||||
"Unikernel.Main" (mclock @-> job)
|
"Unikernel.Main" (mclock @-> job)
|
||||||
|
|
||||||
|
8
dao.ml
8
dao.ml
@ -30,7 +30,7 @@ module VifMap = struct
|
|||||||
end
|
end
|
||||||
|
|
||||||
let directory ~handle dir =
|
let directory ~handle dir =
|
||||||
Os_xen.Xs.directory handle dir >|= function
|
OS.Xs.directory handle dir >|= function
|
||||||
| [""] -> [] (* XenStore client bug *)
|
| [""] -> [] (* XenStore client bug *)
|
||||||
| items -> items
|
| items -> items
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ let vifs ~handle domid =
|
|||||||
| Some device_id ->
|
| Some device_id ->
|
||||||
let vif = { ClientVif.domid; device_id } in
|
let vif = { ClientVif.domid; device_id } in
|
||||||
Lwt.try_bind
|
Lwt.try_bind
|
||||||
(fun () -> Os_xen.Xs.read handle (Printf.sprintf "%s/%d/ip" path device_id))
|
(fun () -> OS.Xs.read handle (Printf.sprintf "%s/%d/ip" path device_id))
|
||||||
(fun client_ip ->
|
(fun client_ip ->
|
||||||
let client_ip = Ipaddr.V4.of_string_exn client_ip in
|
let client_ip = Ipaddr.V4.of_string_exn client_ip in
|
||||||
Lwt.return (Some (vif, client_ip))
|
Lwt.return (Some (vif, client_ip))
|
||||||
@ -61,10 +61,10 @@ let vifs ~handle domid =
|
|||||||
)
|
)
|
||||||
|
|
||||||
let watch_clients fn =
|
let watch_clients fn =
|
||||||
Os_xen.Xs.make () >>= fun xs ->
|
OS.Xs.make () >>= fun xs ->
|
||||||
let backend_vifs = "backend/vif" in
|
let backend_vifs = "backend/vif" in
|
||||||
Log.info (fun f -> f "Watching %s" backend_vifs);
|
Log.info (fun f -> f "Watching %s" backend_vifs);
|
||||||
Os_xen.Xs.wait xs (fun handle ->
|
OS.Xs.wait xs (fun handle ->
|
||||||
begin Lwt.catch
|
begin Lwt.catch
|
||||||
(fun () -> directory ~handle backend_vifs)
|
(fun () -> directory ~handle backend_vifs)
|
||||||
(function
|
(function
|
||||||
|
@ -6,7 +6,7 @@ open Lwt
|
|||||||
let src = Logs.Src.create "memory_pressure" ~doc:"Memory pressure monitor"
|
let src = Logs.Src.create "memory_pressure" ~doc:"Memory pressure monitor"
|
||||||
module Log = (val Logs.src_log src : Logs.LOG)
|
module Log = (val Logs.src_log src : Logs.LOG)
|
||||||
|
|
||||||
let total_pages = Os_xen.MM.Heap_pages.total ()
|
let total_pages = OS.MM.Heap_pages.total ()
|
||||||
let pagesize_kb = Io_page.page_size / 1024
|
let pagesize_kb = Io_page.page_size / 1024
|
||||||
|
|
||||||
let meminfo ~used =
|
let meminfo ~used =
|
||||||
@ -23,7 +23,7 @@ let meminfo ~used =
|
|||||||
|
|
||||||
let report_mem_usage used =
|
let report_mem_usage used =
|
||||||
Lwt.async (fun () ->
|
Lwt.async (fun () ->
|
||||||
let open Os_xen in
|
let open OS in
|
||||||
Xs.make () >>= fun xs ->
|
Xs.make () >>= fun xs ->
|
||||||
Xs.immediate xs (fun h ->
|
Xs.immediate xs (fun h ->
|
||||||
Xs.write h "memory/meminfo" (meminfo ~used)
|
Xs.write h "memory/meminfo" (meminfo ~used)
|
||||||
@ -32,16 +32,16 @@ let report_mem_usage used =
|
|||||||
|
|
||||||
let init () =
|
let init () =
|
||||||
Gc.full_major ();
|
Gc.full_major ();
|
||||||
let used = Os_xen.MM.Heap_pages.used () in
|
let used = OS.MM.Heap_pages.used () in
|
||||||
report_mem_usage used
|
report_mem_usage used
|
||||||
|
|
||||||
let status () =
|
let status () =
|
||||||
let used = Os_xen.MM.Heap_pages.used () |> float_of_int in
|
let used = OS.MM.Heap_pages.used () |> float_of_int in
|
||||||
let frac = used /. float_of_int total_pages in
|
let frac = used /. float_of_int total_pages in
|
||||||
if frac < 0.9 then `Ok
|
if frac < 0.9 then `Ok
|
||||||
else (
|
else (
|
||||||
Gc.full_major ();
|
Gc.full_major ();
|
||||||
let used = Os_xen.MM.Heap_pages.used () in
|
let used = OS.MM.Heap_pages.used () in
|
||||||
report_mem_usage used;
|
report_mem_usage used;
|
||||||
let frac = float_of_int used /. float_of_int total_pages in
|
let frac = float_of_int used /. float_of_int total_pages in
|
||||||
if frac > 0.9 then `Memory_critical
|
if frac > 0.9 then `Memory_critical
|
||||||
|
Loading…
Reference in New Issue
Block a user