macOS: Set correct maxfiles (fixes shader cache and SPU LLVM)

This commit is contained in:
nastys 2022-01-10 14:14:14 +01:00 committed by Ivan
parent ed542b2cb4
commit 3571e6ef85
2 changed files with 18 additions and 0 deletions

View file

@ -508,6 +508,19 @@ int main(int argc, char** argv)
setenv( "KDE_DEBUG", "1", 0 );
#endif
#ifdef __APPLE__
struct ::rlimit rlim;
::getrlimit(RLIMIT_NOFILE, &rlim);
rlim.rlim_cur = OPEN_MAX;
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
std::cerr << "Failed to set max open file limit (" << OPEN_MAX << ").\n";
#endif
#ifndef _WIN32
// Write file limits
sys_log.notice("Maximum open file descriptors: %i", utils::get_maxfiles());
#endif
std::lock_guard qt_init(s_qt_init);
// The constructor of QApplication eats the --style and --stylesheet arguments.