Use override/default for RTPortableServer
[ACE_TAO.git] / ACE / ace / FIFO.cpp
blob3fa295e8d2d7ae281df430ddf24dfc7ebfe7c0aa
1 #include "ace/FIFO.h"
3 #if !defined (__ACE_INLINE__)
4 #include "ace/FIFO.inl"
5 #endif /* __ACE_INLINE__ */
7 #include "ace/Log_Category.h"
8 #include "ace/OS_NS_string.h"
9 #include "ace/OS_NS_errno.h"
10 #include "ace/OS_NS_sys_stat.h"
11 #include "ace/OS_NS_fcntl.h"
12 #if defined (ACE_HAS_ALLOC_HOOKS)
13 # include "ace/Malloc_Base.h"
14 #endif /* ACE_HAS_ALLOC_HOOKS */
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO)
20 void
21 ACE_FIFO::dump () const
23 #if defined (ACE_HAS_DUMP)
24 ACE_TRACE ("ACE_FIFO::dump");
26 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
27 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("rendezvous_ = %s"), this->rendezvous_));
28 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
29 #endif /* ACE_HAS_DUMP */
32 int
33 ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms,
34 LPSECURITY_ATTRIBUTES sa)
36 ACE_TRACE ("ACE_FIFO::open");
37 ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN);
39 if ((flags & O_CREAT) != 0
40 && ACE_OS::mkfifo (this->rendezvous_, perms) == -1
41 && !(errno == EEXIST))
42 return -1;
44 this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa));
45 return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
48 ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name,
49 int flags,
50 mode_t perms,
51 LPSECURITY_ATTRIBUTES sa)
53 ACE_TRACE ("ACE_FIFO::ACE_FIFO");
54 if (this->open (fifo_name, flags, perms, sa) == -1)
55 ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO")));
58 ACE_FIFO::ACE_FIFO ()
60 // ACE_TRACE ("ACE_FIFO::ACE_FIFO");
63 int
64 ACE_FIFO::close ()
66 ACE_TRACE ("ACE_FIFO::close");
67 int result = 0;
69 if (this->get_handle () != ACE_INVALID_HANDLE)
71 result = ACE_OS::close (this->get_handle ());
72 this->set_handle (ACE_INVALID_HANDLE);
74 return result;
77 ACE_END_VERSIONED_NAMESPACE_DECL