[I'm not sure what you are doing but...]
Robert Lunnon bobNoSpaM@yarrabee.net.au writes:
Here is what the Sun man page says about Ptrace, with
apologies to sun, you
can find this page at docs.sun.com. Not the comment for
call 0 (TRACEME) and
ESRCH in the error section
But there has to be some way to attach to a running process.
Yes, ptrace(PTRACE_ATTACH, ...) should work I believe. Haven't tried though.
What happens when you do an attach in gdb? Does it do a ptrace?
I'm not sure. Here is a trace of gdb trying to attach to a bash process (pid 11664).
Patric sed a trace:
open("/proc/11664", O_RDWR) = 3 ioctl(3, PIOCSTATUS, 0x081811E0) = 0 ioctl(3, PIOCOPENLWP, 0x080476C8) = 4 ioctl(4, PIOCSET, 0x080476C4) = 0 close(3) = 0 ioctl(4, PIOCGTRACE, 0x0818163C) = 0 ioctl(4, PIOCGHOLD, 0x08181614) = 0 ioctl(4, PIOCGFAULT, 0x08181628) = 0 ....
That looks pretty clear. However manual in Solaris 2.6 says that one should open /proc/pid/ctl for writing and specifyes messages to perform debug actions. Manual also suggests that ptrace is a library function working with proc filesystem so the only question is wether to use ioctl on /proc/pid or write to /proc/pid/ctl.