Move mac init code after logging init.
This commit is contained in:
parent
7a8103a352
commit
058e421827
42
src/main.cpp
42
src/main.cpp
|
@ -142,6 +142,27 @@ void LoadTranslation(const QString& prefix, const QString& path,
|
||||||
#include <xrme/connection.h>
|
#include <xrme/connection.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void IncreaseFDLimit() {
|
||||||
|
#ifdef Q_OS_DARWIN
|
||||||
|
// Bump the soft limit for the number of file descriptors from the default of 256 to
|
||||||
|
// the maximum (usually 10240).
|
||||||
|
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) {
|
||||||
|
qLog(Debug) << "Max fd:" << max_fd;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if (CrashReporting::SendCrashReport(argc, argv)) {
|
if (CrashReporting::SendCrashReport(argc, argv)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -153,25 +174,6 @@ int main(int argc, char *argv[]) {
|
||||||
// Do Mac specific startup to get media keys working.
|
// Do Mac specific startup to get media keys working.
|
||||||
// This must go before QApplication initialisation.
|
// This must go before QApplication initialisation.
|
||||||
mac::MacMain();
|
mac::MacMain();
|
||||||
|
|
||||||
{
|
|
||||||
// Bump the soft limit for the number of file descriptors from the default of 256 to
|
|
||||||
// the maximum (usually 10240).
|
|
||||||
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) {
|
|
||||||
qLog(Debug) << "Max fd:" << max_fd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QCoreApplication::setApplicationName("Clementine");
|
QCoreApplication::setApplicationName("Clementine");
|
||||||
|
@ -289,6 +291,8 @@ int main(int argc, char *argv[]) {
|
||||||
logging::SetLevels(options.log_levels());
|
logging::SetLevels(options.log_levels());
|
||||||
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), NULL);
|
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), NULL);
|
||||||
|
|
||||||
|
IncreaseFDLimit();
|
||||||
|
|
||||||
QtSingleApplication a(argc, argv);
|
QtSingleApplication a(argc, argv);
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
QCoreApplication::setLibraryPaths(
|
QCoreApplication::setLibraryPaths(
|
||||||
|
|
Loading…
Reference in New Issue