pipefile - attach filter to file in name space


pipefile [ -d ] [ -r command ] [ -w command ] file


Pipefile uses sys-bind(2) to attach a pair of pipes to file, using them to interpose filter commands between the true file and the simulated file that subsequently appears in the name space. Option -r interposes a filter that will affect the data delivered to programs that read from file; -w interposes a filter that will affect the data written by programs to file. At least one command must be specified; pipefile will insert a cat(1) process in the other direction.

After pipefile has been run, the filters are established for programs that subsequently open the file; programs already using the file are unaffected.

Pipefile opens the file twice, once for each direction. If the file is a single-use device, use the -d flag to specify that the file is to be opened once, in ORDWR mode.


To record the history of shell commands:
	pipefile -r 'tee -a '$home/sh.history /dev/cons
	sh -i </dev/cons >/dev/cons >[2=1]






The I/O model of pipefile is peculiar; it doesn't work well on plain files. It is really intended for use with continuous devices such as /dev/cons and /dev/keyboard.

If the program using the file managed by pipefile exits, the filter will see EOF and exit, and the file will be unusable until the name space is repaired.

PIPEFILE(1) Rev:  Fri Jun 15 21:22:04 GMT 2007