This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: is_mp(), sysconf, and atoi. (Statically-linked multithreaded app s broken on X86?)
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: GCJ Java <java at gcc dot gnu dot org>
- Date: Sat, 08 Mar 2003 00:24:30 -0600
- Subject: Re: is_mp(), sysconf, and atoi. (Statically-linked multithreaded app s broken on X86?)
- Reply-to: gnustuff at thisiscool dot com
Hans,
I don't pretend to even have a clue as to what you're talking about, but I was
wondering what you thought of the following idiom instead of what you had
in linux-threads.c. Am I being too anal?
If you're too busy to waste time on this, I understand.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
Index: linux_threads.c
===================================================================
RCS file: /cvsroot/gcc/gcc/boehm-gc/linux_threads.c,v
retrieving revision 1.20
diff -u -2 -r1.20 linux_threads.c
--- linux_threads.c 29 Mar 2002 22:52:12 -0000 1.20
+++ linux_threads.c 8 Mar 2003 06:18:27 -0000
@@ -1022,5 +1022,12 @@
if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'
&& stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') {
- int cpu_no = atoi(stat_buf + i + 4);
+ /* int cpu_no = atoi(stat_buf + i + 4); */
+ int cpu_no = 0;
+ const char* pchCurBufPos = stat_buf + i + 4;
+ char c;
+ while ((c = *pchCurBufPos++) >= '0' & c <= '9') {
+ cpu_no *= 10;
+ cpu_no += (c - '0');
+ }
if (cpu_no >= result) result = cpu_no + 1;
}