Re: [PATCH] MI: new timing command

Mark Kettenis
2006-12-31T11:58:28Z

> Date: Sun, 31 Dec 2006 06:21:59 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> > From: Nick Roberts <nickrob@snap.net.nz>
> > Date: Sun, 31 Dec 2006 11:05:35 +1300
> > Cc: gdb-patches@sourceware.org
> >
> > > > diff -c -p -r1.86 mi-main.c
> > > > *** mi-main.c 17 Nov 2006 19:30:41 -0000 1.86
> > > > --- mi-main.c 30 Dec 2006 08:42:29 -0000
> > > > ***************
> > > > *** 49,54 ****
> > > > --- 49,55 ----
> > > >
> > > > #include <ctype.h>
> > > > #include <sys/time.h>
> > > > + #include <sys/resource.h>
> > >
> > > Is sys/resource.h guaranteed to be available on all supported
> > > platforms? If not, we need to add a configure-time test and enable
> > > this code only under HAVE_GETRUSAGE or some such.
> >
> > mi-main.c already uses sys/time.h. Is sys/resource.h any less widely
> > distributed?
>
> I think sys/time.h is much more wide-spread, but I might be wrong. I
> raised the issue because sys/resource.h is relatively seldom used, so
> it might be less portable.
>
> > Is there any way of finding out e.g online database?
>
> Sorry, I don't know. Anyone?

The OpenBSD getrusage(2) manpage says that the getrusage() function
call appeared in 4.2BSD. Seventh Edition Unix doesn't have it (but
doesn't have <sys/time.h> either). HP-UX 10.20 and Solaris 2.6 both
have it, so I'm pretty sure all the UNIX-like systems we support have
it. But POSIX marks it as an XSI extension, so I think we should not
rely on it.