static cp_grant_id_t gids[NR_IOREQS];
int vec_grants = 0, orig_op, safe;
void *buf_used;
+ endpoint_t ioproc;
/* Determine task dmap. */
dp = &dmap[(dev >> MAJOR) & BYTE];
dev_mess.COUNT = bytes;
dev_mess.HIGHPOS = 0;
- /* This field will be used if the i/o is suspended. */
- fp->fp_ioproc = dev_mess.IO_ENDPT;
+ /* This will be used if the i/o is suspended. */
+ ioproc = dev_mess.IO_ENDPT;
/* Call the task. */
(*dp->dmap_io)(dp->dmap_driver, &dev_mess);
if(vec_grants > 0) {
panic(__FILE__,"SUSPEND on vectored i/o", NO_NUM);
}
+ /* fp is uninitialized at init time. */
+ if(!fp)
+ panic(__FILE__,"SUSPEND on NULL fp", NO_NUM);
if (flags & O_NONBLOCK) {
/* Not supposed to block. */
dev_mess.m_type = CANCEL;
- dev_mess.IO_ENDPT = fp->fp_ioproc;
+ dev_mess.IO_ENDPT = ioproc;
dev_mess.IO_GRANT = (char *) gid;
/* This R_BIT/W_BIT check taken from suspend()/unpause()
suspend(dp->dmap_driver);
assert(!GRANT_VALID(fp->fp_grant));
fp->fp_grant = gid; /* revoke this when unsuspended. */
+ fp->fp_ioproc = ioproc;
return(SUSPEND);
}
}
if (position + bytes > PIPE_SIZE(rip->i_sp->s_block_size)) {
if ((oflags & O_NONBLOCK)
- && bytes < PIPE_SIZE(rip->i_sp->s_block_size))
+ && bytes <= PIPE_SIZE(rip->i_sp->s_block_size))
return(EAGAIN);
else if ((oflags & O_NONBLOCK)
&& bytes > PIPE_SIZE(rip->i_sp->s_block_size)) {