From 461839e0f9902888873b88d52183482262da63f7 Mon Sep 17 00:00:00 2001 From: om Date: Sun, 3 Jun 2007 10:42:08 +0000 Subject: [PATCH] Probably fix 2nd compile issue on RH7 and add some checks which *should* ensure none of this can break anything else git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7223 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_stats.cpp | 6 ++++++ src/inspircd.cpp | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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 + +/* 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 #ifndef WIN32 + #include #include +#include + +/* 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 #include @@ -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; -- 2.39.5