svn commit: r224016 - in head: sys/compat/linux sys/conf sys/kern sys/sys usr.bin/ipcs

Bjoern A. Zeeb bz at FreeBSD.org
Thu Jul 14 14:18:14 UTC 2011


Author: bz
Date: Thu Jul 14 14:18:14 2011
New Revision: 224016
URL: http://svn.freebsd.org/changeset/base/224016

Log:
  Remove semaphore map entry count "semmap" field and its tuning
  option that is highly recommended to be adjusted in too much
  documentation while doing nothing in FreeBSD since r2729 (rev 1.1).
  
  ipcs(1) needs to be recompiled as it is accessing _KERNEL private
  variables.
  
  Reviewed by:	jhb (before comment change on linux code)
  Sponsored by:	Sandvine Incorporated

Modified:
  head/sys/compat/linux/linux_ipc.c
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/kern/sysv_sem.c
  head/sys/sys/sem.h
  head/usr.bin/ipcs/ipc.c
  head/usr.bin/ipcs/ipcs.c

Modified: head/sys/compat/linux/linux_ipc.c
==============================================================================
--- head/sys/compat/linux/linux_ipc.c	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/sys/compat/linux/linux_ipc.c	Thu Jul 14 14:18:14 2011	(r224016)
@@ -575,7 +575,15 @@ linux_semctl(struct thread *td, struct l
 		return (error);
 	case LINUX_IPC_INFO:
 	case LINUX_SEM_INFO:
-		bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) );
+		bcopy(&seminfo, &linux_seminfo.semmni, sizeof(linux_seminfo) -
+		    sizeof(linux_seminfo.semmap) );
+		/*
+		 * Linux does not use the semmap field either but populates it
+		 * with the defined value from SEMMAP, which really is redefined
+		 * to SEMMNS, which they define as SEMMNI * SEMMSL.
+		 * Try to simulate this returning our dynamic semmns value.
+		 */
+		linux_seminfo.semmap = linux_seminfo.semmns;
 /* XXX BSD equivalent?
 #define used_semids 10
 #define used_sems 10

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/sys/conf/NOTES	Thu Jul 14 14:18:14 2011	(r224016)
@@ -2833,9 +2833,6 @@ options 	VERBOSE_SYSINIT
 #####################################################################
 # SYSV IPC KERNEL PARAMETERS
 #
-# Maximum number of entries in a semaphore map.
-options 	SEMMAP=31
-
 # Maximum number of System V semaphores that can be used on the system at
 # one time.
 options 	SEMMNI=11

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/sys/conf/options	Thu Jul 14 14:18:14 2011	(r224016)
@@ -164,7 +164,6 @@ MSGMNI		opt_sysvipc.h
 MSGSEG		opt_sysvipc.h
 MSGSSZ		opt_sysvipc.h
 MSGTQL		opt_sysvipc.h
-SEMMAP		opt_sysvipc.h
 SEMMNI		opt_sysvipc.h
 SEMMNS		opt_sysvipc.h
 SEMMNU		opt_sysvipc.h

Modified: head/sys/kern/sysv_sem.c
==============================================================================
--- head/sys/kern/sysv_sem.c	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/sys/kern/sysv_sem.c	Thu Jul 14 14:18:14 2011	(r224016)
@@ -149,9 +149,6 @@ struct sem_undo {
 #endif
 
 /* shouldn't need tuning */
-#ifndef SEMMAP
-#define SEMMAP	30		/* # of entries in semaphore map */
-#endif
 #ifndef SEMMSL
 #define SEMMSL	SEMMNS		/* max # of semaphores per id */
 #endif
@@ -182,7 +179,6 @@ struct sem_undo {
  * semaphore info struct
  */
 struct seminfo seminfo = {
-                SEMMAP,         /* # of entries in semaphore map */
                 SEMMNI,         /* # of semaphore identifiers */
                 SEMMNS,         /* # of semaphores in system */
                 SEMMNU,         /* # of undo structures in system */
@@ -194,8 +190,6 @@ struct seminfo seminfo = {
                 SEMAEM          /* adjust on exit max value */
 };
 
-SYSCTL_INT(_kern_ipc, OID_AUTO, semmap, CTLFLAG_RW, &seminfo.semmap, 0,
-    "Number of entries in the semaphore map");
 SYSCTL_INT(_kern_ipc, OID_AUTO, semmni, CTLFLAG_RDTUN, &seminfo.semmni, 0,
     "Number of semaphore identifiers");
 SYSCTL_INT(_kern_ipc, OID_AUTO, semmns, CTLFLAG_RDTUN, &seminfo.semmns, 0,
@@ -255,7 +249,6 @@ seminit(void)
 {
 	int i, error;
 
-	TUNABLE_INT_FETCH("kern.ipc.semmap", &seminfo.semmap);
 	TUNABLE_INT_FETCH("kern.ipc.semmni", &seminfo.semmni);
 	TUNABLE_INT_FETCH("kern.ipc.semmns", &seminfo.semmns);
 	TUNABLE_INT_FETCH("kern.ipc.semmnu", &seminfo.semmnu);

Modified: head/sys/sys/sem.h
==============================================================================
--- head/sys/sys/sem.h	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/sys/sys/sem.h	Thu Jul 14 14:18:14 2011	(r224016)
@@ -107,8 +107,7 @@ union semun {
  * semaphore info struct
  */
 struct seminfo {
-	int	semmap,		/* # of entries in semaphore map */
-		semmni,		/* # of semaphore identifiers */
+	int	semmni,		/* # of semaphore identifiers */
 		semmns,		/* # of semaphores in system */
 		semmnu,		/* # of undo structures in system */
 		semmsl,		/* max # of semaphores per id */

Modified: head/usr.bin/ipcs/ipc.c
==============================================================================
--- head/usr.bin/ipcs/ipc.c	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/usr.bin/ipcs/ipc.c	Thu Jul 14 14:18:14 2011	(r224016)
@@ -73,8 +73,7 @@ struct nlist symbols[] = {
 			X(shmseg, sizeof(u_long))			\
 			X(shmall, sizeof(u_long))
 
-#define	SEMINFO_XVEC	X(semmap, sizeof(int))				\
-			X(semmni, sizeof(int))				\
+#define	SEMINFO_XVEC	X(semmni, sizeof(int))				\
 			X(semmns, sizeof(int))				\
 			X(semmnu, sizeof(int))				\
 			X(semmsl, sizeof(int))				\

Modified: head/usr.bin/ipcs/ipcs.c
==============================================================================
--- head/usr.bin/ipcs/ipcs.c	Thu Jul 14 14:15:21 2011	(r224015)
+++ head/usr.bin/ipcs/ipcs.c	Thu Jul 14 14:18:14 2011	(r224016)
@@ -474,8 +474,6 @@ print_ksemtotal(struct seminfo seminfo)
 {
 
 	printf("seminfo:\n");
-	printf("\tsemmap: %12d\t(# of entries in semaphore map)\n",
-	    seminfo.semmap);
 	printf("\tsemmni: %12d\t(# of semaphore identifiers)\n",
 	    seminfo.semmni);
 	printf("\tsemmns: %12d\t(# of semaphores in system)\n",


More information about the svn-src-head mailing list