diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-06-19 10:02:20 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-06-19 10:02:20 +0000 |
commit | 49d9cab1f009cc9681bfb3a5d4c275c8c112ee59 (patch) | |
tree | 76eb1f8af05e22115dec5d0d7c2df969b7b215ce | |
parent | 208d2f594574a994cee962d08b2283ea16dec803 (diff) | |
download | ATCD-49d9cab1f009cc9681bfb3a5d4c275c8c112ee59.tar.gz |
ChangeLogTag: Mon Jun 19 09:56:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ace/Acceptor.cpp | 4 | ||||
-rw-r--r-- | ace/OS_NS_sys_sendfile.cpp | 20 | ||||
-rw-r--r-- | ace/Service_Gestalt.cpp | 4 |
4 files changed, 33 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog index 5bb758e187e..226dd43e846 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +Mon Jun 19 09:56:17 UTC 2006 Ossama Othman <ossama_othman@symantec.com> + + * ace/OS_NS_sys_sendfile.cpp (sendfile_emulation): + + Verify the ACE_OS::mmap() call succeeded prior to continuing. + + Use ACE_OS::send() instead of ACE_OS::write() on Windows. The + latter doesn't provide the same semantics on Windows as on + Unix. Addresses an ACE_OS::sendfile() failure on Windows. + Tue Jun 13 02:10:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> - + * tests/run_tests.lst: Don't run netlink test in ACE_FOR_TAO configuration diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index 8dfb0662c49..b439af0930c 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -96,8 +96,8 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open // the <accept> call can hang! this->peer_acceptor_.enable (ACE_NONBLOCK); - int result = reactor->register_handler (this, - ACE_Event_Handler::ACCEPT_MASK); + int const result = reactor->register_handler (this, + ACE_Event_Handler::ACCEPT_MASK); if (result != -1) this->reactor (reactor); else diff --git a/ace/OS_NS_sys_sendfile.cpp b/ace/OS_NS_sys_sendfile.cpp index 79bf827770f..07a34bed45f 100644 --- a/ace/OS_NS_sys_sendfile.cpp +++ b/ace/OS_NS_sys_sendfile.cpp @@ -2,7 +2,12 @@ #include "ace/OS_NS_sys_sendfile.h" #include "ace/OS_NS_sys_mman.h" -#include "ace/OS_NS_unistd.h" + +#if defined (ACE_WIN32) || defined (HPUX) +# include "ace/OS_NS_sys_socket.h" +#else +# include "ace/OS_NS_unistd.h" +#endif /* ACE_WIN32 || HPUX */ #ifndef ACE_HAS_INLINED_OSCALLS # include "ace/OS_NS_sys_sendfile.inl" @@ -17,13 +22,24 @@ ACE_OS::sendfile_emulation (ACE_HANDLE out_fd, off_t * offset, size_t count) { + // @@ Is it possible to inline a call to ::TransmitFile() on + // MS Windows instead of emulating here? + // @@ We may want set up a signal lease (or oplock) if supported by // the platform so that we don't get a bus error if the mmap()ed // file is truncated. void * const buf = - ACE_OS::mmap (0, count, PROT_READ, MAP_PRIVATE, in_fd, *offset); + ACE_OS::mmap (0, count, PROT_READ, MAP_SHARED, in_fd, *offset); + + if (buf == MAP_FAILED) + return -1; +#if defined (ACE_WIN32) || defined (HPUX) + ssize_t const r = + ACE_OS::send (out_fd, static_cast<const char *> (buf), count); +#else ssize_t const r = ACE_OS::write (out_fd, buf, count); +#endif /* ACE_WIN32 */ (void) ACE_OS::munmap (buf, count); diff --git a/ace/Service_Gestalt.cpp b/ace/Service_Gestalt.cpp index 1faae3f607a..53427c4ff7e 100644 --- a/ace/Service_Gestalt.cpp +++ b/ace/Service_Gestalt.cpp @@ -539,8 +539,8 @@ ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf, #endif ACE_Service_Type *srp = 0; - int retv = this->repo_->find (stf->name (), - (const ACE_Service_Type **) &srp); + int const retv = this->repo_->find (stf->name (), + (const ACE_Service_Type **) &srp); // If there is an active service already, it must first be removed, // before it could be re-installed. |