Two Top-20 features sought for UNIX

Arndt Jonasson aj at zyx.UUCP
Sun Mar 6 12:44:01 AEST 1988


In article <12970 at sri-unix.SRI.COM> cole at sri-unix.ARPA (Susan E. Cole) writes:
>I like UNIX better than Tops-20,really, but there are two Tops-20 capabilities
>that I wish I could get on my Pyramid system.
> ...
>The other capability I'd like is called "trap file openings" on Tops-20.
>Once you set this feature on, the system announces every file open
>done on your behalf (and whether it is for reading or writing).  This 
>can also clear up confusion real fast -- "it's looking in THAT directory?!"

Of course, this can't be implemented with the full generality of the
Tops-20 Set Trap File-Openings without changing the kernel, but your
question inspired me to investigate what could be done with 'ptrace'.

It took me a day and I now have a program that is invoked as e.g.
'trapfile myprog foo bar'. It will then run 'myprog foo bar', while
displaying all calls to 'open' and 'close' on stderr. It makes very
heavy use of 'ptrace' and is thus fairly unportable (I use HP-UX on a
68020) and it doesn't work for programs that fork and then use 'open'
or 'close', although that could be fixed (so that they don't crash,
that is - there can't be any tracing output for the forked processes).
It doesn't make any use of any symbol table that myprog might have,
although that would make it a little faster to find the 'open' and
'close' calls.

If this program is going to be at all useful remains to be seen, but
this shows that it can be done.
-- 
Arndt Jonasson, ZYX Sweden AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address:	 <backbone>!mcvax!enea!zyx!aj	=	aj at zyx.SE



More information about the Comp.unix.questions mailing list