mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +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,23 +1,17 @@
|
|||
// $Id: Pipe.cpp 96985 2013-04-11 15:50:32Z huangh $
|
||||
|
||||
#include "ace/Pipe.h"
|
||||
#include "ace/SOCK_Acceptor.h"
|
||||
#include "ace/SOCK_Connector.h"
|
||||
#include "ace/Log_Category.h"
|
||||
#include "ace/OS_NS_stdio.h"
|
||||
#include "ace/OS_NS_sys_socket.h"
|
||||
#include "ace/OS_Memory.h"
|
||||
#include "ace/Truncate.h"
|
||||
#include "ace/Malloc_Base.h"
|
||||
|
||||
#if defined (ACE_HAS_STREAM_PIPES) || defined (__QNX__)
|
||||
# include "ace/OS_NS_unistd.h"
|
||||
#endif // ACE_HAS_STREAM_PIPES || __QNX__
|
||||
|
||||
#if defined (ACE_LACKS_LISTEN) && defined (ACE_LACKS_SOCKETPAIR) \
|
||||
&& !defined (ACE_HAS_STREAM_PIPES)
|
||||
# include "ace/OS_NS_time.h"
|
||||
# include "ace/os_include/sys/os_un.h"
|
||||
#endif
|
||||
|
||||
#include "ace/os_include/netinet/os_tcp.h"
|
||||
|
||||
#if !defined (__ACE_INLINE__)
|
||||
|
|
@ -45,41 +39,7 @@ ACE_Pipe::open (int buffer_size)
|
|||
{
|
||||
ACE_TRACE ("ACE_Pipe::open");
|
||||
|
||||
#if defined (ACE_LACKS_LISTEN) && defined (ACE_LACKS_SOCKETPAIR) \
|
||||
&& !defined (ACE_HAS_STREAM_PIPES)
|
||||
ACE_UNUSED_ARG (buffer_size);
|
||||
|
||||
if ((this->handles_[0] = ACE_OS::socket (AF_LOCAL, SOCK_DGRAM, 0)) == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
sockaddr_un addr = {
|
||||
#if defined(ACE_VXWORKS) || defined(__APPLE__)
|
||||
sizeof (sockaddr_un),
|
||||
#endif
|
||||
AF_LOCAL, {}};
|
||||
unsigned seed = static_cast<unsigned> (ACE_OS::time ());
|
||||
ACE_OS::snprintf (addr.sun_path, sizeof addr.sun_path, "/tmp/ACE-Pipe-%d-%p",
|
||||
ACE_OS::rand_r (&seed), this);
|
||||
|
||||
if (ACE_OS::bind (this->handles_[0], (sockaddr*) &addr, sizeof addr) == -1)
|
||||
{
|
||||
this->close ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((this->handles_[1] = ACE_OS::socket (AF_LOCAL, SOCK_DGRAM, 0)) == -1 ||
|
||||
ACE_OS::connect (this->handles_[1], (sockaddr*) &addr, sizeof addr) == -1)
|
||||
{
|
||||
ACE_OS::unlink (addr.sun_path);
|
||||
this->close ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
ACE_OS::unlink (addr.sun_path);
|
||||
|
||||
#elif defined (ACE_LACKS_SOCKETPAIR)
|
||||
#if defined (ACE_LACKS_SOCKETPAIR)
|
||||
ACE_INET_Addr my_addr;
|
||||
ACE_SOCK_Acceptor acceptor;
|
||||
ACE_SOCK_Connector connector;
|
||||
|
|
@ -170,7 +130,7 @@ ACE_Pipe::open (int buffer_size)
|
|||
ACE_TEXT ("pipe")),
|
||||
-1);
|
||||
|
||||
# if !defined(__QNX__)
|
||||
#if !defined(__QNX__)
|
||||
int arg = RMSGN;
|
||||
|
||||
// Enable "msg no discard" mode, which ensures that record
|
||||
|
|
@ -187,7 +147,7 @@ ACE_Pipe::open (int buffer_size)
|
|||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ioctl")), -1);
|
||||
}
|
||||
# endif /* __QNX__ */
|
||||
#endif /* __QNX__ */
|
||||
|
||||
#else /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
|
||||
if (ACE_OS::socketpair (AF_UNIX,
|
||||
|
|
@ -314,7 +274,7 @@ int ACE_Pipe::close_write (void)
|
|||
// the ints (basically, an varargs version of writev). The count N is
|
||||
// the *total* number of trailing arguments, *not* a couple of the
|
||||
// number of tuple pairs!
|
||||
#if !defined (ACE_LACKS_VA_FUNCTIONS)
|
||||
|
||||
ssize_t
|
||||
ACE_Pipe::send (size_t n, ...) const
|
||||
{
|
||||
|
|
@ -325,16 +285,9 @@ ACE_Pipe::send (size_t n, ...) const
|
|||
#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);
|
||||
|
|
@ -356,11 +309,7 @@ ACE_Pipe::send (size_t n, ...) const
|
|||
#endif /* ACE_WIN32 */
|
||||
|
||||
#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;
|
||||
|
|
@ -382,16 +331,9 @@ ACE_Pipe::recv (size_t n, ...) const
|
|||
#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);
|
||||
|
|
@ -413,15 +355,10 @@ ACE_Pipe::recv (size_t n, ...) const
|
|||
#endif /* ACE_WIN32 */
|
||||
|
||||
#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 */
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue