diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-07-05 23:09:37 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-07-05 23:09:37 +0000 |
commit | aba344fdfed81b2c03d6114c54cfd73a486aa10b (patch) | |
tree | d032d8430bf1234c3ecc6f6330d6de6e887e5963 /fs/pipe.c | |
parent | 40c138bfc6d37dbff5339f84575db1e3cec6e34e (diff) |
Merge with Linux 2.3.9.
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 43 |
1 files changed, 31 insertions, 12 deletions
@@ -8,6 +8,7 @@ #include <linux/file.h> #include <linux/poll.h> #include <linux/malloc.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> @@ -28,16 +29,12 @@ /* in case of paging and multiple read/write on the same pipe. (FGC) */ -static ssize_t pipe_read(struct file * filp, char * buf, - size_t count, loff_t *ppos) +static ssize_t do_pipe_read(struct file * filp, char * buf, size_t count) { struct inode * inode = filp->f_dentry->d_inode; ssize_t chars = 0, size = 0, read = 0; char *pipebuf; - if (ppos != &filp->f_pos) - return -ESPIPE; - if (filp->f_flags & O_NONBLOCK) { if (PIPE_LOCK(*inode)) return -EAGAIN; @@ -82,17 +79,13 @@ static ssize_t pipe_read(struct file * filp, char * buf, return -EAGAIN; return 0; } - -static ssize_t pipe_write(struct file * filp, const char * buf, - size_t count, loff_t *ppos) + +static ssize_t do_pipe_write(struct file * filp, const char * buf, size_t count) { struct inode * inode = filp->f_dentry->d_inode; ssize_t chars = 0, free = 0, written = 0, err=0; char *pipebuf; - if (ppos != &filp->f_pos) - return -ESPIPE; - if (!PIPE_READERS(*inode)) { /* no readers */ send_sig(SIGPIPE,current,0); return -EPIPE; @@ -147,6 +140,32 @@ errout: return written ? written : err; } +static ssize_t pipe_read(struct file * filp, char * buf, size_t count, loff_t *ppos) +{ + ssize_t retval; + + if (ppos != &filp->f_pos) + return -ESPIPE; + + lock_kernel(); + retval = do_pipe_read(filp, buf, count); + unlock_kernel(); + return retval; +} + +static ssize_t pipe_write(struct file * filp, const char * buf, size_t count, loff_t *ppos) +{ + ssize_t retval; + + if (ppos != &filp->f_pos) + return -ESPIPE; + + lock_kernel(); + retval = do_pipe_write(filp, buf, count); + unlock_kernel(); + return retval; +} + static long long pipe_lseek(struct file * file, long long offset, int orig) { return -ESPIPE; @@ -461,7 +480,7 @@ struct inode_operations pipe_inode_operations = { NULL, /* mknod */ NULL, /* rename */ NULL, /* readlink */ - NULL, /* bmap */ + NULL, /* get_block */ NULL, /* readpage */ NULL, /* writepage */ NULL, /* flushpage */ |