Index: run_check.c =================================================================== RCS file: /usr/cvsroot/ossec-hids/src/syscheckd/run_check.c,v retrieving revision 1.27 diff -u -r1.27 run_check.c --- run_check.c 28 Mar 2007 02:53:58 -0000 1.27 +++ run_check.c 9 Aug 2007 18:41:34 -0000 @@ -10,6 +10,12 @@ */ +/** SCHED_BATCH is Linux specific and is only picked up with _GNU_SOURCE **/ +#ifdef __linux__ + #define _GNU_SOURCE + #include +#endif + #include "shared.h" #include "syscheck.h" #include "os_crypto/md5/md5_op.h" @@ -89,6 +95,20 @@ time_t prev_time_rk = 0; time_t prev_time_sk = 0; + /* + * SCHED_BATCH forces the kernel to assume this is a cpu intensive process + * and gives it a lower priority. This keeps ossec-syscheckd from reducing + * the interactity of an ssh session when checksumming large files. + * This is available in kernel flavors >= 2.6.16 + */ + #ifdef SCHED_BATCH + struct sched_param pri; + pri.sched_priority = 0; + int status = sched_setscheduler(0, SCHED_BATCH, &pri); + #ifdef DEBUG + verbose("%s: Setting SCHED_BATCH returned: %d", ARGV0, status); + #endif + #endif #ifdef DEBUG verbose("%s: Starting daemon ..",ARGV0);