openat: don’t close (-1)
[gnulib.git] / lib / sys_times.in.h
blob94bdf0ddce7b0eda7df417d585e2aca604bed60c
1 /* Provide a sys/times.h header file.
2 Copyright (C) 2008-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 /* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
19 /* This file is supposed to be used on platforms where <sys/times.h>
20 is missing. */
22 #ifndef _@GUARD_PREFIX@_SYS_TIMES_H
24 # if __GNUC__ >= 3
25 @PRAGMA_SYSTEM_HEADER@
26 # endif
27 @PRAGMA_COLUMNS@
29 /* The include_next requires a split double-inclusion guard. */
30 # if @HAVE_SYS_TIMES_H@
31 # @INCLUDE_NEXT@ @NEXT_SYS_TIMES_H@
32 # endif
34 # ifndef _@GUARD_PREFIX@_SYS_TIMES_H
35 # define _@GUARD_PREFIX@_SYS_TIMES_H
37 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
38 # if !_GL_CONFIG_H_INCLUDED
39 # error "Please include config.h first."
40 # endif
42 /* Get clock_t.
43 But avoid namespace pollution on glibc systems. */
44 # ifndef __GLIBC__
45 # include <time.h>
46 # endif
48 /* The definition of _GL_ARG_NONNULL is copied here. */
50 /* The definition of _GL_WARN_ON_USE is copied here. */
52 # ifdef __cplusplus
53 extern "C" {
54 # endif
56 # if !@HAVE_STRUCT_TMS@
57 # if !GNULIB_defined_struct_tms
58 /* Structure describing CPU time used by a process and its children. */
59 struct tms
61 clock_t tms_utime; /* User CPU time. */
62 clock_t tms_stime; /* System CPU time. */
64 clock_t tms_cutime; /* User CPU time of dead children. */
65 clock_t tms_cstime; /* System CPU time of dead children. */
67 # define GNULIB_defined_struct_tms 1
68 # endif
69 # endif
71 # if @GNULIB_TIMES@
72 # if !@HAVE_TIMES@
73 extern clock_t times (struct tms *buffer) _GL_ARG_NONNULL ((1));
74 # endif
75 # elif defined GNULIB_POSIXCHECK
76 # undef times
77 # if HAVE_RAW_DECL_TIMES
78 _GL_WARN_ON_USE (times, "times is unportable - "
79 "use gnulib module times for portability");
80 # endif
81 # endif
83 # ifdef __cplusplus
85 # endif
87 # endif /* _@GUARD_PREFIX@_SYS_TIMES_H */
88 #endif /* _@GUARD_PREFIX@_SYS_TIMES_H */