blob: d21991ce606cc54dc4a3c71745049364bda26582 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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 Gleixner2da06b42008-01-30 13:30:08 +010012asmlinkage long sys32_ipc(u32 call, int first, int second, int third,
13 compat_uptr_t ptr, u32 fifth)
Linus Torvalds1da177e2005-04-16 15:20:36 -070014{
15 int version;
16
17 version = call >> 16; /* hack for backward compatibility */
18 call &= 0xffff;
19
20 switch (call) {
Thomas Gleixner2da06b42008-01-30 13:30:08 +010021 case SEMOP:
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 /* struct sembuf is the same on 32 and 64bit :)) */
23 return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
Thomas Gleixner2da06b42008-01-30 13:30:08 +010024 case SEMTIMEDOP:
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 return compat_sys_semtimedop(first, compat_ptr(ptr), second,
26 compat_ptr(fifth));
Thomas Gleixner2da06b42008-01-30 13:30:08 +010027 case SEMGET:
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 return sys_semget(first, second, third);
Thomas Gleixner2da06b42008-01-30 13:30:08 +010029 case SEMCTL:
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 return compat_sys_semctl(first, second, third, compat_ptr(ptr));
31
Thomas Gleixner2da06b42008-01-30 13:30:08 +010032 case MSGSND:
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
Thomas Gleixner2da06b42008-01-30 13:30:08 +010034 case MSGRCV:
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 return compat_sys_msgrcv(first, second, fifth, third,
36 version, compat_ptr(ptr));
Thomas Gleixner2da06b42008-01-30 13:30:08 +010037 case MSGGET:
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 return sys_msgget((key_t) first, second);
Thomas Gleixner2da06b42008-01-30 13:30:08 +010039 case MSGCTL:
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 return compat_sys_msgctl(first, second, compat_ptr(ptr));
41
Thomas Gleixner2da06b42008-01-30 13:30:08 +010042 case SHMAT:
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 return compat_sys_shmat(first, second, third, version,
44 compat_ptr(ptr));
Thomas Gleixner2da06b42008-01-30 13:30:08 +010045 case SHMDT:
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 return sys_shmdt(compat_ptr(ptr));
Thomas Gleixner2da06b42008-01-30 13:30:08 +010047 case SHMGET:
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 return sys_shmget(first, (unsigned)second, third);
Thomas Gleixner2da06b42008-01-30 13:30:08 +010049 case SHMCTL:
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 return compat_sys_shmctl(first, second, compat_ptr(ptr));
51 }
52 return -ENOSYS;
53}