mirror of https://github.com/BOINC/boinc.git
- client: Add support to detect VirtualBox VM software on Mac.
client/ hostinfo_unix.cpp svn path=/branches/boinc_core_release_6_12/; revision=22758
This commit is contained in:
parent
db9d927cf5
commit
ae7d538764
|
@ -7936,3 +7936,9 @@ David 17 Nov 2010
|
|||
hostinfo.cpp,h
|
||||
sched/
|
||||
sched_types.cpp
|
||||
|
||||
Charlie 18 Nov 2010
|
||||
- client: Add support to detect VirtualBox VM software on Mac.
|
||||
|
||||
client/
|
||||
hostinfo_unix.cpp
|
||||
|
|
|
@ -1094,6 +1094,46 @@ int GetMaxCPUTemperature() {
|
|||
|
||||
#endif
|
||||
|
||||
// see if Virtualbox is installed
|
||||
//
|
||||
int HOST_INFO::get_virtualbox_version() {
|
||||
FSRef theFSRef;
|
||||
OSStatus status = noErr;
|
||||
char path[MAXPATHLEN];
|
||||
char cmd [MAXPATHLEN+35];
|
||||
char *newlinePtr;
|
||||
FILE* fd;
|
||||
|
||||
// First try to locate the VirtualBox application by Bundle ID and Creator Code
|
||||
status = LSFindApplicationForInfo('VBOX', CFSTR("org.virtualbox.app.VirtualBox"),
|
||||
NULL, &theFSRef, NULL
|
||||
);
|
||||
if (status == noErr) {
|
||||
status = FSRefMakePath(&theFSRef, (unsigned char *)path, sizeof(path));
|
||||
}
|
||||
// If that failed, try its default location
|
||||
if (status != noErr) {
|
||||
strcpy(path, "/Applications/VirtualBox.app");
|
||||
}
|
||||
|
||||
if (boinc_file_exists(path)) {
|
||||
safe_strcpy(cmd, "defaults read ");
|
||||
safe_strcat(cmd, path);
|
||||
safe_strcat(cmd, "/Contents/Info CFBundleShortVersionString");
|
||||
fd = popen(cmd, "r");
|
||||
if (fd) {
|
||||
fgets(virtualbox_version, sizeof(virtualbox_version), fd);
|
||||
newlinePtr = strchr(virtualbox_version, '\n');
|
||||
if (newlinePtr) *newlinePtr = '\0';
|
||||
newlinePtr = strchr(virtualbox_version, '\r');
|
||||
if (newlinePtr) *newlinePtr = '\0';
|
||||
pclose(fd);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
// Rules:
|
||||
|
@ -1103,6 +1143,10 @@ int GetMaxCPUTemperature() {
|
|||
int HOST_INFO::get_host_info() {
|
||||
get_filesystem_info(d_total, d_free);
|
||||
|
||||
#if defined( __APPLE__)
|
||||
get_virtualbox_version();
|
||||
#endif
|
||||
|
||||
///////////// p_vendor, p_model, p_features /////////////////
|
||||
#if LINUX_LIKE_SYSTEM
|
||||
parse_cpuinfo_linux(*this);
|
||||
|
|
Loading…
Reference in New Issue