Change the data type of the upper shared memory limits from a signed

integer to an unsigned long. This lifts variables like the maximum
number of pages available for shared memory from 2^31 to 2^32 on 32
bit architectures, and from 2^31 to 2^64 on 64 bit architectures.

It should be noted that this changes breaks ABI on 64 bit architectures
because the size of the shmmax, shmmin, shmmni, shmseg and shmall members
of the shminfo structure has changed.

Silence on:	current@
This commit is contained in:
csjp 2005-08-06 07:20:18 +00:00
parent e9468c6553
commit 8d2abe7f00
3 changed files with 19 additions and 19 deletions

View File

@ -177,15 +177,15 @@ static int shm_use_phys;
static int shm_allow_removed;
SYSCTL_DECL(_kern_ipc);
SYSCTL_INT(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0,
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0,
"Maximum shared memory segment size");
SYSCTL_INT(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0,
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0,
"Minimum shared memory segment size");
SYSCTL_INT(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RDTUN, &shminfo.shmmni, 0,
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RDTUN, &shminfo.shmmni, 0,
"Number of shared memory identifiers");
SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RDTUN, &shminfo.shmseg, 0,
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RDTUN, &shminfo.shmseg, 0,
"Number of segments per process");
SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0,
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0,
"Maximum number of pages available for shared memory");
SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW,
&shm_use_phys, 0, "Enable/Disable locking of shared memory pages in core");
@ -955,15 +955,15 @@ shminit()
{
int i;
TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall);
TUNABLE_ULONG_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall);
for (i = PAGE_SIZE; i > 0; i--) {
shminfo.shmmax = shminfo.shmall * i;
if (shminfo.shmmax >= shminfo.shmall)
break;
}
TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin);
TUNABLE_INT_FETCH("kern.ipc.shmmni", &shminfo.shmmni);
TUNABLE_INT_FETCH("kern.ipc.shmseg", &shminfo.shmseg);
TUNABLE_ULONG_FETCH("kern.ipc.shmmin", &shminfo.shmmin);
TUNABLE_ULONG_FETCH("kern.ipc.shmmni", &shminfo.shmmni);
TUNABLE_ULONG_FETCH("kern.ipc.shmseg", &shminfo.shmseg);
TUNABLE_INT_FETCH("kern.ipc.shm_use_phys", &shm_use_phys);
shmalloced = shminfo.shmmni;

View File

@ -94,11 +94,11 @@ struct shmid_ds {
* might be of interest to user programs. Do we really want/need this?
*/
struct shminfo {
int shmmax, /* max shared memory segment size (bytes) */
shmmin, /* min shared memory segment size (bytes) */
shmmni, /* max number of shared memory identifiers */
shmseg, /* max shared memory segments per process */
shmall; /* max amount of shared memory (pages) */
u_long shmmax; /* max shared memory segment size (bytes) */
u_long shmmin; /* max shared memory segment size (bytes) */
u_long shmmni; /* max number of shared memory identifiers */
u_long shmseg; /* max shared memory segments per process */
u_long shmall; /* max amount of shared memory (pages) */
};
/*

View File

@ -93,11 +93,11 @@ static struct nlist symbols[] = {
};
#define SHMINFO_XVEC \
X(shmmax, sizeof(int)) \
X(shmmin, sizeof(int)) \
X(shmmni, sizeof(int)) \
X(shmseg, sizeof(int)) \
X(shmall, sizeof(int))
X(shmmax, sizeof(u_long)) \
X(shmmin, sizeof(u_long)) \
X(shmmni, sizeof(u_long)) \
X(shmseg, sizeof(u_long)) \
X(shmall, sizeof(u_long))
#define SEMINFO_XVEC \
X(semmap, sizeof(int)) \