From e4100ec889827188e26e1463bd4b50a7a1ee0540 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Expect the sysname field to always be 'Linux' --- uname/virt_uname.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/uname/virt_uname.ml b/uname/virt_uname.ml index 14a8bcc..fff6d7f 100644 --- a/uname/virt_uname.ml +++ b/uname/virt_uname.ml @@ -49,16 +49,20 @@ let () = with Not_found -> str in + (* Expect the first (sysname) field to always be "Linux", which is + * also a good way to tell if we're synchronized to the right bit of + * memory. + *) bitmatch bs with - | { sysname : 65*8 : string; + | { "Linux\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" : 65*8 : string; nodename : 65*8 : string; release : 65*8 : string; version : 65*8 : string; machine : 65*8 : string; domainname : 65*8 : string } -> - printf "%s: %s %s %s %s %s %s\n" + printf "%s: Linux %s %s %s %s %s\n" name - (truncate sysname) (truncate nodename) (truncate release) + (truncate nodename) (truncate release) (truncate version) (truncate machine) (truncate domainname) | { _ } -> eprintf (f_"%s: unexpected system_utsname in kernel image\n") -- 1.8.3.1