From: Matthew Dillon Date: Sat, 29 Oct 2011 00:17:30 +0000 (-0700) Subject: kernel - shmid_ds structure needs to change on 64-bit :-( X-Git-Tag: v3.0.0~795 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/7849af9fc25d204da8a7dc4331976d9564c0a05a kernel - shmid_ds structure needs to change on 64-bit :-( * shmid_ds had very old parameters and used 'int' for the shm segment size. It has to be adjusted to use size_t to accomodate shm segments greater than 2GB. This will break binary package compatibility on 64-bit systems until the related packages are recompiled. * shmget() system call now takes a size_t instead of an int. --- diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index f8dc2f2..ab0183e 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -365,7 +365,7 @@ 229 STD BSD { int shmctl(int shmid, int cmd, \ struct shmid_ds *buf); } 230 STD BSD { int shmdt(void *shmaddr); } -231 STD BSD { int shmget(key_t key, int size, int shmflg); } +231 STD BSD { int shmget(key_t key, size_t size, int shmflg); } ; 232 STD POSIX { int clock_gettime(clockid_t clock_id, \ struct timespec *tp); } diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index f26e478..83f3ae0 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -131,21 +131,21 @@ struct shminfo shminfo = { static int shm_use_phys; -TUNABLE_INT("kern.ipc.shmmin", &shminfo.shmmin); -TUNABLE_INT("kern.ipc.shmmni", &shminfo.shmmni); -TUNABLE_INT("kern.ipc.shmseg", &shminfo.shmseg); -TUNABLE_INT("kern.ipc.shmmaxpgs", &shminfo.shmall); +TUNABLE_LONG("kern.ipc.shmmin", &shminfo.shmmin); +TUNABLE_LONG("kern.ipc.shmmni", &shminfo.shmmni); +TUNABLE_LONG("kern.ipc.shmseg", &shminfo.shmseg); +TUNABLE_LONG("kern.ipc.shmmaxpgs", &shminfo.shmall); TUNABLE_INT("kern.ipc.shm_use_phys", &shm_use_phys); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0, +SYSCTL_LONG(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RW, &shminfo.shmmax, 0, "Max shared memory segment size"); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0, +SYSCTL_LONG(_kern_ipc, OID_AUTO, shmmin, CTLFLAG_RW, &shminfo.shmmin, 0, "Min shared memory segment size"); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RD, &shminfo.shmmni, 0, +SYSCTL_LONG(_kern_ipc, OID_AUTO, shmmni, CTLFLAG_RD, &shminfo.shmmni, 0, "Max number of shared memory identifiers"); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RW, &shminfo.shmseg, 0, +SYSCTL_LONG(_kern_ipc, OID_AUTO, shmseg, CTLFLAG_RW, &shminfo.shmseg, 0, "Max shared memory segments per process"); -SYSCTL_INT(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, +SYSCTL_LONG(_kern_ipc, OID_AUTO, shmall, CTLFLAG_RW, &shminfo.shmall, 0, "Max pages of shared memory"); SYSCTL_INT(_kern_ipc, OID_AUTO, shm_use_phys, CTLFLAG_RW, &shm_use_phys, 0, "Use phys pager allocation instead of swap pager allocation"); @@ -227,7 +227,7 @@ sys_shmdt(struct shmdt_args *uap) struct thread *td = curthread; struct proc *p = td->td_proc; struct shmmap_state *shmmap_s; - int i; + long i; int error; if (!jail_sysvipc_allowed && td->td_ucred->cr_prison != NULL) @@ -261,7 +261,8 @@ sys_shmat(struct shmat_args *uap) { struct thread *td = curthread; struct proc *p = td->td_proc; - int error, i, flags; + int error, flags; + long i; struct shmid_ds *shmseg; struct shmmap_state *shmmap_s = NULL; struct shm_handle *shm_handle; diff --git a/sys/sys/shm.h b/sys/sys/shm.h index 178f097..0053fca 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -54,10 +54,10 @@ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ - int shm_segsz; /* size of segment in bytes */ + size_t shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ - short shm_nattch; /* number of current attaches */ + int shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ @@ -71,7 +71,7 @@ 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) */ + long 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 */