git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@9202 8c455092-636d-4788...
authorsapanb <sapanb@8c455092-636d-4788-adf5-e71def0336e8>
Wed, 30 Apr 2008 06:10:49 +0000 (06:10 +0000)
committersapanb <sapanb@8c455092-636d-4788-adf5-e71def0336e8>
Wed, 30 Apr 2008 06:10:49 +0000 (06:10 +0000)
src/vserver.h [new file with mode: 0644]

diff --git a/src/vserver.h b/src/vserver.h
new file mode 100644 (file)
index 0000000..b2d352e
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef __VSERVER_H__
+#define __VSERVER_H__
+
+#define __NR_vserver 273
+
+#include <sys/syscall.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#define VC_CMD(c, i, v)         (((c & 0x3F) << 24) \
+                                       | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
+#define VC_CMD_GET_VHI_NAME    VC_CMD(2,2,0)
+
+struct vhi_name_struct {
+        uint32_t field;
+        char name[65];
+};
+
+enum vhi_name_field {
+        VHIN_CONTEXT=0,
+        VHIN_SYSNAME,
+        VHIN_NODENAME,
+        VHIN_RELEASE,
+        VHIN_VERSION,
+        VHIN_MACHINE,
+        VHIN_DOMAINNAME,
+};     
+
+uint32_t vserver(uint32_t cmd, uint32_t id, void *data)
+{
+         return syscall(__NR_vserver, cmd, id, data);
+}
+
+uint32_t get_vhi_name(uint32_t xid) {
+       struct vhi_name_struct cmd;
+       cmd.field = VHIN_CONTEXT;
+       vserver(VC_CMD_GET_VHI_NAME, xid, &cmd);
+       return (*((uint32_t *) cmd.name));
+}
+#endif