Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!munnari.oz.au!metro!cluster!necisa!boyd From: boyd@necisa.ho.necisa.oz (Boyd Roberts) Newsgroups: comp.unix.wizards Subject: Re: A question on the implementation of /dev/stdin, etc. Message-ID: <1706@necisa.ho.necisa.oz> Date: 7 May 90 23:44:22 GMT References: <6148.262dbb8d@csv.viccol.edu.au> <707@ehviea.ine.philips.nl> <[2643142a:635.16]comp.unix.wizards;1@wcbcs> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 34 In article <[2643142a:635.16]comp.unix.wizards;1@wcbcs> akcs.kevin@wcbcs (Kevin Schoedel) writes: >This discussion has prompted me to try to implement /dev/fd/... for >System V 3.2 on a 386. I don't have kernel source, so I can't use the > case IFCHR: Yes, do it as a device driver. But... you'll have to cheat! Grody hack follows: fdopen(dev, mode) dev_t dev; int mode; { /* u_rval1 should hold the allocated file descriptor -- gag! */ closef(u.u_ofile[u.u_rval1]); if (u.u_error) return; if (u.u_ofile[minor(dev)] != NULL) { /* fake dup */ u.u_ofile[u.u_rval1] = u.u_ofile[minor(dev)]; u.u_ofile[minor(dev)]->f_count++; } else u.u_error = EBADF; } Boyd Roberts boyd@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...''