intercept system call without kernel modules

Submitted by numeriseriali
on August 2, 2004 - 1:26am

Hi

i wrote a small program using ptrace that intercept read system call, and change the values read.

Now, when i'm reading from the keyboard i must wait that the user press return so the read return and i can issue ptrace poke_data

how can i avoid to wait for the return press ?
i don't want to write a kernel module to intercept the system call.

i want that when i reach the read system call i immediately change the parameteres and immediately return. so the program can continue without pressing the return key

ex. of the program

entry point of the system_call

ptrace(ptrace_syscall) example: reading a string from the keyboard
wait
ptrace(get_regs)
is my system call ?
yes

exit point of the system call
ptrace(ptrace_syscall) example: reading a string from the keyboard
wait I MUST WAIT the hit of the RETURN KEY

ptrace(poke_data) i change the string now