even better output for unset max msg size

This commit is contained in:
Robin Müller 2020-07-04 23:20:29 +02:00
parent 72768a6815
commit e0a3257f8b

View File

@ -62,22 +62,27 @@ ReturnValue_t MessageQueue::handleError(mq_attr* attributes,
// Just an additional helpful printout :-) // Just an additional helpful printout :-)
if(std::ifstream("/proc/sys/fs/mqueue/msg_max",std::ios::in) >> if(std::ifstream("/proc/sys/fs/mqueue/msg_max",std::ios::in) >>
defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) { defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) {
// See: https://www.man7.org/linux/man-pages/man3/mq_open.3.html /*
// This happens if the msg_max value is not large enough See: https://www.man7.org/linux/man-pages/man3/mq_open.3.html
// It is ignored if the executable is run in privileged mode. This happens if the msg_max value is not large enough
// Run the unlockRealtime script or grant the mode manually by using: It is ignored if the executable is run in privileged mode.
// sudo setcap 'CAP_SYS_RESOURCE=+ep' <pathToBinary> Run the unlockRealtime script or grant the mode manually by using:
sudo setcap 'CAP_SYS_RESOURCE=+ep' <pathToBinary>
// Persistent solution for session: Persistent solution for session:
// echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max
// Permanent solution: Permanent solution:
// sudo nano /etc/sysctl.conf sudo nano /etc/sysctl.conf
// Append at end: fs/mqueue/msg_max = <newMsgMaxLen> Append at end: fs/mqueue/msg_max = <newMsgMaxLen>
// Apply changes with: sudo sysctl -p Apply changes with: sudo sysctl -p
*/
sif::error << "MessageQueue::MessageQueue: Default MQ size " sif::error << "MessageQueue::MessageQueue: Default MQ size "
<< defaultMqMaxMsg << " is too small for requested size " << defaultMqMaxMsg << " is too small for requested size "
<< messageDepth << std::endl; << messageDepth << std::endl;
sif::error << "This error can be fixed by setting the maximum "
"allowed message size higher!" << std::endl;
} }
break; break;
} }