aboutsummaryrefslogtreecommitdiffstats
path: root/tools/examples
diff options
context:
space:
mode:
authoriap10@striker.cl.cam.ac.uk <iap10@striker.cl.cam.ac.uk>2003-12-11 18:49:45 +0000
committeriap10@striker.cl.cam.ac.uk <iap10@striker.cl.cam.ac.uk>2003-12-11 18:49:45 +0000
commit49802797ebe9bf6591eba2e93895dd8efe0c7c4e (patch)
treea2c8640d771ec2a325c6eab3c0efdb2c636e17f1 /tools/examples
parent673a94644e7135013592a29b0d5de0835d11ad3f (diff)
downloadxen-49802797ebe9bf6591eba2e93895dd8efe0c7c4e.tar.gz
xen-49802797ebe9bf6591eba2e93895dd8efe0c7c4e.tar.bz2
xen-49802797ebe9bf6591eba2e93895dd8efe0c7c4e.zip
bitkeeper revision 1.647 (3fd8bc49qQxDHkfovcYSBfQ4p0Fpfg)
Add Mark Williamson's readxenconsolering.py example script which reads Xen's console out of the buffer ring, making Xen's boot messages available from within domain 0.
Diffstat (limited to 'tools/examples')
-rw-r--r--tools/examples/readxenconsolering.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/examples/readxenconsolering.py b/tools/examples/readxenconsolering.py
new file mode 100644
index 0000000000..0e9305a1f3
--- /dev/null
+++ b/tools/examples/readxenconsolering.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2003 by Intel Research Cambridge
+
+# File: tools/examples/readconsolering.py
+# Author: Mark A Williamson (mark.a.williamson@intel.com)
+# Date: 2003-12-02
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+
+"""Reads out the contents of the console ring
+
+Usage: readconsolering.py [-c]
+The -c option causes the contents to be cleared.
+"""
+
+import sys, Xc # import the Xc Xen Control module
+
+xc = Xc.new() # get a new instance of the control interface
+
+clear_buffer = False
+
+if sys.argv[1:] != []:
+ if sys.argv[1] == "-c":
+ clear_buffer = True
+ else:
+ print >> sys.stderr, "Usage: " + sys.argv[0] + """ [-c]
+ Reads the contents of the console buffer.
+ (specifying -c will also clear current contents)"""
+
+# Get the console ring's contents as a string and print it out.
+# If argument to readconsolering is true then the buffer is cleared as well as
+# fetching the (pre-clearing) contents.
+print xc.readconsolering(clear_buffer)