From cd19f0b687f7cba3d7fc06bef2afc8cf5f880e25 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 25 Feb 1997 06:43:14 +0000 Subject: [PATCH] Solaris bug requires suid privs for getrusage() (Arjan de Vet) --- src/stat.cc | 9 ++++++++- src/tools.cc | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/stat.cc b/src/stat.cc index dfb8d11617..af6b0c3585 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.125 1997/02/07 04:57:16 wessels Exp $ + * $Id: stat.cc,v 1.126 1997/02/24 23:43:14 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -765,7 +765,14 @@ info_get(const cacheinfo * obj, StoreEntry * sentry) #if HAVE_GETRUSAGE && defined(RUSAGE_SELF) storeAppendPrintf(sentry, "{Resource usage for %s:}\n", appname); +#ifdef _SQUID_SOLARIS_ + /* Solaris 2.5 has getrusage() permission bug -- Arjan de Vet */ + enter_suid(); +#endif getrusage(RUSAGE_SELF, &rusage); +#ifdef _SQUID_SOLARIS_ + leave_suid(); +#endif storeAppendPrintf(sentry, "{\tCPU Time: %d seconds (%d user %d sys)}\n", (int) rusage.ru_utime.tv_sec + (int) rusage.ru_stime.tv_sec, (int) rusage.ru_utime.tv_sec, diff --git a/src/tools.cc b/src/tools.cc index 289272f10e..45cb7a776e 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.95 1997/01/31 20:28:17 wessels Exp $ + * $Id: tools.cc,v 1.96 1997/02/24 23:43:15 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -209,7 +209,14 @@ PrintRusage(void (*f) (void), FILE * lf) { #if HAVE_GETRUSAGE && defined(RUSAGE_SELF) struct rusage rusage; +#ifdef _SQUID_SOLARIS_ + /* Solaris 2.5 has getrusage() permission bug -- Arjan de Vet */ + enter_suid(); +#endif getrusage(RUSAGE_SELF, &rusage); +#ifdef _SQUID_SOLARIS_ + leave_suid(); +#endif fprintf(lf, "CPU Usage: user %d sys %d\n", (int) rusage.ru_utime.tv_sec, (int) rusage.ru_stime.tv_sec); #if defined(_SQUID_SGI_) || defined(_SQUID_OSF_) || defined(BSD4_4) -- 2.47.3