Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Apr 2005 17:10:22 +0200
From:      Divacky Roman <xdivac02@stud.fit.vutbr.cz>
To:        Vladislav Shabanov <vs@rambler-co.ru>
Cc:        hackers@freebsd.org
Subject:   Re: do-nothing code in sysv_shm.c
Message-ID:  <20050412151022.GB17895@stud.fit.vutbr.cz>
In-Reply-To: <200504112003.25096.vs@rambler-co.ru>
References:  <200504112003.25096.vs@rambler-co.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 11, 2005 at 08:03:24PM +0400, Vladislav Shabanov wrote:
> 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:

alfred perlstein commited this saying:
Bring shm functions closer the the opengroup standards.

he is the person you should ask why is it coded this way. imho compiler just
optimizes this out leaving plain shminfo.shmmax = shminfo.shmall * PAGE_SIZE;

roman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050412151022.GB17895>