diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-02 08:46:29 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-02 08:46:29 +0000 |
commit | e3097005652a2f9fbb1c54f5604c96deb003cc33 (patch) | |
tree | 21d8395ae53a863d1687d2c858067c1ba78ab369 | |
parent | e18ff12c8e08df2e24b8d07913d868616539da6f (diff) | |
download | ATCD-e3097005652a2f9fbb1c54f5604c96deb003cc33.tar.gz |
*** empty log message ***
-rw-r--r-- | ace/MEM_Acceptor.cpp | 34 | ||||
-rw-r--r-- | ace/MEM_Acceptor.h | 23 | ||||
-rw-r--r-- | ace/MEM_Acceptor.i | 18 | ||||
-rw-r--r-- | ace/MEM_Connector.cpp | 4 | ||||
-rw-r--r-- | ace/MEM_SAP.cpp | 15 | ||||
-rw-r--r-- | ace/Malloc_T.cpp | 2 |
6 files changed, 72 insertions, 24 deletions
diff --git a/ace/MEM_Acceptor.cpp b/ace/MEM_Acceptor.cpp index c2414f1093c..ee2d1ac7349 100644 --- a/ace/MEM_Acceptor.cpp +++ b/ace/MEM_Acceptor.cpp @@ -21,16 +21,24 @@ ACE_MEM_Acceptor::dump (void) const // Do nothing routine for constructor. ACE_MEM_Acceptor::ACE_MEM_Acceptor (void) + : mmap_prefix_ (0) { ACE_TRACE ("ACE_MEM_Acceptor::ACE_MEM_Acceptor"); } +ACE_MEM_Acceptor::~ACE_MEM_Acceptor (void) +{ + ACE_TRACE ("ACE_MEM_Acceptor::~ACE_MEM_Acceptor"); + delete[] this->mmap_prefix_; +} + // General purpose routine for performing server ACE_SOCK creation. ACE_MEM_Acceptor::ACE_MEM_Acceptor (const u_short local_port, int reuse_addr, int backlog, int protocol) + : mmap_prefix_ (0) { ACE_TRACE ("ACE_MEM_Acceptor::ACE_MEM_Acceptor"); if (this->open (local_port, @@ -64,7 +72,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, u_short *remote_port, ACE_Time_Value *timeout, int restart, - int reset_new_handle) const + int reset_new_handle) { ACE_TRACE ("ACE_MEM_Acceptor::accept"); @@ -96,15 +104,27 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, reset_new_handle) == -1) return -1; - char buf [MAXPATHLEN]; + ASYS_TCHAR buf [MAXPATHLEN]; ACE_INET_Addr local_addr; if (new_stream.get_local_addr (local_addr) == -1) return -1; - // @@ Need to make the filename prefix configurable. Perhaps we - // should have something like ACE_MEM_Addr? - ACE_OS::sprintf (buf, "MEM_Acceptor_%d_", local_addr.get_port_number ()); - char unique [MAXPATHLEN]; + if (this->mmap_prefix_ != 0) + { + ACE_OS::sprintf (buf, + ASYS_TEXT ("%s_%d_"), + this->mmap_prefix_, + local_addr.get_port_number ()); + } + else + { + ACE_OS::sprintf (buf, + ASYS_TEXT ("%s%cMEM_Acceptor_%d_"), + ACE_OS::getenv (ASYS_TEXT (ACE_DEFAULT_TEMP_DIR_ENV)), + ACE_DIRECTORY_SEPARATOR_CHAR, + local_addr.get_port_number ()); + } + ASYS_TCHAR unique [MAXPATHLEN]; ACE_OS::unique_name (&new_stream, unique, MAXPATHLEN); ACE_OS::strcat (buf, unique); @@ -112,7 +132,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, ACE_OS::unlink (buf); // Now set up the shared memory malloc pool. - if (new_stream.create_shm_malloc (buf) == -1) + if (new_stream.create_shm_malloc (buf, &this->malloc_options_) == -1) return -1; // @@ Need to handle timeout here. diff --git a/ace/MEM_Acceptor.h b/ace/MEM_Acceptor.h index 1c9fddd10c9..3e008dc9481 100644 --- a/ace/MEM_Acceptor.h +++ b/ace/MEM_Acceptor.h @@ -44,6 +44,9 @@ public: ACE_MEM_Acceptor (void); // Default constructor. + ~ACE_MEM_Acceptor (void); + // destructor. + ACE_MEM_Acceptor (const u_short local_port, int reuse_addr = 0, int backlog = ACE_DEFAULT_BACKLOG, @@ -64,7 +67,7 @@ public: u_short * = 0, ACE_Time_Value *timeout = 0, int restart = 1, - int reset_new_handle = 0) const; + int reset_new_handle = 0); // Accept a new data transfer connection. int shared_accept_finish (ACE_MEM_Stream new_stream, @@ -73,6 +76,19 @@ public: // Perform operations that must occur after <ACE_OS::accept> is // called. + const ASYS_TCHAR *mmap_prefix (void) const; + void mmap_prefix (ASYS_TCHAR *prefix); + // Accessor/mutator of mmap filename prefix. By default, the + // <mmap_prefix_> is not set and the mmap filename is + // ${(TMP|TEMP)}//ACE_MEM_Acceptor_(port-number)_(&stream), + // otherwise, it is <mmap_prefix_>_(port-number)_(&stream), + // <mmap_prefix_> should include _absolute_ path so the connector + // within the same host can located the mmap file. + // Example: /tmp/mmapfile + + ACE_MEM_SAP::MALLOC_OPTIONS& malloc_options (void); + // Accessor to the mmap options. + // = Meta-type info typedef u_short PEER_ADDR; typedef ACE_MEM_Stream PEER_STREAM; @@ -112,6 +128,11 @@ protected: ACE_Time_Value *timeout = 0, int restart = 1, int reset_new_handle = 0) const; + +private: + ASYS_TCHAR *mmap_prefix_; + + ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_; }; #if defined (__ACE_INLINE__) diff --git a/ace/MEM_Acceptor.i b/ace/MEM_Acceptor.i index 63190298626..96ea55ce4c7 100644 --- a/ace/MEM_Acceptor.i +++ b/ace/MEM_Acceptor.i @@ -51,3 +51,21 @@ ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream, return this->ACE_SOCK_Acceptor::accept (new_stream, qos_params, remote_addr, timeout, restart, reset_new_handle); } + +ASYS_INLINE const ASYS_TCHAR * +ACE_MEM_Acceptor::mmap_prefix (void) const +{ + return this->mmap_prefix_; +} + +ASYS_INLINE void +ACE_MEM_Acceptor::mmap_prefix (ASYS_TCHAR *prefix) +{ + this->mmap_prefix_ = ACE::strnew (prefix); +} + +ASYS_INLINE ACE_MEM_SAP::MALLOC_OPTIONS & +ACE_MEM_Acceptor::malloc_options (void) +{ + return this->malloc_options_; +} diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index 94957e85d52..fa4ff630eb7 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -102,7 +102,9 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, if (ACE::recv (new_handle, buf, buf_len) == -1) return -1; - if (new_stream.create_shm_malloc (buf) == -1) + ACE_MEM_SAP::MALLOC_OPTIONS options; + + if (new_stream.create_shm_malloc (buf, &options) == -1) return -1; return 0; diff --git a/ace/MEM_SAP.cpp b/ace/MEM_SAP.cpp index e84c5b917ca..cba5047aa9e 100644 --- a/ace/MEM_SAP.cpp +++ b/ace/MEM_SAP.cpp @@ -40,25 +40,12 @@ ACE_MEM_SAP::create_shm_malloc (const char *name, if (this->shm_malloc_ != 0) return -1; // already initialized. - int delete_options = 0; - - if (options == 0) - { - delete_options = 1; - ACE_NEW_RETURN (options, - MALLOC_OPTIONS (), - -1); - } - auto_ptr<MALLOC_OPTIONS> safe_options (options); - ACE_NEW_RETURN (this->shm_malloc_, MALLOC (name, - name, + 0, options), -1); - if (delete_options == 0) - safe_options.release (); return 0; } diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index 8c6733ed215..8fa17ae8a93 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -61,7 +61,7 @@ ACE_Allocator_Adapter<MALLOC>::~ACE_Allocator_Adapter (void) template <class MALLOC> void ACE_Allocator_Adapter<MALLOC>::print_stats (void) const { - ACE_TRACE ("ACE_Malloc_T<MALLOC>::print_stats"); + ACE_TRACE ("ACE_Allocator_Adaptor<MALLOC>::print_stats"); this->allocator_.print_stats (); } #endif /* ACE_HAS_MALLOC_STATS */ |