pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib Use statvfs if sys/stat...
details: https://anonhg.NetBSD.org/pkgsrc/rev/11d2386ac3eb
branches: trunk
changeset: 476012:11d2386ac3eb
user: minskim <minskim%pkgsrc.org@localhost>
date: Tue Jun 01 17:29:09 2004 +0000
description:
Use statvfs if sys/statvfs.h is available. Based on patches provided
by Kibum Han in PR pkg/25560.
PKGVERSION will be bumped shortly when 20040601 is imported.
diffstat:
pkgtools/pkg_install/files/lib/pen.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r d459aa488dac -r 11d2386ac3eb pkgtools/pkg_install/files/lib/pen.c
--- a/pkgtools/pkg_install/files/lib/pen.c Tue Jun 01 17:11:31 2004 +0000
+++ b/pkgtools/pkg_install/files/lib/pen.c Tue Jun 01 17:29:09 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.12 2003/09/23 07:13:53 grant Exp $ */
+/* $NetBSD: pen.c,v 1.13 2004/06/01 17:29:09 minskim Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.12 2003/09/23 07:13:53 grant Exp $");
+__RCSID("$NetBSD: pen.c,v 1.13 2004/06/01 17:29:09 minskim Exp $");
#endif
#endif
@@ -51,6 +51,9 @@
#if HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
/* For keeping track of where we are */
static char Current[FILENAME_MAX];
@@ -208,10 +211,17 @@
uint64_t
min_free(char *tmpdir)
{
+#ifdef HAVE_SYS_STATVFS_H
+ struct statvfs buf;
+
+ if (statvfs(tmpdir, &buf) != 0) {
+ warn("statvfs");
+#else
struct statfs buf;
if (statfs(tmpdir, &buf) != 0) {
warn("statfs");
+#endif
return -1;
}
return (uint64_t) buf.f_bavail * (uint64_t) buf.f_bsize;
Home |
Main Index |
Thread Index |
Old Index