From 272c2b0c6852cdff02bb08231cccea0d1ecfb883 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 8 Aug 2015 20:15:59 -0700 Subject: [PATCH] client: Avoid kernel panics at system boot when running as a service / daemon under Mac OS 10.10.4. --- client/main.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/client/main.cpp b/client/main.cpp index 9cf60bc2e7..6e3ffb1267 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2015 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License @@ -47,9 +47,12 @@ #endif -#if (defined (__APPLE__) && defined(SANDBOX) && defined(_DEBUG)) +#ifdef __APPLE__ +#include +#if (defined(SANDBOX) && defined(_DEBUG)) #include "SetupSecurity.h" #endif +#endif #include "diagnostics.h" #include "error_numbers.h" @@ -352,6 +355,15 @@ int boinc_main_loop() { retval = initialize(); if (retval) return retval; +#ifdef __APPLE__ + // If we run too soon during system boot we can cause a kernel panic + if (gstate.executing_as_daemon) { + if (TickCount() < (120*60)) { // If system has been up for less than 2 minutes + boinc_sleep(30.); + } + } +#endif + retval = gstate.init(); if (retval) { log_message_error("gstate.init() failed", retval);