Date: 05/06
Affected NV Version:
OS Version: Mac OS X
Plugin version: N/A
Application version: N/A
Description:
Setting shared memory in Mac OS X
Symptoms:
In Windows, the shared memory is dynamically managed. On Mac OS X, it is set at boot and cannot be changed without a reboot. If you increase the shared memory on the Process Manager tab in the configurator without making the required changes on the system, NetVault will most likely not run. If it does run, it could grind the customer's system to a halt because we're asking for a specific amount of memory that the OS is not set up to handle.
The below information will allow the customer to set up his system dependent upon the amount of memory that he wants to allocate.
1. The shmmax, shmmin, shmmni, shmseg, and shmall settings cannot be
changed after the shared memory system is initialized
2. The shared memory system is initialized immediately after all 5
settings have been configured
3. The shmall setting must be a multiple of the page size (on both
10.3 and 10.4)
Here are excerpts from the sysctl_shminfo() function found in
sysv_shm.c:
[1]
/* Set the values only if shared memory is not initialised */
if (!shm_inited) {
if ((error = SYSCTL_IN(req, arg1, sizeof(user_ssize_t)))
!= 0) {
sysctl_shminfo_ret = error;
goto sysctl_shminfo_out;
}
[2]
/* Initialize only when all values are set */
if ((shminfo.shmmax != (user_ssize_t)-1) &&
(shminfo.shmmin != (user_ssize_t)-1) &&
(shminfo.shmmni != (user_ssize_t)-1) &&
(shminfo.shmseg != (user_ssize_t)-1) &&
(shminfo.shmall != (user_ssize_t)-1)) {
shminit(NULL);
}
[3]
(10.3)
if (arg1 == &shminfo.shmmax) {
if (shminfo.shmmax & PAGE_MASK) {
shminfo.shmmax = -1;
return(EINVAL);
}
}
(10.4)
if (arg1 == &shminfo.shmmax) {
if (shminfo.shmmax & PAGE_MASK_64) {
shminfo.shmmax = -1;
return(EINVAL);
}
}
PAGE_MASK is "(PAGE_SIZE - 1)", and PAGE_MASK_64 is simply "(unsigned
long long)PAGE_MASK"
In a nutshell, if you want to customize the shared memory settings,
you must:
Modify the desired settings inside /etc/rc, and be aware that OS
updates will overwrite your changes.
Example /etc/rc file if the customer has 512MB of memory that can be allocated.
kern.sysv.shmmax=536870912
kern.sysv.shmmin=1
kern.sysv.shmmni=128
kern.sysv.shmseg=32
kern.sysv.shmall=131072
For OS X 10.5 (Leopard), 10.6 (Snow Leopard), and 10.7 (Lion) create a file called /etc/sysctl.conf and add the same values as you would for the /etc/rc file. You DO NOT need to edit any rc files in 10.5.x or 10.6.x
Note the relationship between shmall and shmmax. shmall is the number of pages (4k in size). shmall x 4096 = shmmax.
BakBone SFDC Solution Number: 00001120