OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [mips/] [kernel/] [ipc.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * linux/arch/mips/kernel/ipc.c
3
 *
4
 * This file contains various random system calls that
5
 * have a non-standard calling sequence on the Linux/i386
6
 * platform.
7
 */
8
 
9
#include <linux/config.h>
10
#include <linux/errno.h>
11
#include <linux/sched.h>
12
#include <linux/mm.h>
13
#include <linux/sem.h>
14
#include <linux/msg.h>
15
#include <linux/shm.h>
16
 
17
#include <asm/segment.h>
18
 
19
/*
20
 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
21
 *
22
 * This is really horribly ugly;  removing this will need some minor
23
 * changes in libc.
24
 */
25
asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
26
{
27
#ifdef CONFIG_SYSVIPC
28
        int version;
29
 
30
        version = call >> 16; /* hack for backward compatibility */
31
        call &= 0xffff;
32
 
33
        if (call <= SEMCTL)
34
                switch (call) {
35
                case SEMOP:
36
                        return sys_semop (first, (struct sembuf *)ptr, second);
37
                case SEMGET:
38
                        return sys_semget (first, second, third);
39
                case SEMCTL: {
40
                        union semun fourth;
41
                        int err;
42
                        if (!ptr)
43
                                return -EINVAL;
44
                        if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
45
                                return err;
46
                        fourth.__pad = (void *) get_fs_long(ptr);
47
                        return sys_semctl (first, second, third, fourth);
48
                        }
49
                default:
50
                        return -EINVAL;
51
                }
52
        if (call <= MSGCTL)
53
                switch (call) {
54
                case MSGSND:
55
                        return sys_msgsnd (first, (struct msgbuf *) ptr,
56
                                           second, third);
57
                case MSGRCV:
58
                        switch (version) {
59
                        case 0: {
60
                                struct ipc_kludge tmp;
61
                                int err;
62
                                if (!ptr)
63
                                        return -EINVAL;
64
                                if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
65
                                        return err;
66
                                memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
67
                                               sizeof (tmp));
68
                                return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
69
                                }
70
                        case 1: default:
71
                                return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
72
                        }
73
                case MSGGET:
74
                        return sys_msgget ((key_t) first, second);
75
                case MSGCTL:
76
                        return sys_msgctl (first, second, (struct msqid_ds *) ptr);
77
                default:
78
                        return -EINVAL;
79
                }
80
        if (call <= SHMCTL)
81
                switch (call) {
82
                case SHMAT:
83
                        switch (version) {
84
                        case 0: default: {
85
                                ulong raddr;
86
                                int err;
87
                                if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
88
                                        return err;
89
                                err = sys_shmat (first, (char *) ptr, second, &raddr);
90
                                if (err)
91
                                        return err;
92
                                put_fs_long (raddr, (ulong *) third);
93
                                return 0;
94
                                }
95
                        case 1: /* iBCS2 emulator entry point */
96
                                if (get_fs() != get_ds())
97
                                        return -EINVAL;
98
                                return sys_shmat (first, (char *) ptr, second, (ulong *) third);
99
                        }
100
                case SHMDT:
101
                        return sys_shmdt ((char *)ptr);
102
                case SHMGET:
103
                        return sys_shmget (first, second, third);
104
                case SHMCTL:
105
                        return sys_shmctl (first, second, (struct shmid_ds *) ptr);
106
                default:
107
                        return -EINVAL;
108
                }
109
        return -EINVAL;
110
#else /* CONFIG_SYSVIPC */
111
        return -ENOSYS;
112
#endif /* CONFIG_SYSVIPC */
113
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.