This source file includes following definitions.
- sys_pipe
- old_mmap
- old_select
- sys_ipc
- sys_ioperm
1
2
3
4
5
6
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 #include <linux/stat.h>
17 #include <linux/mman.h>
18
19 #include <asm/segment.h>
20
21
22
23
24
25 asmlinkage int sys_pipe(unsigned long * fildes)
26 {
27 int fd[2];
28 int error;
29
30 error = verify_area(VERIFY_WRITE,fildes,8);
31 if (error)
32 return error;
33 error = do_pipe(fd);
34 if (error)
35 return error;
36 put_user(fd[0],0+fildes);
37 put_user(fd[1],1+fildes);
38 return 0;
39 }
40
41
42
43
44
45
46
47
48 asmlinkage int old_mmap(unsigned long *buffer)
49 {
50 int error;
51 unsigned long flags;
52 struct file * file = NULL;
53
54 error = verify_area(VERIFY_READ, buffer, 6*sizeof(long));
55 if (error)
56 return error;
57 flags = get_user(buffer+3);
58 if (!(flags & MAP_ANONYMOUS)) {
59 unsigned long fd = get_user(buffer+4);
60 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
61 return -EBADF;
62 }
63 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
64 return do_mmap(file, get_user(buffer), get_user(buffer+1),
65 get_user(buffer+2), flags, get_user(buffer+5));
66 }
67
68
69 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
70
71 asmlinkage int old_select(unsigned long *buffer)
72 {
73 int n;
74 fd_set *inp;
75 fd_set *outp;
76 fd_set *exp;
77 struct timeval *tvp;
78
79 n = verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long));
80 if (n)
81 return n;
82
83 n = get_user(buffer);
84 inp = (fd_set *) get_user(buffer+1);
85 outp = (fd_set *) get_user(buffer+2);
86 exp = (fd_set *) get_user(buffer+3);
87 tvp = (struct timeval *) get_user(buffer+4);
88 return sys_select(n, inp, outp, exp, tvp);
89 }
90
91
92
93
94
95
96 asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
97 {
98 int version;
99
100 version = call >> 16;
101 call &= 0xffff;
102
103 if (call <= SEMCTL)
104 switch (call) {
105 case SEMOP:
106 return sys_semop (first, (struct sembuf *)ptr, second);
107 case SEMGET:
108 return sys_semget (first, second, third);
109 case SEMCTL: {
110 union semun fourth;
111 int err;
112 if (!ptr)
113 return -EINVAL;
114 if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
115 return err;
116 fourth.__pad = get_user((void **)ptr);
117 return sys_semctl (first, second, third, fourth);
118 }
119 default:
120 return -EINVAL;
121 }
122 if (call <= MSGCTL)
123 switch (call) {
124 case MSGSND:
125 return sys_msgsnd (first, (struct msgbuf *) ptr,
126 second, third);
127 case MSGRCV:
128 switch (version) {
129 case 0: {
130 struct ipc_kludge tmp;
131 int err;
132 if (!ptr)
133 return -EINVAL;
134 if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
135 return err;
136 memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
137 sizeof (tmp));
138 return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
139 }
140 case 1: default:
141 return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
142 }
143 case MSGGET:
144 return sys_msgget ((key_t) first, second);
145 case MSGCTL:
146 return sys_msgctl (first, second, (struct msqid_ds *) ptr);
147 default:
148 return -EINVAL;
149 }
150 if (call <= SHMCTL)
151 switch (call) {
152 case SHMAT:
153 switch (version) {
154 case 0: default: {
155 ulong raddr;
156 int err;
157 if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
158 return err;
159 err = sys_shmat (first, (char *) ptr, second, &raddr);
160 if (err)
161 return err;
162 put_user (raddr, (ulong *) third);
163 return 0;
164 }
165 case 1:
166 if (get_fs() != get_ds())
167 return -EINVAL;
168 return sys_shmat (first, (char *) ptr, second, (ulong *) third);
169 }
170 case SHMDT:
171 return sys_shmdt ((char *)ptr);
172 case SHMGET:
173 return sys_shmget (first, second, third);
174 case SHMCTL:
175 return sys_shmctl (first, second, (struct shmid_ds *) ptr);
176 default:
177 return -EINVAL;
178 }
179 return -EINVAL;
180 }
181
182 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
183 {
184 return -ENOSYS;
185 }