diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-03-11 20:29:57 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-03-11 20:29:57 +0000 |
commit | b3883f70742627798a50c81d0d874ac28709d903 (patch) | |
tree | cab172e65b1fc6658c1170575ed48dfc6e175d2b /ace | |
parent | 1ff5e7aa20d15e5fb3358f1e5f4ef3782dd1e8e5 (diff) | |
download | ATCD-b3883f70742627798a50c81d0d874ac28709d903.tar.gz |
(uname, hostname): added VxWorks support, and uninlined uname on WIN32 and VxWorks because it contains string literals
Diffstat (limited to 'ace')
-rw-r--r-- | ace/OS.cpp | 30 | ||||
-rw-r--r-- | ace/OS.i | 20 |
2 files changed, 37 insertions, 13 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index 16ff57bd45d..df9d2210b79 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -314,6 +314,36 @@ ACE_OS::gethrtime (void) } #endif /* ACE_HAS_PENTIUM && __GNUC__ */ +#if defined (ACE_WIN32) || defined (VXWORKS) +// Don't inline on those platforms because this function contains +// string literals, and some compilers, e.g., g++, don't handle those +// efficiently in unused inline functions. +int +ACE_OS::uname (struct utsname *name) +{ + // ACE_TRACE ("ACE_OS::uname"); +#if defined (ACE_WIN32) + size_t maxnamelen = sizeof name->nodename; + ::strcpy (name->sysname, "Win32"); + // Any ideas what these should be? + ::strcpy (name->release, "???"); + ::strcpy (name->version, "???"); + ::strcpy (name->machine, "???"); + + return ACE_OS::hostname (name->nodename, maxnamelen); +#elif defined (VXWORKS) + size_t maxnamelen = sizeof name->nodename; + ::strcpy (name->sysname, "VxWorks"); + ::strcpy (name->release, "???"); + ::strcpy (name->version, "???"); + ::strcpy (name->machine, "???"); + + return ACE_OS::hostname (name->nodename, maxnamelen); +#endif /* ACE_WIN32 */ +} +#endif /* ACE_WIN32 || VXWORKS */ + + #if defined(ACE_MT_SAFE) && defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) int ACE_OS::netdb_mutex_inited_ = 0; @@ -4599,25 +4599,17 @@ ACE_OS::creat (LPCTSTR filename, mode_t mode) #endif /* ACE_WIN32 */ } +#if ! defined (ACE_WIN32) && ! defined (VXWORKS) +// Don't inline on those platforms because this function contains +// string literals, and some compilers, e.g., g++, don't handle those +// efficiently in unused inline functions. ACE_INLINE int ACE_OS::uname (struct utsname *name) { // ACE_TRACE ("ACE_OS::uname"); -#if defined (ACE_WIN32) - size_t maxnamelen = sizeof name->nodename; - ::strcpy (name->sysname, "Win32"); - // Any ideas what these should be? - ::strcpy (name->release, "???"); - ::strcpy (name->version, "???"); - ::strcpy (name->machine, "???"); - - return ACE_OS::hostname (name->nodename, maxnamelen); -#elif defined (VXWORKS) - ACE_NOTSUP_RETURN (-1); -#else ACE_OSCALL_RETURN (::uname (name), int, -1); -#endif /* ACE_WIN32 */ } +#endif /* ! ACE_WIN32 && ! VXWORKS */ ACE_INLINE int ACE_OS::hostname (char name[], size_t maxnamelen) @@ -4626,6 +4618,8 @@ ACE_OS::hostname (char name[], size_t maxnamelen) #if defined (ACE_WIN32) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::GetComputerNameA (name, LPDWORD (&maxnamelen)), ace_result_), int, -1); +#elif defined (VXWORKS) + ACE_OSCALL_RETURN (::gethostname (name, maxnamelen), int, -1); #else /* !ACE_WIN32 */ struct utsname host_info; |