Fix the msgsys(), semsys(), and shmsys() syscalls which were broken by the
authorMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Jul 2003 23:28:57 +0000 (23:28 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Mon, 28 Jul 2003 23:28:57 +0000 (23:28 +0000)
messaging code.

sys/kern/sysv_msg.c
sys/kern/sysv_sem.c
sys/kern/sysv_shm.c

index 4c0b307..0b33596 100644 (file)
@@ -1,5 +1,5 @@
 /* $FreeBSD: src/sys/kern/sysv_msg.c,v 1.23.2.5 2002/12/31 08:54:53 maxim Exp $ */
-/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.8 2003/07/26 19:42:11 rob Exp $ */
+/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.9 2003/07/28 23:28:57 dillon Exp $ */
 
 /*
  * Implementation of SVID messages
@@ -205,13 +205,16 @@ int
 msgsys(struct msgsys_args *uap)
 {
        struct proc *p = curproc;
+       int which = uap->which;
 
        if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL)
                return (ENOSYS);
 
-       if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0]))
+       if (which >= sizeof(msgcalls)/sizeof(msgcalls[0]))
                return (EINVAL);
-       return ((*msgcalls[uap->which])(&uap->a2));
+       bcopy(&uap->a2, &uap->which,
+           sizeof(struct msgsys_args) - offsetof(struct msgsys_args, a2));
+       return ((*msgcalls[which])(uap));
 }
 
 static void
index 13ab7a0..b8e93c1 100644 (file)
@@ -1,5 +1,5 @@
 /* $FreeBSD: src/sys/kern/sysv_sem.c,v 1.24.2.8 2002/10/22 20:45:03 fjoe Exp $ */
-/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.7 2003/07/26 19:42:11 rob Exp $ */
+/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.8 2003/07/28 23:28:57 dillon Exp $ */
 
 /*
  * Implementation of SVID semaphores
@@ -207,13 +207,16 @@ int
 semsys(struct semsys_args *uap)
 {
        struct proc *p = curproc;
+       int which = uap->which;
 
        if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL)
                return (ENOSYS);
 
-       if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0]))
+       if (which >= sizeof(semcalls)/sizeof(semcalls[0]))
                return (EINVAL);
-       return ((*semcalls[uap->which])(&uap->a2));
+       bcopy(&uap->a2, &uap->which,
+           sizeof(struct semsys_args) - offsetof(struct semsys_args, a2));
+       return ((*semcalls[which])(&uap));
 }
 
 /*
index e0518b7..5e8ddff 100644 (file)
@@ -1,5 +1,5 @@
 /* $FreeBSD: src/sys/kern/sysv_shm.c,v 1.45.2.6 2002/10/22 20:45:03 fjoe Exp $ */
-/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.7 2003/07/26 18:12:44 dillon Exp $ */
+/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.8 2003/07/28 23:28:57 dillon Exp $ */
 /*     $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $      */
 
 /*
@@ -328,6 +328,7 @@ struct oshmid_ds {
 };
 
 struct oshmctl_args {
+       struct lwkt_msg lmsg;
        int shmid;
        int cmd;
        struct oshmid_ds *ubuf;
@@ -581,13 +582,18 @@ int
 shmsys(struct shmsys_args *uap)
 {
        struct proc *p = curproc;
+       int which = uap->which;
+       int error;
 
        if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL)
                return (ENOSYS);
 
-       if (uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0]))
+       if (which >= sizeof(shmcalls)/sizeof(shmcalls[0]))
                return EINVAL;
-       return ((*shmcalls[uap->which])(&uap->a2));
+       bcopy(&uap->a2, &uap->which,
+               sizeof(struct shmsys_args) - offsetof(struct shmsys_args, a2));
+       error = ((*shmcalls[which])(uap));
+       return(error);
 }
 
 void