summaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
committer <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
commite7c2a72e2680827d6a733931273a93461c0d8d1b (patch)
treec9abeda78ef7504062bb2e816bcf3e3c9d680112 /ipc/util.c
parentec6044459060a8c9ce7f64405c465d141898548c (diff)
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c58
1 files changed, 41 insertions, 17 deletions
diff --git a/ipc/util.c b/ipc/util.c
index fb0e6970d..87c6c28ea 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -7,13 +7,14 @@
#include <linux/errno.h>
#include <asm/segment.h>
#include <linux/sched.h>
+#include <linux/mm.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
void ipc_init (void);
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr);
+asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth);
#ifdef CONFIG_SYSVIPC
@@ -62,9 +63,13 @@ int ipcperms (struct ipc_perm *ipcp, short flag)
return 0;
}
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr)
+asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
{
-
+ int version;
+
+ version = call >> 16; /* hack for backward compatibility */
+ call &= 0xffff;
+
if (call <= SEMCTL)
switch (call) {
case SEMOP:
@@ -89,17 +94,21 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr)
case MSGSND:
return sys_msgsnd (first, (struct msgbuf *) ptr,
second, third);
- case MSGRCV: {
- struct ipc_kludge tmp;
- int err;
- if (!ptr)
- return -EINVAL;
- if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
- return err;
- memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
- sizeof (tmp));
- return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp,
- third);
+ case MSGRCV:
+ switch (version) {
+ case 0: {
+ struct ipc_kludge tmp;
+ int err;
+ if (!ptr)
+ return -EINVAL;
+ if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
+ return err;
+ memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
+ sizeof (tmp));
+ return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
+ }
+ case 1: default:
+ return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
}
case MSGGET:
return sys_msgget ((key_t) first, second);
@@ -111,8 +120,23 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr)
if (call <= SHMCTL)
switch (call) {
case SHMAT:
- return sys_shmat (first, (char *) ptr, second,
- (ulong *) third);
+ switch (version) {
+ case 0: default: {
+ ulong raddr;
+ int err;
+ if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
+ return err;
+ err = sys_shmat (first, (char *) ptr, second, &raddr);
+ if (err)
+ return err;
+ put_fs_long (raddr, (ulong *) third);
+ return 0;
+ }
+ case 1: /* iBCS2 emulator entry point */
+ if (get_fs() != get_ds())
+ return -EINVAL;
+ return sys_shmat (first, (char *) ptr, second, (ulong *) third);
+ }
case SHMDT:
return sys_shmdt ((char *)ptr);
case SHMGET:
@@ -127,7 +151,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr)
#else /* not CONFIG_SYSVIPC */
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr)
+asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
{
return -ENOSYS;
}