Skip to contentSkip to conversation

Intercepting system calls

DISCUSSION selvakumar nagendran 3 participants 3 messages Dec 21, 2004

lore
Share & tools
lore
#0 lore raw

I want to intercept system calls that are provided
for IPC in Linux. I have to determine whether a process blocks while executing a system call and I must save the arguments passed to that system call.
Can I modify the system call source code directly
for this? or if I want the system calls to refer my module, how should I do that? can anyone explain for this, if possible with some code?..

Thanks,
selva

__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com

#1 lore raw
Quoted 2 lines · selvakumar nagendran

Can I modify the system call source code directly
for this?

Yes.

Quoted 2 lines

or if I want the system calls to refer my
module, how should I do that?

EXPORT_SYMBOL

Lee

#2 lore raw
In reply to selvakumar nagendran
Quoted 8 lines · selvakumar nagendran

I want to intercept system calls that are provided
for IPC in Linux. I have to determine whether a process blocks while executing a system call and I must save the arguments passed to that system call.
Can I modify the system call source code directly
for this? or if I want the system calls to refer my module, how should I do that? can anyone explain for this, if possible with some code?..

Do you have to do this in the kernel? Have you taken a look at ptrace? Especially PTRACE_SYSCALL (man ptrace). Although it may be trickier to know if it blocked or not, but it should still be possible to do entirely from user land, and thus easier to write/debug.

-- Steve