mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Up max fds on osx to the max we can set
This commit is contained in:
@@ -71,6 +71,9 @@
|
|||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include "mac/macshortcuthandler.h"
|
#include "mac/macshortcuthandler.h"
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -223,6 +226,24 @@ TomahawkApp::init()
|
|||||||
Tomahawk::setShortcutHandler( static_cast<MacShortcutHandler*>( m_shortcutHandler) );
|
Tomahawk::setShortcutHandler( static_cast<MacShortcutHandler*>( m_shortcutHandler) );
|
||||||
|
|
||||||
Tomahawk::setApplicationHandler( this );
|
Tomahawk::setApplicationHandler( this );
|
||||||
|
|
||||||
|
/// Following code taken from Clementine project, main.cpp. Thanks!
|
||||||
|
// Bump the soft limit for the number of file descriptors from the default of 256 to
|
||||||
|
// the maximum (usually 1024).
|
||||||
|
struct rlimit limit;
|
||||||
|
getrlimit(RLIMIT_NOFILE, &limit);
|
||||||
|
|
||||||
|
// getrlimit() lies about the hard limit so we have to check sysctl.
|
||||||
|
int max_fd = 0;
|
||||||
|
size_t len = sizeof(max_fd);
|
||||||
|
sysctlbyname("kern.maxfilesperproc", &max_fd, &len, NULL, 0);
|
||||||
|
|
||||||
|
limit.rlim_cur = max_fd;
|
||||||
|
int ret = setrlimit(RLIMIT_NOFILE, &limit);
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
qDebug() << "Max fd:" << max_fd;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Connect up shortcuts
|
// Connect up shortcuts
|
||||||
|
Reference in New Issue
Block a user