ptrace in unix tracing non-child processes

Arndt Jonasson aj at zyx.UUCP
Thu Apr 14 19:39:42 AEST 1988


In article <49161 at sun.uucp> brent%terra at Sun.COM (Brent Callaghan) writes:
>SunOs ptrace() has this facility.  You can give it a pid with
>the PTRACE_ATTACH request and attach to another process.  The other
>process must be one of "yours" i.e. same uid/gid.  The process gets
>a SIGSTOP.  A PTRACE_DETACH is used to send the traced process on
>it's way when you've lost interest.

The HP-UX system for HP 9000 series 800 also has that facility (though
the symbols are named PT_ATTACH and PT_DETACH).

Btw, I recently posted my file openings trapper to comp.sources.misc
(though it doesn't seem to have shown up yet).  It also includes
(undocumented) the current state of my options parser (which started
the interesting discussion about option parsing). If anyone feels like
porting the trapper to something other than HP-UX or Vax/4.2BSD, please
send the changes back to me.

[By writing this program, I got quite acquainted with the 'ptrace' call.
Brrr, what a kludge it is..]
-- 
Arndt Jonasson, ZYX Sweden AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address:	 aj at zyx.SE	or	<backbone>!mcvax!enea!zyx!aj



More information about the Comp.unix.wizards mailing list