Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sysctlbyname( "hw.availcpu" ) fails



On Jun 23, 2007, at 4:38 AM, Steve Checkoway wrote:
$ ./a.out
sysctl: 2
sysctlbyname: No such file or directory
sysctlnametomib: No such file or directory
sysctl2: 2
$ sysctl hw.availcpu hw.activecpu
hw.availcpu = 2
hw.activecpu: 2

What is the difference between activecpu and availcpu, e.g., why does one have an equal sign and the other a colon?

activecpu is the correct name; the manifest constant name was not changed because people have existing code that has to compile vs. the MIB version of the call.


The preferred method for all sysctls going forward is to use sysctlbyname(), so that's what you should use in new code.

The reason you get two of these is that one is by mib (and knowledge is built into the sysctl command line tool) and the other is iterated from the information in the kernel. Eventually, the mib-based one will go away.

-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >sysctlbyname( "hw.availcpu" ) fails (From: Steve Checkoway <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.