mirror of
https://github.com/obhq/obliteration.git
synced 2024-10-07 00:13:24 +00:00
Increases file descriptor limit to maximum allowed (#441)
This commit is contained in:
parent
1b1e9a188c
commit
1f758a9015
26
src/main.cpp
26
src/main.cpp
@ -8,13 +8,17 @@
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Setup application.
|
||||
QCoreApplication::setOrganizationName("OBHQ");
|
||||
QCoreApplication::setApplicationName("Obliteration");
|
||||
|
||||
// Dark Mode for Windows
|
||||
// Dark Mode for Windows.
|
||||
#ifdef _WIN32
|
||||
QApplication::setStyle("Fusion");
|
||||
#endif
|
||||
@ -23,6 +27,26 @@ int main(int argc, char *argv[])
|
||||
|
||||
QGuiApplication::setWindowIcon(QIcon(":/resources/obliteration-icon.png"));
|
||||
|
||||
// Increase number of file descriptors to maximum allowed.
|
||||
#ifndef _WIN32
|
||||
rlimit limit;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &limit) == 0) {
|
||||
if (limit.rlim_cur < limit.rlim_max) {
|
||||
limit.rlim_cur = limit.rlim_max;
|
||||
|
||||
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
|
||||
QMessageBox::warning(
|
||||
nullptr,
|
||||
"Warning",
|
||||
"Failed to set file descriptor limit to maximum allowed.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(nullptr, "Warning", "Failed to get file descriptor limit.");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check if no any required settings.
|
||||
if (!hasRequiredUserSettings() || !isSystemInitialized()) {
|
||||
InitializeWizard init;
|
||||
|
Loading…
Reference in New Issue
Block a user