Skip to content

Commit

Permalink
[CMake] Remove HAVE_SYS_RESOURCE_H/HAVE_SETRLIMIT/HAVE_GETRLIMIT
Browse files Browse the repository at this point in the history
Only used by Unix/Program.inc and seem always available.

Pull Request: llvm#123288
  • Loading branch information
MaskRay authored Jan 17, 2025
1 parent bfb6bb6 commit 414980d
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 48 deletions.
7 changes: 0 additions & 7 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_UNISTD_H 1)
elseif (APPLE)
Expand All @@ -32,7 +31,6 @@ elseif (APPLE)
set(HAVE_MALLOC_MALLOC_H 1)
set(HAVE_PTHREAD_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_UNISTD_H 1)
elseif (PURE_WINDOWS)
Expand All @@ -41,7 +39,6 @@ elseif (PURE_WINDOWS)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 0)
set(HAVE_SYS_MMAN_H 0)
set(HAVE_SYS_RESOURCE_H 0)
set(HAVE_SYSEXITS_H 0)
set(HAVE_UNISTD_H 0)
elseif (ZOS)
Expand All @@ -52,7 +49,6 @@ elseif (ZOS)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYS_RESOURCE_H 1)
set(HAVE_SYSEXITS_H 0)
set(HAVE_UNISTD_H 1)
else()
Expand All @@ -62,7 +58,6 @@ else()
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sysexits.h HAVE_SYSEXITS_H)
check_include_file(unistd.h HAVE_UNISTD_H)
endif()
Expand Down Expand Up @@ -326,7 +321,6 @@ check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE__UNWIND_BACKTRACE)
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
check_symbol_exists(sysconf unistd.h HAVE_SYSCONF)
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
check_symbol_exists(isatty unistd.h HAVE_ISATTY)
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
Expand All @@ -342,7 +336,6 @@ check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2)
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
HAVE_MALLOC_ZONE_STATISTICS)
check_symbol_exists(getrlimit "sys/types.h;sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
check_symbol_exists(posix_spawn spawn.h HAVE_POSIX_SPAWN)
check_symbol_exists(pread unistd.h HAVE_PREAD)
check_symbol_exists(sbrk unistd.h HAVE_SBRK)
Expand Down
9 changes: 0 additions & 9 deletions llvm/include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
/* Define to 1 if you have the `getpagesize' function. */
#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}

/* Define to 1 if you have the `getrlimit' function. */
#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT}

/* Define to 1 if you have the `getrusage' function. */
#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}

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

/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}

/* Define to 1 if you have the `sigaltstack' function. */
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}

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

/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}

/* Define to 1 if stat struct has st_mtimespec member .*/
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}

Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/Support/Unix/Process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include <optional>
#include <fcntl.h>
#include <sys/time.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sys/stat.h>
#include <signal.h>
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
Expand Down Expand Up @@ -128,7 +126,6 @@ void Process::GetTimeUsage(TimePoint<> &elapsed,
// their operation. To prevent the disk from filling up, this function
// does what's necessary to prevent their generation.
void Process::PreventCoreFiles() {
#if HAVE_SETRLIMIT
struct rlimit rlim;
getrlimit(RLIMIT_CORE, &rlim);
#ifdef __linux__
Expand All @@ -151,7 +148,6 @@ void Process::PreventCoreFiles() {
rlim.rlim_cur = 0;
#endif
setrlimit(RLIMIT_CORE, &rlim);
#endif

#if defined(HAVE_MACH_MACH_H) && !defined(__GNU__)
// Disable crash reporting on Mac OS X 10.0-10.4
Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/Support/Unix/Program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
#include "llvm/Support/SystemZ/zOSSupport.h"
#include "llvm/Support/raw_ostream.h"
#include <sys/stat.h>
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <signal.h>
#include <fcntl.h>
#if HAVE_UNISTD_H
Expand Down Expand Up @@ -140,7 +138,6 @@ static bool RedirectIO_PS(const std::string *Path, int FD, std::string *ErrMsg,
static void TimeOutHandler(int Sig) {}

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

Expand All @@ -154,7 +151,6 @@ static void SetMemoryLimits(unsigned size) {
r.rlim_cur = limit;
setrlimit(RLIMIT_RSS, &r);
#endif
#endif
}

static std::vector<const char *>
Expand Down
6 changes: 0 additions & 6 deletions llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ write_cmake_config("config") {
"HAVE_DLOPEN=",
"HAVE_FUTIMES=",
"HAVE_GETPAGESIZE=",
"HAVE_GETRLIMIT=",
"HAVE_GETRUSAGE=",
"HAVE_ISATTY=",
"HAVE_LIBPTHREAD=",
Expand All @@ -217,12 +216,10 @@ write_cmake_config("config") {
"HAVE_PTHREAD_RWLOCK_INIT=",
"HAVE_SBRK=",
"HAVE_SETENV=",
"HAVE_SETRLIMIT=",
"HAVE_SIGALTSTACK=",
"HAVE_STRERROR_R=",
"HAVE_SYSCONF=",
"HAVE_SYS_MMAN_H=",
"HAVE_SYS_RESOURCE_H=",
"HAVE_UNISTD_H=",
"HAVE__CHSIZE_S=1",
"HAVE__UNWIND_BACKTRACE=",
Expand All @@ -238,7 +235,6 @@ write_cmake_config("config") {
"HAVE_DLOPEN=1",
"HAVE_FUTIMES=1",
"HAVE_GETPAGESIZE=1",
"HAVE_GETRLIMIT=1",
"HAVE_GETRUSAGE=1",
"HAVE_ISATTY=1",
"HAVE_LIBPTHREAD=1",
Expand All @@ -249,12 +245,10 @@ write_cmake_config("config") {
"HAVE_PTHREAD_RWLOCK_INIT=1",
"HAVE_SBRK=1",
"HAVE_SETENV=1",
"HAVE_SETRLIMIT=1",
"HAVE_SIGALTSTACK=1",
"HAVE_STRERROR_R=1",
"HAVE_SYSCONF=1",
"HAVE_SYS_MMAN_H=1",
"HAVE_SYS_RESOURCE_H=1",
"HAVE_UNISTD_H=1",
"HAVE__CHSIZE_S=",
"HAVE__UNWIND_BACKTRACE=1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1

/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1

/* Define to 1 if you have the `getrusage' function. */
#define HAVE_GETRUSAGE 1

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

/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1

/* Define to 1 if you have the `sigaltstack' function. */
#define HAVE_SIGALTSTACK 1

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

/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1

/* Define to 1 if stat struct has st_mtimespec member .*/
/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */

Expand Down
9 changes: 0 additions & 9 deletions utils/bazel/llvm_configs/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
/* Define to 1 if you have the `getpagesize' function. */
#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}

/* Define to 1 if you have the `getrlimit' function. */
#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT}

/* Define to 1 if you have the `getrusage' function. */
#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}

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

/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}

/* Define to 1 if you have the `sigaltstack' function. */
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}

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

/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}

/* Define to 1 if stat struct has st_mtimespec member .*/
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}

Expand Down

0 comments on commit 414980d

Please sign in to comment.