MSGMAX - SunOS max message size 2048?

MSGMAX - SunOS max message size 2048?

Post by Dave Haverka » Thu, 30 Mar 1995 04:00:00

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


1. max line lenght of 2048 exceeded

dear shell-gurus
my korn-shell-script greps for a string (mystring) in the /etc/group-file.

COUNT_IT = 'grep -c mystring /etc/group'

certain entries in the /etc/group-file exceed the size of 2048 bytes. the
grep command returns a message: maximum line of 2048 exceeded. how can i
avoid this behavior ??

thanx alot

2. Using LILO & System Commander

3. SCSI: Hardware sector size 2048 Byte

4. NIS+/DNS , forcing use

5. X25 line + Packet size of 2048 + hsi

6. Mirroring a complete Linux installation?

7. scsi block size of 2048 bytes (linux)

8. Linux vs. FreeBSD

9. sed dosent work byeyond 2048 line / buffer size.

10. MO & 2048-byte sector size

11. 2048 block size for 640M Magneto-optical disks?

12. what is max file size for SunOS 5.7

13. Max RAM size of SUNOS v4.1 ??