An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit b9b32748 authored by Kitware Robot's avatar Kitware Robot Committed by Brad King
Browse files

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