This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: sysconf(_SC_NPROCESSORS_CONF) core dump?
- To: "Phil Estes" <estesp@austin.ibm.com>
- Subject: Re: sysconf(_SC_NPROCESSORS_CONF) core dump?
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 13 Jul 1999 18:41:40 +0200
- Cc: <glibc-linux@ricardo.ecn.wfu.edu>
- References: <006b01becd4a$9f427800$ee7e3509@margaret.austin.ibm.com>
- Reply-To: glibc-linux@ricardo.ecn.wfu.edu
>>>>> Phil Estes writes:
> Has anyone else encountered the subject mentioned problem under glibc 2.1.1
> (RH 6.0)? Under gdb the stack trace is quite confusing since sysconf calls
> get_nprocs which then does something with the floppy drive (?!?) /dev/fd0,
> which finally fails in a memcpy after some IO_ calls. This also seems to
> occur with _SC_NPROCESSORS_ONLN. I was simply looking for a nice programmatic
This shouldn't happen - have a look at the code in
sysdeps/unix/sysv/linux/getsysstats.c.
> way to determine number of processors and also whether it was uni- or multi-
> processor mode. I guess the other solution is to read /proc/cpuinfo--the
That's what glibc is doing.
> reason I wasn't too excited about that was that I'm not sure if the format is
> different on different kernel levels and whether someone will have a patch
> which changes the format or uses a different process to show multiple cpus
> (xosview recommends a patch that does something like this?).
> Anyway, if I'm not using the glibc 2.1.1 sysconf() call correctly, can someone
> give me a pointer. And if it is a glibc bug, should I open a problem on this?
It's always good to give an example program - otherwise I don't know
what you're doing and it save some time.
I've just created the following small program:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <unistd.h>
#include <stdio.h>
int
main (void)
{
long r;
r = sysconf (_SC_NPROCESSORS_CONF);
printf ("_SC_NPROCESSORS_CONF is %d\n", r);
r = sysconf (_SC_NPROCESSORS_ONLN);
printf ("_SC_NPROCESSORS_ONLN is %d\n", r);
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiled it, and run it:
$ ./sysconf
_SC_NPROCESSORS_CONF is 1
_SC_NPROCESSORS_ONLN is 1
No problems for me. What are you doing differently?
If you feel this should be reported as a bug, please use the glibcbug
script and provide a way to reproduce it.
Andreas
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de