This is the mail archive of the
mailing list for the glibc project.
syscalls.list and read/write/open/close intercepting question
- From: Rick Spillane <necro351 at gmail dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 14 Jun 2005 19:41:47 -0400
- Subject: syscalls.list and read/write/open/close intercepting question
- References: <email@example.com>
- Reply-to: Rick Spillane <necro351 at gmail dot com>
I was wondering if there is a way to intercept system calls during the
time that they are symbols in glibc, and before they are interrupt
requests to the host operating system in the architecture's native
assembly. However I still want to maintain the original system calls,
say under a different name like "r_read" for "real read" and "r_write"
for "real write" as separate symbols that do eventually go to the
kernel. I want to perform the interception once the active context has
moved to glibc, so that it is transparent to linking application code,
this way I could use LD_PRELOAD perhaps in the future or at least have
source compatibility on a level that wouldn't require modifying
I know from my own investigation that 'read' and 'write' have weak and
strong aliases so that other libraries (like pthread say) can have
'read' symbols that will get picked over the syscall 'read' (since
that read is weakley aliased say). I also know that the system calls
are generated by make-syscalls.sh in sysdeps/unix by processing
sysdeps/unix/syscalls.list. I can't figure out how to manipualte
syscalls.list without crashing the glibc build however.
Is there a way to modify syscalls.list so that the system calls will
go under different names, and unistd.h will link to my own system call
"replacements"? I would then like to call either the real syscall
"r_read" or continue on doing something else depending on the fd I'm
Thanks for taking any time on this, I appreciate it.