ports/70041: [ maintainer ] sysutils/torsmo: fix build on FreeBSD 4.x

Roman Bogorodskiy bogorodskiy at inbox.ru
Thu Aug 5 16:50:27 UTC 2004


>Number:         70041
>Category:       ports
>Synopsis:       [ maintainer ] sysutils/torsmo: fix build on FreeBSD 4.x
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 05 16:50:26 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Roman Bogorodskiy
>Release:        FreeBSD 5.2.1-RELEASE-p9 i386
>Organization:
>Environment:
System: FreeBSD lame.novel.ru 5.2.1-RELEASE-p9 FreeBSD 5.2.1-RELEASE-p9 #11: Thu Aug 5 07:58:46 MSD 2004 root at lame.novel.ru:/usr/obj/usr/src/sys/NOV i386


>Description:
	I'm sorry, this patch should been included in my previous pr but
	I forgot. Anyway, it should not conflict with previous patch because 
	different files were changed.

	This patch makes torsmo use statfs(2) instead of statvfs(3) which is 
	not present on FreeBSD 4.x. Anyway, I have no FreeBSD 4.x box here, 
	so this patch should be tested. 
>How-To-Repeat:
>Fix:

diff -ruN torsmo.orig/Makefile torsmo/Makefile
--- torsmo.orig/Makefile	Thu Aug  5 19:40:18 2004
+++ torsmo/Makefile	Thu Aug  5 20:29:38 2004
@@ -26,10 +26,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} < 500000
-BROKEN=		does not build, use statvfs interface which is only present on FreeBSD 5.0 or newer
-.endif
-
 post-extract:
 	@${CP} ${FILESDIR}/freebsd.c ${WRKSRC}
 
diff -ruN torsmo.orig/files/patch-fs.c torsmo/files/patch-fs.c
--- torsmo.orig/files/patch-fs.c	Thu Jan  1 03:00:00 1970
+++ torsmo/files/patch-fs.c	Thu Aug  5 20:29:19 2004
@@ -0,0 +1,37 @@
+--- fs.c.orig	Thu Aug  5 19:59:50 2004
++++ fs.c	Thu Aug  5 20:01:50 2004
+@@ -3,10 +3,12 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+-#include <sys/statvfs.h>
+ #include <sys/types.h>
+ #include <fcntl.h>
+ 
++#include <sys/param.h>
++#include <sys/mount.h>
++
+ /* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and
+  * statvfs() (fstatvfs() would handle mounts I think...) */
+ 
+@@ -15,16 +17,16 @@
+ 
+ void update_fs_stats() {
+   unsigned int i;
+-  struct statvfs s;
++  struct statfs s;
+   for (i=0; i<16; i++) {
+     if (fs_stats[i].fd <= 0)
+       break;
+ 
+-    fstatvfs(fs_stats[i].fd, &s);
++    fstatfs(fs_stats[i].fd, &s);
+ 
+-    fs_stats[i].size = (long long) s.f_blocks * s.f_frsize;
++    fs_stats[i].size = (long long) s.f_blocks * s.f_bsize;
+     /* bfree (root) or bavail (non-roots) ? */
+-    fs_stats[i].avail = (long long) s.f_bavail * s.f_frsize;
++    fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize;
+   }
+ }
+ 


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list