Path: utzoo!utgpu!watserv1!maytag!xenitec!usenet!wcbcs!akcs.kevin From: akcs.kevin@wcbcs (Kevin Schoedel) Newsgroups: comp.unix.wizards Subject: Re: A question on the implementation of /dev/stdin, etc. Message-ID: <[2643142a:635.16]comp.unix.wizards;1@wcbcs> Date: 6 May 90 09:10:50 EDT References: <6148.262dbb8d@csv.viccol.edu.au> <707@ehviea.ine.philips.nl> Lines: 27 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: if( major( dev ) == fd_dev ){ dup minor(dev) return; } (*cdevsw[ .... technique that was mentioned here. I don't want to use a file system for /dev/fd/... because that would prevent me using the synonyms /dev/stdin, etc. So... is there any fundamental problem with having a device, consisting only of an open routine, that gets rid of the file descriptor just created for /dev/fd/N and then dup's N? Specifically, I tried an open function containing, roughly, f = ...file descriptor for /dev/fd/... close( f ) dup( minor( dev ) ) As I said, I don't have source, and my knowledge of the kernel implementation is restricted to having read John Lions' book, and perhaps things have changed a bit since version 6. First, I tried looking in u.u_ar0[0] for the file descriptor, but that was zero, which didn't seem right. Then I tried searching u.u_ofile[] for a file whose inode was that of the special file -- and sure enough, it was in u.u_ofile[0]. So now I'm confused. Am I doing something slightly wrong or fundamentally wrong? -kevin