HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)
p
ptrace(2) ptrace(2)
main()
{
event_len = sizeof(ptrace_event_t);
state_len = sizeof(ptrace_state_t);
event_addr = calloc(event_len, 1);
state_addr = calloc(state_len, 1);
buf_addr = calloc(MAXPATH, 1);
pipe(filed);
switch (pid = fork()) {
case -1:
exit(1);
case 0:
child();
break;
default:
parent();
break;
}
}
ERRORS
If ptrace() fails, errno is set to one of the following values.
[EACCES] The executable image of the process being attached resides across an interruptible
NFS mount.
[EIO] request is an illegal number.
[EIO] The PT_SETTRC request is used with a data argument that is less than zero or not a
multiple of four, or data is not word-aligned.
[EIO] Attempting to write to a memory segment of the traced process that is not writable,
or attempting to write to page 0, or the request argument is out of range.
[EIO] The PT_CONTIN request is being used with an invalid data argument (signal
number).
[EIO] Attempting to write to the user area via the PT_WUAREA request.
[EPERM] The specified process cannot be attached for tracing.
[EPERM] The process pid is already being traced or pid refers to the calling process itself.
[ESRCH] pid identifies a process to be traced that does not exist or has not executed a
ptrace() with request PT_SETTRC .
SEE ALSO
adb(1), exec(2), exit(2), signal(2), ttrace(2), wait(2).
STANDARDS CONFORMANCE
ptrace(): SVID2, SVID3, XPG2
Section 2−−260 Hewlett-Packard Company − 7 − HP-UX 11i Version 1: September 2005