Skip to content

Commit 414980d

Browse files
authored
[CMake] Remove HAVE_SYS_RESOURCE_H/HAVE_SETRLIMIT/HAVE_GETRLIMIT
Only used by Unix/Program.inc and seem always available. Pull Request: #123288
1 parent bfb6bb6 commit 414980d

File tree

7 files changed

+0
-48
lines changed

7 files changed

+0
-48
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|
2323
set(HAVE_MALLOC_MALLOC_H 0)
2424
set(HAVE_PTHREAD_H 1)
2525
set(HAVE_SYS_MMAN_H 1)
26-
set(HAVE_SYS_RESOURCE_H 1)
2726
set(HAVE_SYSEXITS_H 1)
2827
set(HAVE_UNISTD_H 1)
2928
elseif (APPLE)
@@ -32,7 +31,6 @@ elseif (APPLE)
3231
set(HAVE_MALLOC_MALLOC_H 1)
3332
set(HAVE_PTHREAD_H 1)
3433
set(HAVE_SYS_MMAN_H 1)
35-
set(HAVE_SYS_RESOURCE_H 1)
3634
set(HAVE_SYSEXITS_H 1)
3735
set(HAVE_UNISTD_H 1)
3836
elseif (PURE_WINDOWS)
@@ -41,7 +39,6 @@ elseif (PURE_WINDOWS)
4139
set(HAVE_MALLOC_MALLOC_H 0)
4240
set(HAVE_PTHREAD_H 0)
4341
set(HAVE_SYS_MMAN_H 0)
44-
set(HAVE_SYS_RESOURCE_H 0)
4542
set(HAVE_SYSEXITS_H 0)
4643
set(HAVE_UNISTD_H 0)
4744
elseif (ZOS)
@@ -52,7 +49,6 @@ elseif (ZOS)
5249
set(HAVE_MALLOC_MALLOC_H 0)
5350
set(HAVE_PTHREAD_H 1)
5451
set(HAVE_SYS_MMAN_H 1)
55-
set(HAVE_SYS_RESOURCE_H 1)
5652
set(HAVE_SYSEXITS_H 0)
5753
set(HAVE_UNISTD_H 1)
5854
else()
@@ -62,7 +58,6 @@ else()
6258
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
6359
check_include_file(pthread.h HAVE_PTHREAD_H)
6460
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
65-
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
6661
check_include_file(sysexits.h HAVE_SYSEXITS_H)
6762
check_include_file(unistd.h HAVE_UNISTD_H)
6863
endif()
@@ -326,7 +321,6 @@ check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE)
326321
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
327322
check_symbol_exists(sysconf unistd.h HAVE_SYSCONF)
328323
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
329-
check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
330324
check_symbol_exists(isatty unistd.h HAVE_ISATTY)
331325
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
332326
check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
@@ -342,7 +336,6 @@ check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
342336
check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2)
343337
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
344338
HAVE_MALLOC_ZONE_STATISTICS)
345-
check_symbol_exists(getrlimit "sys/types.h;sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
346339
check_symbol_exists(posix_spawn spawn.h HAVE_POSIX_SPAWN)
347340
check_symbol_exists(pread unistd.h HAVE_PREAD)
348341
check_symbol_exists(sbrk unistd.h HAVE_SBRK)

llvm/include/llvm/Config/config.h.cmake

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@
9090
/* Define to 1 if you have the `getpagesize' function. */
9191
#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}
9292

93-
/* Define to 1 if you have the `getrlimit' function. */
94-
#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT}
95-
9693
/* Define to 1 if you have the `getrusage' function. */
9794
#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}
9895

@@ -165,9 +162,6 @@
165162
/* Define to 1 if you have the `setenv' function. */
166163
#cmakedefine HAVE_SETENV ${HAVE_SETENV}
167164

168-
/* Define to 1 if you have the `setrlimit' function. */
169-
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}
170-
171165
/* Define to 1 if you have the `sigaltstack' function. */
172166
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}
173167

@@ -180,9 +174,6 @@
180174
/* Define to 1 if you have the <sys/mman.h> header file. */
181175
#cmakedefine HAVE_SYS_MMAN_H ${HAVE_SYS_MMAN_H}
182176

183-
/* Define to 1 if you have the <sys/resource.h> header file. */
184-
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
185-
186177
/* Define to 1 if stat struct has st_mtimespec member .*/
187178
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}
188179

