[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Help using V1.CLOCK



Hi,

On 2 Sep 2014, at 20:48, Jacob Mitchell <jacob.d.mitchell@xxxxxxxxx> wrote:

> Goal: print the current time to the console; repeat until termination.
> 
> I think I'm close, but when I call "make" the compiled main.ml file
> results in an "Unbound value clock" error. Refer to
> https://gist.github.com/anonymous/90f4107cf5008b12d356 for my source
> code, the main.ml file, and the build log.
> 
> Any pointers? I haven't found any tests or sample code to demonstrate
> how to use non-polymorphic first-class modules like CLOCK, TIME, and
> RANDOM.

It looks to me like a mismatch between the generated code (in main.ml) and the 
mirage-clock code. The other devices (block, network, console) have a ‘connect’ 
function to connect to an instance, but the clock[1] is a singleton. So I think 
we just need to omit all references to “clock” (the instance) in the generated 
fragment:

>>>>
module M1 = Unikernel.Main(Console)(Clock)

let t1 () =
  clock () >>= function
  | `Error e -> fail (Failure "clock")
  | `Ok clock ->
  console1 () >>= function
  | `Error e -> fail (Failure "console1")
  | `Ok console1 ->
  M1.start console1 clock
<<<<

I’ll take a quick look.

Cheers,
Dave

[1] https://github.com/mirage/mirage-clock/blob/master/unix/clock.mli
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.