hgm@beta.UUCP (07/07/87)
I have been using a Microsoft C V-4.0 development system under MS-DOS. Pipe.c as distributed in the 1.2 release results in a system built with my cross development system at least, that won't start. To fix it, I called panic if the fild is out of range. I also masked off the result of the shift used in obtaining fild to prevent sign extension problems. That was suggested by someone else in an earlier posting. This will result in a fild that's always positive, so I removed the test for a negative fild. Had sign extension occurred, the masked portion would be larger than NR_FDS anyway so that portion of the test would fail. My system now at least starts with the 1.2 sources supplied earlier on the news, and I haven't had any panics yet. The necessary changes are marked below and are at the end of pipe.c in fs. BTW there was one change from 1.1 to 1.2 that resulted in what I assume was a typo - an error messsage got changed that I would guess probably shouldn't have. It's marked too. --------------------------- if (who > MM_PROC_NR) return(EPERM); proc_nr = pro; if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("unpause err 1", proc_nr); rfp = &fproc[proc_nr]; if (rfp->fp_suspended == NOT_SUSPENDED) return(OK); task = -rfp->fp_task; if (task != XPIPE) { ! fild = rfp->fp_fd >> 8; /* extract file descriptor */ ! if (fild < 0 || fild >= NR_FDS) return(EBADF); f = rfp->fp_filp[fild]; dev = f->filp_ino->i_zone[0]; /* device on which proc is hanging */ mess.TTY_LINE = (dev >> MINOR) & BYTE; mess.PROC_NR = proc_nr; mess.m_type = CANCEL; ! if (sendrec(task, &mess) != OK) panic("unpause err 3", NO_NUM); while (mess.REP_PROC_NR != proc_nr) { revive(mess.REP_PROC_NR, mess.REP_STATUS); if (receive(task, &m) != OK) panic("unpause err 3", NO_NUM); } revive(proc_nr, EINTR); /* signal interrupted call */ } return(OK); } ----------------------- if (who > MM_PROC_NR) return(EPERM); proc_nr = pro; if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("unpause err 1", proc_nr); rfp = &fproc[proc_nr]; if (rfp->fp_suspended == NOT_SUSPENDED) return(OK); task = -rfp->fp_task; if (task != XPIPE) { ! fild = ((rfp->fp_fd>>8)&0xff); ! if (fild >= NR_FDS) panic("unpause err 4", NO_NUM); f = rfp->fp_filp[fild]; dev = f->filp_ino->i_zone[0]; /* device on which proc is hanging */ mess.TTY_LINE = (dev >> MINOR) & BYTE; mess.PROC_NR = proc_nr; mess.m_type = CANCEL; ! if (sendrec(task, &mess) != OK) panic("unpause err 2", NO_NUM); while (mess.REP_PROC_NR != proc_nr) { revive(mess.REP_PROC_NR, mess.REP_STATUS); if (receive(task, &m) != OK) panic("unpause err 3", NO_NUM); } revive(proc_nr, EINTR); /* signal interrupted call */ } return(OK); } ---------------------- Harry McGavran Group C-8 Los Alamos National Laboratory hgm@lanl.GOV