diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-17 16:26:47 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-17 16:26:47 +0100 |
commit | 0c163c408f9ebf705fd149941994b4997f353744 (patch) | |
tree | 13c77357c410a34f2978d7937d1a87a1179e1a3d /file.c | |
parent | 31972d52b1059d8faca1c5f417c2db1a90b868ae (diff) | |
download | strace-0c163c408f9ebf705fd149941994b4997f353744.tar.gz strace-0c163c408f9ebf705fd149941994b4997f353744.tar.bz2 strace-0c163c408f9ebf705fd149941994b4997f353744.tar.xz |
Simplify sys_lseek64 conditional compilation.
It looks like sys_lseek64() is never used.
For one, it is buggy (always shows 0 return value), and no one complains.
From code inspection: sys_lseek64 name is not used anywhere.
It is defined to sys_lseek if HAVE_LONG_LONG_OFF_T is true.
Thus, if !HAVE_LONG_LONG_OFF_T, it is never used.
Therefore "if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T"
conditional it sits in can be simplified to
"if HAVE_LONG_LONG_OFF_T".
Therefore, we can move it a bit up and merge with
"if !HAVE_LONG_LONG_OFF_T, use this sys_lseek()" code block,
by addind an "else" clause to it.
To simplify it more, drop define and just rename sys_lseek64 ->
sys_lseek.
Since the function is buggy, I think it is unused and we can
just drop it. (I checked: at least I386 never uses it).
* file.c (sys_lseek64): Rename to sys_lseek; don't compile it
if _LFS64_LARGEFILE but !HAVE_LONG_LONG_OFF_T since in this case
it is never used.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -147,7 +147,6 @@ struct stat_sparc64 { # define sys_stat64 sys_stat # define sys_fstat64 sys_fstat # define sys_lstat64 sys_lstat -# define sys_lseek64 sys_lseek # define sys_truncate64 sys_truncate # define sys_ftruncate64 sys_ftruncate #endif @@ -479,8 +478,8 @@ static const struct xlat whence[] = { { 0, NULL }, }; -#ifndef HAVE_LONG_LONG_OFF_T -#if defined(LINUX_MIPSN32) +#if !defined(HAVE_LONG_LONG_OFF_T) +# if defined(LINUX_MIPSN32) int sys_lseek(struct tcb *tcp) { @@ -500,7 +499,7 @@ sys_lseek(struct tcb *tcp) } return RVAL_UDECIMAL; } -#else /* !LINUX_MIPSN32 */ +# else /* !LINUX_MIPSN32 */ int sys_lseek(struct tcb *tcp) { @@ -520,7 +519,26 @@ sys_lseek(struct tcb *tcp) } return RVAL_UDECIMAL; } -#endif /* LINUX_MIPSN32 */ +# endif +#else /* HAVE_LONG_LONG_OFF_T */ +/* + * ??? Any arch using it? I386 doesn't... + */ +int +sys_lseek(struct tcb *tcp) +{ + if (entering(tcp)) { + int argn; + printfd(tcp, tcp->u_arg[0]); + tprints(", "); + if (tcp->u_arg[3] == SEEK_SET) + argn = printllval(tcp, "%llu, ", 1); + else + argn = printllval(tcp, "%lld, ", 1); + printxval(whence, tcp->u_arg[argn], "SEEK_???"); + } + return RVAL_LUDECIMAL; +} #endif int @@ -566,24 +584,6 @@ sys_readahead(struct tcb *tcp) return 0; } -#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T -int -sys_lseek64(struct tcb *tcp) -{ - if (entering(tcp)) { - int argn; - printfd(tcp, tcp->u_arg[0]); - tprints(", "); - if (tcp->u_arg[3] == SEEK_SET) - argn = printllval(tcp, "%llu, ", 1); - else - argn = printllval(tcp, "%lld, ", 1); - printxval(whence, tcp->u_arg[argn], "SEEK_???"); - } - return RVAL_LUDECIMAL; -} -#endif - #ifndef HAVE_LONG_LONG_OFF_T int sys_truncate(struct tcb *tcp) |