Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Both sysctl() and sysctlbyname() allow you to retrieve system information. These standard UNIX functions query the operating system about hardware and OS details. You can get a sense of the kind of scope on offer by glancing at the /usr/include/sys/sysctl.h include file on the Macintosh. There you find an exhaustive list of constants that can be used as parameters to these functions.
These constants allow you to check for core information such as the system’s CPU frequency, the amount of available memory, and more. Recipe 14-1 demonstrates this. It introduces a UIDevice category that gathers system information and returns it via a series of method calls.
You might wonder why this category includes a platform method, when the standard UIDevice class returns device models on demand. The answer lies in distinguishing different types of units.