From: Denys Vlasenko Date: Sat, 17 Mar 2012 15:26:47 +0000 (+0100) Subject: Simplify sys_lseek64 conditional compilation. X-Git-Tag: v4.7~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c163c408f9ebf705fd149941994b4997f353744;p=strace 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 --- diff --git a/file.c b/file.c index bac28d88..258528e1 100644 --- a/file.c +++ b/file.c @@ -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)