Jerry Saravia
Jerry Saravia

Reputation: 3837

Can C be used to capture system calls on a machine?

Good day,

I was wondering if there is a way to do direct system call capture with C or C++?

I know that currently on unix systems you can use SystemTap to do system capture. The problem I'm having is that in order to feed them into another program for analysis I have to pipe them to the other program.

I'd like to pass things along programatically as this is easier than "printing" out into the pipe and then reading in with the other program.

Is there a way of doing this? How difficult would it be?

Upvotes: 1

Views: 255

Answers (1)

karlphillip
karlphillip

Reputation: 93410

strace does exactly that.

You can take a look at its source code to see how its done.

Upvotes: 4

Related Questions