1 /* Substitute for <sys/resource.h>.
2 Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 @PRAGMA_SYSTEM_HEADER@
22 #ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H
24 #if @HAVE_SYS_RESOURCE_H@
26 /* On FreeBSD 5.0, <sys/resource.h> assumes prior inclusion of <sys/types.h>
28 # include <sys/types.h>
29 # include <sys/time.h>
31 /* The include_next requires a split double-inclusion guard. */
32 # @INCLUDE_NEXT@ @NEXT_SYS_RESOURCE_H@
36 #ifndef _@GUARD_PREFIX@_SYS_RESOURCE_H
37 #define _@GUARD_PREFIX@_SYS_RESOURCE_H
39 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
40 #if !_GL_CONFIG_H_INCLUDED
41 #error "Please include config.h first."
44 #if !@HAVE_SYS_RESOURCE_H@
45 /* A platform that lacks <sys/resource.h>. */
47 /* Get 'struct timeval'. */
48 # include <sys/time.h>
50 /* Define the RUSAGE_* constants. */
51 # define RUSAGE_SELF 0
52 # define RUSAGE_CHILDREN -1
58 # if !GNULIB_defined_struct_rusage
59 /* All known platforms that lack <sys/resource.h> also lack any declaration
60 of struct rusage in any other header. */
63 struct timeval ru_utime
; /* CPU time used in user mode */
64 struct timeval ru_stime
; /* CPU time used in system mode (kernel) */
80 # define GNULIB_defined_struct_rusage 1
89 # ifdef __VMS /* OpenVMS */
90 /* Define the RUSAGE_* constants. */
92 # define RUSAGE_SELF 0
94 # ifndef RUSAGE_CHILDREN
95 # define RUSAGE_CHILDREN -1
101 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
103 /* The definition of _GL_ARG_NONNULL is copied here. */
105 /* The definition of _GL_WARN_ON_USE is copied here. */
108 /* Declare overridden functions. */
111 #if @GNULIB_GETRUSAGE@
112 # if !@HAVE_GETRUSAGE@
113 _GL_FUNCDECL_SYS (getrusage
, int, (int who
, struct rusage
*usage_p
),
114 _GL_ARG_NONNULL ((2)));
116 _GL_CXXALIAS_SYS (getrusage
, int, (int who
, struct rusage
*usage_p
));
117 _GL_CXXALIASWARN (getrusage
);
118 #elif defined GNULIB_POSIXCHECK
120 # if HAVE_RAW_DECL_GETRUSAGE
121 _GL_WARN_ON_USE (getrusage
, "getrusage is unportable - "
122 "use gnulib module getrusage for portability");
127 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */
128 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */