int r = OK;
/* Reads start at the beginning; writes append to pipes */
- if (rw_flag == READING)
+ if (notouch) /* In this case we don't actually care whether data transfer
+ * would succeed. See POSIX 1003.1-2008 */
pos = 0;
- else
+ else if (rw_flag == READING)
+ pos = 0;
+ else {
pos = vp->v_size;
+ }
/* If reading, check for empty pipe. */
if (rw_flag == READING) {
*/
#include "fs.h"
+#include <sys/fcntl.h>
#include <sys/time.h>
#include <sys/select.h>
#include <sys/stat.h>
if ((*ops & (SEL_RD|SEL_ERR))) {
/* Check if we can read 1 byte */
- err = pipe_check(f->filp_vno, READING, f->filp_flags, 1, 1 /* Check only */);
+ err = pipe_check(f->filp_vno, READING, f->filp_flags & ~O_NONBLOCK, 1,
+ 1 /* Check only */);
if (err != SUSPEND)
r |= SEL_RD;
if ((*ops & (SEL_WR|SEL_ERR))) {
/* Check if we can write 1 byte */
- err = pipe_check(f->filp_vno, WRITING, f->filp_flags, 1, 1 /* Check only */);
+ err = pipe_check(f->filp_vno, WRITING, f->filp_flags & ~O_NONBLOCK, 1,
+ 1 /* Check only */);
if (err != SUSPEND)
r |= SEL_WR;