aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-07-17 09:13:56 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-07-17 09:13:56 +0000
commit405bd4170ebcb054da8aa6cb9ca8549c8a9faa31 (patch)
tree948b66b8c7e6301e1795919d7ccc05765c59fd2b
parentfa3e395ae6efa68851e7a0bb50ee791c74ca491d (diff)
downloadxen-405bd4170ebcb054da8aa6cb9ca8549c8a9faa31.tar.gz
xen-405bd4170ebcb054da8aa6cb9ca8549c8a9faa31.tar.bz2
xen-405bd4170ebcb054da8aa6cb9ca8549c8a9faa31.zip
bitkeeper revision 1.359 (3f1668d45SYPQy-7cLNFlIKxyY1X8w)
add mkdevnodes and read_console_udp to tools/misc
-rw-r--r--.rootkeys2
-rwxr-xr-xtools/misc/mkdevnodes21
-rw-r--r--tools/misc/read_console_udp.c53
3 files changed, 76 insertions, 0 deletions
diff --git a/.rootkeys b/.rootkeys
index 6f2251a212..d663280b4b 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -140,6 +140,8 @@
3eb781fd7211MZsLxJSiuy7W4KnJXg tools/internal/xi_vifinit
3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/enable_nat
3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/enable_nat.README
+3f1668d4-FUY6Enc7MB3GcwUtfJ5HA tools/misc/mkdevnodes
+3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/read_console_udp.c
3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile
3ddb79bcCa2VbsMp7mWKlhgwLQUQGA xen/README
3ddb79bcWnTwYsQRWl_PaneJfa6p0w xen/Rules.mk
diff --git a/tools/misc/mkdevnodes b/tools/misc/mkdevnodes
new file mode 100755
index 0000000000..c29208fa6a
--- /dev/null
+++ b/tools/misc/mkdevnodes
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+BASE=${1:?"base directory missing (eg. /dev)"}
+
+rm -f ${BASE}/xhd[abcdefghijklmnop]*
+rm -f ${BASE}/xsd[abcdefghijklmnop]*
+rm -f ${BASE}/xvd[abcdefghijklmnop]*
+
+# XLVIRT is 16 devices of 15 partitions
+
+LETTERS="a b c d e f g h i j k l m n o p"
+PARTITIONS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
+
+j=0
+for l in ${LETTERS}; do
+ mknod ${BASE}/xvd${l} b 125 ${j}
+ for i in ${PARTITIONS}; do
+ mknod ${BASE}/xvd${l}${i} b 125 $(($i+$j))
+ done
+ j=$(($j+16))
+done
diff --git a/tools/misc/read_console_udp.c b/tools/misc/read_console_udp.c
new file mode 100644
index 0000000000..632b01ad9a
--- /dev/null
+++ b/tools/misc/read_console_udp.c
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * Test program for reading console lines from DOM0 port 666.
+ */
+
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(void)
+{
+ unsigned char buf[208], abuf[32];
+ struct sockaddr_in addr, from;
+ int fromlen = sizeof(from);
+ int len, fd = socket(PF_INET, SOCK_DGRAM, 0);
+
+ if ( fd < 0 )
+ {
+ fprintf(stderr, "could not open datagram socket\n");
+ return -1;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_addr.s_addr = htonl(0xa9fe0100); /* 169.254.1.0 */
+ addr.sin_port = htons(666);
+ addr.sin_family = AF_INET;
+ if ( bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0 )
+ {
+ fprintf(stderr, "could not bind to local address and port\n");
+ return -1;
+ }
+
+ while ( (len = recvfrom(fd, buf, sizeof(buf), 0,
+ (struct sockaddr *)&from, &fromlen))
+ >= 0 )
+ {
+ printf("%d-byte message from %s:%d --\n", len,
+ inet_ntop(AF_INET, &from.sin_addr, abuf, sizeof(abuf)),
+ ntohs(from.sin_port));
+
+ /* For sanity, clean up the string's tail. */
+ if ( buf[len-1] != '\n' ) { buf[len] = '\n'; len++; }
+ buf[len] = '\0';
+
+ printf("%s", buf);
+
+ fromlen = sizeof(from);
+ }
+
+ return 0;
+}