1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
// $Id$
#include "ace/IPC_SAP.h"
#include "ace/Log_Msg.h"
#if defined (ACE_LACKS_INLINE_FUNCTIONS)
#include "ace/IPC_SAP.i"
#endif
ACE_RCSID(ace, IPC_SAP, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP)
void
ACE_IPC_SAP::dump (void) const
{
ACE_TRACE ("ACE_IPC_SAP::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handle_ = %d"), this->handle_));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %d"), this->pid_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
// Cache for the process ID.
pid_t ACE_IPC_SAP::pid_ = 0;
// This is the do-nothing constructor. It does not perform a
// ACE_OS::socket system call.
ACE_IPC_SAP::ACE_IPC_SAP (void)
: handle_ (ACE_INVALID_HANDLE)
{
// ACE_TRACE ("ACE_IPC_SAP::ACE_IPC_SAP");
}
int
ACE_IPC_SAP::enable (int value) const
{
ACE_TRACE ("ACE_IPC_SAP::enable");
// First-time in initialization.
if (ACE_IPC_SAP::pid_ == 0)
ACE_IPC_SAP::pid_ = ACE_OS::getpid ();
#if defined (ACE_WIN32) || defined (VXWORKS)
switch (value)
{
case ACE_NONBLOCK:
{
// nonblocking argument (1)
// blocking: (0)
u_long nonblock = 1;
return ACE_OS::ioctl (this->handle_,
FIONBIO,
&nonblock);
}
default:
ACE_NOTSUP_RETURN (-1);
}
#else /* ! ACE_WIN32 && ! VXWORKS */
switch (value)
{
#if defined (SIGURG)
case SIGURG:
case ACE_SIGURG:
#if defined (F_SETOWN)
return ACE_OS::fcntl (this->handle_,
F_SETOWN,
ACE_IPC_SAP::pid_);
#else
ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
case SIGIO:
case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
if (ACE_OS::fcntl (this->handle_,
F_SETOWN,
ACE_IPC_SAP::pid_) == -1
|| ACE_Flag_Manip::set_flags (this->handle_,
FASYNC) == -1)
return -1;
break;
#else
ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#endif /* SIGIO <== */
#if defined (F_SETFD)
case ACE_CLOEXEC:
// Enables the close-on-exec flag.
if (ACE_OS::fcntl (this->handle_,
F_SETFD,
1) == -1)
return -1;
break;
#endif /* F_SETFD */
case ACE_NONBLOCK:
if (ACE_Flag_Manip::set_flags (this->handle_,
ACE_NONBLOCK) == ACE_INVALID_HANDLE)
return -1;
break;
default:
return -1;
}
return 0;
#endif /* ! ACE_WIN32 && ! VXWORKS */
/* NOTREACHED */
}
int
ACE_IPC_SAP::disable (int value) const
{
ACE_TRACE ("ACE_IPC_SAP::disable");
#if defined (ACE_WIN32) || defined (VXWORKS)
switch (value)
{
case ACE_NONBLOCK:
// nonblocking argument (1)
// blocking: (0)
{
u_long nonblock = 0;
return ACE_OS::ioctl (this->handle_,
FIONBIO,
&nonblock);
}
default:
ACE_NOTSUP_RETURN (-1);
}
#else /* ! ACE_WIN32 && ! VXWORKS */
switch (value)
{
#if defined (SIGURG)
case SIGURG:
case ACE_SIGURG:
#if defined (F_SETOWN)
return ACE_OS::fcntl (this->handle_,
F_SETOWN,
0);
#else
ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
case SIGIO:
case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
if (ACE_OS::fcntl (this->handle_,
F_SETOWN,
0) == -1
|| ACE_Flag_Manip::clr_flags (this->handle_,
FASYNC) == -1)
return -1;
break;
#else
ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#endif /* SIGIO <== */
#if defined (F_SETFD)
case ACE_CLOEXEC:
// Disables the close-on-exec flag.
if (ACE_OS::fcntl (this->handle_,
F_SETFD,
0) == -1)
return -1;
break;
#endif /* F_SETFD */
case ACE_NONBLOCK:
if (ACE_Flag_Manip::clr_flags (this->handle_,
ACE_NONBLOCK) == -1)
return -1;
break;
default:
return -1;
}
return 0;
#endif /* ! ACE_WIN32 && ! VXWORKS */
/* NOTREACHED */
}
|