home *** CD-ROM | disk | FTP | other *** search
- I'm re-posting this due to popular demand:
-
- This is a pseudo-device driver which implements a
- series of devices: /dev/fd0 - /dev/fd19 which are
- surreptitiously equivalenced to whatever file (if
- any) is associated with the corresponding file
- descriptor in the process which is attempting to
- open that file. In other words: opening the file
- /dev/fd<n> is almost the same as doing the system
- call: dup(n). It's different in that if the file
- is a device, the driver's open routine is called.
- If the corresponding file descriptor is a pipe
- (socket) a dup() sys call is faked.
-
- This can be used to force programs to read from
- their standard input, or write to their standard
- output, even if they haven't been designed to do
- so. For instance:
-
- ln -s /dev/fd0 xx.c
- cc xx.c
- { Type a C program here. }
- ^D
- a.out
-
- Or, to see if a certain source file compiled into a
- particular object file:
-
- cc source.c -o /dev/fd1 | cmp - objectfile
-
- Be sure to make these mods in your conf directory.
-
- In the config file:
- pseudo-device fd
-
- In the ``files'' file:
- sys/dev_fd.c optional fd
-
- <**************************************************************>
-