patches/strace/4.5.19/130-statfs64-check.patch
author Joachim Nilsson <jocke@vmlinux.org>
Fri Jan 01 12:17:39 2010 +0100 (2010-01-01)
changeset 1671 08a5129e6eb0
permissions -rw-r--r--
debug/strace: fix strace 4.5.19 to properly build with latest Linux kernels

Here's a couple of patches to get strace 4.5.19 to configure and build
properly with the latest kernel headers. Not pretty, but hopefully
enough while we wait for 4.5.20 to be released.

With the current strace-4.5.19 patches I failed to get the configure
script running even on my host environment. Also, when cross building
the configure script needs to look for the proper system headers to be
able to properly set HAVE_LINUX_NETLINK_H. Otherwise you get:

[EXTRA] Building strace
[ERROR] /home/jocke/x-tools/targets/src/strace-4.5.19/net.c:976:
error: field 'nl' has incomplete type
[ERROR] make[2]: *** [net.o] Error 1
[ERROR] make[1]: *** [all] Error 2

The fix was simple, backport a change set from the git[1] tree and run
autoreconf to update the configure script.

[1] - http://strace.git.sourceforge.net/git/gitweb.cgi?p=strace/strace;a=commit;h=f0df31e71a58c6e79ba77c1a9d84b2f38d44bec7
yann@1613
     1
diff -durN strace-4.5.19.orig/acinclude.m4 strace-4.5.19/acinclude.m4
yann@1613
     2
--- strace-4.5.19.orig/acinclude.m4	2004-04-14 04:45:53.000000000 +0200
yann@1613
     3
+++ strace-4.5.19/acinclude.m4	2009-10-28 18:47:18.000000000 +0100
yann@1613
     4
@@ -210,6 +210,26 @@
yann@1613
     5
 fi
yann@1613
     6
 ])
yann@1613
     7
 
yann@1613
     8
+dnl ### A macro to determine whether statfs64 is defined.
yann@1613
     9
+AC_DEFUN([AC_STATFS64],
yann@1613
    10
+[AC_MSG_CHECKING(for statfs64 in sys/(statfs|vfs).h)
yann@1613
    11
+AC_CACHE_VAL(ac_cv_type_statfs64,
yann@1613
    12
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX
yann@1613
    13
+#include <linux/types.h>
yann@1613
    14
+#include <sys/statfs.h>
yann@1613
    15
+#else
yann@1613
    16
+#include <sys/vfs.h>
yann@1613
    17
+#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])])
yann@1613
    18
+AC_MSG_RESULT($ac_cv_type_statfs64)
yann@1613
    19
+if test "$ac_cv_type_statfs64" = yes
yann@1613
    20
+then
yann@1613
    21
+	AC_DEFINE([HAVE_STATFS64], 1,
yann@1613
    22
+[Define if statfs64 is available in sys/statfs.h or sys/vfs.h.])
yann@1613
    23
+fi
yann@1613
    24
+])
yann@1613
    25
+
yann@1613
    26
+
yann@1613
    27
+
yann@1613
    28
 dnl ### A macro to determine if off_t is a long long
yann@1613
    29
 AC_DEFUN([AC_OFF_T_IS_LONG_LONG],
yann@1613
    30
 [AC_MSG_CHECKING(for long long off_t)
yann@1613
    31
diff -durN strace-4.5.19.orig/configure.ac strace-4.5.19/configure.ac
yann@1613
    32
--- strace-4.5.19.orig/configure.ac	2009-10-12 21:54:43.000000000 +0200
yann@1613
    33
+++ strace-4.5.19/configure.ac	2009-10-28 18:47:18.000000000 +0100
yann@1613
    34
@@ -187,6 +187,7 @@
yann@1613
    35
 		  struct stat.st_level,
yann@1613
    36
 		  struct stat.st_rdev])
yann@1613
    37
 AC_STAT64
yann@1613
    38
+AC_STATFS64
yann@1613
    39
 
yann@1613
    40
 AC_TYPE_SIGNAL
yann@1613
    41
 AC_TYPE_UID_T
yann@1613
    42
diff -durN strace-4.5.19.orig/file.c strace-4.5.19/file.c
yann@1613
    43
--- strace-4.5.19.orig/file.c	2009-10-21 15:44:04.000000000 +0200
yann@1613
    44
+++ strace-4.5.19/file.c	2009-10-28 18:47:18.000000000 +0100
yann@1613
    45
@@ -1688,7 +1688,7 @@
yann@1613
    46
 	return 0;
yann@1613
    47
 }
yann@1613
    48
 
yann@1613
    49
-#ifdef LINUX
yann@1613
    50
+#ifdef HAVE_STATFS64
yann@1613
    51
 static void
yann@1613
    52
 printstatfs64(struct tcb *tcp, long addr)
yann@1613
    53
 {