Check for fstatvfs and provide/use it only if the host system has it.

Fixes PR#27221
This commit is contained in:
jmc 2004-10-12 03:28:30 +00:00
parent 3f13770b97
commit 7a47cf149b
5 changed files with 4839 additions and 1671 deletions

6485
tools/compat/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# $NetBSD: configure.ac,v 1.46 2004/07/24 16:32:01 dbj Exp $
# $NetBSD: configure.ac,v 1.47 2004/10/12 03:28:32 jmc Exp $
#
# Autoconf definition file for libnbcompat.
#
@ -128,6 +128,10 @@ AC_CHECK_FUNCS([bswap16, bswap32, bswap64],,, [
#include <machine/bswap.h>
])
AC_CHECK_FUNCS([fstatvfs],,, [
#include <sys/statvfs.h>
])
AC_CHECK_DECLS([setgroupent, setpassent],,, [
#include <sys/types.h>
#include <grp.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: nbtool_config.h.in,v 1.6 2004/07/24 16:32:01 dbj Exp $ */
/* $NetBSD: nbtool_config.h.in,v 1.7 2004/10/12 03:28:31 jmc Exp $ */
#ifndef __NETBSD_NBTOOL_CONFIG_H__
#define __NETBSD_NBTOOL_CONFIG_H__
@ -40,6 +40,8 @@
#undef HAVE_U_SHORT
#undef HAVE_U_QUAD_T
#undef HAVE_FSTATVFS
#undef HAVE_BSWAP16
#undef HAVE_BSWAP32
#undef HAVE_BSWAP64

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $ */
/* $NetBSD: ffs.c,v 1.32 2004/10/12 03:28:30 jmc Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -71,7 +71,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $");
__RCSID("$NetBSD: ffs.c,v 1.32 2004/10/12 03:28:30 jmc Exp $");
#endif /* !__lint */
#include <sys/param.h>
@ -91,7 +91,7 @@ __RCSID("$NetBSD: ffs.c,v 1.31 2004/07/24 16:30:50 dbj Exp $");
#include "makefs.h"
#if HAVE_STRUCT_STATVFS_F_IOSIZE
#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
#include <sys/statvfs.h>
#endif
@ -426,7 +426,7 @@ ffs_dump_fsinfo(fsinfo_t *f)
static int
ffs_create_image(const char *image, fsinfo_t *fsopts)
{
#if HAVE_STRUCT_STATVFS_F_IOSIZE
#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
struct statvfs sfs;
#endif
struct fs *fs;
@ -445,11 +445,11 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
}
/* zero image */
#if HAVE_STRUCT_STATVFS_F_IOSIZE
#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
if (fstatvfs(fsopts->fd, &sfs) == -1) {
#endif
bufsize = 8192;
#if HAVE_STRUCT_STATVFS_F_IOSIZE
#if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS
warn("can't fstatvfs `%s', using default %d byte chunk",
image, bufsize);
} else

View File

@ -1,4 +1,4 @@
/* $NetBSD: makefs.h,v 1.14 2004/06/20 22:20:18 jmc Exp $ */
/* $NetBSD: makefs.h,v 1.15 2004/10/12 03:28:30 jmc Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -46,6 +46,7 @@
#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
#define HAVE_STRUCT_STAT_BIRTHTIME 1
#define HAVE_FSTATVFS 1
#endif
#include <sys/stat.h>