This is the mail archive of the libc-help@sourceware.org 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]

Re: On wrapping open without ld --wrap


On 15 Jul 2015 20:43, Sandhya Kumar wrote:
> 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.

try copying sysdeps/unix/sysv/linux/generic/open.c to 
sysdeps/unix/sysv/linux/open.c and then making your changes in there.
-mike

Attachment: signature.asc
Description: Digital signature


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