Merge git://git.infradead.org/battery-2.6
[linux-2.6] / arch / x86_64 / ia32 / ipc32.c
1 #include <linux/kernel.h>
2 #include <linux/spinlock.h>
3 #include <linux/list.h>
4 #include <linux/syscalls.h>
5 #include <linux/time.h>
6 #include <linux/sem.h>
7 #include <linux/msg.h>
8 #include <linux/shm.h>
9 #include <linux/ipc.h>
10 #include <linux/compat.h>
11
12 #include <asm-i386/ipc.h>
13
14 asmlinkage long
15 sys32_ipc(u32 call, int first, int second, int third,
16                 compat_uptr_t ptr, u32 fifth)
17 {
18         int version;
19
20         version = call >> 16; /* hack for backward compatibility */
21         call &= 0xffff;
22
23         switch (call) {
24               case SEMOP:
25                 /* struct sembuf is the same on 32 and 64bit :)) */
26                 return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
27               case SEMTIMEDOP:
28                 return compat_sys_semtimedop(first, compat_ptr(ptr), second,
29                                                 compat_ptr(fifth));
30               case SEMGET:
31                 return sys_semget(first, second, third);
32               case SEMCTL:
33                 return compat_sys_semctl(first, second, third, compat_ptr(ptr));
34
35               case MSGSND:
36                 return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
37               case MSGRCV:
38                 return compat_sys_msgrcv(first, second, fifth, third,
39                                          version, compat_ptr(ptr));
40               case MSGGET:
41                 return sys_msgget((key_t) first, second);
42               case MSGCTL:
43                 return compat_sys_msgctl(first, second, compat_ptr(ptr));
44
45               case SHMAT:
46                 return compat_sys_shmat(first, second, third, version,
47                                         compat_ptr(ptr));
48                 break;
49               case SHMDT:
50                 return sys_shmdt(compat_ptr(ptr));
51               case SHMGET:
52                 return sys_shmget(first, (unsigned)second, third);
53               case SHMCTL:
54                 return compat_sys_shmctl(first, second, compat_ptr(ptr));
55         }
56         return -ENOSYS;
57 }