diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-03-28 02:33:27 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-03-28 02:33:27 +0000 |
commit | ef4497bff2b2f8174e7e86a57ca4a4920fe0f39d (patch) | |
tree | cdd24e07476f49f1f8582d17e795760f4220672a | |
parent | 316df31de5019b8ae60daf55f3f99968bbbe02c0 (diff) | |
download | ATCD-ef4497bff2b2f8174e7e86a57ca4a4920fe0f39d.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-97a | 223 | ||||
-rw-r--r-- | ace/Connector.h | 5 | ||||
-rw-r--r-- | ace/OS.cpp | 170 | ||||
-rw-r--r-- | ace/OS.h | 108 | ||||
-rw-r--r-- | ace/OS.i | 180 | ||||
-rw-r--r-- | ace/SPIPE_Connector.h | 4 | ||||
-rw-r--r-- | ace/SPIPE_Stream.h | 3 | ||||
-rw-r--r-- | ace/Stream_Modules.cpp | 2 | ||||
-rw-r--r-- | ace/Stream_Modules.h | 2 | ||||
-rw-r--r-- | ace/Svc_Handler.cpp | 6 | ||||
-rw-r--r-- | ace/Task_T.cpp | 2 | ||||
-rw-r--r-- | ace/config-hpux-10.x-aCC.h | 6 |
12 files changed, 484 insertions, 227 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index b49f67628fe..b8c5537e75f 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,5 +1,36 @@ Thu Mar 27 14:10:39 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + * ace/OS.h: Added two new accessors to ACE_Time_Value: + + operator timeval *() const; + // Returns a pointer to the object as a timeval. + + const operator timeval *() const; + // Returns a pointer to the object as a timeval. + + Thanks to Carlos O'Ryan <coryan@mat.puc.cl> for this suggestion. + + * ace/OS.i (ACE_Time_Value): Inlined many of the ACE_Time_Value + accessors. + + * ace/OS.h: Reimplemented ACE_Str_Buf at + + struct ACE_Export ACE_Str_Buf : public strbuf + { + // = Initialization method + ACE_Str_Buf(void* b = 0, int l = 0, int max = 0); + // Constructor. + }; + + this makes the casting from ACE_Str_Buf* to strbuf* a "safe" + cast and makes it more portable (say on platforms where the + fields in strbuf are not in the right order). Thanks to Carlos + O'Ryan <coryan@mat.puc.cl> for this fix. + + * ace/OS.h: Moved the definition of imr_multiaddr to just before + class ACE_OS so that it picks everything up appropriately. + Thanks to Hakan Kallberg <hk@simulina.se> for reporting this. + * ace/config-aix-4.[12].x.h and config-mvs.h: Fixed the ACE_HAS_MULTICAST macros, which should have said ACE_HAS_IP_MULTICAST. Thanks to Daniel Montalibet @@ -126,6 +157,100 @@ Tue Mar 25 10:01:05 1997 Chris Cleeland <cleeland@cs.wustl.edu> * platform_linux.GNU: Added -ldl to LIBS. Thanks to alex@aureus.sublink.org (Sandro Doro) for the change. +Tue Mar 25 16:01:34 1997 Carlos O'Ryan <coryan@charlie> + + * ace/Svc_Handler.cpp: + I forgot to comment this: "operator delete" used to call ::delete + on a void*, on ANSI/C++ this is not allowed. Since "operator new" + calls ::new for a char[] I do a casting to char* and call + ::delete[] on the char pointer. + + * ace/config-hpux-10.x-aCC.h: + HP-UX 10.10 supports CLOCK_GETTIME, my guess is that it should + work with g++ and HP/C++, but I won't mess with those files yet. + + * ace/Connector.h: + The default address parameter for "connect" is a bit tricky, from + the comments in the file: + // + // If the compiler supports 'typename' we cannot use + // + // PEER_CONNECTOR::PEER_ADDR::sap_any + // + // because PEER_CONNECTOR::PEER_ADDR is not considered a + // type. But: + // + // typename PEER_CONNECTOR::PEER_ADDR::sap_any + // + // will not work either, because now we are declaring sap_any a + // type, further: + // + // (typename PEER_CONNECTOR::PEER_ADDR)::sap_any + // + // is considered a casting expression. All I can think of is + // using a typedef, I tried PEER_ADDR but that was a source of + // trouble on some platforms. I will try: + // + typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; + + * ace/OS.h: + The stock HP C++ compiler (cfront based) gives lots of warnings in + <net/if.h>. I used to define volatile to avoid this warnings. Now + I think I'll rather like to see them. + + * ace/SPIPE_Stream.h: + * ace/SPIPE_Connector.h: + There was no meta-type info (PEER_ADDR) for SPIPE_Stream and + SPIPE_Connector. + + * ace/Stream_Modules.h: + * ace/Stream_Modules.cpp: + Fixed a "bug" introduced in my last change: a couple of + ACE_ALLOC_HOOK_* were commented but shouldn't. + + * examples/Connection/non-blocking/CPP-acceptor.cpp (open): + PR_AD cannot be used in this context, it expands to + _ACE_PEER_ACCEPTOR::PEER_ADDR (via ACE_PEER_ACCEPTOR_ADDR), but + the template parameter is _ACE_PEER_STREAM (aka PR_ST_1, aka + ACE_PEER_STREAM_1). + The right macro was ACE_PEER_STREAM_ADDR. + + * ace/Connector.h: + * ace/Connector.cpp: + The typedef trick I used (PEER_ADDR) did not work on every + platform. + I also broke some examples since ACE_PEER_CONNECTOR_ADDR did not + include ACE_TYPENAME on its definition. Hopefully this new trick + will work everywhere. + + * I finally sorted out the mistery of including "ace/Module.h" + into "ace/Task_T.cpp": when compiling "ace/Stream_Modules.cpp" you + get the following include sequence: + Stream_Modules.cpp + Stream_Modules.h + Task.h + Task.i + Task_T.h + Message_Queue.h (descendants removed) + Synch_T.h (descendants removed) + Task.h (already included). + Task_T.i + Task_T.cpp + Module.h + ACE.h (descendants removed) + Task.h (already included). + Module.i + Module.cpp + + At this point Module.cpp uses ACE_Thru_Task declared on + Stream_Modules.h, but after the #include "ace/Task.h"; + in fact Module.cpp tries to #include "ace/Stream_Modules.cpp" but + that second #include expands to nothing due to the canonical + protection on Stream_Modules.h. + That explains the removal of Module.h in Task_T.cpp. + If you are wondering why so long an explanation for this change + the answer is simple: just because I was curious on now it worked. + Mon Mar 24 14:08:48 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> * ace/SOCK_Dgram_Bcast.cpp (mk_broadcast): Cleaned up the code a @@ -287,6 +412,104 @@ Sat Mar 22 07:30:49 1997 David L. Levine <levine@cs.wustl.edu> _MSC_VER. Also, fixed typo: "uint64" instead of "unit64" without _MSC_VER. +Fri Mar 21 08:37:34 1997 Carlos O'Ryan <coryan@charlie> + + * makeinclude/rules.lib.GNU: + I use the macro SOEXT to support HP non-standard extension for + shared library names (.sl instead of .so). + I also changed the rule to build shared libraries: under HP-UX you + cannot pass extra libraries (-lXXX options) when building a shared + lib. Before HP-UX 10.10 it wasn't a problem because no library was + needed with ACE, but to support XLI the '-lxti' flag must be used + on binaries (but not on shared libs). + + * include/makeinclude/platform_hpux.GNU: + The PIC option (+Z) was used always, clearly not intended. + + * include/makeinclude/platform_hpux_gcc.GNU: + Added a config file for g++ under HP-UX. + + * include/makeinclude/platform_hpux_aCC.GNU: + Added a config file for HP/aCC compiler under HP-UX. + + * ace/Makefile: + * netsvcs/lib/Makefile: + Changed to support the SOEXT macro. + + * config-hpux-10.x.h: + * config-hpux-10.x-aCC.h: + * config-hpux-10.x-g++.h: + I updated the files to HP-UX 10.10, AFAIK since that version HP-UX + uses fd_set instead of int in select(2) (so ACE_SELECT_USES_INT is + not needed) and the OS supports siginfo_t and ucontext_t so + ACE_HAS_SIGINFO_T and ACE_HAS_UCONTEXT_T are defined. + I *do not* have threads at my site nor the infamous PHSS_6246 + patch so I couldn't test the threaded version nor the HP cfront + based one. + ACE compiled fine with g++ and HP/aCC though. + + * ace/OS.h: + * ace/Malloc_T.h: + HP/aCC supports the typename keyword. I added a new config macro + 'ACE_HAS_TYPENAME_KEYWORD', when it is defined ACE_TYPENAME + expands to 'typename' when not it expands to nothing. + On the cases where HP/aCC requires the usage of 'typename' I added + a 'ACE_TYPENAME'. + + * ace/OS.i: + * ace/OS.cpp: + ACE_OS::inet_aton cannot be inlined under HP-UX. + + * ace/Connector.h: + * ace/Connector.cpp: + I have decided to use a typedef (PEER_ADDR) instead of + ACE_PEER_CONNECTOR_ADDR, mainly because the second form + requires a ACE_TYPENAME before each usage. + + * ace/Event_Handler_T.i: + Much to my surprize ACE_TYPENAME is required when using a template + typedef as a return value. + + * ace/Local_Name_Space_T.h: + HP/aCC does not like the usage of a private typedef from another + class. + + * ace/Strategies_T.h: + * ace/Strategies_T.cpp: + ACE_Process_Strategy declared two defaults constructors: + ACE_Process_Strategy(void) and ACE_Process_Strategy(int = 1). + The constructor code was wrong, it called open() with parameters: + open(thr_mgr, thr_flags, n_threads) + none of which were defined, worse, open() receives just one + parameter (the number of processes) just as the constructor, I + believe that C-w programming is lurking here. + + * ace/Signal.cpp: + Though the header file does not declare ACE_Sig_Handlers under + HP-UX (and the code is not defined too) some auxiliary functions + that use ACE_Sig_Handlers were defined. I removed their + definition. + Some day I'll try to take a look at the code, trying to find out + was wrong with them. + + * ace/Stream_Modules.h: + * ace/Stream_Modules.cpp: + By mistake I commented out the ACE_ALLOC_HOOK_* macros; have to + fix it *real soon*. + + * ace/Task_T.cpp: + No need to include "ace/Module.h" since only the template + declaration is used. When ACE_TEMPLATES_REQUIRE_SOURCE is defined + you end up using ACE_Thru_Task before it gets defined. + This is no problem unless your compiler checks template sintax + before instantiation as the HP/aCC compiler do. + + * examples/Reactor/Misc/test_demuxing.cpp: + ACE_MT_SYNCH was used, but it is only defined if ACE_HAS_THREADS, + I used ACE_SYNCH instead, which is defined as ACE_MT_SYNCH if + ACE_HAS_THREADS and as ACE_NULL_SYNCH if not. + Maybe the semantics are wrong, but the thing compiles. + Fri Mar 21 15:10:59 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> * ace/Makefile (FILES): Moved Log_Msg to the beginning of the diff --git a/ace/Connector.h b/ace/Connector.h index 8f800e8cb54..7c394145993 100644 --- a/ace/Connector.h +++ b/ace/Connector.h @@ -106,6 +106,9 @@ public: // = Initialization and termination methods. // typedef ACE_TYPENAME ACE_PEER_CONNECTOR_ADDR PEER_ADDR; +#if defined (ACE_HAS_TYPENAME_KEYWORD) + typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; +#endif /* ACE_HAS_TYPENAME_KEYWORD */ ACE_Connector (ACE_Reactor *r = ACE_Service_Config::reactor ()); // Initialize a connector. @@ -122,7 +125,7 @@ public: const ACE_PEER_CONNECTOR_ADDR &remote_addr, const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, const ACE_PEER_CONNECTOR_ADDR &local_addr - = (ACE_PEER_CONNECTOR_ADDR &) ACE_PEER_CONNECTOR_ADDR::sap_any, + = (ACE_PEER_CONNECTOR_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, int reuse_addr = 0, int flags = O_RDWR, int perms = 0); diff --git a/ace/OS.cpp b/ace/OS.cpp index a5900bcd88b..f1ea4ad61bd 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -22,12 +22,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Time_Value) // Initializes the ACE_Time_Value object from a timeval. -ACE_Time_Value::ACE_Time_Value (const timeval &tv) -{ - // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (tv); -} - #if defined(ACE_WIN32) // Initializes the ACE_Time_Value object from a Win32 FILETIME @@ -43,9 +37,9 @@ void ACE_Time_Value::set (const FILETIME &file_time) ACE_QWORD _100ns = ACE_MAKE_QWORD (file_time.dwLowDateTime, file_time.dwHighDateTime); // Convert 100ns units to seconds; - this->tv_sec_ = long (_100ns / (10000 * 1000)); + this->tv_.tv_sec = long (_100ns / (10000 * 1000)); // Convert remainder to microseconds; - this->tv_usec_ = long ((_100ns - (this->tv_sec_ * (10000 * 1000))) / 10); + this->tv_.tv_usec = long ((_100ns - (this->tv_.tv_sec * (10000 * 1000))) / 10); } // Returns the value of the object as a Win32 FILETIME. @@ -53,7 +47,7 @@ void ACE_Time_Value::set (const FILETIME &file_time) ACE_Time_Value::operator FILETIME () const { // ACE_TRACE ("ACE_Time_Value::operator FILETIME"); - ACE_QWORD _100ns = ((ACE_QWORD) this->tv_sec_ * (1000 * 1000) + this->tv_usec_) * 10; + ACE_QWORD _100ns = ((ACE_QWORD) this->tv_.tv_sec * (1000 * 1000) + this->tv_.tv_usec) * 10; FILETIME file_time; file_time.dwLowDateTime = ACE_LOW_DWORD (_100ns); file_time.dwHighDateTime = ACE_HIGH_DWORD (_100ns); @@ -80,170 +74,40 @@ ACE_Time_Value::dump (void) const } void -ACE_Time_Value::set (long sec, long usec) -{ - // ACE_TRACE ("ACE_Time_Value::set"); - this->tv_sec_ = sec; - this->tv_usec_ = usec; -} - -void -ACE_Time_Value::set (double d) -{ - // ACE_TRACE ("ACE_Time_Value::set"); - long l = (long) d; - this->tv_sec_ = l; - this->tv_usec_ = ((long) (d - (double) l)) * 1000000; - this->normalize (); -} - -ACE_Time_Value::ACE_Time_Value (long sec, long usec) -{ - // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (sec, usec); - this->normalize (); -} - -// Returns the value of the object as a timeval. - -ACE_Time_Value::operator timeval () const -{ - // ACE_TRACE ("ACE_Time_Value::operator timeval"); - timeval tv; - tv.tv_sec = this->tv_sec_; - tv.tv_usec = this->tv_usec_; - return tv; -} - -// Add TV to this. - -void -ACE_Time_Value::operator+= (const ACE_Time_Value &tv) -{ - // ACE_TRACE ("ACE_Time_Value::operator+="); - this->tv_sec_ += tv.tv_sec_; - this->tv_usec_ += tv.tv_usec_; - this->normalize (); -} - -// Subtract TV to this. - -void -ACE_Time_Value::operator-= (const ACE_Time_Value &tv) -{ - // ACE_TRACE ("ACE_Time_Value::operator-="); - this->tv_sec_ -= tv.tv_sec_; - this->tv_usec_ -= tv.tv_usec_; - this->normalize (); -} - -// Adds two ACE_Time_Value objects together, returns the sum. - -ACE_Time_Value -operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) -{ - // ACE_TRACE ("operator +"); - ACE_Time_Value sum (tv1.tv_sec_ + tv2.tv_sec_, - tv1.tv_usec_ + tv2.tv_usec_); - - sum.normalize (); - return sum; -} - -// Subtracts two ACE_Time_Value objects, returns the difference. - -ACE_Time_Value -operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) -{ - // ACE_TRACE ("operator -"); - ACE_Time_Value delta (tv1.tv_sec_ - tv2.tv_sec_, - tv1.tv_usec_ - tv2.tv_usec_); - delta.normalize (); - return delta; -} - -// True if tv1 > tv2. - -int -operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) -{ - // ACE_TRACE ("operator >"); - if (tv1.tv_sec_ > tv2.tv_sec_) - return 1; - else if (tv1.tv_sec_ == tv2.tv_sec_ - && tv1.tv_usec_ > tv2.tv_usec_) - return 1; - else - return 0; -} - -// True if tv1 >= tv2. - -int -operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) -{ - // ACE_TRACE ("operator >="); - if (tv1.tv_sec_ > tv2.tv_sec_) - return 1; - else if (tv1.tv_sec_ == tv2.tv_sec_ - && tv1.tv_usec_ >= tv2.tv_usec_) - return 1; - else - return 0; -} - -void ACE_Time_Value::normalize (void) { // ACE_TRACE ("ACE_Time_Value::normalize"); // New code from Hans Rohnert... - if (this->tv_usec_ >= ONE_SECOND) + if (this->tv_.tv_usec >= ONE_SECOND) { do { - this->tv_sec_++; - this->tv_usec_ -= ONE_SECOND; + this->tv_.tv_sec++; + this->tv_.tv_usec -= ONE_SECOND; } - while (this->tv_usec_ >= ONE_SECOND); + while (this->tv_.tv_usec >= ONE_SECOND); } - else if (this->tv_usec_ <= -ONE_SECOND) + else if (this->tv_.tv_usec <= -ONE_SECOND) { do { - this->tv_sec_--; - this->tv_usec_ += ONE_SECOND; + this->tv_.tv_sec--; + this->tv_.tv_usec += ONE_SECOND; } - while (this->tv_usec_ <= -ONE_SECOND); + while (this->tv_.tv_usec <= -ONE_SECOND); } - if (this->tv_sec_ >= 1 && this->tv_usec_ < 0) - { - this->tv_sec_--; - this->tv_usec_ += ONE_SECOND; - } - else if (this->tv_sec_ < 0 && this->tv_usec_ > 0) + if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) { - this->tv_sec_++; - this->tv_usec_ -= ONE_SECOND; + this->tv_.tv_sec--; + this->tv_.tv_usec += ONE_SECOND; } - -#if 0 - // Old code... - while ((this->tv_usec_ >= ONE_SECOND) - || (this->tv_sec_ < 0 && this->tv_usec_ > 0 )) + else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) { - this->tv_usec_ -= ONE_SECOND; - this->tv_sec_++; + this->tv_.tv_sec++; + this->tv_.tv_usec -= ONE_SECOND; } - - while ((this->tv_usec_ <= -ONE_SECOND) - || (this->tv_sec_ > 0 && this->tv_usec_ < 0)) - { - this->tv_usec_ += ONE_SECOND; - this->tv_sec_--; - } -#endif } int @@ -199,16 +199,6 @@ typedef int key_t; #include /**/ <vxWorks.h> #endif /* VXWORKS */ -#if !defined (ACE_HAS_IP_MULTICAST) -struct ip_mreq -{ - struct in_addr imr_multiaddr; - // IP multicast address of group - struct in_addr imr_interface; - // local IP address of interface -}; -#endif /* ACE_HAS_IP_MULTICAST */ - #if defined (ACE_HAS_CHARPTR_SPRINTF) #define ACE_SPRINTF_ADAPTER(X) ::strlen (X) #else @@ -401,6 +391,9 @@ public: operator timeval () const; // Returns the value of the object as a timeval. + operator timeval *() const; + // Returns a pointer to the object as a timeval. + #if defined(ACE_WIN32) operator FILETIME () const; // Returns the value of the object as a Win32 FILETIME. @@ -460,11 +453,8 @@ private: void normalize (void); // Put the timevalue into a canonical form. - long tv_sec_; - // Seconds. - - long tv_usec_; - // Microseconds. + timeval tv_; + // Store the values as a <timeval>. }; class ACE_Export ACE_Countdown_Time @@ -554,6 +544,29 @@ private: #define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR #define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR #define ACE_PEER_CONNECTOR_ADDR ACE_TYPENAME _ACE_PEER_CONNECTOR::PEER_ADDR +#if !defined(ACE_HAS_TYPENAME_KEYWORD) +#define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any +#else +// +// If the compiler supports 'typename' we cannot use +// +// PEER_CONNECTOR::PEER_ADDR::sap_any +// +// because PEER_CONNECTOR::PEER_ADDR is not considered a type. But: +// +// typename PEER_CONNECTOR::PEER_ADDR::sap_any +// +// will not work either, because now we are declaring sap_any a +// type, further: +// +// (typename PEER_CONNECTOR::PEER_ADDR)::sap_any +// +// is considered a casting expression. All I can think of is using a +// typedef, I tried PEER_ADDR but that was a source of trouble on +// some platforms. I will try: +// +#define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_ADDR_TYPEDEF::sap_any +#endif /* ACE_HAS_TYPENAME_KEYWORD */ // Handle ACE_SOCK_* #define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor @@ -618,6 +631,7 @@ private: #define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR #define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR #define ACE_PEER_CONNECTOR_ADDR _ACE_PEER_ADDR +#define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any // Handle ACE_SOCK_* #define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr @@ -752,33 +766,6 @@ typedef struct rlimit ACE_SETRLIMIT_TYPE; typedef const struct rlimit ACE_SETRLIMIT_TYPE; #endif /* ACE_HAS_BROKEN_SETRLIMIT */ -#if !defined (ACE_HAS_STRBUF_T) -struct strbuf -{ - int maxlen; // no. of bytes in buffer. - int len; // no. of bytes returned. - void *buf; // pointer to data. -}; -#endif /* ACE_HAS_STRBUF_T */ - -struct ACE_Export ACE_Str_Buf - // = TITLE - // Simple wrapper for STREAM pipes strbuf. -{ - int maxlen; - // Number of bytes in buffer. - - int len; - // Number of bytes returned. - - void *buf; - // Pointer to data. - - // = Initialization method - ACE_Str_Buf (void *b = 0, int l = 0, int max = 0); - // Constructor. -}; - #if defined (ACE_MT_SAFE) #define ACE_MT(X) X #if !defined (_REENTRANT) @@ -1751,13 +1738,7 @@ extern "C" { #else #include /**/ <netdb.h> #endif /* VXWORKS */ -#if defined (HPUX) -#define volatile -#endif /* HPUX */ #include /**/ <net/if.h> -#if defined (HPUX) -#undef volatile -#endif /* HPUX */ #include /**/ <netinet/in.h> #include /**/ <arpa/inet.h> } @@ -2409,6 +2390,37 @@ struct flock }; #endif /* ACE_LACKS_FILELOCKS */ +#if !defined (ACE_HAS_IP_MULTICAST) +struct ip_mreq +{ + struct in_addr imr_multiaddr; + // IP multicast address of group + struct in_addr imr_interface; + // local IP address of interface +}; +#endif /* ACE_HAS_IP_MULTICAST */ + +#if !defined (ACE_HAS_STRBUF_T) +struct strbuf +{ + int maxlen; // no. of bytes in buffer. + int len; // no. of bytes returned. + void *buf; // pointer to data. +}; +#endif /* ACE_HAS_STRBUF_T */ + +struct ACE_Export ACE_Str_Buf : public strbuf + // = TITLE + // Simple wrapper for STREAM pipes strbuf. +{ + // = Initialization method + ACE_Str_Buf (void *b = 0, int l = 0, int max = 0); + // Constructor. + + ACE_Str_Buf (strbuf &); + // Constructor. +}; + class ACE_Export ACE_OS // = TITLE // This class defines an operating system independent @@ -100,7 +100,137 @@ typedef const struct timespec * ACE_TIMESPEC_PTR; // can't make this an enum due to compiler bugs on some platforms... static const long ONE_SECOND = 1000000L; -// Initializes the ACE_Time_Value object. +// Returns the value of the object as a timeval. + +ACE_INLINE +ACE_Time_Value::operator timeval () const +{ + // ACE_TRACE ("ACE_Time_Value::operator timeval"); + return this->tv_; +} + +// Returns a pointer to the object as a timeval. + +ACE_INLINE +ACE_Time_Value::operator timeval * () const +{ + // ACE_TRACE ("ACE_Time_Value::operator timeval"); + return (timeval *) &this->tv_; +} + +// Add TV to this. + +ACE_INLINE void +ACE_Time_Value::operator+= (const ACE_Time_Value &tv) +{ + // ACE_TRACE ("ACE_Time_Value::operator+="); + this->tv_.tv_sec += tv.tv_.tv_sec; + this->tv_.tv_usec += tv.tv_.tv_usec; + this->normalize (); +} + +// Subtract TV to this. + +ACE_INLINE void +ACE_Time_Value::operator-= (const ACE_Time_Value &tv) +{ + // ACE_TRACE ("ACE_Time_Value::operator-="); + this->tv_.tv_sec -= tv.tv_.tv_sec; + this->tv_.tv_usec -= tv.tv_.tv_usec; + this->normalize (); +} + +// Adds two ACE_Time_Value objects together, returns the sum. + +ACE_INLINE ACE_Time_Value +operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_TRACE ("operator +"); + ACE_Time_Value sum (tv1.tv_.tv_sec + tv2.tv_.tv_sec, + tv1.tv_.tv_usec + tv2.tv_.tv_usec); + + sum.normalize (); + return sum; +} + +ACE_INLINE void +ACE_Time_Value::set (long sec, long usec) +{ + // ACE_TRACE ("ACE_Time_Value::set"); + this->tv_.tv_sec = sec; + this->tv_.tv_usec = usec; +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const timeval &tv) +{ + // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (tv); +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (long sec, long usec) +{ + // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (sec, usec); + this->normalize (); +} + +ACE_INLINE void +ACE_Time_Value::set (double d) +{ + // ACE_TRACE ("ACE_Time_Value::set"); + long l = (long) d; + this->tv_.tv_sec = l; + this->tv_.tv_usec = ((long) (d - (double) l)) * 1000000; + this->normalize (); +} + +// Subtracts two ACE_Time_Value objects, returns the difference. + +ACE_INLINE ACE_Time_Value +operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_TRACE ("operator -"); + ACE_Time_Value delta (tv1.tv_.tv_sec - tv2.tv_.tv_sec, + tv1.tv_.tv_usec - tv2.tv_.tv_usec); + delta.normalize (); + return delta; +} + +// True if tv1 > tv2. + +ACE_INLINE int +operator > (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_TRACE ("operator >"); + if (tv1.tv_.tv_sec > tv2.tv_.tv_sec) + return 1; + else if (tv1.tv_.tv_sec == tv2.tv_.tv_sec + && tv1.tv_.tv_usec > tv2.tv_.tv_usec) + return 1; + else + return 0; +} + +// True if tv1 >= tv2. + +ACE_INLINE int +operator >= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_TRACE ("operator >="); + if (tv1.tv_.tv_sec > tv2.tv_.tv_sec) + return 1; + else if (tv1.tv_.tv_sec == tv2.tv_.tv_sec + && tv1.tv_.tv_usec >= tv2.tv_.tv_usec) + return 1; + else + return 0; +} // Initializes a timestruc_t. Note that this approach loses precision // since it converts the nano-seconds into micro-seconds. But then @@ -111,8 +241,8 @@ ACE_INLINE void ACE_Time_Value::set (const timestruc_t &tv) { // ACE_TRACE ("ACE_Time_Value::set"); - this->tv_sec_ = tv.tv_sec; - this->tv_usec_ = tv.tv_nsec / 1000; + this->tv_.tv_sec = tv.tv_sec; + this->tv_.tv_usec = tv.tv_nsec / 1000; this->normalize (); } @@ -124,8 +254,8 @@ ACE_Time_Value::operator timestruc_t () const { // ACE_TRACE ("ACE_Time_Value::operator timestruc_t"); timestruc_t tv; - tv.tv_sec = this->tv_sec_; - tv.tv_nsec = this->tv_usec_ * 1000; + tv.tv_sec = this->tv_.tv_sec; + tv.tv_nsec = this->tv_.tv_usec * 1000; return tv; } @@ -142,8 +272,8 @@ ACE_INLINE void ACE_Time_Value::set (const timeval &tv) { // ACE_TRACE ("ACE_Time_Value::set"); - this->tv_sec_ = tv.tv_sec; - this->tv_usec_ = tv.tv_usec; + this->tv_.tv_sec = tv.tv_sec; + this->tv_.tv_usec = tv.tv_usec; this->normalize (); } @@ -152,8 +282,7 @@ ACE_Time_Value::set (const timeval &tv) ACE_INLINE ACE_Time_Value::ACE_Time_Value (const ACE_Time_Value &tv) - : tv_sec_ (tv.tv_sec_), - tv_usec_ (tv.tv_usec_) + : tv_ (tv.tv_) { // ACE_TRACE ("ACE_Time_Value::ACE_Time_Value"); } @@ -164,7 +293,7 @@ ACE_INLINE long ACE_Time_Value::sec (void) const { // ACE_TRACE ("ACE_Time_Value::sec"); - return this->tv_sec_; + return this->tv_.tv_sec; } // Sets the number of seconds. @@ -173,7 +302,7 @@ ACE_INLINE void ACE_Time_Value::sec (long sec) { // ACE_TRACE ("ACE_Time_Value::sec"); - this->tv_sec_ = sec; + this->tv_.tv_sec = sec; } // Converts from Time_Value format into milli-seconds format. @@ -182,7 +311,7 @@ ACE_INLINE long ACE_Time_Value::msec (void) const { // ACE_TRACE ("ACE_Time_Value::msec"); - return this->tv_sec_ * 1000 + this->tv_usec_ / 1000; + return this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; } // Converts from milli-seconds format into Time_Value format. @@ -192,9 +321,9 @@ ACE_Time_Value::msec (long milliseconds) { // ACE_TRACE ("ACE_Time_Value::msec"); // Convert millisecond units to seconds; - this->tv_sec_ = milliseconds / 1000; + this->tv_.tv_sec = milliseconds / 1000; // Convert remainder to microseconds; - this->tv_usec_ = (milliseconds - (this->tv_sec_ * 1000)) * 1000; + this->tv_.tv_usec = (milliseconds - (this->tv_.tv_sec * 1000)) * 1000; } // Returns number of micro-seconds. @@ -203,7 +332,7 @@ ACE_INLINE long ACE_Time_Value::usec (void) const { // ACE_TRACE ("ACE_Time_Value::usec"); - return this->tv_usec_; + return this->tv_.tv_usec; } // Sets the number of micro-seconds. @@ -212,7 +341,7 @@ ACE_INLINE void ACE_Time_Value::usec (long usec) { // ACE_TRACE ("ACE_Time_Value::usec"); - this->tv_usec_ = usec; + this->tv_.tv_usec = usec; } // True if tv1 < tv2. @@ -242,8 +371,8 @@ operator == (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_TRACE ("operator =="); - return tv1.tv_sec_ == tv2.tv_sec_ - && tv1.tv_usec_ == tv2.tv_usec_; + return tv1.tv_.tv_sec == tv2.tv_.tv_sec + && tv1.tv_.tv_usec == tv2.tv_.tv_usec; } // True if tv1 != tv2. @@ -262,7 +391,6 @@ operator != (const ACE_Time_Value &tv1, #include /**/ <rpc/rpc.h> #endif /* ACE_LACKS_RPC_H */ - // Matthew Stevens 7-10-95 Fix GNU GCC 2.7 for memchr() problem. #if defined (ACE_HAS_GNU_CSTRING_H) // Define this file to keep /usr/include/memory.h from being included. @@ -6063,10 +6191,18 @@ ACE_OS::getenv (const char *symbol) ACE_INLINE ACE_Str_Buf::ACE_Str_Buf (void *b, int l, int max) - : maxlen (max), - len (l), - buf (b) { + this->maxlen = max; + this->len = l; + this->buf = (char *) b; +} + +ACE_INLINE +ACE_Str_Buf::ACE_Str_Buf (strbuf &sb) +{ + this->maxlen = sb.maxlen; + this->len = sb.len; + this->buf = sb.buf; } #if defined (ACE_HAS_UNICODE) diff --git a/ace/SPIPE_Connector.h b/ace/SPIPE_Connector.h index bc659f9ae8e..282836552a9 100644 --- a/ace/SPIPE_Connector.h +++ b/ace/SPIPE_Connector.h @@ -76,6 +76,10 @@ public: // The <flags> and <perms> arguments are passed down to the open() // method. + // = Meta-type info + typedef ACE_SPIPE_Addr PEER_ADDR; + typedef ACE_SPIPE_Stream PEER_STREAM; + void dump (void) const; // Dump the state of an object. diff --git a/ace/SPIPE_Stream.h b/ace/SPIPE_Stream.h index 5b78bd1e148..3da98013637 100644 --- a/ace/SPIPE_Stream.h +++ b/ace/SPIPE_Stream.h @@ -103,6 +103,9 @@ public: ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; // Recv <n> bytes via Win32 ReadFile using overlapped I/O. + // = Meta-type info + typedef ACE_SPIPE_Addr PEER_ADDR; + void dump (void) const; // Dump the state of an object. diff --git a/ace/Stream_Modules.cpp b/ace/Stream_Modules.cpp index 7842eb55944..9bbea1b0ae2 100644 --- a/ace/Stream_Modules.cpp +++ b/ace/Stream_Modules.cpp @@ -288,7 +288,7 @@ ACE_Stream_Tail<ACE_SYNCH_2>::fini (void) return 0; } -// ACE_ALLOC_HOOK_DEFINE(ACE_Thru_Task) +ACE_ALLOC_HOOK_DEFINE(ACE_Thru_Task) template <ACE_SYNCH_1> ACE_Thru_Task<ACE_SYNCH_2>::ACE_Thru_Task (void) diff --git a/ace/Stream_Modules.h b/ace/Stream_Modules.h index 7bb102b82cb..26e3151ae1a 100644 --- a/ace/Stream_Modules.h +++ b/ace/Stream_Modules.h @@ -116,7 +116,7 @@ public: void dump (void) const; // Dump the state of an object. - // ACE_ALLOC_HOOK_DECLARE; + ACE_ALLOC_HOOK_DECLARE; // Declare the dynamic allocation hooks. }; diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index 9673ce5a068..0fb42db14f2 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -77,7 +77,11 @@ template <PR_ST_1, ACE_SYNCH_1> void ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::operator delete (void *obj) { ACE_TRACE ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_2>::delete"); - ::delete obj; + // You cannot delete a 'void*' (X3J16/95-0087 5.3.5.3), but we know + // the pointer was created using new char[] (see operator new code), + // so we use a cast: + char *tmp = (char *) obj; + ::delete [] tmp; } // Default constructor. diff --git a/ace/Task_T.cpp b/ace/Task_T.cpp index 489ec46371b..6626d19571c 100644 --- a/ace/Task_T.cpp +++ b/ace/Task_T.cpp @@ -6,7 +6,9 @@ #define ACE_BUILD_DLL #include "ace/Task_T.h" +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Module.h" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #include "ace/Service_Config.h" #if !defined (__ACE_INLINE__) diff --git a/ace/config-hpux-10.x-aCC.h b/ace/config-hpux-10.x-aCC.h index 1a4e6ddbb90..d22caadddbc 100644 --- a/ace/config-hpux-10.x-aCC.h +++ b/ace/config-hpux-10.x-aCC.h @@ -77,6 +77,12 @@ // Compiler/platform has thread-specific storage // #define ACE_HAS_THREAD_SPECIFIC_STORAGE +// Platform supports POSIX 1.b clock_gettime () +#define ACE_HAS_CLOCK_GETTIME + +// iostream header lacks ipfx (), isfx (), etc., declarations +#define ACE_LACKS_IOSTREAM_FX + // Compiler/platform supports struct strbuf. #define ACE_HAS_STRBUF_T #include /**/ <stropts.h> /* for struct strbuf */ |