I have written wrappers for both open()
and open64(
). Now I run vi by preloading my wrapper library using LD_PRELOAD
environment variable and I see that the open64()
wrapper is used instead of the open()
. But when I strace vi I see that the system calls made is to open()
(of course including the other system calls). What is the issue here?

- 15,458
- 6
- 54
- 72

- 3,774
- 6
- 43
- 56
2 Answers
Are you running on a 64 bit system? If so then this is no surprise. strace traces the actuall syscalls, not which functions in a library are called. On 64 bit systems open
and open64
are implemented by the same syscall.

- 159,371
- 13
- 185
- 298
The strace utility traces system calls (syscall) and open happens to be both a syscall and a library function. Both the open()
and open64()
library functions use the open
syscall internally to request services from the kernel. It is my understanding that using open()
with the O_LARGEFILE
flag is equivalent to using open64()
to support large files in 32-bit applications.
If the call to open64()
were to call the open()
function internally, your open()
wrapper would not be called because you cannot interpose internal library function calls. They are resolved before runtime.

- 15,458
- 6
- 54
- 72