This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
6
unikernel/duniverse/mirage-mtime/.gitignore
vendored
Normal file
6
unikernel/duniverse/mirage-mtime/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
_build
|
||||
*.install
|
||||
.merlin
|
||||
duniverse
|
||||
*.locked
|
||||
_esy
|
||||
4
unikernel/duniverse/mirage-mtime/.ocamlformat
Normal file
4
unikernel/duniverse/mirage-mtime/.ocamlformat
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
version = 0.27.0
|
||||
profile = conventional
|
||||
|
||||
parse-docstrings = true
|
||||
92
unikernel/duniverse/mirage-mtime/CHANGES.md
Normal file
92
unikernel/duniverse/mirage-mtime/CHANGES.md
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
### v5.2.0 (2025-09-01)
|
||||
|
||||
* Add support for unikraft (#1 @shym @fabbing @Firobe)
|
||||
|
||||
### v5.1.0 (2025-08-24)
|
||||
|
||||
* mirage-mtime.mock: add a `val Mirage_mtime_set.reset : unit -> unit` function,
|
||||
required by moby/vpnkit (#2 @hannesm)
|
||||
|
||||
### v5.0.0 (2025-01-30)
|
||||
|
||||
* Renamed to mirage-mtime (from mirage-clock), only the MCLOCK part
|
||||
* use "dune variants" for the different implementations
|
||||
|
||||
### v4.2.0 (2022-03-27)
|
||||
|
||||
* Rename the freestanding toolchain to solo5 (@dinosaure, #51)
|
||||
* Use ocamlformat (@samoht, #54)
|
||||
|
||||
### v4.1.0 (2022-02-01)
|
||||
|
||||
* Be able to build & instal the distribution via `opam` without the expected `dune`'s context (@TheLortex, @dinosaure, #49)
|
||||
|
||||
### v4.0.0 (2021-11-15)
|
||||
|
||||
* Remove Mirage_clock_lwt module (#48 @hannesm)
|
||||
* Use caml_get_wall_clock instead of unix_gettime to avoid floating point
|
||||
conversion roundtrip (#47 @hannesm)
|
||||
|
||||
### v3.1.0 (2020-11-19)
|
||||
|
||||
* Use implicit executable dependency for discover.exe
|
||||
into the dune file (#46 @TheLortex)
|
||||
* Fix cross-compilation on Android (#45 @EduardoRFS)
|
||||
|
||||
### v3.0.1 (2019-11-04)
|
||||
|
||||
* provide deprecated Mirage_clock_lwt for smooth transition (#44 @hannesm)
|
||||
|
||||
### v3.0.0 (2019-10-21)
|
||||
|
||||
* remove mirage-clock-lwt (#43 @hannesm)
|
||||
* mirage-clock is no device anymore, drop lwt dependency (#43 @hannesm)
|
||||
* raise lower OCaml bound to 4.06.0 (#43 @hannesm)
|
||||
|
||||
### v2.0.0 (2018-12-27)
|
||||
|
||||
* Constrain the clock type `t` to `unit` to improve compatability with
|
||||
the webmachine CLOCK interface. All current implementations satisfy
|
||||
this interface so there shouldn't be an issue, but bumping the
|
||||
library major version number to reflect the interface change (#38 @hannesm)
|
||||
|
||||
* Port library to Dune from jbuilder and use `dune-release` and the builtin
|
||||
`dune.configurator` to reduce the build dependency cone (#39 @avsm).
|
||||
|
||||
* Remove unused variable warnings (#39 @avsm).
|
||||
|
||||
* Update opam package metadata to 2.0 format (#39 @avsm).
|
||||
|
||||
* Fixes to the ocamldoc comment headers for odoc compatibility (@avsm)
|
||||
|
||||
### v1.4.1 (2018-08-03)
|
||||
|
||||
* mirage-clock-unix: fix integer overflow on 32 bit (#37, @mattgray)
|
||||
|
||||
### v1.4.0 (2017-07-25)
|
||||
|
||||
* Add support for windows to `mirage-clock-unix` (#32, @fdopen and @samoht)
|
||||
|
||||
### v1.3.0 (2017-06-19)
|
||||
|
||||
* port to Jbuilder
|
||||
|
||||
### v1.2.0 (2016-12-21)
|
||||
|
||||
* import `V1.MCLOCK` and `V1.PCLOCK` from `mirage-types` under `mirage-clock`
|
||||
and `mirage-clock-lwt`
|
||||
|
||||
### v1.1.0 (2015-01-05)
|
||||
|
||||
* xen: pure OCaml implementation of `Clock.gmtime`
|
||||
|
||||
### v1.0.0 (2013-12-07)
|
||||
|
||||
* Remove unnecessary cstruct dependency.
|
||||
* Install ocamlfind packages as `mirage-clock-xen` and `mirage-clock-unix`.
|
||||
* Fix META file descriptions.
|
||||
* Add Travis tests.
|
||||
|
||||
### v0.9.9 (2013-12-05)
|
||||
|
||||
* Initial public release, based on mirage/mirage-platform#0.9.8
|
||||
14
unikernel/duniverse/mirage-mtime/LICENSE.md
Normal file
14
unikernel/duniverse/mirage-mtime/LICENSE.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Copyright (c) 2010 Anil Madhavapeddy <anil@recoil.org>
|
||||
2014 Daniel C. Bünzli
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
19
unikernel/duniverse/mirage-mtime/Makefile
Normal file
19
unikernel/duniverse/mirage-mtime/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
.PHONY: build clean test
|
||||
|
||||
build:
|
||||
dune build @install
|
||||
|
||||
test:
|
||||
dune runtest
|
||||
|
||||
install:
|
||||
dune install
|
||||
|
||||
uninstall:
|
||||
dune uninstall
|
||||
|
||||
doc:
|
||||
dune build @doc
|
||||
|
||||
clean:
|
||||
dune clean
|
||||
13
unikernel/duniverse/mirage-mtime/README.md
Normal file
13
unikernel/duniverse/mirage-mtime/README.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
## mirage-mtime -- libraries for a monotonic clock
|
||||
|
||||
This library implements portable support for an operating system timesource
|
||||
that is compatible with the [MirageOS](https://mirageos.org) library interfaces
|
||||
found in: <https://github.com/mirage/mirage>
|
||||
|
||||
It implements a `Mirage_mtime` module that represents a monotonic timesource
|
||||
since an arbitrary point.
|
||||
|
||||
The following sources are used:
|
||||
|
||||
* The Unix version uses [Mtime_clock](https://erratique.ch/software/mtime),
|
||||
* The freestanding version uses the paravirtual clock source from the hypervisor.
|
||||
3
unikernel/duniverse/mirage-mtime/dune-project
Normal file
3
unikernel/duniverse/mirage-mtime/dune-project
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(lang dune 2.8)
|
||||
(name mirage-mtime)
|
||||
(version v5.2.0)
|
||||
4
unikernel/duniverse/mirage-mtime/lib_test/dune
Normal file
4
unikernel/duniverse/mirage-mtime/lib_test/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(test
|
||||
(name portable)
|
||||
(package mirage-mtime)
|
||||
(libraries mirage-mtime))
|
||||
14
unikernel/duniverse/mirage-mtime/lib_test/portable.ml
Normal file
14
unikernel/duniverse/mirage-mtime/lib_test/portable.ml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
let print_mtime c =
|
||||
Printf.printf "Monotonic clock says: %Ld nanoseconds\n"
|
||||
(Mirage_mtime.elapsed_ns c)
|
||||
|
||||
let print_period_mono c =
|
||||
match Mirage_mtime.period_ns c with
|
||||
| Some ns ->
|
||||
Printf.printf "The monotonic clock period is: %Ld nanoseconds\n" ns
|
||||
| None -> Printf.printf "Monotonic clock period unavailable\n"
|
||||
|
||||
let () =
|
||||
print_mtime ();
|
||||
print_mtime ();
|
||||
print_period_mono ()
|
||||
29
unikernel/duniverse/mirage-mtime/mirage-mtime.opam
Normal file
29
unikernel/duniverse/mirage-mtime/mirage-mtime.opam
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
version: "5.2.0"
|
||||
opam-version: "2.0"
|
||||
maintainer: "hannes@mehnert.org"
|
||||
authors: ["Anil Madhavapeddy" "Daniel C. Bünzli" "Matthew Gray" "Hannes Mehnert"]
|
||||
license: "ISC"
|
||||
tags: "org:mirage"
|
||||
homepage: "https://github.com/mirage/mirage-mtime"
|
||||
doc: "https://mirage.github.io/mirage-mtime/"
|
||||
bug-reports: "https://github.com/mirage/mirage-mtime/issues"
|
||||
synopsis: "Libraries and module types for a monotonic clock"
|
||||
description: """
|
||||
This library implements portable support for an operating system timesource
|
||||
that is compatible with the [MirageOS](https://mirageos.org) library interfaces
|
||||
found in: <https://github.com/mirage/mirage>
|
||||
|
||||
It implements a monotonic timesource since an arbitrary point.
|
||||
"""
|
||||
depends: [
|
||||
"ocaml" {>= "4.08.0"}
|
||||
"dune" {>= "2.8"}
|
||||
"mtime" {>= "2.0.0"}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
["dune" "build" "-p" name "-j" jobs]
|
||||
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
||||
]
|
||||
dev-repo: "git+https://github.com/mirage/mirage-mtime.git"
|
||||
x-maintenance-intent: [ "(latest)" ]
|
||||
11
unikernel/duniverse/mirage-mtime/mock/dune
Normal file
11
unikernel/duniverse/mirage-mtime/mock/dune
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(library
|
||||
(name mirage_mtime_set)
|
||||
(public_name mirage-mtime.set)
|
||||
(modules mirage_mtime_set))
|
||||
|
||||
(library
|
||||
(name mirage_mtime_mock)
|
||||
(public_name mirage-mtime.mock)
|
||||
(implements mirage-mtime)
|
||||
(libraries mirage-mtime.set)
|
||||
(modules mirage_mtime))
|
||||
18
unikernel/duniverse/mirage-mtime/mock/mirage_mtime.ml
Normal file
18
unikernel/duniverse/mirage-mtime/mock/mirage_mtime.ml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(*
|
||||
* Copyright (c) 2015 Matt Gray <matthew.thomas.gray@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*)
|
||||
|
||||
let elapsed_ns () = !Mirage_mtime_set.now
|
||||
let period_ns () = None
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
let now = ref 0L
|
||||
let tick () = now := Int64.add !now 1L
|
||||
let tick_for v = now := Int64.add !now v
|
||||
let reset () = now := 0L
|
||||
4
unikernel/duniverse/mirage-mtime/solo5/dune
Normal file
4
unikernel/duniverse/mirage-mtime/solo5/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(library
|
||||
(name mirage_mtime_solo5)
|
||||
(public_name mirage-mtime.solo5)
|
||||
(implements mirage-mtime))
|
||||
20
unikernel/duniverse/mirage-mtime/solo5/mirage_mtime.ml
Normal file
20
unikernel/duniverse/mirage-mtime/solo5/mirage_mtime.ml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
(*
|
||||
* Copyright (c) 2015 Matt Gray <matthew.thomas.gray@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*)
|
||||
|
||||
(* C stub implemented in mirage-solo5 *)
|
||||
external elapsed_ns : unit -> int64 = "caml_get_monotonic_time"
|
||||
|
||||
let period_ns () = None
|
||||
5
unikernel/duniverse/mirage-mtime/src/dune
Normal file
5
unikernel/duniverse/mirage-mtime/src/dune
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(library
|
||||
(name mirage_mtime)
|
||||
(public_name mirage-mtime)
|
||||
(virtual_modules mirage_mtime)
|
||||
(default_implementation mirage-mtime.unix))
|
||||
27
unikernel/duniverse/mirage-mtime/src/mirage_mtime.mli
Normal file
27
unikernel/duniverse/mirage-mtime/src/mirage_mtime.mli
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(*
|
||||
* Copyright (c) 2015 Matt Gray <matthew.thomas.gray@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*)
|
||||
(** {2 Monotonic clock}
|
||||
|
||||
Clock returning monotonic time since an arbitrary point. To be used for e.g.
|
||||
profiling. *)
|
||||
|
||||
val elapsed_ns : unit -> int64
|
||||
(** [elapsed_ns ()] is a monotonically increasing count of nanoseconds elapsed
|
||||
since some arbitrary point *)
|
||||
|
||||
val period_ns : unit -> int64 option
|
||||
(** [period_ns ()] is [Some ns] representing the clock's nanosecond period [ns],
|
||||
if known *)
|
||||
7
unikernel/duniverse/mirage-mtime/unikraft/dune
Normal file
7
unikernel/duniverse/mirage-mtime/unikraft/dune
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(library
|
||||
(name mirage_mtime_unikraft)
|
||||
(public_name mirage-mtime.unikraft)
|
||||
(implements mirage-mtime)
|
||||
(foreign_stubs
|
||||
(language c)
|
||||
(names stubs)))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(* C stub implemented in mirage-unikraft *)
|
||||
external elapsed_ns : unit -> int64 = "caml_get_monotonic_time"
|
||||
external uk_time_tick_ns : unit -> int64 = "uk_time_tick_ns"
|
||||
|
||||
let elapsed_ns () = elapsed_ns ()
|
||||
let period_ns () = Some (uk_time_tick_ns ())
|
||||
15
unikernel/duniverse/mirage-mtime/unikraft/stubs.c
Normal file
15
unikernel/duniverse/mirage-mtime/unikraft/stubs.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifdef __Unikraft__
|
||||
|
||||
#include <caml/alloc.h>
|
||||
#include <caml/mlvalues.h>
|
||||
#include <caml/memory.h>
|
||||
#include <uk/plat/time.h>
|
||||
|
||||
value uk_time_tick_ns(void)
|
||||
{
|
||||
CAMLparam0();
|
||||
|
||||
CAMLreturn(caml_copy_int64(UKPLAT_TIME_TICK_NSEC));
|
||||
}
|
||||
|
||||
#endif
|
||||
5
unikernel/duniverse/mirage-mtime/unix/dune
Normal file
5
unikernel/duniverse/mirage-mtime/unix/dune
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(library
|
||||
(name mirage_mtime_unix)
|
||||
(public_name mirage-mtime.unix)
|
||||
(implements mirage-mtime)
|
||||
(libraries mtime.clock.os))
|
||||
17
unikernel/duniverse/mirage-mtime/unix/mirage_mtime.ml
Normal file
17
unikernel/duniverse/mirage-mtime/unix/mirage_mtime.ml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(*
|
||||
* Copyright (c) 2015 Matt Gray <matthew.thomas.gray@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*)
|
||||
|
||||
include Mtime_clock
|
||||
Loading…
Add table
Add a link
Reference in a new issue