diff options
-rw-r--r-- | src/cmd_stats.cpp | 6 | ||||
-rw-r--r-- | src/inspircd.cpp | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 9a0dc5ef7..037ffe304 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -15,6 +15,12 @@ #include "configreader.h" #ifndef WIN32 #include <sys/resource.h> + +/* This is just to be completely certain that the change which fixed getrusage on RH7 doesn't break anything else -- Om */ +#ifndef RUSAGE_SELF +#define RUSAGE_SELF 0 +#endif + #endif #include "users.h" #include "modules.h" diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 1761d47fa..bcfc92c48 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -15,8 +15,16 @@ #include "configreader.h" #include <signal.h> #ifndef WIN32 + #include <dirent.h> #include <unistd.h> +#include <sys/resource.h> + +/* This is just to be completely certain that the change which fixed getrusage on RH7 doesn't break anything else -- Om */ +#ifndef RUSAGE_SELF +#define RUSAGE_SELF 0 +#endif + #endif #include <exception> #include <fstream> @@ -978,7 +986,8 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) Timers->TickMissedTimers(TIME); } #ifndef WIN32 - if (!getrusage(0, &ru)) + /* Same change as in cmd_stats.cpp, use RUSAGE_SELF rather than '0' -- Om */ + if (!getrusage(RUSAGE_SELF, &ru)) { gettimeofday(&this->stats->LastSampled, NULL); this->stats->LastCPU = ru.ru_utime; |