Revision: 48385
http://brlcad.svn.sourceforge.net/brlcad/?rev=48385&view=rev
Author: brlcad
Date: 2012-01-11 15:09:41 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
don't set ncpu to 1 if the method of detecting cpus fails. there may be
alternate/additional methods available that can succeed. this prevents a
DEADCODE condition reported by coerity (cov cid 160)
Modified Paths:
--------------
brlcad/trunk/src/libbu/parallel.c
Modified: brlcad/trunk/src/libbu/parallel.c
===================================================================
--- brlcad/trunk/src/libbu/parallel.c 2012-01-11 14:49:49 UTC (rev 48384)
+++ brlcad/trunk/src/libbu/parallel.c 2012-01-11 15:09:41 UTC (rev 48385)
@@ -319,7 +319,6 @@
size_t len;
len = 4;
if (sysctlbyname("hw.ncpu", &maxproc, &len, NULL, 0) == -1) {
- ncpu = 1;
perror("sysctlbyname");
} else {
ncpu = maxproc;
@@ -337,7 +336,6 @@
len = sizeof(maxproc);
if (sysctl(mib, 2, &maxproc, &len, NULL, 0) == -1) {
perror("sysctl");
- ncpu = 1;
} else {
ncpu = maxproc; /* should be able to get sysctl to return maxproc */
}
@@ -358,7 +356,6 @@
ncpu = sysconf(_SC_NPROCESSORS_ONLN);
if (ncpu < 0) {
perror("Unable to get the number of available CPUs");
- ncpu = 1;
}
}
#endif
@@ -368,7 +365,6 @@
ncpu = sysconf(_SC_NPROC_ONLN);
if (ncpu < 0) {
perror("Unable to get the number of available CPUs");
- ncpu = 1;
}
}
#endif
@@ -379,7 +375,6 @@
ncpu = sysconf(_SC_CRAY_NCPU);
if (ncpu < 0) {
perror("Unable to get the number of available CPUs");
- ncpu = 1;
}
}
# endif
@@ -398,24 +393,18 @@
FILE *fp;
char buf[128];
- ncpu = 0;
-
fp = fopen (CPUINFO_FILE, "r");
if (fp == NULL) {
- ncpu = 1;
perror (CPUINFO_FILE);
} else {
+ ncpu = 0;
while (bu_fgets(buf, 80, fp) != NULL) {
if (strncmp (buf, "processor", 9) == 0) {
- ++ ncpu;
+ ncpu++;
}
}
fclose (fp);
-
- if (ncpu <= 0) {
- ncpu = 1;
- }
}
}
# endif
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits