This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / include / asm-um / unistd.h
1 /* 
2  * Copyright (C) 2000, 2001  Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef _UM_UNISTD_H_
7 #define _UM_UNISTD_H_
8
9 #include <linux/syscalls.h>
10 #include "linux/resource.h"
11 #include "asm/uaccess.h"
12
13 extern int um_execve(const char *file, char *const argv[], char *const env[]);
14
15 #ifdef __KERNEL__
16 #define __ARCH_WANT_IPC_PARSE_VERSION
17 #define __ARCH_WANT_OLD_READDIR
18 #define __ARCH_WANT_OLD_STAT
19 #define __ARCH_WANT_STAT64
20 #define __ARCH_WANT_SYS_ALARM
21 #define __ARCH_WANT_SYS_GETHOSTNAME
22 #define __ARCH_WANT_SYS_PAUSE
23 #define __ARCH_WANT_SYS_SGETMASK
24 #define __ARCH_WANT_SYS_SIGNAL
25 #define __ARCH_WANT_SYS_TIME
26 #define __ARCH_WANT_SYS_UTIME
27 #define __ARCH_WANT_SYS_WAITPID
28 #define __ARCH_WANT_SYS_SOCKETCALL
29 #define __ARCH_WANT_SYS_FADVISE64
30 #define __ARCH_WANT_SYS_GETPGRP
31 #define __ARCH_WANT_SYS_LLSEEK
32 #define __ARCH_WANT_SYS_NICE
33 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
34 #define __ARCH_WANT_SYS_OLDUMOUNT
35 #define __ARCH_WANT_SYS_SIGPENDING
36 #define __ARCH_WANT_SYS_SIGPROCMASK
37 #endif
38
39 #ifdef __KERNEL_SYSCALLS__
40
41 #include <linux/compiler.h>
42 #include <linux/types.h>
43
44 #define KERNEL_CALL(ret_t, sys, args...)        \
45         mm_segment_t fs = get_fs();             \
46         ret_t ret;                              \
47         set_fs(KERNEL_DS);                      \
48         ret = sys(args);                        \
49         set_fs(fs);                             \
50         return ret;
51
52 static inline long open(const char *pathname, int flags, int mode) 
53 {
54         KERNEL_CALL(int, sys_open, pathname, flags, mode)
55 }
56
57 static inline long dup(unsigned int fd)
58 {
59         KERNEL_CALL(int, sys_dup, fd);
60 }
61
62 static inline long close(unsigned int fd)
63 {
64         KERNEL_CALL(int, sys_close, fd);
65 }
66
67 static inline int execve(const char *filename, char *const argv[], 
68                          char *const envp[])
69 {
70         KERNEL_CALL(int, um_execve, filename, argv, envp);
71 }
72
73 static inline long waitpid(pid_t pid, unsigned int *status, int options)
74 {
75         KERNEL_CALL(pid_t, sys_wait4, pid, status, options, NULL)
76 }
77
78 static inline pid_t setsid(void)
79 {
80         KERNEL_CALL(pid_t, sys_setsid)
81 }
82
83 static inline long lseek(unsigned int fd, off_t offset, unsigned int whence)
84 {
85         KERNEL_CALL(long, sys_lseek, fd, offset, whence)
86 }
87
88 static inline int read(unsigned int fd, char * buf, int len)
89 {
90         KERNEL_CALL(int, sys_read, fd, buf, len)
91 }
92
93 static inline int write(unsigned int fd, char * buf, int len)
94 {
95         KERNEL_CALL(int, sys_write, fd, buf, len)
96 }
97
98 long sys_mmap2(unsigned long addr, unsigned long len,
99                 unsigned long prot, unsigned long flags,
100                 unsigned long fd, unsigned long pgoff);
101 int sys_execve(char *file, char **argv, char **env);
102 long sys_clone(unsigned long clone_flags, unsigned long newsp,
103                 int *parent_tid, int *child_tid);
104 long sys_fork(void);
105 long sys_vfork(void);
106 int sys_pipe(unsigned long *fildes);
107 int sys_ptrace(long request, long pid, long addr, long data);
108 struct sigaction;
109 asmlinkage long sys_rt_sigaction(int sig,
110                                 const struct sigaction __user *act,
111                                 struct sigaction __user *oact,
112                                 size_t sigsetsize);
113
114 #endif
115
116 /* Save the value of __KERNEL_SYSCALLS__, undefine it, include the underlying
117  * arch's unistd.h for the system call numbers, and restore the old 
118  * __KERNEL_SYSCALLS__.
119  */
120
121 #ifdef __KERNEL_SYSCALLS__
122 #define __SAVE_KERNEL_SYSCALLS__ __KERNEL_SYSCALLS__
123 #endif
124
125 #undef __KERNEL_SYSCALLS__
126 #include "asm/arch/unistd.h"
127
128 #ifdef __KERNEL_SYSCALLS__
129 #define __KERNEL_SYSCALLS__ __SAVE_KERNEL_SYSCALLS__
130 #endif
131
132 #endif
133
134 /*
135  * Overrides for Emacs so that we follow Linus's tabbing style.
136  * Emacs will notice this stuff at the end of the file and automatically
137  * adjust the settings for this buffer only.  This must remain at the end
138  * of the file.
139  * ---------------------------------------------------------------------------
140  * Local variables:
141  * c-file-style: "linux"
142  * End:
143  */