Lutrin Jean
2006-Oct-05 00:15 UTC
Re: [Xen-users] Programatically checking if we''re in a domU or dom0
Thanks for your answers... But IMHO it''s hacky and error-prone to rely on the name of the host to determine if it''s a domU or a dom0 (or an unmodified kernel) :( I don''t like that much neither changing the name of the kernel :-/ I need to be able to determine, as a normal user (that is: non-root), if I''m running in a domU or not (I can already tell if I''m running on a modified kernel or not by checking /proc/xen). Currently I''m parsing the process in memory and looking for xend. It works here, on the various system I tried. But I don''t know if it would be somehow technically possible to launch a "xend" in a domU (I don''t *want* to do that, I''m simply concerned that it could happen, by mistake), hence my original post, asking if it''s possible to start xend in a domU or not. At the moment, I do this: if (/proc/xen/ exists) --> modified kernel else --> non-modified kernel fi if (modified kernel) if (ps output contains xend) --> dom0 else --> domU fi fi Is parsing the output of ps, looking for xend, *once I know I''ve got a modified kernel*, an acceptable way to differentiate, *as a normal user*, between a dom0 and a domU? Oh well, anyway I think I''ll follow Andrew Ross''s advice of checking for control_d in /proc/xen/capabilities. I''ll just wrap the call to my shell script in an SUID executable (seen that "chmod +s" on a shell script has no effect) so that a non-root user can acces that info. thanks all and tell me if you have a cleaner way to do it, Jean ___________________________________________________________________________ Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet ! Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. http://fr.answers.yahoo.com _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users