]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Solaris bug requires suid privs for getrusage() (Arjan de Vet)
authorwessels <>
Tue, 25 Feb 1997 06:43:14 +0000 (06:43 +0000)
committerwessels <>
Tue, 25 Feb 1997 06:43:14 +0000 (06:43 +0000)
src/stat.cc
src/tools.cc

index dfb8d116175ed87bdf4f139ed62233ed7f54c280..af6b0c3585b1b3d17262865c0eee21235a5b839d 100644 (file)
@@ -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,
index 289272f10ea4fda7a720821bc61e2f4cbacef2dd..45cb7a776ee493cbe67291a65dd73f3630f275fe 100644 (file)
@@ -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)