Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 12 | asmlinkage long sys32_ipc(u32 call, int first, int second, int third, |
| 13 | compat_uptr_t ptr, u32 fifth) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | { |
| 15 | int version; |
| 16 | |
| 17 | version = call >> 16; /* hack for backward compatibility */ |
| 18 | call &= 0xffff; |
| 19 | |
| 20 | switch (call) { |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 21 | case SEMOP: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | /* struct sembuf is the same on 32 and 64bit :)) */ |
| 23 | return sys_semtimedop(first, compat_ptr(ptr), second, NULL); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 24 | case SEMTIMEDOP: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | return compat_sys_semtimedop(first, compat_ptr(ptr), second, |
| 26 | compat_ptr(fifth)); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 27 | case SEMGET: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | return sys_semget(first, second, third); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 29 | case SEMCTL: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | return compat_sys_semctl(first, second, third, compat_ptr(ptr)); |
| 31 | |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 32 | case MSGSND: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | return compat_sys_msgsnd(first, second, third, compat_ptr(ptr)); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 34 | case MSGRCV: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | return compat_sys_msgrcv(first, second, fifth, third, |
| 36 | version, compat_ptr(ptr)); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 37 | case MSGGET: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | return sys_msgget((key_t) first, second); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 39 | case MSGCTL: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | return compat_sys_msgctl(first, second, compat_ptr(ptr)); |
| 41 | |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 42 | case SHMAT: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | return compat_sys_shmat(first, second, third, version, |
| 44 | compat_ptr(ptr)); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 45 | case SHMDT: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | return sys_shmdt(compat_ptr(ptr)); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 47 | case SHMGET: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | return sys_shmget(first, (unsigned)second, third); |
Thomas Gleixner | 2da06b4 | 2008-01-30 13:30:08 +0100 | [diff] [blame] | 49 | case SHMCTL: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | return compat_sys_shmctl(first, second, compat_ptr(ptr)); |
| 51 | } |
| 52 | return -ENOSYS; |
| 53 | } |