title: mq_receive: message too long
body: <p>I am implementing a communication between 2 processes using a queue. The problem is that when I call the function mq_receive, I get this error: Message too long.</p>
  
  <p>I have done the following:</p>
  
  <pre><code>struct mq_attr attr;
  
  long size = attr.mq_msgsize;
  .... // initializing the queue "/gateway"
  
  int rc = mq_receive(gateway, buffer, size, &amp;prio);
  </code></pre>
  
  <p>If I print the size value, I get size=1, while when I print the same size but from another program (got by the same mechanism), I get something not long integer ( -1217186280 )...</p>
  
  <p>How can I solve this error?....so while size = 1, I believe it's right to say "message too long" but why is 1? </p>
  
  <p>P.S. I have also tried to put : </p>
  
  <pre><code>int rc = mq_receive(gateway, buffer, sizeof(buffer), &amp;prio);
  </code></pre>
  
  <p>but with no result.</p>