Fix shared memory code that it could handle > 4GB addresses correctly.

PR/38109, patch (a little bit modified) from Chris Brand.
This commit is contained in:
rmind 2008-04-12 20:49:22 +00:00
parent 2a02b38790
commit 8d700f664c
3 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysv_shm.c,v 1.105 2008/01/30 21:09:41 njoly Exp $ */
/* $NetBSD: sysv_shm.c,v 1.106 2008/04/12 20:49:22 rmind Exp $ */
/*-
* Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.105 2008/01/30 21:09:41 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.106 2008/04/12 20:49:22 rmind Exp $");
#define SYSVSHM
@ -101,7 +101,8 @@ struct shmmap_entry {
static kmutex_t shm_lock;
static kcondvar_t * shm_cv;
static struct pool shmmap_entry_pool;
static int shm_last_free, shm_committed, shm_use_phys;
static int shm_last_free, shm_use_phys;
static size_t shm_committed;
static kcondvar_t shm_realloc_cv;
static bool shm_realloc_state;

View File

@ -1,4 +1,4 @@
/* $NetBSD: shm.h,v 1.43 2008/01/02 11:49:07 ad Exp $ */
/* $NetBSD: shm.h,v 1.44 2008/04/12 20:49:22 rmind Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -141,11 +141,11 @@ struct shmid_ds {
* might be of interest to user programs. Do we really want/need this?
*/
struct shminfo {
int32_t shmmax; /* max shared memory segment size (bytes) */
int32_t shmmin; /* min shared memory segment size (bytes) */
int32_t shmmni; /* max number of shared memory identifiers */
int32_t shmseg; /* max shared memory segments per process */
int32_t shmall; /* max amount of shared memory (pages) */
uint64_t shmmax; /* max shared memory segment size (bytes) */
uint32_t shmmin; /* min shared memory segment size (bytes) */
uint32_t shmmni; /* max number of shared memory identifiers */
uint32_t shmseg; /* max shared memory segments per process */
uint32_t shmall; /* max amount of shared memory (pages) */
};
/* Warning: 64-bit structure padding is needed here */
@ -161,7 +161,6 @@ struct shmid_ds_sysctl {
};
struct shm_sysctl_info {
struct shminfo shminfo;
int32_t pad; /* shminfo not a multiple of 64 bits */
struct shmid_ds_sysctl shmids[1];
};
#endif /* _NETBSD_SOURCE */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipcs.c,v 1.39 2007/12/15 19:44:51 perry Exp $ */
/* $NetBSD: ipcs.c,v 1.40 2008/04/12 20:49:22 rmind Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -64,6 +64,7 @@
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/inttypes.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
@ -276,7 +277,7 @@ static void
show_shmtotal(struct shminfo *shminfo)
{
(void)printf("shminfo:\n");
(void)printf("\tshmmax: %7d\t(max shared memory segment size)\n",
(void)printf("\tshmmax: %" PRIu64 "\t(max shared memory segment size)\n",
shminfo->shmmax);
(void)printf("\tshmmin: %7d\t(min shared memory segment size)\n",
shminfo->shmmin);