fchmod-tests, fchmodat tests, lchmod tests: Add more tests.
[gnulib.git] / lib / sys_resource.in.h
blobe70f2b192709c183e40b69efb17cad3eee68dfe4
1 /* Substitute for <sys/resource.h>.
2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program 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 General Public License for more details.
14 You should have received a copy of the GNU 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 #if !@HAVE_SYS_RESOURCE_H@
40 /* A platform that lacks <sys/resource.h>. */
42 /* Get 'struct timeval'. */
43 # include <sys/time.h>
45 /* Define the RUSAGE_* constants. */
46 # define RUSAGE_SELF 0
47 # define RUSAGE_CHILDREN -1
49 # ifdef __cplusplus
50 extern "C" {
51 # endif
53 # if !GNULIB_defined_struct_rusage
54 /* All known platforms that lack <sys/resource.h> also lack any declaration
55 of struct rusage in any other header. */
56 struct rusage
58 struct timeval ru_utime; /* CPU time used in user mode */
59 struct timeval ru_stime; /* CPU time used in system mode (kernel) */
60 long ru_maxrss;
61 long ru_ixrss;
62 long ru_idrss;
63 long ru_isrss;
64 long ru_minflt;
65 long ru_majflt;
66 long ru_nswap;
67 long ru_inblock;
68 long ru_oublock;
69 long ru_msgsnd;
70 long ru_msgrcv;
71 long ru_nsignals;
72 long ru_nvcsw;
73 long ru_nivcsw;
75 # define GNULIB_defined_struct_rusage 1
76 # endif
78 # ifdef __cplusplus
80 # endif
82 #else
84 # ifdef __VMS /* OpenVMS */
85 /* Define the RUSAGE_* constants. */
86 # ifndef RUSAGE_SELF
87 # define RUSAGE_SELF 0
88 # endif
89 # ifndef RUSAGE_CHILDREN
90 # define RUSAGE_CHILDREN -1
91 # endif
92 # endif
94 #endif
96 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
98 /* The definition of _GL_ARG_NONNULL is copied here. */
100 /* The definition of _GL_WARN_ON_USE is copied here. */
103 /* Declare overridden functions. */
106 #if @GNULIB_GETRUSAGE@
107 # if !@HAVE_GETRUSAGE@
108 _GL_FUNCDECL_SYS (getrusage, int, (int who, struct rusage *usage_p)
109 _GL_ARG_NONNULL ((2)));
110 # endif
111 _GL_CXXALIAS_SYS (getrusage, int, (int who, struct rusage *usage_p));
112 _GL_CXXALIASWARN (getrusage);
113 #elif defined GNULIB_POSIXCHECK
114 # undef getrusage
115 # if HAVE_RAW_DECL_GETRUSAGE
116 _GL_WARN_ON_USE (getrusage, "getrusage is unportable - "
117 "use gnulib module getrusage for portability");
118 # endif
119 #endif
122 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */
123 #endif /* _@GUARD_PREFIX@_SYS_RESOURCE_H */