BRL-CAD
Loading...
Searching...
No Matches
bresource.h
Go to the documentation of this file.
1/* B R E S O U R C E . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2015-2026 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup bu_resource
21 *
22 * BRL-CAD system compatibility wrapper header that provides
23 * declarations for standard system RESOURCE LIMIT routines.
24 *
25 * This header is commonly used in lieu of including the following:
26 * sys/resource.h sys/time.h sys/wait.h sys/user.h sys/kinfo.h
27 * mach/mach.h
28 *
29 * This header does not belong to any BRL-CAD library but may used by
30 * all of them.
31 *
32 * The following preprocessor variables control header inclusions:
33 * HAVE_SYS_TIME_H
34 * HAVE_SYS_RESOURCE_H
35 * HAVE_SYS_WAIT_H
36 * HAVE_SYS_USER_H
37 * HAVE_SYS_KINFO_H
38 * HAVE_MACH_MACH_H
39 */
40/** @{ */
41/** @file bresource.h */
42
43#ifndef BRESOURCE_H
44#define BRESOURCE_H
45
46/* intentionally not included for header independence */
47/* #include "common.h" */
48
49#ifdef HAVE_SYS_TIME_H
50# include <sys/time.h>
51#endif
52
53/* this ugly hack overcomes a c89 + -pedantic-errors bug in glibc <2.9
54 * where it raises a warning for a trailing comma when including the
55 * sys/resource.h system header.
56 *
57 * need a better solution that preserves pedantic c89 compilation,
58 * ideally without resorting to a sys/resource.h compilation feature
59 * test (which will vary with build flags).
60 */
61#if !defined(__USE_GNU) && defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9)
62# define __USE_GNU 1
63# define DEFINED_USE_GNU 1
64#endif
65#ifdef HAVE_SYS_RESOURCE_H
66# include <sys/resource.h>
67#endif
68#ifdef DEFINED_USE_GNU
69# undef __USE_GNU
70# undef DEFINED_USE_GNU
71#endif
72
73#ifdef HAVE_SYS_WAIT_H
74# include <sys/wait.h>
75#endif
76#if defined(__FreeBSD__) && defined(HAVE_SYS_USER_H)
77# include <sys/user.h>
78#endif
79#if defined(__DragonFly__) && defined(HAVE_SYS_KINFO_H)
80# include <sys/kinfo.h>
81#endif
82#if defined(__APPLE__) && defined(HAVE_MACH_MACH_H)
83# include <mach/mach.h>
84#endif
85
86#endif /* BRESOURCE_H */
87
88/** @} */
89
90/*
91 * Local Variables:
92 * tab-width: 8
93 * mode: C
94 * indent-tabs-mode: t
95 * c-file-style: "stroustrup"
96 * End:
97 * ex: shiftwidth=4 tabstop=8
98 */