2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
9 #include "linux/resource.h"
10 #include "asm/uaccess.h"
12 extern long sys_open(const char *filename
, int flags
, int mode
);
13 extern long sys_dup(unsigned int fildes
);
14 extern long sys_close(unsigned int fd
);
15 extern int um_execve(const char *file
, char *const argv
[], char *const env
[]);
16 extern long sys_setsid(void);
17 extern long sys_waitpid(pid_t pid
, unsigned int * stat_addr
, int options
);
18 extern long sys_wait4(pid_t pid
,unsigned int *stat_addr
, int options
,
20 extern long sys_mount(char *dev_name
, char *dir_name
, char *type
,
21 unsigned long flags
, void *data
);
22 extern long sys_select(int n
, fd_set
*inp
, fd_set
*outp
, fd_set
*exp
,
24 extern long sys_lseek(unsigned int fildes
, unsigned long offset
, int whence
);
25 extern long sys_read(unsigned int fildes
, char *buf
, int len
);
26 extern long sys_write(int fildes
, const char *buf
, size_t len
);
28 #ifdef __KERNEL_SYSCALLS__
30 #define KERNEL_CALL(ret_t, sys, args...) \
31 mm_segment_t fs = get_fs(); \
38 static inline long open(const char *pathname
, int flags
, int mode
)
40 KERNEL_CALL(int, sys_open
, pathname
, flags
, mode
)
43 static inline long dup(unsigned int fd
)
45 KERNEL_CALL(int, sys_dup
, fd
);
48 static inline long close(unsigned int fd
)
50 KERNEL_CALL(int, sys_close
, fd
);
53 static inline int execve(const char *filename
, char *const argv
[],
56 KERNEL_CALL(int, um_execve
, filename
, argv
, envp
);
59 static inline long waitpid(pid_t pid
, unsigned int *status
, int options
)
61 KERNEL_CALL(pid_t
, sys_wait4
, pid
, status
, options
, NULL
)
64 static inline pid_t
setsid(void)
66 KERNEL_CALL(pid_t
, sys_setsid
)
69 static inline long lseek(unsigned int fd
, off_t offset
, unsigned int whence
)
71 KERNEL_CALL(long, sys_lseek
, fd
, offset
, whence
)
74 static inline int read(unsigned int fd
, char * buf
, int len
)
76 KERNEL_CALL(int, sys_read
, fd
, buf
, len
)
79 static inline int write(unsigned int fd
, char * buf
, int len
)
81 KERNEL_CALL(int, sys_write
, fd
, buf
, len
)
86 /* Save the value of __KERNEL_SYSCALLS__, undefine it, include the underlying
87 * arch's unistd.h for the system call numbers, and restore the old
88 * __KERNEL_SYSCALLS__.
91 #ifdef __KERNEL_SYSCALLS__
92 #define __SAVE_KERNEL_SYSCALLS__ __KERNEL_SYSCALLS__
95 #undef __KERNEL_SYSCALLS__
96 #include "asm/arch/unistd.h"
98 #ifdef __KERNEL_SYSCALLS__
99 #define __KERNEL_SYSCALLS__ __SAVE_KERNEL_SYSCALLS__
105 * Overrides for Emacs so that we follow Linus's tabbing style.
106 * Emacs will notice this stuff at the end of the file and automatically
107 * adjust the settings for this buffer only. This must remain at the end
109 * ---------------------------------------------------------------------------
111 * c-file-style: "linux"