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-changelog

[Xen-changelog] Add a new /proc/xen file called 'capabilities'. Currentl

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add a new /proc/xen file called 'capabilities'. Currently, when read in dom0 it will return 'control_d', and be empty when read in a guest. This provides a convenient way to allow the root user to detect whether they're running in a guest or dom0, and e.g. gate whether to start xend. In future, when we add more fine grained capabilities we will add other details into this file.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Dec 2005 11:20:07 +0000
Delivery-date: Thu, 01 Dec 2005 11:20:23 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User iap10@xxxxxxxxxxxxxxxxxxxxx
# Node ID 06c3b8e194d7085693af4af75eea0187be6bf984
# Parent  82f61375cd742d3e944b319f63a7b1e87797c2d6

Add a new /proc/xen file called 'capabilities'. Currently, when read in dom0 it 
will return 'control_d', and be empty when read in a guest. This provides a 
convenient way to allow the root user to detect whether they're running in a 
guest or dom0, and e.g. gate whether to start xend. In future, when we add more 
fine grained capabilities we will add other details into this file.

Signed-off-by: ian@xxxxxxxxxxxxx

diff -r 82f61375cd74 -r 06c3b8e194d7 
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Thu Dec  1 
01:36:46 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c        Thu Dec  1 
01:43:04 2005
@@ -33,6 +33,7 @@
 #include <asm-xen/xen_proc.h>
 
 static struct proc_dir_entry *privcmd_intf;
+static struct proc_dir_entry *capabilities_intf;
 
 static int privcmd_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long data)
@@ -234,12 +235,28 @@
        .mmap  = privcmd_mmap,
 };
 
+static int capabilities_read(char *page, char **start, off_t off,
+                        int count, int *eof, void *data)
+{
+       int len = 0;
+       *page = 0;
+
+       if (xen_start_info->flags & SIF_INITDOMAIN)
+               len = sprintf( page, "control_d\n" );
+
+       *eof = 1;
+       return len;
+}
 
 static int __init privcmd_init(void)
 {
        privcmd_intf = create_xen_proc_entry("privcmd", 0400);
        if (privcmd_intf != NULL)
                privcmd_intf->proc_fops = &privcmd_file_ops;
+
+       capabilities_intf = create_xen_proc_entry("capabilities", 0400 );
+       if (capabilities_intf != NULL)
+               capabilities_intf->read_proc = capabilities_read;
 
        return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add a new /proc/xen file called 'capabilities'. Currently, when read in dom0 it will return 'control_d', and be empty when read in a guest. This provides a convenient way to allow the root user to detect whether they're running in a guest or dom0, and e.g. gate whether to start xend. In future, when we add more fine grained capabilities we will add other details into this file., Xen patchbot -unstable <=