2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
6 #include "linux/sched.h"
10 #include "asm/uaccess.h"
11 #include "asm/unistd.h"
14 * Perform the select(nd, in, out, ex, tv) and mmap() system
15 * calls. Linux/i386 didn't use to be able to handle more than
16 * 4 system call parameters, so these system calls used a memory
17 * block for parameter passing..
20 struct mmap_arg_struct
{
29 extern int old_mmap(unsigned long addr
, unsigned long len
,
30 unsigned long prot
, unsigned long flags
,
31 unsigned long fd
, unsigned long offset
);
33 long old_mmap_i386(struct mmap_arg_struct __user
*arg
)
35 struct mmap_arg_struct a
;
38 if (copy_from_user(&a
, arg
, sizeof(a
)))
41 err
= old_mmap(a
.addr
, a
.len
, a
.prot
, a
.flags
, a
.fd
, a
.offset
);
46 struct sel_arg_struct
{
51 struct timeval __user
*tvp
;
54 long old_select(struct sel_arg_struct __user
*arg
)
56 struct sel_arg_struct a
;
58 if (copy_from_user(&a
, arg
, sizeof(a
)))
60 /* sys_select() does the appropriate kernel locking */
61 return sys_select(a
.n
, a
.inp
, a
.outp
, a
.exp
, a
.tvp
);
64 /* The i386 version skips reading from %esi, the fourth argument. So we must do
67 long sys_clone(unsigned long clone_flags
, unsigned long newsp
,
68 int __user
*parent_tid
, int unused
, int __user
*child_tid
)
72 /* XXX: normal arch do here this pass, and also pass the regs to
73 * do_fork, instead of NULL. Currently the arch-independent code
74 * ignores these values, while the UML code (actually it's
75 * copy_thread) does the right thing. But this should change,
78 newsp = UPT_SP(current->thread.regs);*/
79 current
->thread
.forking
= 1;
80 ret
= do_fork(clone_flags
, newsp
, NULL
, 0, parent_tid
, child_tid
);
81 current
->thread
.forking
= 0;
86 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
88 * This is really horribly ugly.
90 long sys_ipc (uint call
, int first
, int second
,
91 int third
, void __user
*ptr
, long fifth
)
95 version
= call
>> 16; /* hack for backward compatibility */
100 return sys_semtimedop(first
, (struct sembuf
*) ptr
, second
,
103 return sys_semtimedop(first
, (struct sembuf
*) ptr
, second
,
104 (const struct timespec
*) fifth
);
106 return sys_semget (first
, second
, third
);
111 if (get_user(fourth
.__pad
, (void **) ptr
))
113 return sys_semctl (first
, second
, third
, fourth
);
117 return sys_msgsnd (first
, (struct msgbuf
*) ptr
,
122 struct ipc_kludge tmp
;
126 if (copy_from_user(&tmp
,
127 (struct ipc_kludge
*) ptr
,
130 return sys_msgrcv (first
, tmp
.msgp
, second
,
134 panic("msgrcv with version != 0");
135 return sys_msgrcv (first
,
136 (struct msgbuf
*) ptr
,
137 second
, fifth
, third
);
140 return sys_msgget ((key_t
) first
, second
);
142 return sys_msgctl (first
, second
, (struct msqid_ds
*) ptr
);
148 ret
= do_shmat (first
, (char *) ptr
, second
, &raddr
);
151 return put_user (raddr
, (ulong
*) third
);
153 case 1: /* iBCS2 emulator entry point */
154 if (!segment_eq(get_fs(), get_ds()))
156 return do_shmat (first
, (char *) ptr
, second
, (ulong
*) third
);
159 return sys_shmdt ((char *)ptr
);
161 return sys_shmget (first
, second
, third
);
163 return sys_shmctl (first
, second
,
164 (struct shmid_ds
*) ptr
);
170 long sys_sigaction(int sig
, const struct old_sigaction __user
*act
,
171 struct old_sigaction __user
*oact
)
173 struct k_sigaction new_ka
, old_ka
;
178 if (!access_ok(VERIFY_READ
, act
, sizeof(*act
)) ||
179 __get_user(new_ka
.sa
.sa_handler
, &act
->sa_handler
) ||
180 __get_user(new_ka
.sa
.sa_restorer
, &act
->sa_restorer
))
182 __get_user(new_ka
.sa
.sa_flags
, &act
->sa_flags
);
183 __get_user(mask
, &act
->sa_mask
);
184 siginitset(&new_ka
.sa
.sa_mask
, mask
);
187 ret
= do_sigaction(sig
, act
? &new_ka
: NULL
, oact
? &old_ka
: NULL
);
190 if (!access_ok(VERIFY_WRITE
, oact
, sizeof(*oact
)) ||
191 __put_user(old_ka
.sa
.sa_handler
, &oact
->sa_handler
) ||
192 __put_user(old_ka
.sa
.sa_restorer
, &oact
->sa_restorer
))
194 __put_user(old_ka
.sa
.sa_flags
, &oact
->sa_flags
);
195 __put_user(old_ka
.sa
.sa_mask
.sig
[0], &oact
->sa_mask
);
202 * Overrides for Emacs so that we follow Linus's tabbing style.
203 * Emacs will notice this stuff at the end of the file and automatically
204 * adjust the settings for this buffer only. This must remain at the end
206 * ---------------------------------------------------------------------------
208 * c-file-style: "linux"