From: Philip Homburg Date: Wed, 7 Jun 2006 14:41:47 +0000 (+0000) Subject: Fixed some select bugs related to pipes. Removed SELFD_* because they were X-Git-Tag: v3.1.3~348 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/mem/static/processing.js?a=commitdiff_plain;h=cb02a90b7735705b9d6a9d3ec273cc4996ec39fd;p=minix.git Fixed some select bugs related to pipes. Removed SELFD_* because they were bogus and unused. --- diff --git a/servers/fs/pipe.c b/servers/fs/pipe.c index 25b8e51d2..a6b68075d 100644 --- a/servers/fs/pipe.c +++ b/servers/fs/pipe.c @@ -406,15 +406,14 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block) orig_ops = *ops; if ((*ops & (SEL_RD|SEL_ERR))) { if ((err = pipe_check(f->filp_ino, READING, 0, - 1, f->filp_pos, &canwrite, 1)) != SUSPEND && err > 0) + 1, f->filp_pos, &canwrite, 1)) != SUSPEND) r |= SEL_RD; if (err < 0 && err != SUSPEND) r |= SEL_ERR; } if ((*ops & (SEL_WR|SEL_ERR))) { if ((err = pipe_check(f->filp_ino, WRITING, 0, - 1, f->filp_pos, &canwrite, 1)) != SUSPEND && - err > 0 && canwrite > 0) + 1, f->filp_pos, &canwrite, 1)) != SUSPEND) r |= SEL_WR; if (err < 0 && err != SUSPEND) r |= SEL_ERR; diff --git a/servers/fs/proto.h b/servers/fs/proto.h index 5a612f6be..e09412b73 100644 --- a/servers/fs/proto.h +++ b/servers/fs/proto.h @@ -144,7 +144,7 @@ _PROTOTYPE( int do_pipe, (void) ); _PROTOTYPE( int do_unpause, (void) ); _PROTOTYPE( int unpause, (int proc_nr_e) ); _PROTOTYPE( int pipe_check, (struct inode *rip, int rw_flag, - int oflags, int bytes, off_t position, int *canwrite, int notouch)); + int oflags, int bytes, off_t position, int *canwrite, int notouch)); _PROTOTYPE( void release, (struct inode *ip, int call_nr, int count) ); _PROTOTYPE( void revive, (int proc_nr, int bytes) ); _PROTOTYPE( void suspend, (int task) ); diff --git a/servers/fs/select.c b/servers/fs/select.c index ac8f81482..609f009a4 100644 --- a/servers/fs/select.c +++ b/servers/fs/select.c @@ -38,12 +38,6 @@ PRIVATE struct selectentry { timer_t timer; /* if expiry > 0 */ } selecttab[MAXSELECTS]; -#define SELFD_FILE 0 -#define SELFD_PIPE 1 -#define SELFD_TTY 2 -#define SELFD_INET 3 -#define SELFD_LOG 4 -#define SEL_FDS 5 FORWARD _PROTOTYPE(int select_reevaluate, (struct filp *fp)); @@ -70,18 +64,14 @@ PRIVATE struct fdtype { int (*select_request)(struct filp *, int *ops, int block); int (*select_match)(struct filp *); int select_major; -} fdtypes[SEL_FDS] = { - /* SELFD_FILE */ +} fdtypes[] = { { select_request_file, select_match_file, 0 }, - /* SELFD_TTY (also PTY) */ { select_request_general, NULL, TTY_MAJOR }, - /* SELFD_INET */ { select_request_general, NULL, INET_MAJOR }, - /* SELFD_PIPE (pipe(2) pipes and FS FIFOs) */ { select_request_pipe, select_match_pipe, 0 }, - /* SELFD_LOG (/dev/klog) */ { select_request_general, NULL, LOG_MAJOR }, }; +#define SEL_FDS (sizeof(fdtypes) / sizeof(fdtypes[0])) /* Open Group: * "File descriptors associated with regular files shall always select true