IBM java, smp etc. glibc fix
james gunning
yellowdog-general@lists.terrasoftsolutions.com
Mon Sep 9 18:15:01 2002
Hi people,
So far the fix for IBM's java on YDL has been to run an SMP kernel. Those
who run MOL (which doesn't support SMP) have been a little dismayed by this.
I tried the fix described below (from the newsgroup) on a ppc G4 running YDL,
and found the erroneous sysconf.c is actually in sysdeps/posix/sysconf.c.
Rebuilding glibc (via the source RPMS) with the patch below seems to work.
Kernel gurus: yes, I probably don't know what I'm doing, but everything seems to
work with this hack so far...I can now run linux without SMP switched on, and
MOL too.
System:
IBMJava2-SDK-1.3.1-0.0
kernel 2.4.18-0.8a
glibc-2.2.5-0.19a
James
Neil Masson wrote:
> Apparently the system call to find out the number of processors
> is not supported on all hardware. To find out if you have this problem
> try the following program:
>
> #include <stdio.h>
> #include <unistd.h>
>
> main() {
> fprintf(stderr, "Number of processors configured = %d\n",
> sysconf(_SC_NPROCESSORS_CONF));
> fprintf(stderr, "Number of processors online = %d\n",
> sysconf(_SC_NPROCESSORS_ONLN));
> }
>
> If this reports that you have less than one processor online, you
> are in trouble. A fix will be available in Service Release 3. Until
> then your only option is to rebuild glibc after modifying
> sysdeps/generic/sysconf.c to return a suitable value. Don't
> attempt this if you don't know what you're doing.
>
The above returns 0 & 0 on my stock glibc with no SMP built in.
Suggested hack..............
long int
__sysconf (name)
int name;
{
int JGHACK_N;
.
.
.
.
.
.
case _SC_NPROCESSORS_CONF:
{
JGHACK_N = __get_nprocs_conf ();
return (JGHACK_N==0) ? 1 : JGHACK_N;
}
case _SC_NPROCESSORS_ONLN:
{
JGHACK_N = __get_nprocs ();
return (JGHACK_N==0) ? 1 : JGHACK_N;
}
.
.
.
.
.