diff options
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -950,7 +950,7 @@ fail_inode: | |||
950 | return NULL; | 950 | return NULL; |
951 | } | 951 | } |
952 | 952 | ||
953 | struct file *create_write_pipe(void) | 953 | struct file *create_write_pipe(int flags) |
954 | { | 954 | { |
955 | int err; | 955 | int err; |
956 | struct inode *inode; | 956 | struct inode *inode; |
@@ -983,7 +983,7 @@ struct file *create_write_pipe(void) | |||
983 | goto err_dentry; | 983 | goto err_dentry; |
984 | f->f_mapping = inode->i_mapping; | 984 | f->f_mapping = inode->i_mapping; |
985 | 985 | ||
986 | f->f_flags = O_WRONLY; | 986 | f->f_flags = O_WRONLY | (flags & O_NONBLOCK); |
987 | f->f_version = 0; | 987 | f->f_version = 0; |
988 | 988 | ||
989 | return f; | 989 | return f; |
@@ -1007,7 +1007,7 @@ void free_write_pipe(struct file *f) | |||
1007 | put_filp(f); | 1007 | put_filp(f); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | struct file *create_read_pipe(struct file *wrf) | 1010 | struct file *create_read_pipe(struct file *wrf, int flags) |
1011 | { | 1011 | { |
1012 | struct file *f = get_empty_filp(); | 1012 | struct file *f = get_empty_filp(); |
1013 | if (!f) | 1013 | if (!f) |
@@ -1019,7 +1019,7 @@ struct file *create_read_pipe(struct file *wrf) | |||
1019 | f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping; | 1019 | f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping; |
1020 | 1020 | ||
1021 | f->f_pos = 0; | 1021 | f->f_pos = 0; |
1022 | f->f_flags = O_RDONLY; | 1022 | f->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
1023 | f->f_op = &read_pipe_fops; | 1023 | f->f_op = &read_pipe_fops; |
1024 | f->f_mode = FMODE_READ; | 1024 | f->f_mode = FMODE_READ; |
1025 | f->f_version = 0; | 1025 | f->f_version = 0; |
@@ -1033,13 +1033,13 @@ int do_pipe_flags(int *fd, int flags) | |||
1033 | int error; | 1033 | int error; |
1034 | int fdw, fdr; | 1034 | int fdw, fdr; |
1035 | 1035 | ||
1036 | if (flags & ~O_CLOEXEC) | 1036 | if (flags & ~(O_CLOEXEC | O_NONBLOCK)) |
1037 | return -EINVAL; | 1037 | return -EINVAL; |
1038 | 1038 | ||
1039 | fw = create_write_pipe(); | 1039 | fw = create_write_pipe(flags); |
1040 | if (IS_ERR(fw)) | 1040 | if (IS_ERR(fw)) |
1041 | return PTR_ERR(fw); | 1041 | return PTR_ERR(fw); |
1042 | fr = create_read_pipe(fw); | 1042 | fr = create_read_pipe(fw, flags); |
1043 | error = PTR_ERR(fr); | 1043 | error = PTR_ERR(fr); |
1044 | if (IS_ERR(fr)) | 1044 | if (IS_ERR(fr)) |
1045 | goto err_write_pipe; | 1045 | goto err_write_pipe; |