discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSProcessInfo -processorCount, -activeProcessorCount, -physicalMemor


From: Richard Frith-Macdonald
Subject: Re: NSProcessInfo -processorCount, -activeProcessorCount, -physicalMemory
Date: Thu, 13 Nov 2008 17:59:46 +0000


On 13 Nov 2008, at 17:54, Fred Kiefer wrote:

Richard Frith-Macdonald wrote:

On 13 Nov 2008, at 08:42, Fred Kiefer wrote:

Having an implementation for these methods would be nice, but going down
the /proc/something parsing route seems wrong to me. Why not call
sysconf() with _SC_NPROCESSORS_CONF (on my GUN/Linux system this is
defined in /usr/include/bits/confname.h).
This too is a system specific solution, but at least we use glibc
instead of doing the parsing ourselves. This should save us the problem
of adopting to a new kernel every time.

We still will need different solutions for non-Linux systems.

I've implemented a combination ... using sysconf if possible and falling
back to the /proc code (though I'm not sure that /proc will ever work
where sysconf does not) as well as adding an implementation for
mswindows. The code compiles without error but is completely untested, so it would be good if anyone interested could try it out and report bugs.


Not sure, but for the sysctlbyname() case, don't you have to pass on
&len as well? There must be a reason why you set up that variable, so
most likely that system call is expecting it :-)

Thanks... missed that ... I don't have a bsd system to test on, so I can't even be sure this stuff would build on bsd... we do need people to test this.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]