Date: Mon, 11 Apr 2005 20:03:24 +0400 From: Vladislav Shabanov <vs@rambler-co.ru> To: hackers@freebsd.org Subject: do-nothing code in sysv_shm.c Message-ID: <200504112003.25096.vs@rambler-co.ru>
index | next in thread | raw e-mail
I`ve found the following code in sysv_shm.c :
............
static void
shminit()
{
int i;
TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall);
for (i = PAGE_SIZE; i > 0; i--) {
shminfo.shmmax = shminfo.shmall * PAGE_SIZE;
if (shminfo.shmmax >= shminfo.shmall)
break;
}
TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin);
.........
IMHO, loop does nothing. Possible variant:
#define shmall_bits (sizeof(shminfo.shmall)*8)
if (0 == (shminfo.shmall & (~ ( (1<<(shmall_bits-PAGE_SHIFT-1)) - 1)))) {
/* if high PAGE_SHIFT+1 bits of shminfo.shmall is zero */
shminfo.shmmax = shminfo.shmall << PAGE_SHIFT;
} else {
shminfo.shmmax = __INT_MAX;
}
------------------------------
previous changes in this part of code:
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sysv_shm.c.diff?r1=1.78&r2=1.79&f=h
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sysv_shm.c.diff?r1=1.79&r2=1.80&f=h
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504112003.25096.vs>
