diff options
author | neal <neal> | 2008-01-15 10:40:46 +0000 |
---|---|---|
committer | neal <neal> | 2008-01-15 10:40:46 +0000 |
commit | 8596032ca1a6ca09c674e37092439d8f977b9041 (patch) | |
tree | fd2401e4f2a177e91ab4a5c89aa2485dbc6a424d /hurd/rpc.h | |
parent | 96fefd41ff33efe49cc886419fcd14433134fbb9 (diff) |
2008-01-15 Neal H. Walfield <neal@gnu.org>
* rpc.h (RPC_REPLY_): New macro.
(RPC_SIMPLE): Generate reply stubs.
(RPC): Likewise.
Diffstat (limited to 'hurd/rpc.h')
-rw-r--r-- | hurd/rpc.h | 34 |
1 files changed, 31 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* rpc.h - RPC template definitions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. Written by Neal H. Walfield <neal@gnu.org>. This file is part of the GNU Hurd. @@ -643,6 +643,30 @@ (&msg, RPC_ARGUMENTS (ocount, \ RPC_CHOP (icount, ##__VA_ARGS__))), \ (&msg)); \ + } \ + +/* Generate stubs for marshalling a reply and sending it (without + blocking). */ +#define RPC_REPLY_(id, icount, ocount, ...) \ + static inline error_t \ + RPC_CONCAT (RPC_STUB_PREFIX_(id), _reply) \ + (l4_thread_id_t tid RPC_IF_COMMA (ocount) () \ + RPC_GRAB2 (, ocount, RPC_CHOP (icount, ##__VA_ARGS__))) \ + { \ + l4_msg_tag_t tag; \ + l4_msg_t msg; \ + \ + RPC_CONCAT (RPC_STUB_PREFIX_(id), _reply_marshal) \ + (&msg RPC_IF_COMMA (ocount) () \ + RPC_ARGUMENTS(ocount, RPC_CHOP (icount, __VA_ARGS__))); \ + \ + l4_msg_load (msg); \ + l4_accept (L4_UNTYPED_WORDS_ACCEPTOR); \ + \ + tag = l4_reply (tid); \ + if (l4_ipc_failed (tag)) \ + return EHOSTDOWN; \ + return 0; \ } /* RPC template. ID is the method name, ARGS is the list of arguments @@ -657,13 +681,17 @@ \ RPC_SIMPLE_(, id, icount, ocount, ##__VA_ARGS__) \ RPC_SIMPLE_(_send, id, icount, ocount, ##__VA_ARGS__) \ - RPC_(_call, id, icount, ocount, ##__VA_ARGS__) + RPC_(_call, id, icount, ocount, ##__VA_ARGS__) \ + \ + RPC_REPLY_(id, icount, ocount, ##__VA_ARGS__) #define RPC(id, icount, ocount, ...) \ RPC_MARSHAL_GEN_(id, icount, ocount, ##__VA_ARGS__) \ \ RPC_(, id, icount, ocount, ##__VA_ARGS__) \ RPC_SIMPLE_(_send, id, icount, ocount, ##__VA_ARGS__) \ - RPC_(_call, id, icount, ocount, ##__VA_ARGS__) + RPC_(_call, id, icount, ocount, ##__VA_ARGS__) \ + \ + RPC_REPLY_(id, icount, ocount, ##__VA_ARGS__) #endif |