.Nm getrusage
.Nd get information about resource utilization
.Sh SYNOPSIS
-.Fd #include <sys/time.h>
.Fd #include <sys/resource.h>
+.Pp
.Fd #define RUSAGE_SELF 0
.Fd #define RUSAGE_CHILDREN -1
.Ft int
-.Fn getrusage "int who" "struct rusage *rusage"
+.Fo getrusage
+.Fa "int who"
+.Fa "struct rusage *r_usage"
+.Fc
.Sh DESCRIPTION
-.Fn Getrusage
+.Fn getrusage
returns information describing the resources utilized by the current
process, or all its terminated child processes.
The
or
.Dv RUSAGE_CHILDREN .
The buffer to which
-.Fa rusage
+.Fa r_usage
points will be filled in with
the following structure:
.Bd -literal
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
- long ru_maxrss; /* integral max resident set size */
+ long ru_maxrss; /* max resident set size */
long ru_ixrss; /* integral shared text memory size */
long ru_idrss; /* integral unshared data size */
long ru_isrss; /* integral unshared stack size */
the total amount of time spent in the system executing on behalf
of the process(es).
.It Fa ru_maxrss
-the maximum resident set size utilized (in kilobytes).
+the maximum resident set size utilized (in bytes).
.It Fa ru_ixrss
an \*(lqintegral\*(rq value indicating the amount of memory used
by the text segment
account only for real
I/O; data supplied by the caching mechanism is charged only
to the first process to read or write the data.
+.Sh RETURN VALUES
+.Rv -std getrusage
.Sh ERRORS
-.Fn Getrusage
-returns -1 on error.
-The possible errors are:
+The
+.Fn getrusage
+system call will fail if:
.Bl -tag -width Er
+.It Bq Er EFAULT
+The address specified by the
+.Fa r_usage
+parameter is not in a valid part of the process address space.
.It Bq Er EINVAL
The
.Fa who
parameter is not a valid value.
-.It Bq Er EFAULT
-The address specified by the
-.Fa rusage
-parameter is not in a valid part of the process address space.
.El
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/time.h>
+.Fd #include <sys/resource.h>
+.Pp
+The include file
+.In sys/time.h
+is necessary.
.Sh SEE ALSO
.Xr gettimeofday 2 ,
-.Xr wait 2
+.Xr wait 2 ,
+.Xr compat 5
.Sh BUGS
There is no way to obtain information about a child process
that has not yet terminated.