ping: [PATCH] add configure check for statfs64()

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Nov 25 14:11:41 UTC 2008


ping

On Mon, Nov 17, 2008 at 11:40:53AM +0100, Bernhard Reutner-Fischer wrote:
>Hi,
>
>Please find attached 2 patches which
>
>- add configure check for statfs64
>- add fallbacks for !LFS
>
>2008-11-17  Bernhard Reutner-Fischer  <>
>
>	* acinclude.m4 (AC_STATFS64): New.
>	* configure.ac (AC_STATFS64): Call.
>	* file.c (printstatfs64): Only compile if
>	the non-standard statfs64() is available.
>	Fallback to stat() if stat64() is unavailable.
>
>2008-11-17  Bernhard Reutner-Fischer  <>
>
>	* syscall.c (sys_truncate64, sys_ftruncate64, sys_getdents64,
>	sys_statfs64, sys_fstatfs64): Fallback to !LFS variants if
>	largefile support is unavailable.
>
>
>Please apply.

>diff -u strace-4.5.18.orig/acinclude.m4 strace-4.5.18/acinclude.m4
>--- strace-4.5.18.orig/acinclude.m4	2004-04-14 04:21:01.000000000 +0200
>+++ strace-4.5.18/acinclude.m4	2008-10-28 14:24:30.000000000 +0100
>@@ -210,6 +210,23 @@
> fi
> ])
> 
>+dnl ### A macro to determine whether statfs64 is defined.
>+AC_DEFUN([AC_STATFS64],
>+[AC_MSG_CHECKING(for statfs64 in sys/vfs.h)
>+AC_CACHE_VAL(ac_cv_type_statfs64,
>+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX
>+#include <linux/types.h>
>+#include <sys/vfs.h>
>+#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])])
>+AC_MSG_RESULT($ac_cv_type_statfs64)
>+if test "$ac_cv_type_statfs64" = yes
>+then
>+	AC_DEFINE([HAVE_STATFS64], 1,
>+[Define if statfs64 is available in sys/vfs.h.])
>+fi
>+])
>+
>+
> dnl ### A macro to determine if off_t is a long long
> AC_DEFUN([AC_OFF_T_IS_LONG_LONG],
> [AC_MSG_CHECKING(for long long off_t)
>diff -u strace-4.5.18.orig/configure.ac strace-4.5.18/configure.ac
>--- strace-4.5.18.orig/configure.ac	2008-08-28 23:15:56.000000000 +0200
>+++ strace-4.5.18/configure.ac	2008-10-28 14:24:41.000000000 +0100
>@@ -170,6 +170,7 @@
> 		  struct stat.st_level,
> 		  struct stat.st_rdev])
> AC_STAT64
>+AC_STATFS64
> 
> AC_TYPE_SIGNAL
> AC_TYPE_UID_T
>diff -u strace-4.5.18.orig/file.c strace-4.5.18/file.c
>--- strace-4.5.18.orig/file.c	2008-08-01 03:13:10.000000000 +0200
>+++ strace-4.5.18/file.c	2008-10-28 14:27:03.000000000 +0100
>@@ -1704,13 +1704,17 @@
> 	return 0;
> }
> 
>-#ifdef LINUX
>+#if defined LINUX && defined HAVE_STATFS64
> static void
> printstatfs64(tcp, addr)
> struct tcb *tcp;
> long addr;
> {
>+#ifdef HAVE_STAT64
> 	struct statfs64 statbuf;
>+#else
>+	struct statfs statbuf;
>+#endif
> 
> 	if (syserror(tcp) || !verbose(tcp)) {
> 		tprintf("%#lx", addr);

>--- strace-4.5.18/syscall.c	2008-08-25 05:16:26.000000000 +0200
>+++ strace-4.5.18.new/syscall.c	2008-10-28 14:36:08.000000000 +0100
>@@ -125,6 +125,18 @@
> #define TP TRACE_PROCESS
> #define TS TRACE_SIGNAL
> 
>+#ifndef HAVE_STATFS64
>+/*
>+ * Ugly hacks for systems that do not have LFS
>+ */
>+
>+#define sys_truncate64  sys_truncate
>+#define sys_ftruncate64 sys_ftruncate
>+#define sys_getdents64  sys_getdents
>+#define sys_statfs64    sys_statfs
>+#define sys_fstatfs64   sys_fstatfs
>+#endif
>+
> static const struct sysent sysent0[] = {
> #include "syscallent.h"
> };





More information about the Strace-devel mailing list