Skip to content

Commit

Permalink
add missing flag for stdc++fs
Browse files Browse the repository at this point in the history
Signed-off-by: Ric Li <[email protected]>
  • Loading branch information
ricmli committed Nov 16, 2023
1 parent 6bb714a commit 747a6f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/src/mt_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int mt_instance_put_lcore(struct mtl_main_impl* impl, unsigned int lcore_id) {
int sock = impl->instance_fd;

mtl_message_t msg;
msg.header.magic = htonl(IMTL_MAGIC);
msg.header.magic = htonl(MTL_MANAGER_MAGIC);
msg.header.type = htonl(MTL_MSG_TYPE_PUT_LCORE);
msg.body.lcore_msg.lcore = htons(lcore_id);
msg.header.body_len = sizeof(msg.body.lcore_msg);
Expand All @@ -35,7 +35,7 @@ int mt_instance_get_lcore(struct mtl_main_impl* impl, unsigned int lcore_id) {
int sock = impl->instance_fd;

mtl_message_t msg;
msg.header.magic = htonl(IMTL_MAGIC);
msg.header.magic = htonl(MTL_MANAGER_MAGIC);
msg.header.type = htonl(MTL_MSG_TYPE_GET_LCORE);
msg.body.lcore_msg.lcore = htons(lcore_id);
msg.header.body_len = htonl(sizeof(mtl_lcore_message_t));
Expand All @@ -48,7 +48,7 @@ int mt_instance_get_lcore(struct mtl_main_impl* impl, unsigned int lcore_id) {

ret = recv(sock, &msg, sizeof(mtl_message_t), 0);

if (ret < 0 || ntohl(msg.header.magic) != IMTL_MAGIC ||
if (ret < 0 || ntohl(msg.header.magic) != MTL_MANAGER_MAGIC ||
ntohl(msg.header.type) != MTL_MSG_TYPE_RESPONSE) {
err("%s, recv response fail\n", __func__);
return -EIO;
Expand Down Expand Up @@ -80,7 +80,7 @@ int mt_instance_init(struct mtl_main_impl* impl) {
struct mt_user_info* u_info = &impl->u_info;

mtl_message_t msg;
msg.header.magic = htonl(IMTL_MAGIC);
msg.header.magic = htonl(MTL_MANAGER_MAGIC);
msg.header.type = htonl(MTL_MSG_TYPE_REGISTER);
msg.header.body_len = sizeof(mtl_register_message_t);

Expand All @@ -97,7 +97,7 @@ int mt_instance_init(struct mtl_main_impl* impl) {
}

ret = recv(sock, &msg, sizeof(msg), 0);
if (ret < 0 || ntohl(msg.header.magic) != IMTL_MAGIC ||
if (ret < 0 || ntohl(msg.header.magic) != MTL_MANAGER_MAGIC ||
ntohl(msg.header.type) != MTL_MSG_TYPE_RESPONSE) {
err("%s, recv response fail\n", __func__);
close(sock);
Expand Down
2 changes: 1 addition & 1 deletion manager/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cpp_c = meson.get_compiler('cpp')

sources = ['mtl_manager.cpp']

cpp_args = ['-std=c++17', '-Wall']
cpp_args = ['-lstdc++fs', '-std=c++17', '-Wall']

if get_option('buildtype') != 'debug'
cpp_args += ['-Werror']
Expand Down
4 changes: 2 additions & 2 deletions manager/mtl_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class mtl_instance {
int handle_message_register(mtl_register_message_t* register_msg);
int send_response(bool success) {
mtl_message_t msg;
msg.header.magic = htonl(IMTL_MAGIC);
msg.header.magic = htonl(MTL_MANAGER_MAGIC);
msg.header.type = (mtl_message_type_t)htonl(MTL_MSG_TYPE_RESPONSE);
msg.header.body_len = htonl(sizeof(mtl_response_message_t));
msg.body.response_msg.response = success ? 0 : 1;
Expand Down Expand Up @@ -58,7 +58,7 @@ class mtl_instance {
int mtl_instance::handle_message(const char* buf, int len) {
if ((size_t)len < sizeof(mtl_message_t)) return -1;
mtl_message_t* msg = (mtl_message_t*)buf;
if (ntohl(msg->header.magic) != IMTL_MAGIC) {
if (ntohl(msg->header.magic) != MTL_MANAGER_MAGIC) {
std::cout << "Invalid magic number" << std::endl;
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions manager/mtl_mproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ extern "C" {

#define MTL_MANAGER_SOCK_PATH "/var/run/imtl/mtl_manager.sock"

#pragma pack(push, 1)
#define MTL_MANAGER_MAGIC (0x494D544C) /* ASCII representation of "IMTL" */

#define IMTL_MAGIC (0x494D544C) /* ASCII representation of "IMTL" */
#pragma pack(push, 1)

/* message type */
typedef enum {
Expand Down

0 comments on commit 747a6f1

Please sign in to comment.