logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

getrusage.3p (3145B)


  1. '\" et
  2. .TH GETRUSAGE "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. getrusage
  12. \(em get information about resource utilization
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/resource.h>
  17. .P
  18. int getrusage(int \fIwho\fP, struct rusage *\fIr_usage\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIgetrusage\fR()
  23. function shall provide measures of the resources used by the current
  24. process or its terminated and waited-for child processes. If the value
  25. of the
  26. .IR who
  27. argument is RUSAGE_SELF, information shall be returned about resources
  28. used by the current process. If the value of the
  29. .IR who
  30. argument is RUSAGE_CHILDREN,
  31. information shall be returned about resources used by the terminated and
  32. waited-for children of the current process. If the child is never
  33. waited for (for example, if the parent has SA_NOCLDWAIT set or sets
  34. SIGCHLD to SIG_IGN), the resource
  35. information for the child process is discarded and not included in the
  36. resource information provided by
  37. \fIgetrusage\fR().
  38. .P
  39. The
  40. .IR r_usage
  41. argument is a pointer to an object of type
  42. .BR "struct rusage"
  43. in which the returned information is stored.
  44. .SH "RETURN VALUE"
  45. Upon successful completion,
  46. \fIgetrusage\fR()
  47. shall return 0; otherwise, \-1 shall be returned and
  48. .IR errno
  49. set to indicate the error.
  50. .SH ERRORS
  51. The
  52. \fIgetrusage\fR()
  53. function shall fail if:
  54. .TP
  55. .BR EINVAL
  56. The value of the
  57. .IR who
  58. argument is not valid.
  59. .LP
  60. .IR "The following sections are informative."
  61. .SH EXAMPLES
  62. .SS "Using getrusage(\|)"
  63. .P
  64. The following example returns information about the resources used by
  65. the current process.
  66. .sp
  67. .RS 4
  68. .nf
  69. #include <sys/resource.h>
  70. \&...
  71. int who = RUSAGE_SELF;
  72. struct rusage usage;
  73. int ret;
  74. .P
  75. ret = getrusage(who, &usage);
  76. .fi
  77. .P
  78. .RE
  79. .SH "APPLICATION USAGE"
  80. None.
  81. .SH RATIONALE
  82. None.
  83. .SH "FUTURE DIRECTIONS"
  84. None.
  85. .SH "SEE ALSO"
  86. .IR "\fIexit\fR\^(\|)",
  87. .IR "\fIsigaction\fR\^(\|)",
  88. .IR "\fItime\fR\^(\|)",
  89. .IR "\fItimes\fR\^(\|)",
  90. .IR "\fIwait\fR\^(\|)"
  91. .P
  92. The Base Definitions volume of POSIX.1\(hy2017,
  93. .IR "\fB<sys_resource.h>\fP"
  94. .\"
  95. .SH COPYRIGHT
  96. Portions of this text are reprinted and reproduced in electronic form
  97. from IEEE Std 1003.1-2017, Standard for Information Technology
  98. -- Portable Operating System Interface (POSIX), The Open Group Base
  99. Specifications Issue 7, 2018 Edition,
  100. Copyright (C) 2018 by the Institute of
  101. Electrical and Electronics Engineers, Inc and The Open Group.
  102. In the event of any discrepancy between this version and the original IEEE and
  103. The Open Group Standard, the original IEEE and The Open Group Standard
  104. is the referee document. The original Standard can be obtained online at
  105. http://www.opengroup.org/unix/online.html .
  106. .PP
  107. Any typographical or formatting errors that appear
  108. in this page are most likely
  109. to have been introduced during the conversion of the source files to
  110. man page format. To report such errors, see
  111. https://www.kernel.org/doc/man-pages/reporting_bugs.html .