getruntime.c (get_run_time): Use RUSAGE_SELF as argument 1 of getrusage call.
authorUros Bizjak <ubizjak@gmail.com>
Wed, 8 Jul 2015 07:05:11 +0000 (09:05 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 8 Jul 2015 07:05:11 +0000 (09:05 +0200)
* getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as
argument 1 of getrusage call.

From-SVN: r225534

libiberty/ChangeLog
libiberty/getruntime.c

index f2b014841aae4b528b348af7c7e467d0f03fc6b8..643d04ea265e4372103277c81466cf757939624c 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-08  Uros Bizjak  <ubizjak@gmail.com>
+
+       * getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as
+       argument 1 of getrusage call.
+
 2015-06-01  Jason Merrill  <jason@redhat.com>
 
        * cp-demangle.c (cplus_demangle_type): Handle arguments to vendor
index 82f3d2e41858852e19ec3ab9215a55c66fa103ad..9d5eed191165107306441d1b07d9cf9c150b40f8 100644 (file)
@@ -95,7 +95,11 @@ 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 */