Does posix_fadvice call the broken API sys_fadvice64 or the fixed sys_fadvice64_64?
I'm wanting to experiment with the fadvice functions and reading up
discovered 开发者_C百科that there is a sys_fadvice64
function which is obsoleted by sys_fadvice64_64
But, the new function has the same parameters. Why didn't they just fix the old one?
And secondly, does posix_fadvice
call the broken API or the fixed one? how can I tell?
The new function uses loff_t
for len
, whereas the old one uses size_t
. To maintain binary compatibility with programs compiled against the old function, a new function was required.
posix_fadvise()
should call the new function, if it is available. You can test this by compiling a test program that uses posix_fadvise()
, and using the strace
utility to see which system call it uses (don't forget to compile with -D_FILE_OFFSET_BITS=64
).
精彩评论