This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

syscalls.list and read/write/open/close intercepting question


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
application code.
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 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]