diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2010-06-25 16:27:36 -0500 |
---|---|---|
committer | Patrick Williams <iawillia@us.ibm.com> | 2010-06-25 16:27:36 -0500 |
commit | e9a3562d6a5cf88e6034570ab791e91e63ffb14a (patch) | |
tree | 8f3d0727b431f81d6f8b70195ddd8d37b6c3e8e6 /src/lib/syscall_msg.C | |
parent | 8085c7634979f38c1b152d0a35b98c2447ce497a (diff) | |
download | talos-hostboot-e9a3562d6a5cf88e6034570ab791e91e63ffb14a.tar.gz talos-hostboot-e9a3562d6a5cf88e6034570ab791e91e63ffb14a.zip |
Add shell of VFS for registering and resolving message queue names.
Diffstat (limited to 'src/lib/syscall_msg.C')
-rw-r--r-- | src/lib/syscall_msg.C | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/lib/syscall_msg.C b/src/lib/syscall_msg.C index 774ddb0bb..66eaa1679 100644 --- a/src/lib/syscall_msg.C +++ b/src/lib/syscall_msg.C @@ -1,12 +1,11 @@ #include <sys/msg.h> #include <sys/syscall.h> +#include <sys/vfs.h> #include <string.h> using namespace Systemcalls; -const char* VFS_ROOT = "/"; // TODO. - msg_q_t msg_q_create() { return (msg_q_t) _syscall0(MSGQ_CREATE); @@ -17,7 +16,7 @@ int msg_q_destroy(msg_q_t q) return (int64_t)_syscall1(MSGQ_DESTROY, q); } -int msg_q_register(msg_q_t q, char* name) +int msg_q_register(msg_q_t q, const char* name) { if (0 == strcmp(VFS_ROOT, name)) { @@ -25,12 +24,17 @@ int msg_q_register(msg_q_t q, char* name) } else { - // TODO. - return -1; + msg_q_t vfsQ = (msg_q_t)_syscall0(MSGQ_RESOLVE_ROOT); + msg_t* msg = msg_allocate(); + msg->type = VFS_MSG_REGISTER_MSGQ; + msg->extra_data = (void*) name; + int rc = msg_sendrecv(vfsQ, msg); + msg_free(msg); + return rc; } } -msg_q_t msg_q_resolve(char* name) +msg_q_t msg_q_resolve(const char* name) { if (0 == strcmp(VFS_ROOT, name)) { @@ -38,8 +42,14 @@ msg_q_t msg_q_resolve(char* name) } else { - // TODO. - return NULL; + msg_q_t vfsQ = (msg_q_t)_syscall0(MSGQ_RESOLVE_ROOT); + msg_t* msg = msg_allocate(); + msg->type = VFS_MSG_RESOLVE_MSGQ; + msg->extra_data = (void*) name; + msg_sendrecv(vfsQ, msg); + msg_q_t rc = (msg_q_t) msg->data[0]; + msg_free(msg); + return rc; } } |