AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only
  • 1.  Trapping system calls using ptrace/ptracex/ptrace64

    Posted Thu July 23, 2009 07:31 AM

    Originally posted by: SystemAdmin


    Hello experts,

    Is it possible to trace system calls which are being called by traced process(child/forked process) using ptrace/ptracex/ptrace64 avilable on AIX (as we can do it on Linux)???
    In AIX,which header file has system calls list and thier numbers?

    Your help would be greatly appreciated!!!

    Thanks in advance!!!

    Patel.
    #AIX-Forum


  • 2.  Re: Trapping system calls using ptrace/ptracex/ptrace64

    Posted Thu July 23, 2009 07:58 AM

    Originally posted by: drajarsh


    Check for syscalls.h. Look for syscalls.exp which should give you a good idea on the system calls used.

    You can use /usr/bin/truss on AIX to trace system calls.

    HTH
    Rajarshi
    #AIX-Forum


  • 3.  Re: Trapping system calls using ptrace/ptracex/ptrace64

    Posted Thu July 23, 2009 08:17 AM

    Originally posted by: SystemAdmin


    Hi Rajarshi,

    Thanks for your reply!

    I didn't find "syscall.h" on AIX. And I want to write my own tracer instead of depending on truss, tusc, strace or any other third party!. ptrace is meant for that, but I am not able to get the control over traced(child/forked) process when it makes a call to any syscalls(say for ex : open(), read(), write()...).

    Thanks,
    Patel.
    #AIX-Forum


  • 4.  Re: Trapping system calls using ptrace/ptracex/ptrace64

    Posted Fri July 24, 2009 01:56 AM

    Originally posted by: drajarsh


    Take a look at /usr/lib/syscalls.exp. That should give you a good idea on the system calls.

    Meanwhile, what I understand is that once you start tracing using ptrace and your traced process forks, within the child process you do not get control if any system calls are made. Is this correct?

    Can you check if you gain control within the child process if you do not make any system calls?

    basically, want to understand if your loss of control is limited to making system calls or is it generally within the child process that you are unable to control?

    Also, when you say lose control, are you indicating that the breakpoints get cleared, or do you mean that you are unable to break into the syscalls themselves?

    It would be good if you could also share the parameters that you pass to ptrace.

    • Rajarshi

    #AIX-Forum