@@ -26,11 +26,11 @@ #include "platform.h" #ifdef HAVE_SYS_UTSNAME_H # include #endif -#ifdef OF_MACOS +#if defined(OF_MACOS) || defined(OF_NETBSD) # include #endif #if defined(OF_AMIGAOS4) # define __USE_INLINE__ @@ -568,10 +568,42 @@ return [OFString stringWithCString: buffer encoding: OF_STRING_ENCODING_ASCII length: 12]; #else + return nil; +#endif +} + ++ (OFString *)CPUModel +{ +#if defined(OF_MACOS) || defined(OF_NETBSD) + char value[256]; + size_t length = sizeof(value); + +# if defined(OF_MACOS) + if (sysctlbyname("machdep.cpu.brand_string", +# elif defined(OF_NETBSD) + if (sysctlbyname("machdep.cpu_brand", +# endif + &value, &length, NULL, 0) != 0) + return nil; + + return [OFString stringWithCString: value + encoding: OF_STRING_ENCODING_ASCII]; +#elif defined(OF_AMIGAOS4) + CONST_STRPTR model, version; + + GetCPUInfoTags(GCIT_ModelString, &model, + GCIT_VersionString, &version, TAG_END); + + if (version != NULL) + return [OFString stringWithFormat: @"%s V%s", model, version]; + else + return [OFString stringWithCString: model + encoding: OF_STRING_ENCODING_ASCII]; +#else return nil; #endif } #if defined(OF_X86_64) || defined(OF_X86)