Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / IPC_SAP.cpp
bloba7a0aa3efc6a80525b6d99abb58aa8db032177da
1 #include "ace/IPC_SAP.h"
3 #include "ace/Log_Category.h"
4 #include "ace/OS_NS_unistd.h"
5 #include "ace/os_include/os_signal.h"
6 #include "ace/OS_NS_errno.h"
7 #include "ace/OS_NS_fcntl.h"
8 #if defined (ACE_HAS_ALLOC_HOOKS)
9 # include "ace/Malloc_Base.h"
10 #endif /* ACE_HAS_ALLOC_HOOKS */
12 #if !defined (__ACE_INLINE__)
13 #include "ace/IPC_SAP.inl"
14 #endif /* __ACE_INLINE__ */
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP)
20 void
21 ACE_IPC_SAP::dump () const
23 #if defined (ACE_HAS_DUMP)
24 ACE_TRACE ("ACE_IPC_SAP::dump");
26 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
27 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_));
28 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
29 #endif /* ACE_HAS_DUMP */
32 // This is the do-nothing constructor. It does not perform a
33 // ACE_OS::socket system call.
35 ACE_IPC_SAP::ACE_IPC_SAP ()
36 : handle_ (ACE_INVALID_HANDLE)
38 // ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
41 int
42 ACE_IPC_SAP::enable (int value) const
44 ACE_TRACE ("ACE_IPC_SAP::enable");
46 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
47 switch (value)
49 case ACE_NONBLOCK:
51 // nonblocking argument (1)
52 // blocking: (0)
53 int nonblock = 1;
54 return ACE_OS::ioctl (this->handle_,
55 FIONBIO,
56 &nonblock);
58 default:
59 ACE_NOTSUP_RETURN (-1);
61 #else /* ! ACE_WIN32 && ! ACE_VXWORKS */
62 switch (value)
64 #if defined (SIGURG)
65 case SIGURG:
66 case ACE_SIGURG:
67 #if defined (F_SETOWN)
68 return ACE_OS::fcntl (this->handle_,
69 F_SETOWN,
70 ACE_OS::getpid ());
71 #else
72 ACE_NOTSUP_RETURN (-1);
73 #endif /* F_SETOWN */
74 #endif /* SIGURG */
75 #if defined (SIGIO)
76 case SIGIO:
77 case ACE_SIGIO:
78 #if defined (F_SETOWN) && defined (FASYNC)
79 if (ACE_OS::fcntl (this->handle_,
80 F_SETOWN,
81 ACE_OS::getpid ()) == -1
82 || ACE::set_flags (this->handle_,
83 FASYNC) == -1)
84 return -1;
85 break;
86 #else
87 ACE_NOTSUP_RETURN (-1);
88 #endif /* F_SETOWN && FASYNC */
89 #endif /* SIGIO <== */
90 #if defined (F_SETFD)
91 case ACE_CLOEXEC:
92 // Enables the close-on-exec flag.
93 if (ACE_OS::fcntl (this->handle_,
94 F_SETFD,
95 1) == -1)
96 return -1;
97 break;
98 #endif /* F_SETFD */
99 case ACE_NONBLOCK:
100 if (ACE::set_flags (this->handle_,
101 ACE_NONBLOCK) == ACE_INVALID_HANDLE)
102 return -1;
103 break;
104 default:
105 return -1;
107 return 0;
108 #endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
110 /* NOTREACHED */
114 ACE_IPC_SAP::disable (int value) const
116 ACE_TRACE ("ACE_IPC_SAP::disable");
118 #if defined (ACE_WIN32) || defined (ACE_VXWORKS)
119 switch (value)
121 case ACE_NONBLOCK:
122 // nonblocking argument (1)
123 // blocking: (0)
125 int nonblock = 0;
126 return ACE_OS::ioctl (this->handle_,
127 FIONBIO,
128 &nonblock);
130 default:
131 ACE_NOTSUP_RETURN (-1);
133 #else /* ! ACE_WIN32 && ! ACE_VXWORKS */
134 switch (value)
136 #if defined (SIGURG)
137 case SIGURG:
138 case ACE_SIGURG:
139 #if defined (F_SETOWN)
140 return ACE_OS::fcntl (this->handle_,
141 F_SETOWN,
143 #else
144 ACE_NOTSUP_RETURN (-1);
145 #endif /* F_SETOWN */
146 #endif /* SIGURG */
147 #if defined (SIGIO)
148 case SIGIO:
149 case ACE_SIGIO:
150 #if defined (F_SETOWN) && defined (FASYNC)
151 if (ACE_OS::fcntl (this->handle_,
152 F_SETOWN,
153 0) == -1
154 || ACE::clr_flags (this->handle_,
155 FASYNC) == -1)
156 return -1;
157 break;
158 #else
159 ACE_NOTSUP_RETURN (-1);
160 #endif /* F_SETOWN && FASYNC */
161 #endif /* SIGIO <== */
162 #if defined (F_SETFD)
163 case ACE_CLOEXEC:
164 // Disables the close-on-exec flag.
165 if (ACE_OS::fcntl (this->handle_,
166 F_SETFD,
167 0) == -1)
168 return -1;
169 break;
170 #endif /* F_SETFD */
171 case ACE_NONBLOCK:
172 if (ACE::clr_flags (this->handle_,
173 ACE_NONBLOCK) == -1)
174 return -1;
175 break;
176 default:
177 return -1;
179 return 0;
180 #endif /* ! ACE_WIN32 && ! ACE_VXWORKS */
181 /* NOTREACHED */
184 ACE_END_VERSIONED_NAMESPACE_DECL