+ SYSV_SHM_SUBSYS_LOCK();
+
+ /* shmmni can not be changed after SysV SHM has been initialized */
+ if (shm_inited && arg1 == &shminfo.shmmni) {
+ sysctl_shminfo_ret = EPERM;
+ goto sysctl_shminfo_out;
+ }
+ saved_shmmax = shminfo.shmmax;
+
+ if ((error = SYSCTL_IN(req, arg1, sizeof(int64_t))) != 0) {
+ sysctl_shminfo_ret = error;
+ goto sysctl_shminfo_out;
+ }
+
+ if (arg1 == &shminfo.shmmax) {
+ /* shmmax needs to be page-aligned */
+ if (shminfo.shmmax & PAGE_MASK_64) {
+ shminfo.shmmax = saved_shmmax;
+ sysctl_shminfo_ret = EINVAL;
+ goto sysctl_shminfo_out;
+ }
+ }
+ sysctl_shminfo_ret = 0;
+sysctl_shminfo_out:
+ SYSV_SHM_SUBSYS_UNLOCK();
+ return sysctl_shminfo_ret;
+}
+
+static int
+IPCS_shm_sysctl(__unused struct sysctl_oid *oidp, __unused void *arg1,
+ __unused int arg2, struct sysctl_req *req)
+{
+ int error;
+ int cursor;
+ union {
+ struct user32_IPCS_command u32;
+ struct user_IPCS_command u64;
+ } ipcs;
+ struct user32_shmid_ds shmid_ds32; /* post conversion, 32 bit version */
+ struct user_shmid_ds shmid_ds; /* 64 bit version */
+ void *shmid_dsp;
+ size_t ipcs_sz = sizeof(struct user_IPCS_command);
+ size_t shmid_ds_sz = sizeof(struct user_shmid_ds);
+ struct proc *p = current_proc();
+
+ SYSV_SHM_SUBSYS_LOCK();
+