Operating System - HP-UX
1825771 Members
2077 Online
109687 Solutions
New Discussion

Trapping system calls using ptrace

 
Shaan_2
Occasional Advisor

Trapping system calls using ptrace

Is it possible to trap system calls using ptrace(which are called by any child processes)? as we can do it in Linux and other OS's. The ttrace is provided for the same, but ttrace is not supported for the older versions, only after 11i is supported.

Thanks in advance for your help :-)
--
Shaan.

4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Trapping system calls using ptrace

Shalom,

ptrace/strace that you are used to with Linux and other OS is called tusc on HP-UX

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-7.10/

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: Trapping system calls using ptrace

If you want to just trace the calls and output to a file, you should use tusc as SEP mentioned.

If you need to use ttrace(2) or ptrace(2), you may have to invent your own debugger.
Shaan_2
Occasional Advisor

Re: Trapping system calls using ptrace

Thanks for your reply!
BTW I want to write my own tracer using ptrace according to my requirement. I know tusc is doing the same, but I don't think tusc is supported for older versions before 11i(I hope tusc is written on top of ttrace). I can go for ttrace, again the same problem since ttrace is not supported for older versions. I need similar kind of API which works for older versions. ptrace is meant for that, but I am not sure that the child processes gives us(to parent process) signal when they are calling syscalls. Then we cannot have control on child processes when they are making calls to syscalls.

Thanks in advance for your help :-)
--
Shaan.
Dennis Handly
Acclaimed Contributor

Re: Trapping system calls using ptrace

>according to my requirement.

Which is? If you want to use ptrace(2) or old OS versions, these aren't supported.

tusc has been around for some time. Try looking for old versions.