/usr/include/ace/Handle_Gobbler.inl is in libace-dev 6.2.8+dfsg-1.
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 | // -*- C++ -*-
//
// $Id: Handle_Gobbler.inl 90388 2010-06-02 15:27:59Z vzykov $
// Since this is only included in Handle_Gobbler.h, these should be
// inline, not ACE_INLINE.
// FUZZ: disable check_for_inline
#include "ace/ACE.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_fcntl.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
inline void
ACE_Handle_Gobbler::close_remaining_handles (void)
{
ACE_Handle_Set_Iterator iter (this->handle_set_);
for (ACE_HANDLE h = iter (); h != ACE_INVALID_HANDLE; h = iter ())
ACE_OS::close (h);
}
inline
ACE_Handle_Gobbler::~ACE_Handle_Gobbler (void)
{
this->close_remaining_handles ();
}
inline int
ACE_Handle_Gobbler::free_handles (size_t n_handles)
{
ACE_Handle_Set_Iterator iter (this->handle_set_);
for (ACE_HANDLE h = iter ();
h != ACE_INVALID_HANDLE && n_handles > 0;
--n_handles, h = iter ())
ACE_OS::close (h);
return 0;
}
inline int
ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available)
{
int result = 0;
#if defined(ACE_WIN32)
// On Win32, this style of gobbling doesn't seem to work.
ACE_UNUSED_ARG(n_handles_to_keep_available);
#else
while (1)
{
ACE_HANDLE handle = ACE_OS::open (ACE_DEV_NULL, O_WRONLY);
if (handle == ACE_INVALID_HANDLE)
{
if (ACE::out_of_handles (errno))
{
result = this->free_handles (n_handles_to_keep_available);
break;
}
else
{
result = -1;
break;
}
}
if (handle >= static_cast<ACE_HANDLE>(FD_SETSIZE))
break;
this->handle_set_.set_bit (handle);
}
#endif /* ACE_WIN32 */
return result;
}
ACE_END_VERSIONED_NAMESPACE_DECL
|