ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / sys-i386 / syscalls.c
1 /* 
2  * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include "asm/mman.h"
7 #include "asm/uaccess.h"
8 #include "asm/unistd.h"
9
10 /*
11  * Perform the select(nd, in, out, ex, tv) and mmap() system
12  * calls. Linux/i386 didn't use to be able to handle more than
13  * 4 system call parameters, so these system calls used a memory
14  * block for parameter passing..
15  */
16
17 struct mmap_arg_struct {
18         unsigned long addr;
19         unsigned long len;
20         unsigned long prot;
21         unsigned long flags;
22         unsigned long fd;
23         unsigned long offset;
24 };
25
26 extern int old_mmap(unsigned long addr, unsigned long len,
27                     unsigned long prot, unsigned long flags,
28                     unsigned long fd, unsigned long offset);
29
30 int old_mmap_i386(struct mmap_arg_struct *arg)
31 {
32         struct mmap_arg_struct a;
33         int err = -EFAULT;
34
35         if (copy_from_user(&a, arg, sizeof(a)))
36                 goto out;
37
38         err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
39  out:
40         return err;
41 }
42
43 struct sel_arg_struct {
44         unsigned long n;
45         fd_set *inp, *outp, *exp;
46         struct timeval *tvp;
47 };
48
49 int old_select(struct sel_arg_struct *arg)
50 {
51         struct sel_arg_struct a;
52
53         if (copy_from_user(&a, arg, sizeof(a)))
54                 return -EFAULT;
55         /* sys_select() does the appropriate kernel locking */
56         return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
57 }
58
59 /*
60  * Overrides for Emacs so that we follow Linus's tabbing style.
61  * Emacs will notice this stuff at the end of the file and automatically
62  * adjust the settings for this buffer only.  This must remain at the end
63  * of the file.
64  * ---------------------------------------------------------------------------
65  * Local variables:
66  * c-file-style: "linux"
67  * End:
68  */