summaryrefslogtreecommitdiff
path: root/libs/ardour/globals.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-12-10 15:27:22 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-12-10 15:27:32 -0500
commitb91c7836deb4d99ec97ba5738293879edcc84bff (patch)
tree1e971271b83e7df7142c46cba1734de78fd517f1 /libs/ardour/globals.cc
parent83e3d7c274e133da54903cbd4efae99234e76fed (diff)
try some alternate, hard numbers when resetting open file limits on OS X
Diffstat (limited to 'libs/ardour/globals.cc')
-rw-r--r--libs/ardour/globals.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 44367b8cf3..c36748612a 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -218,7 +218,30 @@ lotsa_files_please ()
if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
if (rl.rlim_cur == RLIM_INFINITY) {
+#if __APPLE__
+ /* For some reason, Apple doesn't do this the
+ * same way as Linux, and asking for
+ * RLIM_INFINITY even though that is
+ * rl.rlim_cur doesn't work.
+ *
+ * So try some actual large numbers in the hope
+ * that one of them will work.
+ */
+
+ rl.rlim_cur = 10000;
+ if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
+ rl.rlim_cur = 4096;
+ if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
+ rl.rlim_cur = 1000;
+ if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
+ error << _("Could not set system open files limit to a reasonable value. Be careful!") << endmsg;
+ }
+ }
+ }
+ info << string_compose ("Configured system open file limit to %1", rl.rlim_cur) << endmsg;
+#else
error << _("Could not set system open files limit to \"unlimited\"") << endmsg;
+#endif
} else {
error << string_compose (_("Could not set system open files limit to %1"), rl.rlim_cur) << endmsg;
}