Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern More preparation for modularizing the SYSVxxx optio...



details:   https://anonhg.NetBSD.org/src/rev/d9484c483c87
branches:  trunk
changeset: 808296:d9484c483c87
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed May 13 01:00:16 2015 +0000

description:
More preparation for modularizing the SYSVxxx options.  Here we
change the kern.ipc.sysvxxx sysctls into dynamic values, so each
sub-component of SYSVxxx can declare its own availability.

diffstat:

 sys/kern/init_sysctl.c |  49 +++++++++++++++++++++++--------------------------
 sys/kern/sysv_msg.c    |   8 ++++++--
 sys/kern/sysv_sem.c    |  10 ++++++++--
 sys/kern/sysv_shm.c    |   8 ++++++--
 4 files changed, 43 insertions(+), 32 deletions(-)

diffs (195 lines):

diff -r fcdbcb4c1fe9 -r d9484c483c87 sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c    Tue May 12 23:16:47 2015 +0000
+++ b/sys/kern/init_sysctl.c    Wed May 13 01:00:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_sysctl.c,v 1.205 2015/04/22 16:42:24 pooka Exp $ */
+/*     $NetBSD: init_sysctl.c,v 1.206 2015/05/13 01:00:16 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.205 2015/04/22 16:42:24 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.206 2015/05/13 01:00:16 pgoyette Exp $");
 
 #include "opt_sysv.h"
 #include "opt_compat_netbsd.h"
@@ -75,6 +75,16 @@
 gid_t security_setidcore_group = 0;
 mode_t security_setidcore_mode = (S_IRUSR|S_IWUSR);
 
+/*
+ * Current status of SysV IPC capability.  Initially, these are
+ * 0 if the capability is not built-in to the kernel, but can
+ * be updated if the appropriate kernel module is (auto)loaded.
+ */
+
+int kern_has_sysvmsg = 0;
+int kern_has_sysvshm = 0;
+int kern_has_sysvsem = 0;
+
 static const u_int sysctl_lwpprflagmap[] = {
        LPR_DETACHED, L_DETACHED,
        0
@@ -276,38 +286,25 @@
                       NULL, 0, NULL, 0,
                       CTL_KERN, KERN_SYSVIPC, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
-                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "sysvmsg",
                       SYSCTL_DESCR("System V style message support available"),
-                      NULL,
-#ifdef SYSVMSG
-                      1,
-#else /* SYSVMSG */
-                      0,
-#endif /* SYSVMSG */
-                      NULL, 0, CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_MSG, CTL_EOL);
+                      NULL, 0, &kern_has_sysvmsg, sizeof(int),
+                      CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_MSG, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
-                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "sysvsem",
                       SYSCTL_DESCR("System V style semaphore support "
-                                   "available"), NULL,
-#ifdef SYSVSEM
-                      1,
-#else /* SYSVSEM */
-                      0,
-#endif /* SYSVSEM */
-                      NULL, 0, CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SEM, CTL_EOL);
+                                   "available"),
+                      NULL, 0, &kern_has_sysvsem, sizeof(int),
+                      CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SEM, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
-                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "sysvshm",
                       SYSCTL_DESCR("System V style shared memory support "
-                                   "available"), NULL,
-#ifdef SYSVSHM
-                      1,
-#else /* SYSVSHM */
-                      0,
-#endif /* SYSVSHM */
-                      NULL, 0, CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SHM, CTL_EOL);
+                                   "available"),
+                      NULL, 0, &kern_has_sysvshm, sizeof(int),
+                      CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SHM, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
                       CTLTYPE_INT, "synchronized_io",
diff -r fcdbcb4c1fe9 -r d9484c483c87 sys/kern/sysv_msg.c
--- a/sys/kern/sysv_msg.c       Tue May 12 23:16:47 2015 +0000
+++ b/sys/kern/sysv_msg.c       Wed May 13 01:00:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysv_msg.c,v 1.67 2015/05/12 05:19:20 pgoyette Exp $   */
+/*     $NetBSD: sysv_msg.c,v 1.68 2015/05/13 01:00:16 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.67 2015/05/12 05:19:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.68 2015/05/13 01:00:16 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -89,6 +89,8 @@
 
 static void msg_freehdr(struct __msg *);
 
+extern int kern_has_sysvmsg;
+
 void
 msginit(void)
 {
@@ -157,6 +159,8 @@
        cv_init(&msg_realloc_cv, "msgrealc");
        msg_realloc_state = false;
 
+       kern_has_sysvmsg = 1;
+
        sysvipcinit();
 }
 
diff -r fcdbcb4c1fe9 -r d9484c483c87 sys/kern/sysv_sem.c
--- a/sys/kern/sysv_sem.c       Tue May 12 23:16:47 2015 +0000
+++ b/sys/kern/sysv_sem.c       Wed May 13 01:00:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysv_sem.c,v 1.92 2015/05/12 05:19:20 pgoyette Exp $   */
+/*     $NetBSD: sysv_sem.c,v 1.93 2015/05/13 01:00:16 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_sem.c,v 1.92 2015/05/12 05:19:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_sem.c,v 1.93 2015/05/13 01:00:16 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -87,6 +87,10 @@
 #define SEM_PRINTF(a)
 #endif
 
+void *hook;    /* cookie from exithook_establish() */
+
+extern int kern_has_sysvsem;
+
 struct sem_undo *semu_alloc(struct proc *);
 int semundo_adjust(struct proc *, struct sem_undo **, int, int, int);
 void semundo_clear(int, int);
@@ -132,6 +136,8 @@
        semu_list = NULL;
        exithook_establish(semexit, NULL);
 
+       kern_has_sysvsem = 1;
+
        sysvipcinit();
 }
 
diff -r fcdbcb4c1fe9 -r d9484c483c87 sys/kern/sysv_shm.c
--- a/sys/kern/sysv_shm.c       Tue May 12 23:16:47 2015 +0000
+++ b/sys/kern/sysv_shm.c       Wed May 13 01:00:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysv_shm.c,v 1.126 2015/05/12 05:19:20 pgoyette Exp $  */
+/*     $NetBSD: sysv_shm.c,v 1.127 2015/05/13 01:00:16 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.126 2015/05/12 05:19:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.127 2015/05/13 01:00:16 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -108,6 +108,8 @@
        SLIST_HEAD(, shmmap_entry) entries;
 };
 
+extern int kern_has_sysvshm;
+
 #ifdef SHMDEBUG
 #define SHMPRINTF(a) printf a
 #else
@@ -986,6 +988,8 @@
        shm_realloc_disable = 0;
        shm_realloc_state = false;
 
+       kern_has_sysvshm = 1;
+
        sysvipcinit();
 }
 



Home | Main Index | Thread Index | Old Index