In Steven's book on "Advanced Programming in the Unix Environment"
page 454, there is a table of System limits that affect message
queue's. MSGMAX is defined as the size in bytes of the largest
message we can send. According to the SunOS headers, I should be
able to send 8192 bytes in a message. However, in actual usage I
can only send 2048 max. I eventually need to use my code on Sun,
Alpha, and HP-UX machines, so would like to set it to use a system
define for the max message. I thought MSGMAX was the correct define
to use, but aparently not. Any thoughts?
I did find a define MSGMNB 2048 /* default max number of bytes on a queue */
NOT what the book was telling me.
I did some grep'ing and found the following:
grep MSGMAX /usr/include/*/*.h
/usr/include/sys/msg.h:#ifndef MSGMAX
/usr/include/sys/msg.h:#define MSGMAX (MSGPOOL * 1024) /* max message size (in bytes) */
grep MSGPOOL /usr/include/*/*.h
/usr/include/sys/msg.h:#ifndef MSGPOOL
/usr/include/sys/msg.h:#define MSGPOOL 8 /* size, in kilobytes, of message pool */
/usr/include/sys/msg.h:#define MSGMAX (MSGPOOL * 1024) /* max message size (in bytes) */
/usr/include/sys/msg.h:#define MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* # segments (MUST BE < 32768) */
grep MSGSSZ /usr/include/*/*.h
/usr/include/sys/msg.h:#ifndef MSGSSZ
/usr/include/sys/msg.h:#define MSGSSZ 8 /* msg segment size (should be word size multiple) */
----------------------------------------
Anyhow when I try to send a message larger than 2048, msgsnd fails.
According to the headers MSGMAX is 8192.
--
David Haverkamp