OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man2 / getrusage.2
index 0e5bc0a..2c30ee3 100644 (file)
@@ -1,8 +1,7 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright (c) 1992 Drew Eckhardt, March 28, 1992
 .\" and Copyright (c) 2002 Michael Kerrisk
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -22,6 +21,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
 .\" coverage of getrusage(2), has been split, so that the latter is
@@ -36,7 +36,7 @@
 .\"     document ru_maxrss
 .\" 2010-05-24, mtk, enhanced description of various fields
 .\"
-.TH GETRUSAGE 2 2010-06-14 "Linux" "Linux Programmer's Manual"
+.TH GETRUSAGE 2 2014-05-10 "Linux" "Linux Programmer's Manual"
 .SH NAME
 getrusage \- get resource usage
 .SH SYNOPSIS
@@ -65,6 +65,13 @@ if all of the intervening descendants waited on their terminated children.
 .TP
 .BR RUSAGE_THREAD " (since Linux 2.6.26)"
 Return resource usage statistics for the calling thread.
+The
+.B _GNU_SOURCE
+feature test macro must be defined (before including
+.I any
+header file)
+in order to obtain the definition of this constant from
+.IR <sys/resource.h> .
 .PP
 The resource usages are returned in the structure pointed to by
 .IR usage ,
@@ -112,7 +119,8 @@ expressed in a
 structure (seconds plus microseconds).
 .TP
 .IR ru_maxrss " (since Linux 2.6.32)"
-This is the maximum resident set size used (in kilobytes). For
+This is the maximum resident set size used (in kilobytes).
+For
 .BR RUSAGE_CHILDREN ,
 this is the resident set size of the largest child, not the maximum
 resident set size of the process tree.
@@ -146,10 +154,10 @@ This field is currently unused on Linux.
 .\" On some systems, this is the number of swaps out of physical memory.
 .TP
 .IR ru_inblock " (since Linux 2.6.22)"
-The number of times the file system had to perform input.
+The number of times the filesystem had to perform input.
 .TP
 .IR ru_oublock " (since Linux 2.6.22)"
-The number of times the file system had to perform output.
+The number of times the filesystem had to perform output.
 .TP
 .IR ru_msgsnd " (unmaintained)"
 This field is currently unused on Linux.
@@ -177,7 +185,7 @@ The number of times a context switch resulted due to a higher
 priority process becoming runnable or because the current process
 exceeded its time slice.
 .PP
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 On success, zero is returned.
 On error, \-1 is returned, and
 .I errno
@@ -191,11 +199,11 @@ points outside the accessible address space.
 .B EINVAL
 .I who
 is invalid.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 SVr4, 4.3BSD.
 POSIX.1-2001 specifies
 .BR getrusage (),
-but only specifies the fields
+but specifies only the fields
 .I ru_utime
 and
 .IR ru_stime .
@@ -229,14 +237,32 @@ This nonconformance is rectified in Linux 2.6.9 and later.
 The structure definition shown at the start of this page
 was taken from 4.3BSD Reno.
 
+Ancient systems provided a
+.BR vtimes ()
+function with a similar purpose to
+.BR getrusage ().
+For backward compatibility, glibc also provides
+.BR vtimes ().
+All new applications should be written using
+.BR getrusage ().
+
 See also the description of
 .IR /proc/PID/stat
 in
 .BR proc (5).
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR clock_gettime (2),
 .BR getrlimit (2),
 .BR times (2),
 .BR wait (2),
 .BR wait4 (2),
 .BR clock (3)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.