## Max size of a message for msgsnd()

### Max size of a message for msgsnd()

Hi,
Is there a way to find the maximal size of the message one
can send using msgsnd()? I have seen Stevens' method in UNP 2e V2 pp
152-153 where he repeatedly sends messages of decreased size until msgsnd()
accepts it without error, but I was thinking about something more
elegant. A system call or library function maybe. I am particularly
interested in Solaris and AIX solution.

I know that on Solaris I can look in /etc/system for msgsys:msginfo_msgmax
variable, but is there another approach?

Thanx a lot. Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole

### Max size of a message for msgsnd()

> Is there a way to find the maximal size of the message one
> can send using msgsnd()? I have seen Stevens' method in UNP 2e V2 pp
> 152-153 where he repeatedly sends messages of decreased size until msgsnd()
> accepts it without error, but I was thinking about something more
> elegant. A system call or library function maybe. I am particularly
> interested in Solaris and AIX solution.

1. getrlimit( ) for MSGMAX. or
2.Use sysdef command

--Nithyanand.

### Max size of a message for msgsnd()

> > Is there a way to find the maximal size of the message one
> > can send using msgsnd()? I have seen Stevens' method in UNP 2e V2 pp
> > 152-153 where he repeatedly sends messages of decreased size until msgsnd()
> > accepts it without error, but I was thinking about something more
> > elegant. A system call or library function maybe. I am particularly
> > interested in Solaris and AIX solution.

> 1. getrlimit( ) for MSGMAX. or
> 2.Use sysdef command

Nice try but doesn't work. getrlimit() recognises neither RLIMIT_MSGMAX nor
MSGMAX (there are only 7 limits on Solaris it recognise) whereas sysconf()
indeed can supply some of the IPC parameters, but MSGMAX is not one of them
(and I am also not sure if they talk about POSIX or SYSV IPC).

Any other idea?

Thanks, Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole

### Max size of a message for msgsnd()

> > > Is there a way to find the maximal size of the message one
> > > can send using msgsnd()? I have seen Stevens' method in UNP 2e V2 pp
> > > 152-153 where he repeatedly sends messages of decreased size until msgsnd()
> > > accepts it without error, but I was thinking about something more
> > > elegant. A system call or library function maybe. I am particularly
> > > interested in Solaris and AIX solution.

> > 1. getrlimit( ) for MSGMAX. or
> > 2.Use sysdef command

> Nice try but doesn't work. getrlimit() recognises neither RLIMIT_MSGMAX nor
> MSGMAX (there are only 7 limits on Solaris it recognise) whereas sysconf()
> indeed can supply some of the IPC parameters, but MSGMAX is not one of them
> (and I am also not sure if they talk about POSIX or SYSV IPC).

> Any other idea?

sysdef should have worked.....did u get the value of 0.?

From UNP vol2.
".....the values are printed as 0 if the corresponding kernel module has not been
loaded(i.e.the facility has not yet been used)....."

Hth,
Nithyanand.

### Max size of a message for msgsnd()

> what about "ipcs " command.....?
> sysdef should have worked.....did u get the value of 0.?

reading the source code for sysdef.c reveals that they are finding this
information by searching through /dev/kmem and printing these values, so
this is not something I would call portable.

Oh well, thanks for your answers, it seems I will have to stick to
Stevens' method or just put some safe arbitrary value less than any of
values I encounter across different systems.

Thanks, Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole

### Max size of a message for msgsnd()

> > what about "ipcs " command.....?
> > sysdef should have worked.....did u get the value of 0.?

> Sysdef does work (sorry, misread your first sysdef for sysconf), but
> reading the source code for sysdef.c reveals that they are finding this
> information by searching through /dev/kmem and printing these values, so
> this is not something I would call portable.

Did you try "ipcs -q" ?   Did you get the portable results?

--Nithyanand.

### Max size of a message for msgsnd()

> Did you try "ipcs -q" ?   Did you get the portable results?

That one only reports the number of used bytes and maximal number of bytes
in a queue (on Linux), the information I can get from msqid_ds structure
anyway (fields msg_cbytes and msg_qbytes) using msgctl(2) system call. At
the end, I _did_ use the Stevens' method, it doesn't take too long to check
anyway and is used only once during the initialisation.

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole

Hi,
In my sendmail.cf, there is a line
O MaxMessageSize= 5242880
However, I can only send mail out in around 3M.
Why isn't it 5M ? Thanks

Eddy