summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2013-11-12 21:49:03 +0000
committerDmitry V. Levin <ldv@altlinux.org>2013-11-12 22:10:44 +0000
commit594eb8f8f882e61fe89f08c9a524f73af43790f9 (patch)
treec44fc3d8ed82434644db5b8d97b3d361100755c2
parent6974bd4f5fae1e78791cf64a6aebc1da2ded25fe (diff)
downloadstrace-594eb8f8f882e61fe89f08c9a524f73af43790f9.tar.gz
strace-594eb8f8f882e61fe89f08c9a524f73af43790f9.tar.bz2
strace-594eb8f8f882e61fe89f08c9a524f73af43790f9.tar.xz
Define printflock64 only if it is referenced by other code
* configure.ac (AC_CHECK_TYPES): Add struct flock64. * desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros. [!HAVE_STRUCT_FLOCK64] (struct flock64): Define. (printflock64): Define only if referenced by other code. (sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff these constants are defined and differ from their non-64bit versions.
-rw-r--r--configure.ac2
-rw-r--r--desc.c42
2 files changed, 36 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 3ea1956..fa4a4bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -257,6 +257,8 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
struct sigevent.__pad],,, [#include <signal.h>])
+AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
+
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
AC_CHECK_DECLS(m4_normalize([
diff --git a/desc.c b/desc.c
index 58c9f13..3ccf422 100644
--- a/desc.c
+++ b/desc.c
@@ -220,7 +220,35 @@ static const struct xlat perf_event_open_flags[] = {
{ 0, NULL },
};
-#if _LFS64_LARGEFILE
+#if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
+# define HAVE_F_SETLK64 1
+#else
+# define HAVE_F_SETLK64 0
+#endif
+
+#if defined(F_SETLKW64) && F_SETLKW64 + 0 != F_SETLKW
+# define HAVE_F_SETLKW64 1
+#else
+# define HAVE_F_SETLKW64 0
+#endif
+
+#if defined(F_GETLK64) && F_GETLK64+0 != F_GETLK
+# define HAVE_F_GETLK64 1
+#else
+# define HAVE_F_GETLK64 0
+#endif
+
+#if defined(X32) || defined(F_FREESP64) || \
+ HAVE_F_SETLK64 || HAVE_F_SETLKW64 || HAVE_F_GETLK64
+
+#ifndef HAVE_STRUCT_FLOCK64
+struct flock64 {
+ short int l_type, l_whence;
+ int64_t l_start, l_len;
+ int l_pid;
+};
+#endif
+
/* fcntl/lockf */
static void
printflock64(struct tcb *tcp, long addr, int getlk)
@@ -333,22 +361,22 @@ sys_fcntl(struct tcb *tcp)
tprints(", ");
printflock(tcp, tcp->u_arg[2], 0);
break;
-#if _LFS64_LARGEFILE
+#if defined(F_FREESP64) || HAVE_F_SETLK64 || HAVE_F_SETLKW64
#ifdef F_FREESP64
case F_FREESP64:
#endif
/* Linux glibc defines SETLK64 as SETLK,
even though the kernel has different values - as does Solaris. */
-#if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
+#if HAVE_F_SETLK64
case F_SETLK64:
#endif
-#if defined(F_SETLKW64) && F_SETLKW64 + 0 != F_SETLKW
+#if HAVE_F_SETLKW64
case F_SETLKW64:
#endif
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 0);
break;
-#endif
+#endif /* defined(F_FREESP64) || HAVE_F_SETLK64 || HAVE_F_SETLKW64 */
#ifdef F_NOTIFY
case F_NOTIFY:
tprints(", ");
@@ -393,10 +421,8 @@ sys_fcntl(struct tcb *tcp)
tprints(", ");
printflock(tcp, tcp->u_arg[2], 1);
break;
-#if _LFS64_LARGEFILE
-#if defined(F_GETLK64) && F_GETLK64+0 != F_GETLK
+#if HAVE_F_GETLK64
case F_GETLK64:
-#endif
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 1);
break;