Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /* * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */ #ifndef _UM_UNISTD_H_ #define _UM_UNISTD_H_ #include "linux/resource.h" #include "asm/uaccess.h" extern long sys_open(const char *filename, int flags, int mode); extern long sys_dup(unsigned int fildes); extern long sys_close(unsigned int fd); extern int um_execve(const char *file, char *const argv[], char *const env[]); extern long sys_setsid(void); extern long sys_waitpid(pid_t pid, unsigned int * stat_addr, int options); extern long sys_wait4(pid_t pid,unsigned int *stat_addr, int options, struct rusage *ru); extern long sys_mount(char *dev_name, char *dir_name, char *type, unsigned long flags, void *data); extern long sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp); extern long sys_lseek(unsigned int fildes, unsigned long offset, int whence); extern long sys_read(unsigned int fildes, char *buf, int len); extern long sys_write(int fildes, const char *buf, size_t len); #ifdef __KERNEL_SYSCALLS__ #define KERNEL_CALL(ret_t, sys, args...) \ mm_segment_t fs = get_fs(); \ ret_t ret; \ set_fs(KERNEL_DS); \ ret = sys(args); \ set_fs(fs); \ return ret; static inline long open(const char *pathname, int flags, int mode) { KERNEL_CALL(int, sys_open, pathname, flags, mode) } static inline long dup(unsigned int fd) { KERNEL_CALL(int, sys_dup, fd); } static inline long close(unsigned int fd) { KERNEL_CALL(int, sys_close, fd); } static inline int execve(const char *filename, char *const argv[], char *const envp[]) { KERNEL_CALL(int, um_execve, filename, argv, envp); } static inline long waitpid(pid_t pid, unsigned int *status, int options) { KERNEL_CALL(pid_t, sys_wait4, pid, status, options, NULL) } static inline pid_t setsid(void) { KERNEL_CALL(pid_t, sys_setsid) } static inline long lseek(unsigned int fd, off_t offset, unsigned int whence) { KERNEL_CALL(long, sys_lseek, fd, offset, whence) } static inline int read(unsigned int fd, char * buf, int len) { KERNEL_CALL(int, sys_read, fd, buf, len) } static inline int write(unsigned int fd, char * buf, int len) { KERNEL_CALL(int, sys_write, fd, buf, len) } #endif /* Save the value of __KERNEL_SYSCALLS__, undefine it, include the underlying * arch's unistd.h for the system call numbers, and restore the old * __KERNEL_SYSCALLS__. */ #ifdef __KERNEL_SYSCALLS__ #define __SAVE_KERNEL_SYSCALLS__ __KERNEL_SYSCALLS__ #endif #undef __KERNEL_SYSCALLS__ #include "asm/arch/unistd.h" #ifdef __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__ __SAVE_KERNEL_SYSCALLS__ #endif #endif /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically * adjust the settings for this buffer only. This must remain at the end * of the file. * --------------------------------------------------------------------------- * Local variables: * c-file-style: "linux" * End: */ |