Module Name: src
Committed By: pgoyette
Date: Wed May 13 01:00:16 UTC 2015
Modified Files:
src/sys/kern: init_sysctl.c sysv_msg.c sysv_sem.c sysv_shm.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/kern/init_sysctl.c
cvs rdiff -u -r1.67 -r1.68 src/sys/kern/sysv_msg.c
cvs rdiff -u -r1.92 -r1.93 src/sys/kern/sysv_sem.c
cvs rdiff -u -r1.126 -r1.127 src/sys/kern/sysv_shm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/init_sysctl.c
diff -u src/sys/kern/init_sysctl.c:1.205 src/sys/kern/init_sysctl.c:1.206
--- src/sys/kern/init_sysctl.c:1.205 Wed Apr 22 16:42:24 2015
+++ src/sys/kern/init_sysctl.c Wed May 13 01:00:16 2015
@@ -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 @@ uid_t security_setidcore_owner = 0;
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 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl
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",
Index: src/sys/kern/sysv_msg.c
diff -u src/sys/kern/sysv_msg.c:1.67 src/sys/kern/sysv_msg.c:1.68
--- src/sys/kern/sysv_msg.c:1.67 Tue May 12 05:19:20 2015
+++ src/sys/kern/sysv_msg.c Wed May 13 01:00:16 2015
@@ -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 kcondvar_t msg_realloc_cv;
static void msg_freehdr(struct __msg *);
+extern int kern_has_sysvmsg;
+
void
msginit(void)
{
@@ -157,6 +159,8 @@ msginit(void)
cv_init(&msg_realloc_cv, "msgrealc");
msg_realloc_state = false;
+ kern_has_sysvmsg = 1;
+
sysvipcinit();
}
Index: src/sys/kern/sysv_sem.c
diff -u src/sys/kern/sysv_sem.c:1.92 src/sys/kern/sysv_sem.c:1.93
--- src/sys/kern/sysv_sem.c:1.92 Tue May 12 05:19:20 2015
+++ src/sys/kern/sysv_sem.c Wed May 13 01:00:16 2015
@@ -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 @@ static u_int sem_waiters __cacheline_a
#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 @@ seminit(void)
semu_list = NULL;
exithook_establish(semexit, NULL);
+ kern_has_sysvsem = 1;
+
sysvipcinit();
}
Index: src/sys/kern/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.126 src/sys/kern/sysv_shm.c:1.127
--- src/sys/kern/sysv_shm.c:1.126 Tue May 12 05:19:20 2015
+++ src/sys/kern/sysv_shm.c Wed May 13 01:00:16 2015
@@ -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 @@ struct shmmap_state {
SLIST_HEAD(, shmmap_entry) entries;
};
+extern int kern_has_sysvshm;
+
#ifdef SHMDEBUG
#define SHMPRINTF(a) printf a
#else
@@ -986,6 +988,8 @@ shminit(void)
shm_realloc_disable = 0;
shm_realloc_state = false;
+ kern_has_sysvshm = 1;
+
sysvipcinit();
}