KWSys 2012-11-05 (df32fa6f)

Extract upstream KWSys using the following shell commands.

$ git archive --prefix=upstream-kwsys/ df32fa6f | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' b7a97ac3..df32fa6f
Brad King (4):
      b90f28e3 SystemInformation: Use kwsys_ios:: for string streams
      b7c42507 SystemInformation: No backtrace on LSB < 4.1
      2c46f562 SystemInformation: Fix sw_vers output processing
      df32fa6f SystemInformation: Compute FQDN only on specific platforms

Change-Id: I0a8f2d7c56a6dbde70e1dfbc1e25712b2f9b0e48
This commit is contained in:
KWSys Robot 2012-11-05 12:00:08 -05:00 committed by Brad King
parent 7ae44db4b9
commit cd83da97a7
1 changed files with 38 additions and 28 deletions

View File

@ -74,6 +74,18 @@ typedef int siginfo_t;
# include <errno.h> // extern int errno; # include <errno.h> // extern int errno;
#endif #endif
#ifdef __FreeBSD__
# include <sys/sysctl.h>
# include <fenv.h>
# include <sys/socket.h>
# include <netdb.h>
# include <netinet/in.h>
# if defined(KWSYS_SYS_HAS_IFADDRS_H)
# include <ifaddrs.h>
# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
# endif
#endif
#ifdef __APPLE__ #ifdef __APPLE__
# include <sys/sysctl.h> # include <sys/sysctl.h>
# include <mach/vm_statistics.h> # include <mach/vm_statistics.h>
@ -84,6 +96,10 @@ typedef int siginfo_t;
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
# include <netinet/in.h> # include <netinet/in.h>
# if defined(KWSYS_SYS_HAS_IFADDRS_H)
# include <ifaddrs.h>
# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
# endif
# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 >= 1050 # if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 >= 1050
# include <execinfo.h> # include <execinfo.h>
# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE # define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE
@ -95,9 +111,17 @@ typedef int siginfo_t;
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
# include <netinet/in.h> # include <netinet/in.h>
# if defined(KWSYS_SYS_HAS_IFADDRS_H)
# include <ifaddrs.h>
# if !defined(__LSB_VERSION__) /* LSB has no getifaddrs */
# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
# endif
# endif
# if defined(__GNUG__) # if defined(__GNUG__)
# include <execinfo.h> # include <execinfo.h>
# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE # if !(defined(__LSB_VERSION__) && __LSB_VERSION__ < 41)
# define KWSYS_SYSTEMINFORMATION_HAVE_BACKTRACE
# endif
# endif # endif
# if defined(KWSYS_CXX_HAS_RLIMIT64) # if defined(KWSYS_CXX_HAS_RLIMIT64)
typedef struct rlimit64 ResourceLimitType; typedef struct rlimit64 ResourceLimitType;
@ -111,10 +135,6 @@ typedef struct rlimit ResourceLimitType;
# include <sys/pstat.h> # include <sys/pstat.h>
#endif #endif
#if defined(KWSYS_SYS_HAS_IFADDRS_H)
# include <ifaddrs.h>
#endif
#ifdef __HAIKU__ #ifdef __HAIKU__
# include <OS.h> # include <OS.h>
#endif #endif
@ -453,7 +473,7 @@ bool SystemInformation::DoesCPUSupportFeature(long int i)
kwsys_stl::string SystemInformation::GetCPUDescription() kwsys_stl::string SystemInformation::GetCPUDescription()
{ {
kwsys_stl::ostringstream oss; kwsys_ios::ostringstream oss;
oss oss
<< this->GetNumberOfPhysicalCPU() << this->GetNumberOfPhysicalCPU()
<< " core "; << " core ";
@ -543,7 +563,7 @@ int SystemInformation::GetOSIsApple()
kwsys_stl::string SystemInformation::GetOSDescription() kwsys_stl::string SystemInformation::GetOSDescription()
{ {
kwsys_stl::ostringstream oss; kwsys_ios::ostringstream oss;
oss oss
<< this->GetOSName() << this->GetOSName()
<< " " << " "
@ -599,7 +619,7 @@ kwsys_stl::string SystemInformation::GetMemoryDescription(
const char *hostLimitEnvVarName, const char *hostLimitEnvVarName,
const char *procLimitEnvVarName) const char *procLimitEnvVarName)
{ {
kwsys_stl::ostringstream oss; kwsys_ios::ostringstream oss;
oss oss
<< "Host Total: " << "Host Total: "
<< iostreamLongLong(this->GetHostMemoryTotal()) << iostreamLongLong(this->GetHostMemoryTotal())
@ -805,7 +825,7 @@ int NameValue(
{ {
continue; continue;
} }
kwsys_stl::istringstream is(lines[i].substr(at+name.size())); kwsys_ios::istringstream is(lines[i].substr(at+name.size()));
is >> value; is >> value;
return 0; return 0;
} }
@ -1271,7 +1291,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
WSACleanup(); WSACleanup();
return 0; return 0;
#elif defined(KWSYS_SYS_HAS_IFADDRS_H) #elif defined(KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN)
// gethostname typical returns an alias for loopback interface // gethostname typical returns an alias for loopback interface
// we want the fully qualified domain name. Because there are // we want the fully qualified domain name. Because there are
// any number of interfaces on this system we look for the // any number of interfaces on this system we look for the
@ -3310,7 +3330,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
#elif defined(__APPLE__) #elif defined(__APPLE__)
SystemInformation::LongLong memUsed=0; SystemInformation::LongLong memUsed=0;
pid_t pid=getpid(); pid_t pid=getpid();
kwsys_stl::ostringstream oss; kwsys_ios::ostringstream oss;
oss << "ps -o rss= -p " << pid; oss << "ps -o rss= -p " << pid;
FILE *file=popen(oss.str().c_str(),"r"); FILE *file=popen(oss.str().c_str(),"r");
if (file==0) if (file==0)
@ -3335,7 +3355,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
{ {
return -2; return -2;
} }
kwsys_stl::istringstream iss(oss.str()); kwsys_ios::istringstream iss(oss.str());
iss >> memUsed; iss >> memUsed;
return memUsed; return memUsed;
#else #else
@ -4670,22 +4690,12 @@ int SystemInformationImplementation::CallSwVers(
kwsys_stl::string &ver) kwsys_stl::string &ver)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
kwsys_stl::ostringstream oss; kwsys_stl::vector<const char*> args;
oss << "sw_vers " << arg; args.push_back("sw_vers");
FILE *f=popen(oss.str().c_str(),"r"); args.push_back(arg);
if (f==0) args.push_back(0);
{ ver = this->RunProcess(args);
return -1; this->TrimNewline(ver);
}
oss.str("");
char buf[256]={'\0'};
while (fgets(buf, 256, f) != 0)
{
oss << buf;
}
pclose(f);
kwsys_stl::istringstream iss(oss.str());
iss >> ver;
#else #else
// avoid C4100 // avoid C4100
(void)arg; (void)arg;