Fixed some select bugs related to pipes. Removed SELFD_* because they were
bogus and unused.
This commit is contained in:
parent
373ea53510
commit
cb02a90b77
3 changed files with 5 additions and 16 deletions
|
@ -406,15 +406,14 @@ PUBLIC int select_request_pipe(struct filp *f, int *ops, int block)
|
||||||
orig_ops = *ops;
|
orig_ops = *ops;
|
||||||
if ((*ops & (SEL_RD|SEL_ERR))) {
|
if ((*ops & (SEL_RD|SEL_ERR))) {
|
||||||
if ((err = pipe_check(f->filp_ino, READING, 0,
|
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;
|
r |= SEL_RD;
|
||||||
if (err < 0 && err != SUSPEND)
|
if (err < 0 && err != SUSPEND)
|
||||||
r |= SEL_ERR;
|
r |= SEL_ERR;
|
||||||
}
|
}
|
||||||
if ((*ops & (SEL_WR|SEL_ERR))) {
|
if ((*ops & (SEL_WR|SEL_ERR))) {
|
||||||
if ((err = pipe_check(f->filp_ino, WRITING, 0,
|
if ((err = pipe_check(f->filp_ino, WRITING, 0,
|
||||||
1, f->filp_pos, &canwrite, 1)) != SUSPEND &&
|
1, f->filp_pos, &canwrite, 1)) != SUSPEND)
|
||||||
err > 0 && canwrite > 0)
|
|
||||||
r |= SEL_WR;
|
r |= SEL_WR;
|
||||||
if (err < 0 && err != SUSPEND)
|
if (err < 0 && err != SUSPEND)
|
||||||
r |= SEL_ERR;
|
r |= SEL_ERR;
|
||||||
|
|
|
@ -144,7 +144,7 @@ _PROTOTYPE( int do_pipe, (void) );
|
||||||
_PROTOTYPE( int do_unpause, (void) );
|
_PROTOTYPE( int do_unpause, (void) );
|
||||||
_PROTOTYPE( int unpause, (int proc_nr_e) );
|
_PROTOTYPE( int unpause, (int proc_nr_e) );
|
||||||
_PROTOTYPE( int pipe_check, (struct inode *rip, int rw_flag,
|
_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 release, (struct inode *ip, int call_nr, int count) );
|
||||||
_PROTOTYPE( void revive, (int proc_nr, int bytes) );
|
_PROTOTYPE( void revive, (int proc_nr, int bytes) );
|
||||||
_PROTOTYPE( void suspend, (int task) );
|
_PROTOTYPE( void suspend, (int task) );
|
||||||
|
|
|
@ -38,12 +38,6 @@ PRIVATE struct selectentry {
|
||||||
timer_t timer; /* if expiry > 0 */
|
timer_t timer; /* if expiry > 0 */
|
||||||
} selecttab[MAXSELECTS];
|
} 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));
|
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_request)(struct filp *, int *ops, int block);
|
||||||
int (*select_match)(struct filp *);
|
int (*select_match)(struct filp *);
|
||||||
int select_major;
|
int select_major;
|
||||||
} fdtypes[SEL_FDS] = {
|
} fdtypes[] = {
|
||||||
/* SELFD_FILE */
|
|
||||||
{ select_request_file, select_match_file, 0 },
|
{ select_request_file, select_match_file, 0 },
|
||||||
/* SELFD_TTY (also PTY) */
|
|
||||||
{ select_request_general, NULL, TTY_MAJOR },
|
{ select_request_general, NULL, TTY_MAJOR },
|
||||||
/* SELFD_INET */
|
|
||||||
{ select_request_general, NULL, INET_MAJOR },
|
{ select_request_general, NULL, INET_MAJOR },
|
||||||
/* SELFD_PIPE (pipe(2) pipes and FS FIFOs) */
|
|
||||||
{ select_request_pipe, select_match_pipe, 0 },
|
{ select_request_pipe, select_match_pipe, 0 },
|
||||||
/* SELFD_LOG (/dev/klog) */
|
|
||||||
{ select_request_general, NULL, LOG_MAJOR },
|
{ select_request_general, NULL, LOG_MAJOR },
|
||||||
};
|
};
|
||||||
|
#define SEL_FDS (sizeof(fdtypes) / sizeof(fdtypes[0]))
|
||||||
|
|
||||||
/* Open Group:
|
/* Open Group:
|
||||||
* "File descriptors associated with regular files shall always select true
|
* "File descriptors associated with regular files shall always select true
|
||||||
|
|
Loading…
Reference in a new issue