portingtools/src/data.cpp

19 lines
336 B
C++
Raw Normal View History

2022-11-05 18:07:20 +01:00
#include "data.hpp"
2022-11-09 22:02:26 +01:00
2022-11-05 18:07:20 +01:00
#include <boost/log/trivial.hpp>
#include <cstdlib>
2022-11-07 01:01:36 +01:00
#include <stdexcept>
2022-11-05 18:07:20 +01:00
#include <sys/ipc.h>
namespace data {
2022-11-09 22:02:26 +01:00
key_t getIpcKeyFromExeName(char* argv0) {
auto k = ftok(argv0, 'X');
2022-11-05 18:07:20 +01:00
2022-11-09 22:02:26 +01:00
if (k < 0) {
throw std::runtime_error("failed to get IPC key");
}
2022-11-05 18:07:20 +01:00
2022-11-09 22:02:26 +01:00
return k;
}
2022-11-05 18:07:20 +01:00
}