Add p5-Filesys-Statvfs_Df 0.68, provides an interface between Perl and

the statvfs() system call.

PR:		ports/62980
Submitted by:	Jim Pirzyk
This commit is contained in:
Vanilla I. Shu 2004-03-21 02:13:34 +00:00
parent 0cb0415317
commit 4bfbd2c7ba
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=104800
6 changed files with 133 additions and 0 deletions

View File

@ -732,6 +732,7 @@
SUBDIR += p5-File-Temp
SUBDIR += p5-File-chdir
SUBDIR += p5-FileHandle-Unget
SUBDIR += p5-Filesys-Statvfs_Df
SUBDIR += p5-Filter
SUBDIR += p5-Filter-CBC
SUBDIR += p5-FreezeThaw

View File

@ -0,0 +1,23 @@
# New ports collection makefile for: p5-Filesys-Statvfs_Df
# Date created: Feb 17 2004
# Whom: Jim Pirzyk
#
# $FreeBSD$
#
PORTNAME= Filesys-Statvfs_Df
PORTVERSION= 0.68
CATEGORIES= devel perl5
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= Filesys
PKGNAMEPREFIX= p5-
MAINTAINER= pirzyk@freebsd.org
COMMENT= Provides an interface between Perl and the statvfs() system call
PERL_CONFIGURE= yes
MAN3PREFIX= ${PREFIX}/lib/perl5/${PERL_VERSION}
MAN3= Filesys::Df.3 Filesys::Statvfs.3
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (Filesys-Statvfs_Df-0.68.tar.gz) = 8425476ff9de21513a0264faadca7d07

View File

@ -0,0 +1,90 @@
--- Statvfs.xs.orig Wed Nov 22 09:57:31 2000
+++ Statvfs.xs Tue Feb 17 10:13:35 2004
@@ -5,12 +5,21 @@
#include "perl.h"
#include "XSUB.h"
#include "config.h"
-#include<sys/statvfs.h>
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
+#include <sys/statvfs.h>
+#endif
#ifdef __cplusplus
}
#endif
-typedef struct statvfs Statvfs;
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ typedef struct statfs Statvfs;
+#else
+ typedef struct statvfs Statvfs;
+#endif
MODULE = Filesys::Statvfs PACKAGE = Filesys::Statvfs
@@ -20,34 +29,63 @@
PREINIT:
Statvfs st;
Statvfs *st_ptr;
+ long t;
PPCODE:
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ if(statfs(dir, &st) == 0) {
+#else
if(statvfs(dir, &st) == 0) {
+#endif
st_ptr=&st;
EXTEND(sp, 15);
PUSHs(sv_2mortal(newSViv(st_ptr->f_bsize)));
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ PUSHs(sv_2mortal(newSViv(0)));
+#else
PUSHs(sv_2mortal(newSViv(st_ptr->f_frsize)));
+#endif
PUSHs(sv_2mortal(newSViv(st_ptr->f_blocks)));
PUSHs(sv_2mortal(newSViv(st_ptr->f_bfree)));
PUSHs(sv_2mortal(newSViv(st_ptr->f_bavail)));
PUSHs(sv_2mortal(newSViv(st_ptr->f_files)));
PUSHs(sv_2mortal(newSViv(st_ptr->f_ffree)));
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ PUSHs(sv_2mortal(newSViv(st_ptr->f_ffree)));
+#else
PUSHs(sv_2mortal(newSViv(st_ptr->f_favail)));
+#endif
#if defined(_AIX__) || defined(_LINUX__)
PUSHs(sv_2mortal(newSViv(0)));
#else
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ memcpy (&t, &st_ptr->f_fsid, sizeof (long));
+ PUSHs(sv_2mortal(newSViv(t)));
+#else
PUSHs(sv_2mortal(newSViv(st_ptr->f_fsid)));
#endif
+#endif
#ifdef _LINUX__
PUSHs(sv_2mortal(newSVpv(NULL, 1)));
#else
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ PUSHs(sv_2mortal(newSVpv(st_ptr->f_fstypename, 0)));
+#else
PUSHs(sv_2mortal(newSVpv(st_ptr->f_basetype, 0)));
#endif
+#endif
+#if defined(__APPLE__ ) || defined(__FreeBSD__)
+ PUSHs(sv_2mortal(newSViv(st_ptr->f_flags)));
+ PUSHs(sv_2mortal(newSVpv(st_ptr->f_mntonname, MNAMELEN)));
+#else
PUSHs(sv_2mortal(newSViv(st_ptr->f_flag)));
PUSHs(sv_2mortal(newSViv(st_ptr->f_namemax)));
+#endif
#if defined(_DEC__) || defined(_LINUX__)
PUSHs(sv_2mortal(newSVpv(NULL, 1)));
#else
+#if ! defined(__APPLE__ ) && ! defined(__FreeBSD__)
PUSHs(sv_2mortal(newSVpv(st_ptr->f_fstr, 0)));
+#endif
#endif
#ifdef _HPUX__
PUSHs(sv_2mortal(newSViv(st_ptr->f_size)));

View File

@ -0,0 +1,13 @@
Filesys::Statvfs provides an interface between
Perl and the statvfs() system call.
Filesys::Df uses Filesys::Statvfs to obtain
filesystem statistics then creates additional
filesystem information such as percent full,
user and superuser differentials, etc.
Filesys::Df will also let you specify the
block size for the values you wish to see.
The default block size output is 1024 bytes per
block. So if you want to get the size in bytes
just take the block size and * it by 1024.

View File

@ -0,0 +1,5 @@
%%SITE_PERL%%/%%PERL_ARCH%%/Filesys/Df.pm
%%SITE_PERL%%/%%PERL_ARCH%%/Filesys/Statvfs.pm
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Filesys/Statvfs/.packlist
@unexec rmdir %D/%%SITE_PERL%%/%%PERL_ARCH%%/auto/Filesys 2>/dev/null || true
@unexec rmdir %D/%%SITE_PERL%%/Filesys 2>/dev/null || true