From: john.levon@sun.com Subject: [PATCH] Fix non-portability in xentrace Date: Wed, 27 Feb 2008 08:07:54 -0800 Message-ID: <77ea7611d2c51c65a137.1204128474@hatchback> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User john.levon@sun.com # Date 1204123693 28800 # Node ID 77ea7611d2c51c65a13736a46427ec401721f187 # Parent c8be63feb437ce500fc2c200c816316c1bd0d12b Fix non-portability in xentrace Replace statfs() with the equivalent statvfs(), and correct the block size multiplier. Signed-off-by: John Levon diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c --- a/tools/xentrace/xentrace.c +++ b/tools/xentrace/xentrace.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include @@ -87,7 +87,7 @@ void write_buffer(unsigned int cpu, unsi void write_buffer(unsigned int cpu, unsigned char *start, int size, int total_size, int outfd) { - struct statfs stat; + struct statvfs stat; size_t written = 0; if ( opts.disk_rsvd != 0 ) @@ -95,13 +95,13 @@ void write_buffer(unsigned int cpu, unsi unsigned long long freespace; /* Check that filesystem has enough space. */ - if ( fstatfs (outfd, &stat) ) + if ( fstatvfs (outfd, &stat) ) { fprintf(stderr, "Statfs failed!\n"); goto fail; } - freespace = stat.f_bsize * (unsigned long long)stat.f_bfree; + freespace = stat.f_frsize * (unsigned long long)stat.f_bfree; if ( total_size ) freespace -= total_size;