]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
getruntime.c (RUSAGE_SELF): Define if not already defined.
authorUros Bizjak <ubizjak@gmail.com>
Thu, 9 Jul 2015 15:06:00 +0000 (17:06 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 9 Jul 2015 15:06:00 +0000 (17:06 +0200)
* getruntime.c (RUSAGE_SELF): Define if not already defined.
(get_runtime): Use RUSAGE_SELF as argument 1 of getrusage call.

From-SVN: r225614

libiberty/ChangeLog
libiberty/getruntime.c

index 643d04ea265e4372103277c81466cf757939624c..5d009cc8468f3a7985719eb05354b089a67427fe 100644 (file)
@@ -1,7 +1,7 @@
-2015-07-08  Uros Bizjak  <ubizjak@gmail.com>
+2015-07-09  Uros Bizjak  <ubizjak@gmail.com>
 
-       * getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as
-       argument 1 of getrusage call.
+       * getruntime.c (RUSAGE_SELF): Define if not already defined.
+       (get_runtime): Use RUSAGE_SELF as argument 1 of getrusage call.
 
 2015-06-01  Jason Merrill  <jason@redhat.com>
 
index 9d5eed191165107306441d1b07d9cf9c150b40f8..1e0daad19ac0e4bdebbe4b2ed15dc50b6fa40e0d 100644 (file)
@@ -65,6 +65,10 @@ Boston, MA 02110-1301, USA.  */
 #define CLOCKS_PER_SEC 1
 #endif
 
+#ifndef RUSAGE_SELF
+#define RUSAGE_SELF 0
+#endif
+
 #ifdef _SC_CLK_TCK
 #define GNU_HZ  sysconf(_SC_CLK_TCK)
 #else
@@ -95,11 +99,7 @@ get_run_time (void)
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
   struct rusage rusage;
 
-#if defined __USE_GNU && !defined __cplusplus
   getrusage (RUSAGE_SELF, &rusage);
-#else
-  getrusage (0, &rusage);
-#endif
   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
          + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
 #else /* ! HAVE_GETRUSAGE */