This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
On wrapping open without ld --wrap
- From: Sandhya Kumar <insatiablecuriousity07 at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Wed, 15 Jul 2015 20:43:56 +0800
- Subject: On wrapping open without ld --wrap
- Authentication-results: sourceware.org; auth=none
Hi,
I wish to customize and wrap the libc wrapper for open() system call.
At the moment, I am just trying to add a simple print statement before
the sys_open() is actually invoked.
I am very much aware of GNU linker --wrap option and in fact that
actually solves my problem. But I am altering some other functionality
in libc for which I am anyway picking my custom libc code. So I wish
to place the wrapping logic of open as well in source codes rather
than depending on linker. But when I see the eglibc v2.19 source
codes, many of the wrapper boils down to a template defined in
syscall-template.S due to which I am unable to wrap/alter the logic in
the libc function.
sysdeps/unix/sysv/linux/wordsize-64/open64.c [EMPTY FILE]
sysdeps/unix/syscall-template.S
Can you point me on how to alter this and add a simple puts("Hello")
whenever a open() call is made? BTW I was successful in wrapping
xstat64.c and cases where the files themselves are not empty.