From: sapanb <sapanb@8c455092-636d-4788-adf5-e71def0336e8>
Date: Wed, 30 Apr 2008 06:10:49 +0000 (+0000)
Subject: git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@9202 8c455092-636d-4788... 
X-Git-Tag: fprobe-ulog-1.1.3-3~31
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3e51c597d3876b9f4bb9d7aa59835f4ec3fab140;p=fprobe-ulog.git

git-svn-id: svn.planet-lab.org/svn/fprobe-ulog/trunk@9202 8c455092-636d-4788-adf5-e71def0336e8
---

diff --git a/src/vserver.h b/src/vserver.h
new file mode 100644
index 0000000..b2d352e
--- /dev/null
+++ b/src/vserver.h
@@ -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