From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 12 15:10:25 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC7C116A4D0 for ; Tue, 12 Apr 2005 15:10:25 +0000 (GMT) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E78843D45 for ; Tue, 12 Apr 2005 15:10:25 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) (8.13.4/8.13.3) with ESMTP id j3CFAMEt018942 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 12 Apr 2005 17:10:22 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.4/8.13.3/Submit) id j3CFAM0j018939; Tue, 12 Apr 2005 17:10:22 +0200 (CEST) Date: Tue, 12 Apr 2005 17:10:22 +0200 From: Divacky Roman To: Vladislav Shabanov Message-ID: <20050412151022.GB17895@stud.fit.vutbr.cz> References: <200504112003.25096.vs@rambler-co.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504112003.25096.vs@rambler-co.ru> User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.49 on 147.229.10.14 cc: hackers@freebsd.org Subject: Re: do-nothing code in sysv_shm.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2005 15:10:25 -0000 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