diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/FIFO_Recv_Msg.i | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'ace/FIFO_Recv_Msg.i')
-rw-r--r-- | ace/FIFO_Recv_Msg.i | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ace/FIFO_Recv_Msg.i b/ace/FIFO_Recv_Msg.i new file mode 100644 index 00000000000..7ee7f74ee10 --- /dev/null +++ b/ace/FIFO_Recv_Msg.i @@ -0,0 +1,55 @@ +/* -*- C++ -*- */ +// $Id$ + +// FIFO_Recv_Msg.i + +// Note that the return values mean different things if +// ACE_HAS_STREAM_PIPES vs. if it doesn't... See the manual page on +// getmsg(2) and read(2) for more details. + +inline ssize_t +ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); +#if defined (ACE_HAS_STREAM_PIPES) + int i = 0; + return ACE_OS::getmsg (this->get_handle (), (strbuf *) 0, (strbuf *) &recv_msg, &i); +#else /* Do the ol' 2-read trick... */ + if (ACE_OS::read (this->get_handle (), + (char *) &recv_msg.len, + sizeof recv_msg.len) != sizeof recv_msg.len) + return -1; + else + return ACE_OS::read (this->get_handle (), + (char *) recv_msg.buf, + (int) recv_msg.len); +#endif /* ACE_HAS_STREAM_PIPES */ +} + +inline ssize_t +ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + ACE_Str_Buf recv_msg ((char *) buf, 0, max_len); + + return this->recv (recv_msg); +} + +#if defined (ACE_HAS_STREAM_PIPES) +inline ssize_t +ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, ACE_Str_Buf *cntl, int *flags) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + return ACE_OS::getmsg (this->get_handle (), + (strbuf *) cntl, (strbuf *) data, flags); +} + +inline ssize_t +ACE_FIFO_Recv_Msg::recv (int *band, ACE_Str_Buf *data, ACE_Str_Buf *cntl, int *flags) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + return ACE_OS::getpmsg (this->get_handle (), + (strbuf *) cntl, (strbuf *) data, band, flags); +} + +#endif /* ACE_HAS_STREAM_PIPES */ |