[parisc-linux-cvs] More fixes for ipc syscall wrappers

Richard Hirst rhirst@linuxcare.com
Mon, 26 Mar 2001 00:35:50 +0100


With these fixes 'fakeroot date' works on 64 bit.

Richard


diff -u -r1.2 sys_parisc32.c
--- sys_parisc32.c      2001/03/25 21:05:33     1.2
+++ sys_parisc32.c      2001/03/25 23:26:50
@@ -2500,7 +2500,7 @@
 {
        struct msgbuf *mb;
        struct msgbuf32 mb32;
-       int err;
+       int err, len;
 
        if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
                return -ENOMEM;
@@ -2508,11 +2508,14 @@
        KERNEL_SYSCALL(err, sys_msgrcv, msqid, mb, msgsz, msgtyp, msgflg);
 
        if (err >= 0) {
+               len = err;
                mb32.mtype = mb->mtype;
                err = put_user(mb32.mtype, &umsgp32->mtype);
-               err |= copy_to_user(&umsgp32->mtext, mb->mtext, err);
+               err |= copy_to_user(&umsgp32->mtext, mb->mtext, len);
                if (err)
                        err = -EFAULT;
+               else
+                       err = len;
        }
 
        kfree(mb);
@@ -2539,7 +2542,7 @@
                /* Don't support the older stuff */
                if (ipc_parse_version(&cmd) != IPC_64) {
                    printk("msgctl() does not support libc5 IPC_SET\n");
-                   return ENOSYS;
+                   return -ENOSYS;
                }
                /* padded values (time_t's) aren't used, so this is safe */
                err = sys_msgctl(msqid, cmd, buf);
@@ -2597,8 +2600,16 @@
        union semun u;
        int version = ipc_parse_version(&cmd);
 
-
        switch (cmd) {
+       case SETVAL:
+               /* Ugh.  arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
+                * The int should be in the first 4, but our argument
+                * frobbing has left it in the last 4.
+                */
+               u.val = *((int *)&arg + 1);
+               err = sys_semctl (semid, semnum, cmd, u);
+               break;
+
        case IPC_SET:
                if (version != IPC_64) {
                        printk("semctl(IPC_STAT(cmd=0x%x)) does not support libc5-style cmds\n", cmd);
@@ -2613,7 +2624,6 @@
        case GETNCNT:
        case GETZCNT:
        case GETALL:
-       case SETVAL:
        case SETALL:
                err = sys_semctl (semid, semnum, cmd, arg);
                break;