mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Some missing from merge.
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
ec939a5bce
commit
f4be15a7af
1895 changed files with 160408 additions and 53601 deletions
|
|
@ -1,12 +1,11 @@
|
|||
// $Id: FILE_IO.cpp 97355 2013-09-27 22:16:09Z shuston $
|
||||
|
||||
#include "ace/FILE_IO.h"
|
||||
|
||||
#include "ace/Log_Category.h"
|
||||
#include "ace/OS_NS_sys_stat.h"
|
||||
#include "ace/OS_Memory.h"
|
||||
#include "ace/Truncate.h"
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
# include "ace/Malloc_Base.h"
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
#if !defined (__ACE_INLINE__)
|
||||
#include "ace/FILE_IO.inl"
|
||||
|
|
@ -46,26 +45,15 @@ ssize_t
|
|||
ACE_FILE_IO::send (size_t n, ...) const
|
||||
{
|
||||
ACE_TRACE ("ACE_FILE_IO::send");
|
||||
#ifdef ACE_LACKS_VA_FUNCTIONS
|
||||
ACE_UNUSED_ARG (n);
|
||||
ACE_NOTSUP_RETURN (-1);
|
||||
#else
|
||||
va_list argp;
|
||||
int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
|
||||
iovec *iovp = 0;
|
||||
#if defined (ACE_HAS_ALLOCA)
|
||||
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
|
||||
#else
|
||||
# ifdef ACE_HAS_ALLOC_HOOKS
|
||||
ACE_ALLOCATOR_RETURN (iovp, (iovec *)
|
||||
ACE_Allocator::instance ()->malloc (total_tuples *
|
||||
sizeof (iovec)),
|
||||
-1);
|
||||
# else
|
||||
ACE_NEW_RETURN (iovp,
|
||||
iovec[total_tuples],
|
||||
-1);
|
||||
# endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
#endif /* !defined (ACE_HAS_ALLOCA) */
|
||||
|
||||
va_start (argp, n);
|
||||
|
|
@ -80,15 +68,10 @@ ACE_FILE_IO::send (size_t n, ...) const
|
|||
iovp,
|
||||
total_tuples);
|
||||
#if !defined (ACE_HAS_ALLOCA)
|
||||
# ifdef ACE_HAS_ALLOC_HOOKS
|
||||
ACE_Allocator::instance ()->free (iovp);
|
||||
# else
|
||||
delete [] iovp;
|
||||
# endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
#endif /* !defined (ACE_HAS_ALLOCA) */
|
||||
va_end (argp);
|
||||
return result;
|
||||
#endif // ACE_LACKS_VA_FUNCTIONS
|
||||
}
|
||||
|
||||
// This is basically an interface to ACE_OS::readv, that doesn't use
|
||||
|
|
@ -101,26 +84,15 @@ ssize_t
|
|||
ACE_FILE_IO::recv (size_t n, ...) const
|
||||
{
|
||||
ACE_TRACE ("ACE_FILE_IO::recv");
|
||||
#ifdef ACE_LACKS_VA_FUNCTIONS
|
||||
ACE_UNUSED_ARG (n);
|
||||
ACE_NOTSUP_RETURN (-1);
|
||||
#else
|
||||
va_list argp;
|
||||
int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
|
||||
iovec *iovp = 0;
|
||||
#if defined (ACE_HAS_ALLOCA)
|
||||
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
|
||||
#else
|
||||
# ifdef ACE_HAS_ALLOC_HOOKS
|
||||
ACE_ALLOCATOR_RETURN (iovp, (iovec *)
|
||||
ACE_Allocator::instance ()->malloc (total_tuples *
|
||||
sizeof (iovec)),
|
||||
-1);
|
||||
# else
|
||||
ACE_NEW_RETURN (iovp,
|
||||
iovec[total_tuples],
|
||||
-1);
|
||||
# endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
#endif /* !defined (ACE_HAS_ALLOCA) */
|
||||
|
||||
va_start (argp, n);
|
||||
|
|
@ -135,15 +107,10 @@ ACE_FILE_IO::recv (size_t n, ...) const
|
|||
iovp,
|
||||
total_tuples);
|
||||
#if !defined (ACE_HAS_ALLOCA)
|
||||
# ifdef ACE_HAS_ALLOC_HOOKS
|
||||
ACE_Allocator::instance ()->free (iovp);
|
||||
# else
|
||||
delete [] iovp;
|
||||
# endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
#endif /* !defined (ACE_HAS_ALLOCA) */
|
||||
va_end (argp);
|
||||
return result;
|
||||
#endif // ACE_LACKS_VA_FUNCTIONS
|
||||
}
|
||||
|
||||
// Allows a client to read from a file without having to provide a
|
||||
|
|
@ -163,15 +130,9 @@ ACE_FILE_IO::recvv (iovec *io_vec)
|
|||
{
|
||||
// Restrict to max size we can record in iov_len.
|
||||
size_t len = ACE_Utils::truncate_cast<u_long> (length);
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
ACE_ALLOCATOR_RETURN (io_vec->iov_base,
|
||||
static_cast<char*>(ACE_Allocator::instance()->malloc(sizeof(char) * len)),
|
||||
-1);
|
||||
#else
|
||||
ACE_NEW_RETURN (io_vec->iov_base,
|
||||
char[len],
|
||||
-1);
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
io_vec->iov_len = static_cast<u_long> (this->recv_n (io_vec->iov_base,
|
||||
len));
|
||||
return io_vec->iov_len;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue