Move mlockall() to main() in srsUE and srsENB

master
Ismael Gomez 4 years ago
parent 46bd8845ba
commit 0b91598e36

@ -14,6 +14,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
#include "srsran/common/common_helper.h"
@ -534,6 +535,10 @@ int main(int argc, char* argv[])
event_logger::configure(json_channel);
}
if (mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE) == -1) {
srsran::console("Failed to `mlockall`: {}", errno);
}
// Create eNB
unique_ptr<srsenb::enb> enb{new srsenb::enb(srslog::get_default_sink())};
if (enb->init(args) != SRSRAN_SUCCESS) {

@ -15,7 +15,6 @@
#include <string.h>
#include <string>
#include <strings.h>
#include <sys/mman.h>
#include <unistd.h>
#include "srsenb/hdr/phy/phy.h"
@ -105,8 +104,6 @@ int phy::init(const phy_args_t& args,
return SRSRAN_ERROR;
}
mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE);
// Add PHY lib log.
srslog::basic_levels log_lvl = srslog::str_to_basic_level(args.log.phy_lib_level);

@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sys/mman.h>
#include <unistd.h>
extern bool simulate_rlf;
@ -675,6 +676,10 @@ int main(int argc, char* argv[])
srsran::check_scaling_governor(args.rf.device_name);
if (mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE) == -1) {
fprintf(stderr, "Failed to `mlockall`: %d", errno);
}
// Create UE instance.
srsue::ue ue;
if (ue.init(args)) {

@ -11,7 +11,6 @@
*/
#include <string>
#include <sys/mman.h>
#include "srsran/common/band_helper.h"
#include "srsran/common/standard_streams.h"
@ -104,7 +103,6 @@ int phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srsran::
int phy::init(const phy_args_t& args_)
{
std::unique_lock<std::mutex> lock(config_mutex);
mlockall(MCL_CURRENT | MCL_FUTURE);
args = args_;

Loading…
Cancel
Save