/usr/include/ace/Handle_Set.inl is in libace-dev 6.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 183 184 185 186 187 188 189 190 191 192 193 | // -*- C++ -*-
//
// $Id: Handle_Set.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Log_Msg.h"
// todo: This should be cleaned up a bit.
// memset for FD_ZERO on OpenBSD and Solaris w/ gcc 2.95.3
#include "ace/os_include/os_string.h"
// FreeBSD 4.8-RC? for bzero() used by FD_ZERO
#include "ace/os_include/os_strings.h"
// IRIX5 defines bzero() in this odd file... used by FD_ZERO
#if defined (ACE_HAS_BSTRING)
# include /**/ <bstring.h>
#endif /* ACE_HAS_BSTRING */
// AIX defines bzero() in this odd file... used by FD_ZERO
#if defined (ACE_HAS_STRINGS)
# include "ace/os_include/os_strings.h"
#endif /* ACE_HAS_STRINGS */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Initialize the bitmask to all 0s and reset the associated fields.
ACE_INLINE void
ACE_Handle_Set::reset (void)
{
ACE_TRACE ("ACE_Handle_Set::reset");
this->max_handle_ =
ACE_INVALID_HANDLE;
#if defined (ACE_HAS_BIG_FD_SET)
this->min_handle_ =
NUM_WORDS * WORDSIZE;
#endif /* ACE_HAS_BIG_FD_SET */
this->size_ = 0;
// #if !defined (ACE_HAS_BIG_FD_SET) Why is this here? -Steve Huston
FD_ZERO (&this->mask_);
// #endif /* ACE_HAS_BIG_FD_SET */
}
#if defined (ACE_HAS_BIG_FD_SET)
ACE_INLINE ACE_Handle_Set &
ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs)
{
ACE_TRACE ("ACE_Handle_Set::operator =");
if (rhs.size_ > 0)
{
this->size_ =
rhs.size_;
this->max_handle_ =
rhs.max_handle_;
this->min_handle_ =
rhs.min_handle_;
this->mask_ =
rhs.mask_;
}
else
this->reset ();
return *this;
}
#endif /* ACE_HAS_BIG_FD_SET */
// Returns the number of the large bit.
ACE_INLINE ACE_HANDLE
ACE_Handle_Set::max_set (void) const
{
ACE_TRACE ("ACE_Handle_Set::max_set");
return this->max_handle_;
}
// Checks whether handle is enabled.
ACE_INLINE int
ACE_Handle_Set::is_set (ACE_HANDLE handle) const
{
ACE_TRACE ("ACE_Handle_Set::is_set");
#if defined (ACE_HAS_BIG_FD_SET)
return FD_ISSET (handle,
&this->mask_)
&& this->size_ > 0;
#elif defined (ACE_HAS_NONCONST_FD_ISSET)
return FD_ISSET (handle,
const_cast<fd_set*> (&this->mask_));
#else
return FD_ISSET (handle,
&this->mask_);
#endif /* ACE_HAS_BIG_FD_SET */
}
// Enables the handle.
ACE_INLINE void
ACE_Handle_Set::set_bit (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Handle_Set::set_bit");
if ((handle != ACE_INVALID_HANDLE)
&& (!this->is_set (handle)))
{
#if defined (ACE_WIN32)
FD_SET ((SOCKET) handle,
&this->mask_);
++this->size_;
#else /* ACE_WIN32 */
#if defined (ACE_HAS_BIG_FD_SET)
if (this->size_ == 0)
FD_ZERO (&this->mask_);
if (handle < this->min_handle_)
this->min_handle_ = handle;
#endif /* ACE_HAS_BIG_FD_SET */
FD_SET (handle,
&this->mask_);
++this->size_;
if (handle > this->max_handle_)
this->max_handle_ = handle;
#endif /* ACE_WIN32 */
}
}
// Disables the handle.
ACE_INLINE void
ACE_Handle_Set::clr_bit (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Handle_Set::clr_bit");
if ((handle != ACE_INVALID_HANDLE) &&
(this->is_set (handle)))
{
FD_CLR ((ACE_SOCKET) handle,
&this->mask_);
--this->size_;
#if !defined (ACE_WIN32)
if (handle == this->max_handle_)
this->set_max (this->max_handle_);
#endif /* !ACE_WIN32 */
}
}
// Returns a count of the number of enabled bits.
ACE_INLINE int
ACE_Handle_Set::num_set (void) const
{
ACE_TRACE ("ACE_Handle_Set::num_set");
#if defined (ACE_WIN32)
return this->mask_.fd_count;
#else /* !ACE_WIN32 */
return this->size_;
#endif /* ACE_WIN32 */
}
// Returns a pointer to the underlying fd_set.
ACE_INLINE
ACE_Handle_Set::operator fd_set *()
{
ACE_TRACE ("ACE_Handle_Set::operator fd_set *");
if (this->size_ > 0)
return (fd_set *) &this->mask_;
else
return (fd_set *) 0;
}
// Returns a pointer to the underlying fd_set.
ACE_INLINE fd_set *
ACE_Handle_Set::fdset (void)
{
ACE_TRACE ("ACE_Handle_Set::fdset");
if (this->size_ > 0)
return (fd_set *) &this->mask_;
else
return (fd_set *) 0;
}
ACE_INLINE
ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
|