Skip to content

Commit 0fc1430

Browse files
Add automatic cleanup for buffer file
1 parent a5ba300 commit 0fc1430

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CommandLineUtilities/ProgramListCards.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "CommandLineUtilities/Program.h"
1010
#include "RocPciDevice.h"
1111
#include "ReadoutCard/ChannelFactory.h"
12+
#include "ReadoutCard/MemoryMappedFile.h"
1213
#include <boost/format.hpp>
1314

1415
using namespace AliceO2::roc::CommandLineUtilities;
@@ -52,8 +53,8 @@ class ProgramListCards: public Program
5253
try {
5354
Parameters params = Parameters::makeParameters(card.pciAddress, 0);
5455
// Temporary (hopefully) workaround, because DmaChannel requires a buffer when initializing
55-
params.setBufferParameters(buffer_parameters::File{"/dev/hugepages/rorc_channel_utility_dummy_buffer",
56-
2*1024*1024});
56+
MemoryMappedFile file("/dev/hugepages/rorc_channel_utility_dummy_buffer", 2*1024*1024, true);
57+
params.setBufferParameters(buffer_parameters::Memory{file.getAddress(), file.getSize()});
5758
firmware = ChannelFactory().getDmaChannel(params)->getFirmwareInfo().value_or("n/a");
5859
}
5960
catch (const Exception& e) {

0 commit comments

Comments
 (0)