|
From: Lars E. G <lar...@er...> - 2012-06-06 11:29:35
|
Hello,
examples/lttng > /lib/libc.so.6
GNU C Library stable release version 2.11.1 (20100118), by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Configured for i686-suse-linux.
Compiled by GNU CC version 4.3.4 [gcc-4_3-branch revision 152973].
Compiled on a Linux 2.6.32 system on 2010-10-25.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
NoVersion patch for broken glibc 2.0 binaries
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
On a SLED 11 SP1 host (company WS, hence the ancient version)
An "strace" shows;
> strace numcpu
(...stuff removed)
open("/sys/devices/system/cpu", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
brk(0) = 0x804b000
brk(0x8074000) = 0x8074000
getdents64(3, /* 7 entries */, 32768) = 208
getdents64(3, /* 0 entries */, 32768) = 0
brk(0x806c000) = 0x806c000
close(3) = 0
fstat64(1, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 0), ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4018f000
write(1, "_SC_NPROCESSORS_CONF = 0\n", 25_SC_NPROCESSORS_CONF = 0
) = 25
open("/proc/stat", O_RDONLY|O_CLOEXEC) = 3
read(3, "cpu 6 0 6 1228 0 0 0 0 0 0\ncpu0"..., 8192) = 210
close(3) = 0
write(1, "_SC_NPROCESSORS_ONLN = 1\n", 25_SC_NPROCESSORS_ONLN = 1
) = 25
exit_group(0) = ?
Regards,
L Ekman
-----Original Message-----
From: richard -rw- weinberger [mailto:ric...@gm...]
Sent: den 6 juni 2012 13:18
To: Lars Ekman G
Cc: use...@li...
Subject: Re: [uml-user] sysconf(_SC_NPROCESSORS_CONF) returns incorrect on UML (0)
On Wed, Jun 6, 2012 at 12:56 PM, Lars Ekman G <lar...@er...> wrote:
> I am using UML-kernel; 3.0.26
>
> Anyway, this program;
>
> #include <stdio.h>
> #include <unistd.h>
> int main(int argc, char* argv[])
> {
> printf("_SC_NPROCESSORS_CONF = %d\n",
> sysconf(_SC_NPROCESSORS_CONF));
> printf("_SC_NPROCESSORS_ONLN = %d\n",
> sysconf(_SC_NPROCESSORS_ONLN));
> return 0;
> }
>
> prints;
>
> _SC_NPROCESSORS_CONF = 0
> _SC_NPROCESSORS_ONLN = 1
>
> I found this when using http://lttng.org/ust on UML.
> It "almost worked". In fact everything except "lttng start"
> seems to work. I patched LTTng to fix the problem.
>
> The problem took a few hours to find so I post this just in case.
Thanks a lot for reporting this!
What glibc-version are you using?
--
Thanks,
//richard
|