WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

[Xen-users] Programatically checking if we're in a domU or dom0

To: Lutrin Jean <jeanlutrin@xxxxxxxx>
Subject: [Xen-users] Programatically checking if we're in a domU or dom0
From: Andrew Ross <aross@xxxxxxxxxx>
Date: Wed, 04 Oct 2006 13:20:21 +1000
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 03 Oct 2006 20:21:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20061004011241.68356.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Openpgp: id=061CDD57
Organization: Gentoo
References: <20061004011241.68356.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)
Lutrin Jean wrote:


> - what would be a simple way from a shell script
> to detect wether we're inside a domU or a dom0?

The mere existence of /proc/xen is enough to infer that you're in a
paravirtualized Xen domain (as opposed to running under a regular Linux
kernel, for example).

Personally, I use the following command in a startup script to check if
we're in a privileged domain:

grep -qsE '^control_d$' /proc/xen/capabilities

Cheers

Andrew

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>