Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / FIFO_Recv.cpp
blob2fd920b13a2f72c9d6d57508da0bcc15587199d8
1 #include "ace/FIFO_Recv.h"
2 #include "ace/Log_Category.h"
3 #include "ace/OS_NS_fcntl.h"
4 #if defined (ACE_HAS_ALLOC_HOOKS)
5 # include "ace/Malloc_Base.h"
6 #endif /* ACE_HAS_ALLOC_HOOKS */
8 #if !defined (__ACE_INLINE__)
9 #include "ace/FIFO_Recv.inl"
10 #endif /* __ACE_INLINE__ */
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv)
16 void
17 ACE_FIFO_Recv::dump () const
19 #if defined (ACE_HAS_DUMP)
20 ACE_TRACE ("ACE_FIFO_Recv::dump");
21 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
22 ACE_FIFO::dump ();
23 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_));
24 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
25 #endif /* ACE_HAS_DUMP */
28 int
29 ACE_FIFO_Recv::close ()
31 ACE_TRACE ("ACE_FIFO_Recv::close");
32 int result = ACE_FIFO::close ();
34 if (this->aux_handle_ != ACE_INVALID_HANDLE)
35 return ACE_OS::close (this->aux_handle_);
36 else
37 return result;
40 // Note that persistent means "open fifo for writing, as well as
41 // reading." This ensures that the fifo never gets EOF, even if there
42 // aren't any writers at the moment!
44 int
45 ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name,
46 int flags,
47 mode_t perms,
48 int persistent,
49 LPSECURITY_ATTRIBUTES sa)
51 ACE_TRACE ("ACE_FIFO_Recv::open");
53 if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1)
54 return -1;
55 else if (this->disable (ACE_NONBLOCK) == -1)
56 return -1;
57 else if (persistent
58 && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE)
59 return -1;
60 else
61 return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
64 ACE_FIFO_Recv::ACE_FIFO_Recv ()
65 : aux_handle_ (ACE_INVALID_HANDLE)
67 ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
70 ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name,
71 int flags,
72 mode_t perms,
73 int persistent,
74 LPSECURITY_ATTRIBUTES sa)
75 : aux_handle_ (ACE_INVALID_HANDLE)
77 ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
79 if (this->ACE_FIFO_Recv::open (fifo_name,
80 flags,
81 perms,
82 persistent,
83 sa) == -1)
84 ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv")));
87 ACE_END_VERSIONED_NAMESPACE_DECL