Mac Client: more idle time tweaks to allow running as a daemon by using Mac OS X's launchd mechanism.

svn path=/trunk/boinc/; revision=14471
This commit is contained in:
Charlie Fenton 2008-01-06 08:19:25 +00:00
parent 7651ec301e
commit 3f4fbb8e65
3 changed files with 22 additions and 8 deletions

View File

@ -107,3 +107,13 @@ David Jan 4 2008
sample_index.php
tools/
make_project
Charlie Jan 6 2008
- Mac Client: more idle time tweaks to allow running as a daemon by
using Mac OS X's launchd mechanism.
- Mac: Update script which sets BOINC up to run as a daemon so it
client/
hostinfo_unix.C
main.C

View File

@ -92,7 +92,7 @@ extern "C" {
} // extern "C"
#endif
NXEventHandle gEventHandle;
NXEventHandle gEventHandle = NULL;
#endif // __APPLE__
#ifdef _HPUX_SOURCE
@ -861,7 +861,16 @@ inline bool all_logins_idle(time_t t) {
bool HOST_INFO::users_idle(
bool check_all_logins, double idle_time_to_run, double *actual_idle_time
) {
double idleTime = NXIdleTime(gEventHandle);
double idleTime = 0;
if (gEventHandle) {
idleTime = NXIdleTime(gEventHandle);
} else {
// Initialize Mac OS X idle time measurement / idle detection
// Do this here because NXOpenEventStatus() may not be available
// immediately on system startup when running as a deaemon.
gEventHandle = NXOpenEventStatus();
}
if (actual_idle_time) {
*actual_idle_time = idleTime;

View File

@ -665,11 +665,6 @@ int main(int argc, char** argv) {
break;
}
}
#elif defined(__APPLE__)
// If the real user ID is root, we are executing as a daemon
if (getuid() == (uid_t)0) {
gstate.executing_as_daemon = true;
}
#elif defined __EMX__
#else
// non-Apple Unix
@ -753,7 +748,7 @@ int main(int argc, char** argv) {
SetBOINCDataOwnersGroupsAndPermissions();
}
#endif // _DEBUG && __APPLE__
int i = check_security(g_use_sandbox, false);
i = check_security(g_use_sandbox, false);
if (i) {
printf(
"File ownership or permissions are set in a way that\n"