summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-05-14 13:08:46 +0200
committerKai Koehne <kai.koehne@digia.com>2014-05-14 14:09:05 +0200
commit8f8800de7ab89e6cbc7b5eb08f2b3f16407e6cdf (patch)
treef0f7ca1b311472dd992a7e34736ab19e849425e8
parent7d7e09ad17468e96f85dc11af51209382a9c0764 (diff)
Avoid 'Too many open files' on Mac
Increase the number of file descriptors that the process can open to the maximum allowed. By default, Mac OS X only allows 256 file descriptors, which can easily be reached. Change-Id: Ie4e5ab1051d8e3bf1cb39747f629360915a22d97 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
-rw-r--r--src/sdk/installerbase.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 3629cc22f..a3141def9 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2012-2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
@@ -103,6 +103,14 @@ static QStringList repositories(const QStringList &arguments, const int index)
int main(int argc, char *argv[])
{
+// increase maximum numbers of file descriptors
+#if defined (Q_OS_MAC)
+ struct rlimit rl;
+ getrlimit(RLIMIT_NOFILE, &rl);
+ rl.rlim_cur = qMin((rlim_t)OPEN_MAX, rl.rlim_max);
+ setrlimit(RLIMIT_NOFILE, &rl);
+#endif
+
QStringList args = QInstaller::parseCommandLineArgs(argc, argv);
// hack to use cleanlooks if it is under Ubuntu