diff libiberty/getruntime.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents a06113de4d67
children 84e7813d76e9
line wrap: on
line diff
--- a/libiberty/getruntime.c	Sun Aug 21 07:07:55 2011 +0900
+++ b/libiberty/getruntime.c	Fri Oct 27 22:46:09 2017 +0900
@@ -1,5 +1,5 @@
 /* Return time used so far, in microseconds.
-   Copyright (C) 1994, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1994-2017 Free Software Foundation, Inc.
 
 This file is part of the libiberty library.
 Libiberty is free software; you can redistribute it and/or
@@ -65,6 +65,10 @@
 #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,7 +99,7 @@
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
   struct rusage rusage;
 
-  getrusage (0, &rusage);
+  getrusage (RUSAGE_SELF, &rusage);
   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 */