From 8d2abe7f0012fbe9a1b7b4d60141fe7ef7773ff7 Mon Sep 17 00:00:00 2001 From: csjp Date: Sat, 6 Aug 2005 07:20:18 +0000 Subject: [PATCH] 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@ --- sys/kern/sysv_shm.c | 18 +++++++++--------- sys/sys/shm.h | 10 +++++----- usr.bin/ipcs/ipcs.c | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 02f96e60c6ae..637beb12c41b 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -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; diff --git a/sys/sys/shm.h b/sys/sys/shm.h index 0e6b86b9681d..88eaf0624d0f 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -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) */ }; /* diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c index 5a1dbb02d67b..cd2fe13c3791 100644 --- a/usr.bin/ipcs/ipcs.c +++ b/usr.bin/ipcs/ipcs.c @@ -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)) \