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
This commit is contained in:
om 2007-06-03 10:42:08 +00:00
parent afc03e1287
commit 461839e0f9
2 changed files with 16 additions and 1 deletions

View File

@ -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"

View File

@ -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;