From nobody@FreeBSD.org  Mon Dec 27 15:01:39 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 662D716A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 15:01:39 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 303DB43D5A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 15:01:39 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iBRF1d1v073801
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 15:01:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iBRF1c41073800;
	Mon, 27 Dec 2004 15:01:38 GMT
	(envelope-from nobody)
Message-Id: <200412271501.iBRF1c41073800@www.freebsd.org>
Date: Mon, 27 Dec 2004 15:01:38 GMT
From: Sergiy Vyshnevetskiy <serg@vostok.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Inconsistent naming of a tunable and weird code in sysvshm module
X-Send-Pr-Version: www-2.3

>Number:         75542
>Category:       kern
>Synopsis:       Inconsistent naming of a tunable and weird code in sysvshm module
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    rwatson
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 15:10:13 GMT 2004
>Closed-Date:    Sun Jan 13 15:53:58 UTC 2008
>Last-Modified:  Sat Oct 24 19:10:02 UTC 2009
>Originator:     Sergiy Vyshnevetskiy
>Release:        5-stable
>Organization:
>Environment:
FreeBSD serg.vostok.net 5.3-STABLE FreeBSD 5.3-STABLE #0: Mon Dec  6 11:01:12 EET 2004     root@serg.vostok.net:/usr/5/src/sys/i386/compile/SERG  i386
>Description:
kern.ipc.shmmaxpgs tunable is accessible as kern.ipc.shmall with sysctl.
Meaningless code near it's definition.
>How-To-Repeat:
Remove options SYSVSHM from your kernel configuration file. Recompile kernel and reboot. Load sysvshm module. You will have to use kern.ipc.shmmaxpgs tunable but will see it as kern.ipc.shmall in sysctl output.
>Fix:
--- sys/kern/sysv_shm.c.orig  Fri Dec  3 17:02:20 2004                          
+++ sys/kern/sysv_shm.c Fri Dec  3 17:04:58 2004                                
@@ -863,12 +863,8 @@                                                            
 {                                                                              
  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.shmall", &shminfo.shmall);                        
+ shminfo.shmmax = shminfo.shmall * PAGE_SIZE;                                  
  TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin);                        
  TUNABLE_INT_FETCH("kern.ipc.shmmni", &shminfo.shmmni);                        
  TUNABLE_INT_FETCH("kern.ipc.shmseg", &shminfo.shmseg);                        

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: rwatson 
State-Changed-When: Thu Dec 30 13:56:42 GMT 2004 
State-Changed-Why:  
Merged to sysv_msg.c as revision 1.55 in CVS HEAD.  Will MFC after 2 
weeks.  Thanks! 



Responsible-Changed-From-To: freebsd-bugs->rwatson 
Responsible-Changed-By: rwatson 
Responsible-Changed-When: Thu Dec 30 13:56:42 GMT 2004 
Responsible-Changed-Why:  
I'll grab this one. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=75542 
State-Changed-From-To: patched->closed 
State-Changed-By: rwatson 
State-Changed-When: Sun Jan 13 15:52:28 UTC 2008 
State-Changed-Why:  
This change was MFC'd to 5.x, and appeared in FreeBSD 5.4 and later. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=75542 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/75542: commit references a PR
Date: Sat, 24 Oct 2009 19:01:12 +0000 (UTC)

 Author: ru
 Date: Sat Oct 24 19:00:58 2009
 New Revision: 198449
 URL: http://svn.freebsd.org/changeset/base/198449
 
 Log:
   - Rename tunable kern.ipc.shmmaxpgs to kern.ipc.shmall.
   - Explain the fuss when initializing shmmax.
   
   PR:	75542 (mistakenly closed instead of PR 75541)
 
 Modified:
   head/sys/kern/sysv_shm.c
 
 Modified: head/sys/kern/sysv_shm.c
 ==============================================================================
 --- head/sys/kern/sysv_shm.c	Sat Oct 24 18:49:17 2009	(r198448)
 +++ head/sys/kern/sysv_shm.c	Sat Oct 24 19:00:58 2009	(r198449)
 @@ -821,12 +821,19 @@ shminit()
  {
  	int i;
  
 -	TUNABLE_ULONG_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall);
 +#ifndef BURN_BRIDGES
 +	if (TUNABLE_ULONG_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall) != 0)
 +		printf("kern.ipc.shmmaxpgs is now called kern.ipc.shmall!\n");
 +#endif
 +	TUNABLE_ULONG_FETCH("kern.ipc.shmall", &shminfo.shmall);
 +
 +	/* Initialize shmmax dealing with possible overflow. */
  	for (i = PAGE_SIZE; i > 0; i--) {
  		shminfo.shmmax = shminfo.shmall * i;
  		if (shminfo.shmmax >= shminfo.shmall)
  			break;
  	}
 +
  	TUNABLE_ULONG_FETCH("kern.ipc.shmmin", &shminfo.shmmin);
  	TUNABLE_ULONG_FETCH("kern.ipc.shmmni", &shminfo.shmmni);
  	TUNABLE_ULONG_FETCH("kern.ipc.shmseg", &shminfo.shmseg);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
