aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
authorOmar Mahboubi <166836773+omar-mahboubi@users.noreply.github.com>2026-10-30 15:07:40 +0100
committerGitHub <noreply@github.com>2026-10-30 15:07:40 +0100
commit0a778123e9dcdb4a484fac688ee1bf95837b4a34 (patch)
treed58327b7d8672b7ceca2b3be7774ed09db3978ee /src/yuzu_cmd
parent62de5e8e4c97c3df8c56fb0922631f3af430dacf (diff)
parent9e4e58c8e54add0e9909de8a9cba2444d8314ee7 (diff)
Merge pull request #32 from givethesourceplox/nx2-open-file-limit
yuzu_cmd: raise the open file limit on macOS and Linux
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/yuzu.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 3d9f50d4e5..70fd9090e3 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -4,6 +4,7 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <algorithm>
#include <atomic>
#include <iterator>
#include <fstream>
@@ -56,6 +57,10 @@
#include "yuzu_cmd/emu_window/emu_window_sdl3_vk.h"
#include "yuzu_cmd/nx2_sampler.h"
+#if defined(__unix__) || defined(__APPLE__)
+#include <sys/resource.h>
+#endif
+
#ifdef _WIN32
// windows.h needs to be included before shellapi.h
#include <windows.h>
@@ -262,6 +267,12 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
// Raise the CRT's open-file limit like the Qt frontend: loose RomFS folders keep thousands of
// files open through the VFS cache.
_setmaxstdio(8192);
+#elif defined(__unix__) || defined(__APPLE__)
+ // Same for the open file limit (macOS shells default to 256).
+ if (struct rlimit rl; getrlimit(RLIMIT_NOFILE, &rl) == 0) {
+ rl.rlim_cur = std::min<rlim_t>(8192, rl.rlim_max);
+ setrlimit(RLIMIT_NOFILE, &rl);
+ }
#endif
Common::Log::Initialize();