kernel - Fix shmat() for 64-bit
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 28 Mar 2010 00:12:02 +0000 (17:12 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 28 Mar 2010 00:12:02 +0000 (17:12 -0700)
* shmat() was storing pointers into integer fields, which works fine
  for 32-bit but fails utterly for 64-bit.  Fixed.

Reported-by: Stathis Kamperis <ekamperi@gmail.com>
sys/kern/syscalls.master
sys/kern/sysv_shm.c

index 1b5080d..e0a65c7 100644 (file)
                            int msgflg); }
 227    STD     BSD     { int msgrcv(int msqid, void *msgp, size_t msgsz, \
                            long msgtyp, int msgflg); }
-228    STD     BSD     { int shmat(int shmid, void *shmaddr, int shmflg); }
+228    STD     BSD     { void *shmat(int shmid, void *shmaddr, int shmflg); }
 229    STD     BSD     { int shmctl(int shmid, int cmd, \
                            struct shmid_ds *buf); }
 230    STD     BSD     { int shmdt(void *shmaddr); }
index e173982..026d457 100644 (file)
@@ -350,7 +350,7 @@ again:
        shmseg->shm_lpid = p->p_pid;
        shmseg->shm_atime = time_second;
        shmseg->shm_nattch++;
-       uap->sysmsg_result = attach_va;
+       uap->sysmsg_resultp = (void *)attach_va;
        error = 0;
 done:
        rel_mplock();