exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / sys_resource.in.h
blobc15450cef15ad6a084733bf03d02f9c300db11db
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/>. */
17 # if __GNUC__ >= 3
18 @PRAGMA_SYSTEM_HEADER@
19 # endif
20 @PRAGMA_COLUMNS@
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>
27 and <sys/time.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@
34 #endif
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."
42 #endif
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
54 # ifdef __cplusplus
55 extern "C" {
56 # endif
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. */
61 struct rusage
63 struct timeval ru_utime; /* CPU time used in user mode */
64 struct timeval ru_stime; /* CPU time used in system mode (kernel) */
65 long ru_maxrss;
66 long ru_ixrss;
67 long ru_idrss;
68 long ru_isrss;
69 long ru_minflt;
70 long ru_majflt;
71 long ru_nswap;
72 long ru_inblock;
73 long ru_oublock;
74 long ru_msgsnd;
75 long ru_msgrcv;
76 long ru_nsignals;
77 long ru_nvcsw;
78 long ru_nivcsw;
80 # define GNULIB_defined_struct_rusage 1
81 # endif
83 # ifdef __cplusplus
85 # endif
87 #else
89 # ifdef __VMS /* OpenVMS */
90 /* Define the RUSAGE_* constants. */
91 # ifndef RUSAGE_SELF
92 # define RUSAGE_SELF 0
93 # endif
94 # ifndef RUSAGE_CHILDREN
95 # define RUSAGE_CHILDREN -1
96 # endif
97 # endif
99 #endif
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)));
115 # endif
116 _GL_CXXALIAS_SYS (getrusage, int, (int who, struct rusage *usage_p));
117 _GL_CXXALIASWARN (getrusage);
118 #elif defined GNULIB_POSIXCHECK
119 # undef getrusage
120 # if HAVE_RAW_DECL_GETRUSAGE
121 _GL_WARN_ON_USE (getrusage, "getrusage is unportable - "
122 "use gnulib module getrusage for portability");
123 # endif
124 #endif
127 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */
128 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */