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

Re: [Xen-devel] [PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD



Wei Liu writes ("[PATCH for-4.9 2/2] oxenstored: make it work on FreeBSD"):
> Call the uname syscall to determine sysname and return device names
> accordingly.
...
> -let xenstored_proc_kva = "/proc/xen/xsd_kva"
> -let xenstored_proc_port = "/proc/xen/xsd_port"
> +let xenstored_proc_kva =
> +  let info = Unix_syscalls.uname () in
> +  match info.sysname with
> +  | "Linux" -> "/proc/xen/xsd_kva"
> +  | "FreeBSD" -> "/dev/xen/xenstored"
> +  | _ -> "nonexistent"

This isn't very good.  If this code wants to fail, it returns a string
"nonexistent" which would then be used to construct pathnames, and
actually accessed.

In Haskell one could simply leave the default case off, which would
generate a runtime failure.  Is that possible in ocaml ?

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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