VFS: fix select again

Change-Id: Ia5e26cdbfe38e3fb293dd57269a76b15c1fe236b
This commit is contained in:
Thomas Veerman 2013-01-25 17:42:36 +00:00
parent cb87646dac
commit 06e2adbeaa
2 changed files with 11 additions and 4 deletions

View file

@ -190,10 +190,14 @@ int notouch /* check only */
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) {

View file

@ -7,6 +7,7 @@
*/
#include "fs.h"
#include <sys/fcntl.h>
#include <sys/time.h>
#include <sys/select.h>
#include <sys/stat.h>
@ -452,7 +453,8 @@ static int select_request_pipe(struct filp *f, int *ops, int block)
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;
@ -468,7 +470,8 @@ static int select_request_pipe(struct filp *f, int *ops, int block)
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;