1 // $Id: IPC_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/IPC_SAP.h"
5 #include "ace/Log_Msg.h"
6 #include "ace/OS_NS_unistd.h"
7 #include "ace/os_include/os_signal.h"
8 #include "ace/OS_NS_errno.h"
9 #include "ace/OS_NS_fcntl.h"
11 #if !defined (__ACE_INLINE__)
12 #include "ace/IPC_SAP.inl"
13 #endif /* __ACE_INLINE__ */
15 ACE_RCSID(ace
, IPC_SAP
, "$Id: IPC_SAP.cpp 80826 2008-03-04 14:51:23Z wotte $")
17 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
19 ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP
)
22 ACE_IPC_SAP::dump (void) const
24 #if defined (ACE_HAS_DUMP)
25 ACE_TRACE ("ACE_IPC_SAP::dump");
27 ACE_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
28 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("handle_ = %d"), this->handle_
));
29 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("\npid_ = %d"), this->pid_
));
30 ACE_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
31 #endif /* ACE_HAS_DUMP */
34 // Cache for the process ID.
35 pid_t
ACE_IPC_SAP::pid_
= 0;
37 // This is the do-nothing constructor. It does not perform a
38 // ACE_OS::socket system call.
40 ACE_IPC_SAP::ACE_IPC_SAP (void)
41 : handle_ (ACE_INVALID_HANDLE
)
43 // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
47 ACE_IPC_SAP::enable (int value
) const
49 ACE_TRACE ("ACE_IPC_SAP::enable");
51 // First-time in initialization.
52 if (ACE_IPC_SAP::pid_
== 0)
53 ACE_IPC_SAP::pid_
= ACE_OS::getpid ();
55 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
60 // nonblocking argument (1)
63 return ACE_OS::ioctl (this->handle_
,
68 ACE_NOTSUP_RETURN (-1);
70 #else /* ! ACE_WIN32 && ! ACE_VXWORKS */
76 #if defined (F_SETOWN)
77 return ACE_OS::fcntl (this->handle_
,
81 ACE_NOTSUP_RETURN (-1);
87 #if defined (F_SETOWN) && defined (FASYNC)
88 if (ACE_OS::fcntl (this->handle_
,
90 ACE_IPC_SAP::pid_
) == -1
91 || ACE::set_flags (this->handle_
,
96 ACE_NOTSUP_RETURN (-1);
97 #endif /* F_SETOWN && FASYNC */
98 #endif /* SIGIO <== */
101 // Enables the close-on-exec flag.
102 if (ACE_OS::fcntl (this->handle_
,
109 if (ACE::set_flags (this->handle_
,
110 ACE_NONBLOCK
) == ACE_INVALID_HANDLE
)
117 #endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
123 ACE_IPC_SAP::disable (int value
) const
125 ACE_TRACE ("ACE_IPC_SAP::disable");
127 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
131 // nonblocking argument (1)
135 return ACE_OS::ioctl (this->handle_
,
140 ACE_NOTSUP_RETURN (-1);
142 #else /* ! ACE_WIN32 && ! ACE_VXWORKS */
148 #if defined (F_SETOWN)
149 return ACE_OS::fcntl (this->handle_
,
153 ACE_NOTSUP_RETURN (-1);
154 #endif /* F_SETOWN */
159 #if defined (F_SETOWN) && defined (FASYNC)
160 if (ACE_OS::fcntl (this->handle_
,
163 || ACE::clr_flags (this->handle_
,
168 ACE_NOTSUP_RETURN (-1);
169 #endif /* F_SETOWN && FASYNC */
170 #endif /* SIGIO <== */
171 #if defined (F_SETFD)
173 // Disables the close-on-exec flag.
174 if (ACE_OS::fcntl (this->handle_
,
181 if (ACE::clr_flags (this->handle_
,
189 #endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
193 ACE_END_VERSIONED_NAMESPACE_DECL