Commit 8b8d9925 authored by Daniel Hsu's avatar Daniel Hsu

*** empty log message ***

svn path=/trunk/boinc/; revision=3541
parent 673c7f81
......@@ -250,7 +250,6 @@ Eric H. May 30, 2002
David A. June 1, 2002
- Ensure that preferences propagate from the server
where they are updated to all hosts,
and from there to the servers of other project.
Eliminated concept of "home project".
Not tested yet.
Also to do: replace the "accounts.xml" file with
......@@ -13321,3 +13320,14 @@ Jeff 11 June 2004
sched/
start
Daniel 11 June 2004
- client: check_idle() now also checks /dev/tty[1-7] (linux).
Also put idle checks under #ifdefs. MacOS X idle checks
will be more difficult.
configure
configure.ac
client/
cs_prefs.C
......@@ -109,11 +109,36 @@ inline bool device_idle(time_t t, char *device) {
return stat(device, &sbuf) || (sbuf.st_atime < t);
}
inline bool all_tty_idle(time_t t, char *device, char first_char, int num_tty) {
struct stat sbuf;
char *tty_index = device + strlen(device) - 1;
*tty_index = first_char;
for (int i = 0; i < num_tty; i++, (*tty_index)++) {
if (stat(device, &sbuf)) {
// error looking at device; don't try any more
return true;
} else if (sbuf.st_atime >= t) {
return false;
}
}
return true;
}
void CLIENT_STATE::check_idle() {
char device_tty[] = "/dev/tty1";
time_t idle_time =
time(NULL) - (long) (60 * global_prefs.idle_time_to_run);
user_idle = device_idle(idle_time, "/dev/kbd")
&& device_idle(idle_time, "/dev/mouse");
user_idle = true
#ifdef HAVE__DEV_MOUSE
&& device_idle(idle_time, "/dev/mouse") // solaris, linux
#endif
#ifdef HAVE__DEV_KBD
&& device_idle(idle_time, "/dev/kbd") // solaris
#endif
#ifdef HAVE__DEV_TTY1
&& all_tty_idle(idle_time, device_tty, '1', 7) // linux
#endif
;
}
#endif
......
......@@ -7771,6 +7771,28 @@ _ACEOF
fi
if test -e "/dev/mouse"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE__DEV_MOUSE 1
_ACEOF
fi
if test -e "/dev/kbd"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE__DEV_KBD 1
_ACEOF
fi
if test -e "/dev/tty1"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE__DEV_TTY1 1
_ACEOF
fi
# by default, create static binaries on linux.
#[if [ "$target_os" = "linux-gnu" ]; then
# STATIC_FLAGS="-static"
......
......@@ -120,6 +120,17 @@ AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
dnl Checks for device files
if test -e "/dev/mouse"; then
AC_DEFINE(HAVE__DEV_MOUSE, 1, [Define to 1 if /dev/mouse exists])
fi
if test -e "/dev/kbd"; then
AC_DEFINE(HAVE__DEV_KBD, 1, [Define to 1 if /dev/kbd exists])
fi
if test -e "/dev/tty1"; then
AC_DEFINE(HAVE__DEV_TTY1, 1, [Define to 1 if /dev/tty1 exists])
fi
# by default, create static binaries on linux.
#[if [ "$target_os" = "linux-gnu" ]; then
# STATIC_FLAGS="-static"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment