summaryrefslogtreecommitdiff
path: root/viengoos
diff options
context:
space:
mode:
authorneal <neal>2008-10-08 16:07:58 +0000
committerneal <neal>2008-10-08 16:07:58 +0000
commit8ab8295384ace533b8f17260b07e74327995658e (patch)
treede8c28bc557b30c28028ef3141b54c05ae00acaf /viengoos
parentdc9064e55f993d79c6ed1ca7093812eaa2fececd (diff)
viengoos/origin
2008-10-08 Neal H. Walfield <neal@gnu.org> * rm.h (enum rm_method_id): Add RM_read. (rm_method_id_string): Handle it. (read): New RPC. * server.c (server_loop): Implement the read RPC. newlib/ 2008-10-08 Neal H. Walfield <neal@gnu.org> * addon/newlib/libc/sys/hurd/readr.c: Include <hurd/rm.h>. (read): Implement.
Diffstat (limited to 'viengoos')
-rw-r--r--viengoos/ChangeLog7
-rw-r--r--viengoos/rm.h6
-rw-r--r--viengoos/server.c24
3 files changed, 36 insertions, 1 deletions
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog
index e3b88a7..a3f14ea 100644
--- a/viengoos/ChangeLog
+++ b/viengoos/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-08 Neal H. Walfield <neal@gnu.org>
+
+ * rm.h (enum rm_method_id): Add RM_read.
+ (rm_method_id_string): Handle it.
+ (read): New RPC.
+ * server.c (server_loop): Implement the read RPC.
+
2008-08-15 Neal H. Walfield <neal@gnu.org>
* server.c (server_loop): In the implementation of cap_read, if
diff --git a/viengoos/rm.h b/viengoos/rm.h
index 04e2a06..366e759 100644
--- a/viengoos/rm.h
+++ b/viengoos/rm.h
@@ -31,6 +31,7 @@
enum rm_method_id
{
RM_write = 100,
+ RM_read,
RM_as_dump,
};
@@ -41,6 +42,8 @@ rm_method_id_string (int id)
{
case RM_write:
return "write";
+ case RM_read:
+ return "read";
case RM_as_dump:
return "as_dump";
case RM_folio_alloc:
@@ -107,6 +110,9 @@ struct io_buffer
/* Echo the character CHR on the manager console. */
RPC_SIMPLE(write, 1, 0, struct io_buffer, io)
+/* Read up to MAX characters from the console's input device. */
+RPC(read, 1, 1, int, max, struct io_buffer, io)
+
/* Dump the address space rooted at ROOT. */
RPC(as_dump, 2, 0, addr_t, principal, addr_t, root)
diff --git a/viengoos/server.c b/viengoos/server.c
index 3b72606..81f5411 100644
--- a/viengoos/server.c
+++ b/viengoos/server.c
@@ -307,7 +307,7 @@ server_loop (void)
if (raise_fault)
{
- DEBUG (4, "fault (ip: %x; fault: %x.%c%s)!",
+ DEBUG (4, "Reflecting fault (ip: %x; fault: %x.%c%s)!",
ip, fault, w ? 'w' : 'r', discarded ? " discarded" : "");
l4_word_t c = _L4_XCHG_REGS_DELIVER;
@@ -527,6 +527,28 @@ server_loop (void)
do_reply = 0;
continue;
}
+ else if (label == RM_read)
+ {
+ int max;
+ err = rm_read_send_unmarshal (&msg, &max);
+ if (err)
+ {
+ debug (0, "Read error!");
+ REPLY (EINVAL);
+ }
+
+ struct io_buffer buffer;
+ buffer.len = 0;
+
+ if (max > 0)
+ {
+ buffer.len = 1;
+ buffer.data[0] = getchar ();
+ }
+
+ rm_read_reply_marshal (&msg, buffer);
+ continue;
+ }
do_reply = 1;