A question on the implementation of /dev/stdin, etc.
Boyd Roberts
boyd at necisa.ho.necisa.oz
Tue May 8 09:44:22 AEST 1990
In article <[2643142a:635.16]comp.unix.wizards;1 at wcbcs> akcs.kevin at 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 at necisa.ho.necisa.oz.au
``When the going gets wierd, the weird turn pro...''
More information about the Comp.unix.wizards
mailing list