discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSProcessInfo -processorCount, -activeProcessorCount, -physicalMemor


From: Fred Kiefer
Subject: Re: NSProcessInfo -processorCount, -activeProcessorCount, -physicalMemory
Date: Thu, 13 Nov 2008 18:54:53 +0100
User-agent: Thunderbird 2.0.0.17 (X11/20080922)

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 :-)




reply via email to

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