Skip to content

Commit bce404d

Browse files
authored
Fix pipe defines old kernels (#344)
* fix defines * remove redundant includes * typo
1 parent b12b9a6 commit bce404d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

co_sim_io/includes/communication/local_socket_communication.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define CO_SIM_IO_LOCAL_SOCKET_COMMUNICATION_INCLUDED
1515

1616
// System includes
17-
#include <thread>
1817

1918
// Project includes
2019
#include "includes/communication/base_socket_communication.hpp"

co_sim_io/includes/communication/socket_communication.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define CO_SIM_IO_SOCKET_COMMUNICATION_INCLUDED
1515

1616
// System includes
17-
#include <thread>
1817

1918
// Project includes
2019
#include "includes/communication/base_socket_communication.hpp"

co_sim_io/sources/communication/communication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ void Communication::HandShake(const Info& I_Info)
524524

525525
auto print_endianness = [](const bool IsBigEndian){return IsBigEndian ? "big endian" : "small endian";};
526526

527-
CO_SIM_IO_INFO_IF("CoSimIO", Utilities::IsBigEndian() != mPartnerInfo.Get<bool>("is_big_endian")) << "WARNING: Parnters have different endianness, check results carefully! It is recommended to use serialized ascii commuication.\n My endianness: " << print_endianness(Utilities::IsBigEndian()) << "\n Partner endianness: " << print_endianness(mPartnerInfo.Get<bool>("is_big_endian")) << std::endl;
527+
CO_SIM_IO_INFO_IF("CoSimIO", Utilities::IsBigEndian() != mPartnerInfo.Get<bool>("is_big_endian")) << "WARNING: Parnters have different endianness, check results carefully! It is recommended to use serialized ascii communication.\n My endianness: " << print_endianness(Utilities::IsBigEndian()) << "\n Partner endianness: " << print_endianness(mPartnerInfo.Get<bool>("is_big_endian")) << std::endl;
528528

529529
// more things can be done in derived class if necessary
530530
DerivedHandShake();

co_sim_io/sources/communication/pipe_communication.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ PipeCommunication::BidirectionalPipe::BidirectionalPipe(
140140
CO_SIM_IO_ERROR_IF((mPipeHandleWrite = open(mPipeNameWrite.c_str(), O_WRONLY)) < 0) << "Pipe " << mPipeNameWrite << " could not be opened!" << std::endl;
141141
}
142142

143-
#ifdef CO_SIM_IO_COMPILED_IN_LINUX
143+
// if possible try to resize the pipes to the buffer size
144+
// not resizing still works but leads to communication in more chunks
145+
#if defined(F_GETPIPE_SZ) && defined(F_SETPIPE_SZ) // some old kernels don't define this
144146
const int pipe_buffer_size_read = fcntl(mPipeHandleRead, F_GETPIPE_SZ);
145147
const int pipe_buffer_size_write = fcntl(mPipeHandleWrite, F_GETPIPE_SZ);
146148

0 commit comments

Comments
 (0)