Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!cornell!uw-beaver!mit-eddie!ll-xn!ames!amdcad!amd!intelca!oliveb!pyramid!prls!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.unix.wizards Subject: Re: /dev/stdin for 4.3? Message-ID: <823@mcgill-vision.UUCP> Date: Fri, 26-Jun-87 05:04:21 EDT Article-I.D.: mcgill-v.823 Posted: Fri Jun 26 05:04:21 1987 Date-Received: Sat, 4-Jul-87 22:55:27 EDT References: <7359@brl-adm.ARPA> <5856@brl-smoke.ARPA> <15318@onfcanim.UUCP> <302@jpusa1.UUCP> Organization: McGill University, Montreal Lines: 59 In article <302@jpusa1.UUCP>, stu@jpusa1.UUCP (Stu Heiss) writes: > In article <7036@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >> In article <792@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) >> gives an implementation of the `open' routine for the /dev/fd/n >> driver. His has an interesting bug. Indeed it does. Thanks for catching that one, Chris. >> This should not in fact break anything, True, assuming you did in fact put nodev in the read and write slots of the cdevsw entry. > C'mon guys, don't leave us in the dark! I was about to install > Mouse's 'driver' and don't recall seeing anything by Fred Blonder. Neither do I, for that matter, but I wasn't watching closely 'cause I've already *got* such a driver. > Give us a working driver, please. Well, actually the original worked, it's just that one particular error case wasn't being caught quite soon enough, and resulted in a successful open() and then failing read()s and/or write()s. > This seems trivial for you kernal wizards. Chris, Mouse, can you > help? Once noticed, it is simple to fix. (This patch also changes a NULL to a 0, because I have quit trusting people responsible for C system maintenence to define NULL correctly. In this case, it's OK 'cause this is rather BSD-specific, but it can't hurt anything.) *** stdiodev.c= Fri Nov 21 04:45:25 1986 --- stdiodev.c Fri Jun 26 04:51:27 1987 *************** *** 19,25 **** if ((fd < 0) || (fd >= NOFILE)) { return(EBADF); } ! if (u.u_ofile[fd] == NULL) { return(ENXIO); } if ((mode&FREAD) && !(u.u_ofile[fd]->f_flag&FREAD)) --- 19,28 ---- if ((fd < 0) || (fd >= NOFILE)) { return(EBADF); } ! if (fd == rfd) ! { return(ENXIO); ! } ! if (u.u_ofile[fd] == 0) { return(ENXIO); } if ((mode&FREAD) && !(u.u_ofile[fd]->f_flag&FREAD)) der Mouse (mouse@mcgill-vision.uucp)