Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 1 | #include <linux/errno.h> |
| 2 | #include <linux/sched.h> |
| 3 | #include <linux/mm.h> |
| 4 | #include <linux/smp.h> |
| 5 | #include <linux/sem.h> |
| 6 | #include <linux/msg.h> |
| 7 | #include <linux/shm.h> |
| 8 | #include <linux/stat.h> |
| 9 | #include <linux/syscalls.h> |
| 10 | #include <linux/mman.h> |
| 11 | #include <linux/file.h> |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 12 | #include <linux/module.h> |
| 13 | #include <linux/fs.h> |
| 14 | #include <linux/ipc.h> |
| 15 | #include <asm/cacheflush.h> |
| 16 | #include <asm/uaccess.h> |
| 17 | #include <asm/unistd.h> |
Paul Mundt | fa43972 | 2008-09-04 18:53:58 +0900 | [diff] [blame] | 18 | #include <asm/syscalls.h> |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 19 | |
| 20 | /* |
| 21 | * sys_pipe() is the normal C calling standard for creating |
| 22 | * a pipe. It's not the way Unix traditionally does this, though. |
| 23 | */ |
Bobby Bingham | abafe5d | 2014-04-03 14:46:39 -0700 | [diff] [blame] | 24 | asmlinkage int sys_sh_pipe(void) |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 25 | { |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 26 | int fd[2]; |
| 27 | int error; |
| 28 | |
Ulrich Drepper | ed8cae8 | 2008-07-23 21:29:30 -0700 | [diff] [blame] | 29 | error = do_pipe_flags(fd, 0); |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 30 | if (!error) { |
Bobby Bingham | abafe5d | 2014-04-03 14:46:39 -0700 | [diff] [blame] | 31 | current_pt_regs()->regs[1] = fd[1]; |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 32 | return fd[0]; |
| 33 | } |
| 34 | return error; |
| 35 | } |
| 36 | |
Paul Mundt | fa43972 | 2008-09-04 18:53:58 +0900 | [diff] [blame] | 37 | asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf, |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 38 | size_t count, long dummy, loff_t pos) |
| 39 | { |
| 40 | return sys_pread64(fd, buf, count, pos); |
| 41 | } |
| 42 | |
Paul Mundt | fa43972 | 2008-09-04 18:53:58 +0900 | [diff] [blame] | 43 | asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf, |
Paul Mundt | bcb28e4 | 2007-11-20 15:50:59 +0900 | [diff] [blame] | 44 | size_t count, long dummy, loff_t pos) |
| 45 | { |
| 46 | return sys_pwrite64(fd, buf, count, pos); |
| 47 | } |
| 48 | |
| 49 | asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1, |
| 50 | u32 len0, u32 len1, int advice) |
| 51 | { |
| 52 | #ifdef __LITTLE_ENDIAN__ |
| 53 | return sys_fadvise64_64(fd, (u64)offset1 << 32 | offset0, |
| 54 | (u64)len1 << 32 | len0, advice); |
| 55 | #else |
| 56 | return sys_fadvise64_64(fd, (u64)offset0 << 32 | offset1, |
| 57 | (u64)len0 << 32 | len1, advice); |
| 58 | #endif |
| 59 | } |