Re: System-imposed maximum for requested size of shared memory segment



Alex Vinokur wrote:
On Feb 11, 12:26 pm, Alex Vinokur <ale...@xxxxxxxxxxxxxxxxxxxxx>
wrote:
HP-UX B.11.23 U ia64
HP-UX 11i Version 2: August 2003

From man for shmget:
-------------------------
shmget() fails if any of the following conditions are encountered:

[EINVAL] size is less than the system-imposed minimum or
greater than the system-imposed maximum.
-------------------------

Where can we find those minimum and maximum?


64 GB according to shmmax(5)

sys/shm.h holds 'struct shmifo'
struct shminfo {
long shmmax; /* max shared memory segment size */
long shmmin; /* min shared memory segment size */
int shmmni; /* # of shared memory identifiers */
int shmseg; /* max attached shared memory segments per
process */
};

But where are the members set?

By the kernel dynamic tunable handlers for shmmax, shmmni and
shmseg [all of which are dynamic in v2]. shmmin isn't adjustable
and in practice anything positive and non-zero will pass it.

>
> I would like to write in my program something like:
> assert (requested_size <= shmmax);

man gettune() if you want to ask the kernel for the current
tunable values, man shmmax, man shmmni and man shmseg for
more details on the tunables.

Don

.