Use exception logger for the memory locking error

This commit is contained in:
Robbert van der Helm
2021-07-23 15:53:19 +02:00
parent 1a34a80c21
commit 5c3491c1e1
4 changed files with 23 additions and 15 deletions
+11 -10
View File
@@ -18,6 +18,8 @@
#include <iostream>
#include "logging/common.h"
AudioShmBuffer::AudioShmBuffer(const Config& config)
: config(config),
shm(boost::interprocess::open_or_create,
@@ -74,16 +76,15 @@ void AudioShmBuffer::setup_mapping() {
}
} catch (const boost::interprocess::interprocess_exception& error) {
if (error.get_native_error() == EAGAIN) {
std::cerr << "ERROR: Could not map shared memory. This means that"
<< std::endl;
std::cerr << " your user's memory locking limit has been set"
<< std::endl;
std::cerr << " too low. Check your distro's documentation or"
<< std::endl;
std::cerr << " wiki for instructions on how to set up"
<< std::endl;
std::cerr << " realtime privileges and memlock limits."
<< std::endl;
Logger logger = Logger::create_exception_logger();
logger.log("");
logger.log("ERROR: Could not map shared memory. This means that");
logger.log(" your user's memory locking limit has been");
logger.log(" reached. Check your distro's documentation or");
logger.log(" wiki for instructions on how to set up");
logger.log(" realtime privileges and memlock limits.");
logger.log("");
}
throw;
+6 -5
View File
@@ -309,11 +309,12 @@ class Sockets {
if (base_dir.string().starts_with(temp_dir.string())) {
boost::filesystem::remove_all(base_dir);
} else {
std::cerr << std::endl;
std::cerr << "WARNING: Unexpected socket base directory found, "
"not removing '"
<< base_dir.string() << "'" << std::endl;
std::cerr << std::endl;
Logger logger = Logger::create_exception_logger();
logger.log("");
logger.log("WARNING: Unexpected socket base directory found,");
logger.log(" not removing '" + base_dir.string() + "'");
logger.log("");
}
} catch (const boost::filesystem::filesystem_error&) {
// There should not be any filesystem errors since only one side
+3
View File
@@ -51,8 +51,11 @@ extern "C" VST_EXPORT AEffect* VSTPluginMain(
return &bridge->plugin;
} catch (const std::exception& error) {
Logger logger = Logger::create_exception_logger();
logger.log("");
logger.log("Error during initialization:");
logger.log(error.what());
logger.log("");
// Also show a desktop notification most people likely won't see the
// above message
+3
View File
@@ -54,8 +54,11 @@ bool InitModule() {
return true;
} catch (const std::exception& error) {
Logger logger = Logger::create_exception_logger();
logger.log("");
logger.log("Error during initialization:");
logger.log(error.what());
logger.log("");
// Also show a desktop notification most people likely won't see the
// above message