Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / IO_SAP.cpp
blob1c5fcdf311d234f9125c914b197b32b4de357e26
1 #include "ace/IO_SAP.h"
3 #include "ace/Log_Category.h"
4 #include "ace/OS_NS_unistd.h"
5 #include "ace/OS_NS_errno.h"
6 #include "ace/OS_NS_fcntl.h"
7 #include "ace/os_include/os_signal.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/IO_SAP.inl"
14 #endif /* __ACE_INLINE__ */
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP)
20 // This is the do-nothing constructor. It does not perform a
21 // ACE_OS::open system call.
23 ACE_IO_SAP::ACE_IO_SAP ()
24 : handle_ (ACE_INVALID_HANDLE)
26 ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP");
29 void
30 ACE_IO_SAP::dump () const
32 #if defined (ACE_HAS_DUMP)
33 ACE_TRACE ("ACE_IO_SAP::dump");
35 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
36 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_));
37 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
38 #endif /* ACE_HAS_DUMP */
41 int
42 ACE_IO_SAP::enable (int value) const
44 ACE_TRACE ("ACE_IO_SAP::enable");
46 switch (value)
48 #if defined (SIGURG)
49 case SIGURG:
50 case ACE_SIGURG:
51 #if defined (F_SETOWN)
52 return ACE_OS::fcntl (this->handle_,
53 F_SETOWN,
54 ACE_OS::getpid ());
55 #else
56 ACE_NOTSUP_RETURN (-1);
57 #endif /* F_SETOWN */
58 #endif /* SIGURG */
59 #if defined (SIGIO)
60 case SIGIO:
61 case ACE_SIGIO:
62 #if defined (F_SETOWN) && defined (FASYNC)
63 if (ACE_OS::fcntl (this->handle_,
64 F_SETOWN,
65 ACE_OS::getpid ()) == -1
66 || ACE::set_flags (this->handle_,
67 FASYNC) == -1)
68 return -1;
69 break;
70 #else
71 ACE_NOTSUP_RETURN (-1);
72 #endif /* F_SETOWN && FASYNC */
73 #else // <==
74 ACE_NOTSUP_RETURN (-1);
75 #endif /* SIGIO <== */
76 case ACE_NONBLOCK:
77 if (ACE::set_flags (this->handle_,
78 ACE_NONBLOCK) == -1)
79 return -1;
80 break;
81 default:
82 return -1;
85 return 0;
88 int
89 ACE_IO_SAP::disable (int value) const
91 ACE_TRACE ("ACE_IO_SAP::disable");
93 switch (value)
95 #if defined (SIGURG)
96 case SIGURG:
97 case ACE_SIGURG:
98 #if defined (F_SETOWN)
99 if (ACE_OS::fcntl (this->handle_,
100 F_SETOWN, 0) == -1)
101 return -1;
102 break;
103 #else
104 ACE_NOTSUP_RETURN (-1);
105 #endif /* F_SETOWN */
106 #endif /* SIGURG */
107 #if defined (SIGIO)
108 case SIGIO:
109 case ACE_SIGIO:
110 #if defined (F_SETOWN) && defined (FASYNC)
111 if (ACE_OS::fcntl (this->handle_,
112 F_SETOWN,
113 0) == -1
114 || ACE::clr_flags (this->handle_, FASYNC) == -1)
115 return -1;
116 break;
117 #else
118 ACE_NOTSUP_RETURN (-1);
119 #endif /* F_SETOWN && FASYNC */
120 #else // <==
121 ACE_NOTSUP_RETURN (-1);
122 #endif /* SIGIO <== */
123 case ACE_NONBLOCK:
124 if (ACE::clr_flags (this->handle_,
125 ACE_NONBLOCK) == -1)
126 return -1;
127 break;
128 default:
129 return -1;
131 return 0;
134 ACE_END_VERSIONED_NAMESPACE_DECL