llvm/lib/Support/Unix/Process.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include <optional>
2020
#include <fcntl.h>
2121
#include <sys/time.h>
22-
#ifdef HAVE_SYS_RESOURCE_H
2322
#include <sys/resource.h>
24-
#endif
2523
#include <sys/stat.h>
2624
#include <signal.h>
2725
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
@@ -128,7 +126,6 @@ void Process::GetTimeUsage(TimePoint<> &elapsed,
128126
// their operation. To prevent the disk from filling up, this function
129127
// does what's necessary to prevent their generation.
130128
void Process::PreventCoreFiles() {
131-
#if HAVE_SETRLIMIT
132129
struct rlimit rlim;
133130
getrlimit(RLIMIT_CORE, &rlim);
134131
#ifdef __linux__
@@ -151,7 +148,6 @@ void Process::PreventCoreFiles() {
151148
rlim.rlim_cur = 0;
152149
#endif
153150
setrlimit(RLIMIT_CORE, &rlim);
154-
#endif
155151

156152
#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__)
157153
// Disable crash reporting on Mac OS X 10.0-10.4

llvm/lib/Support/Unix/Program.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
#include "llvm/Support/SystemZ/zOSSupport.h"
3030
#include "llvm/Support/raw_ostream.h"
3131
#include <sys/stat.h>
32-
#if HAVE_SYS_RESOURCE_H
3332
#include <sys/resource.h>
34-
#endif
3533
#include <signal.h>
3634
#include <fcntl.h>
3735
#if HAVE_UNISTD_H
@@ -140,7 +138,6 @@ static bool RedirectIO_PS(const std::string *Path, int FD, std::string *ErrMsg,
140138
static void TimeOutHandler(int Sig) {}
141139

142140
static void SetMemoryLimits(unsigned size) {
143-
#if HAVE_SYS_RESOURCE_H && HAVE_GETRLIMIT && HAVE_SETRLIMIT
144141
struct rlimit r;
145142
__typeof__(r.rlim_cur) limit = (__typeof__(r.rlim_cur))(size)*1048576;
146143

@@ -154,7 +151,6 @@ static void SetMemoryLimits(unsigned size) {
154151
r.rlim_cur = limit;
155152
setrlimit(RLIMIT_RSS, &r);
156153
#endif
157-
#endif
158154
}
159155

160156
static std::vector<const char *>

llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ write_cmake_config("config") {
206206
"HAVE_DLOPEN=",
207207
"HAVE_FUTIMES=",
208208
"HAVE_GETPAGESIZE=",
209-
"HAVE_GETRLIMIT=",
210209
"HAVE_GETRUSAGE=",
211210
"HAVE_ISATTY=",
212211
"HAVE_LIBPTHREAD=",
@@ -217,12 +216,10 @@ write_cmake_config("config") {
217216
"HAVE_PTHREAD_RWLOCK_INIT=",
218217
"HAVE_SBRK=",
219218
"HAVE_SETENV=",
220-
"HAVE_SETRLIMIT=",
221219
"HAVE_SIGALTSTACK=",
222220
"HAVE_STRERROR_R=",
223221
"HAVE_SYSCONF=",
224222
"HAVE_SYS_MMAN_H=",
225-
"HAVE_SYS_RESOURCE_H=",
226223
"HAVE_UNISTD_H=",
227224
"HAVE__CHSIZE_S=1",
228225
"HAVE__UNWIND_BACKTRACE=",
@@ -238,7 +235,6 @@ write_cmake_config("config") {
238235
"HAVE_DLOPEN=1",
239236
"HAVE_FUTIMES=1",
240237
"HAVE_GETPAGESIZE=1",
241-
"HAVE_GETRLIMIT=1",
242238
"HAVE_GETRUSAGE=1",
243239
"HAVE_ISATTY=1",
244240
"HAVE_LIBPTHREAD=1",
@@ -249,12 +245,10 @@ write_cmake_config("config") {
249245
"HAVE_PTHREAD_RWLOCK_INIT=1",
250246
"HAVE_SBRK=1",
251247
"HAVE_SETENV=1",
252-
"HAVE_SETRLIMIT=1",
253248
"HAVE_SIGALTSTACK=1",
254249
"HAVE_STRERROR_R=1",
255250
"HAVE_SYSCONF=1",
256251
"HAVE_SYS_MMAN_H=1",
257-
"HAVE_SYS_RESOURCE_H=1",
258252
"HAVE_UNISTD_H=1",
259253
"HAVE__CHSIZE_S=",
260254
"HAVE__UNWIND_BACKTRACE=1",

utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@
102102
/* Define to 1 if you have the `getpagesize' function. */
103103
#define HAVE_GETPAGESIZE 1
104104

105-
/* Define to 1 if you have the `getrlimit' function. */
106-
#define HAVE_GETRLIMIT 1
107-
108105
/* Define to 1 if you have the `getrusage' function. */
109106
#define HAVE_GETRUSAGE 1
110107

@@ -168,9 +165,6 @@
168165
/* Define to 1 if you have the `setenv' function. */
169166
/* HAVE_SETENV defined in Bazel */
170167

171-
/* Define to 1 if you have the `setrlimit' function. */
172-
#define HAVE_SETRLIMIT 1
173-
174168
/* Define to 1 if you have the `sigaltstack' function. */
175169
#define HAVE_SIGALTSTACK 1
176170

@@ -183,9 +177,6 @@
183177
/* Define to 1 if you have the <sys/mman.h> header file. */
184178
#define HAVE_SYS_MMAN_H 1
185179

186-
/* Define to 1 if you have the <sys/resource.h> header file. */
187-
#define HAVE_SYS_RESOURCE_H 1
188-
189180
/* Define to 1 if stat struct has st_mtimespec member .*/
190181
/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */
191182

utils/bazel/llvm_configs/config.h.cmake

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@
9090
/* Define to 1 if you have the `getpagesize' function. */
9191
#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}
9292

93-
/* Define to 1 if you have the `getrlimit' function. */
94-
#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT}
95-
9693
/* Define to 1 if you have the `getrusage' function. */
9794
#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}
9895

@@ -165,9 +162,6 @@
165162
/* Define to 1 if you have the `setenv' function. */
166163
#cmakedefine HAVE_SETENV ${HAVE_SETENV}
167164

168-
/* Define to 1 if you have the `setrlimit' function. */
169-
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}
170-
171165
/* Define to 1 if you have the `sigaltstack' function. */
172166
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}
173167

@@ -180,9 +174,6 @@
180174
/* Define to 1 if you have the <sys/mman.h> header file. */
181175
#cmakedefine HAVE_SYS_MMAN_H ${HAVE_SYS_MMAN_H}
182176

183-
/* Define to 1 if you have the <sys/resource.h> header file. */
184-
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
185-
186177
/* Define to 1 if stat struct has st_mtimespec member .*/
187178
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}
188179

0 commit comments

Comments
 (0)