Avoid exceptions
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
#include "connection_registry.hpp"
|
||||
#include "connection.hpp"
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
ConnectionRegistry::ConnectionRegistry() : connections_(nullptr), max_fds_(0) {
|
||||
// Get the process file descriptor limit
|
||||
struct rlimit rlim;
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1) {
|
||||
throw std::runtime_error("Failed to get RLIMIT_NOFILE");
|
||||
perror("getrlimit");
|
||||
std::abort();
|
||||
}
|
||||
max_fds_ = rlim.rlim_cur;
|
||||
|
||||
@@ -25,7 +26,8 @@ ConnectionRegistry::ConnectionRegistry() : connections_(nullptr), max_fds_(0) {
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
|
||||
|
||||
if (connections_ == MAP_FAILED) {
|
||||
throw std::runtime_error("Failed to mmap for connection registry");
|
||||
perror("mmap");
|
||||
std::abort();
|
||||
}
|
||||
|
||||
// Store aligned size for munmap
|
||||
|
||||
Reference in New Issue
Block a user