From 753b20a67fa69144a99faf3517eee1362c023089 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 15 Apr 2008 22:42:23 +0000 Subject: [PATCH] - client: do the /proc/interrupts stuff (see above) only on Linux-like systems; use device_idle() only on non-Linux Unix systems svn path=/trunk/boinc/; revision=15059 --- checkin_notes | 8 ++++++++ client/hostinfo_unix.C | 12 +++++++++--- html/inc/email.inc | 7 ++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 4bbb31954d..fa517c89ca 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3255,3 +3255,11 @@ Rytis April 15 2008 html/inc/ translation.inc + +David April 15 2008 + - client: do the /proc/interrupts stuff (see above) + only on Linux-like systems; + use device_idle() only on non-Linux Unix systems + + client/ + hostinfo_unix.C diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index ec2d7c5c38..bb8ebfdb3a 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -1036,6 +1036,7 @@ inline bool user_idle(time_t t, struct utmp* u) { #else // ! __APPLE__ +#if LINUX_LIKE_SYSTEM bool interrupts_idle(time_t t) { static FILE *ifp = NULL; static long irq_count[256]; @@ -1066,6 +1067,7 @@ bool interrupts_idle(time_t t) { } return last_irq < t; } +#endif bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) { time_t idle_time = time(0) - (long) (60 * idle_time_to_run); @@ -1078,15 +1080,19 @@ bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) { if (!all_tty_idle(idle_time)) return false; - // According to Frank Thomas (#463) the following may be pointless +#if LINUX_LIKE_SYSTEM + // Check /proc/interrupts to detect keyboard or mouse activity. + if (!interrupts_idle(idle_time)) return false; +#else + // We should find out which of the following are actually relevant + // on which systems (if any) // if (!device_idle(idle_time, "/dev/mouse")) return false; // solaris, linux if (!device_idle(idle_time, "/dev/input/mice")) return false; if (!device_idle(idle_time, "/dev/kbd")) return false; // solaris - // Check /proc/interrupts to detect keyboard or mouse activity. - if (!interrupts_idle(idle_time)) return false; +#endif return true; } diff --git a/html/inc/email.inc b/html/inc/email.inc index 813048cdd0..ff610abd2b 100644 --- a/html/inc/email.inc +++ b/html/inc/email.inc @@ -46,10 +46,11 @@ function send_email($user, $subject, $body, $body_html=null) { return true; } } else { - if (defined('EMAIL_FROM')) { + $headers =""; + if (defined('EMAIL_FROM') && defined('EMAIL_FROM_NAME')) { + $headers = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM.">"; + } else if (defined('EMAIL_FROM')) { $headers = "From: ". EMAIL_FROM; - } else { - $headers =""; } return mail($user->email_addr, $subject, $body, $headers); }