Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / FIFO_Send_Msg.cpp
blob117d8c96bdbfc6c7b74e7a3b34d33dbf4942cb81
1 #include "ace/FIFO_Send_Msg.h"
3 #include "ace/Log_Category.h"
4 #include "ace/OS_NS_sys_uio.h"
5 #if defined (ACE_HAS_ALLOC_HOOKS)
6 # include "ace/Malloc_Base.h"
7 #endif /* ACE_HAS_ALLOC_HOOKS */
9 #if !defined (__ACE_INLINE__)
10 #include "ace/FIFO_Send_Msg.inl"
11 #endif /* __ACE_INLINE__ */
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg)
17 void
18 ACE_FIFO_Send_Msg::dump () const
20 #if defined (ACE_HAS_DUMP)
21 ACE_TRACE ("ACE_FIFO_Send_Msg::dump");
22 ACE_FIFO_Send::dump ();
23 #endif /* ACE_HAS_DUMP */
26 ssize_t
27 ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
29 // ACE_TRACE ("ACE_FIFO_Send_Msg::send");
30 #if defined (ACE_HAS_STREAM_PIPES)
31 if (ACE_OS::putmsg (this->get_handle (),
32 (strbuf *) 0,
33 (strbuf *) &send_msg,
34 0) == -1)
35 return -1;
36 else
37 return send_msg.len;
38 #else
39 iovec iov[2];
41 iov[0].iov_base = (char *) &send_msg.len;
42 iov[0].iov_len = sizeof send_msg.len;
44 iov[1].iov_base = (char *) send_msg.buf;
45 iov[1].iov_len = static_cast<u_long> (send_msg.len);
47 ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2);
48 if (sent > 0)
49 sent -= iov[0].iov_len; // Don't count the length we added.
50 return sent;
51 #endif /* ACE_HAS_STREAM_PIPES */
54 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg ()
56 // ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
59 int
60 ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
61 int flags,
62 mode_t perms,
63 LPSECURITY_ATTRIBUTES sa)
65 ACE_TRACE ("ACE_FIFO_Send_Msg::open");
66 return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
69 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
70 int flags,
71 mode_t perms,
72 LPSECURITY_ATTRIBUTES sa)
74 ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
75 if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
76 ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Send_Msg")));
79 ACE_END_VERSIONED_NAMESPACE_DECL