summaryrefslogtreecommitdiff
path: root/misc/mbuffer
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-12-26 02:03:25 +0000
committerRong-En Fan <rafan@FreeBSD.org>2008-12-26 02:03:25 +0000
commit201ef559ef6e0d9568924f912fc5b0e001e3191f (patch)
treedb40403044985d769b79cc5cdb3d370483f8ac58 /misc/mbuffer
parentAdd json-glib, an JSON (RFC 4627) interface for Glib. This interface (diff)
- Update to 20081207 which fixes many bugs from previous version in ports
Notes
Notes: svn path=/head/; revision=224783
Diffstat (limited to 'misc/mbuffer')
-rw-r--r--misc/mbuffer/Makefile3
-rw-r--r--misc/mbuffer/distinfo6
-rw-r--r--misc/mbuffer/files/patch-mbuffer.c124
3 files changed, 88 insertions, 45 deletions
diff --git a/misc/mbuffer/Makefile b/misc/mbuffer/Makefile
index 34fb704af5d7..e56d515abd6c 100644
--- a/misc/mbuffer/Makefile
+++ b/misc/mbuffer/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= mbuffer
-PORTVERSION= 2006.07.28
+PORTVERSION= 2008.12.07
CATEGORIES= misc
MASTER_SITES= http://www.maier-komor.de/software/mbuffer/
DISTNAME= ${PORTNAME}-${PORTVERSION:S/.//g}
@@ -17,6 +17,7 @@ COMMENT= A tool for buffering data streams
USE_GMAKE= yes
GNU_CONFIGURE= yes
+MAKE_ARGS= SHELL=${SH}
PLIST_FILES= bin/mbuffer
diff --git a/misc/mbuffer/distinfo b/misc/mbuffer/distinfo
index 183ce66b98d8..07d1d57c22ff 100644
--- a/misc/mbuffer/distinfo
+++ b/misc/mbuffer/distinfo
@@ -1,3 +1,3 @@
-MD5 (mbuffer-20060728.tgz) = 92310e1e06b248a22b37ad76f13c1339
-SHA256 (mbuffer-20060728.tgz) = b5584ccba77d151e160f1b6ef16ec9690b965a322c05fd7b2dbcfc5a7278691b
-SIZE (mbuffer-20060728.tgz) = 77820
+MD5 (mbuffer-20081207.tgz) = 640dab1531246f4e93ba5f0ccccff65b
+SHA256 (mbuffer-20081207.tgz) = 860972a2c6b781deb5340351713ad11036f3739882788fdfbca638ade604ffa6
+SIZE (mbuffer-20081207.tgz) = 105958
diff --git a/misc/mbuffer/files/patch-mbuffer.c b/misc/mbuffer/files/patch-mbuffer.c
index 04b2a034199e..c74f0794c56b 100644
--- a/misc/mbuffer/files/patch-mbuffer.c
+++ b/misc/mbuffer/files/patch-mbuffer.c
@@ -1,10 +1,14 @@
---- mbuffer.c.orig Fri Jul 28 23:05:14 2006
-+++ mbuffer.c Mon Dec 18 13:22:57 2006
-@@ -16,15 +16,18 @@
- #include <stdlib.h>
- #include <strings.h>
- #include <string.h>
--#include <stropts.h>
+--- mbuffer.c.orig 2008-12-24 12:17:41.000000000 +0800
++++ mbuffer.c 2008-12-24 12:36:47.000000000 +0800
+@@ -32,7 +32,6 @@
+ #include <fcntl.h>
+ #include <libgen.h>
+ #include <limits.h>
+-#include <malloc.h>
+ #include <math.h>
+ #include <pthread.h>
+ #include <semaphore.h>
+@@ -45,6 +44,8 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -13,52 +17,79 @@
#include <termios.h>
#include <unistd.h>
- #ifdef HAVE_SENDFILE
--#include <sys/sendfile.h>
+@@ -52,6 +53,9 @@
+ #ifdef HAVE_SENDFILE_H
+ #include <sys/sendfile.h>
+ #endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
/* if this sendfile implementation does not support sending from buffers,
disable sendfile support */
#ifndef SFV_FD_SELF
-@@ -1033,11 +1036,13 @@
- totalmem = calcint(argv,c,totalmem);
- optMset = 1;
- if (totalmem < 100) {
-- long pgsz, nump;
-+ long pgsz;
-+ unsigned long nump;
-+ size_t nump_size = sizeof(nump_size);
- pgsz = sysconf(_SC_PAGESIZE);
- assert(pgsz > 0);
-- nump = sysconf(_SC_PHYS_PAGES);
-- assert(pgsz > 0);
-+ sysctlbyname("hw.availptotals", &nump, &nump_size, NULL, 0);
-+ assert(nump > 0);
- debugmsg("total # of phys pages: %li (pagesize %li)\n",nump,pgsz);
- totalmem = ((unsigned long long) nump * pgsz * totalmem) / 100 ;
- }
-@@ -1046,8 +1051,8 @@
- Numblocks = (atoi(argv[c])) ? ((unsigned long long) atoll(argv[c])) : Numblocks;
- optBset = 1;
- debugmsg("Numblocks = %llu\n",Numblocks);
--#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- } else if (!argcheck("-d",argv,&c)) {
-+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- setOutsize = 1;
- debugmsg("setting output size according to the blocksize of the device\n");
- #else
-@@ -1112,7 +1117,7 @@
+@@ -855,7 +859,7 @@
+ err = fsync(fd);
+ while ((err != 0) && (errno == EINTR));
+ if (err != 0) {
+- if ((errno == EINVAL) || (errno == EBADRQC)) {
++ if ((errno == EINVAL)) {
+ infomsg("syncing unsupported on %s: omitted.\n",d->arg);
+ } else {
+ warningmsg("unable to sync %s: %s\n",d->arg,strerror(errno));
+@@ -1126,7 +1130,7 @@
+ err = fsync(d->fd);
+ while ((err != 0) && (errno == EINTR));
+ if (err != 0) {
+- if ((errno == EINVAL) || (errno == EBADRQC)) {
++ if ((errno == EINVAL)) {
+ infomsg("syncing unsupported on %s: omitted.\n",d->arg);
+ } else {
+ warningmsg("unable to sync %s: %s\n",d->arg,strerror(errno));
+@@ -1608,12 +1612,22 @@
+ const char *outfile = 0;
+ struct sigaction sig;
+ dest_t *dest = 0;
+-#if defined(_SC_AVPHYS_PAGES) && defined(_SC_PAGESIZE) && !defined(__CYGWIN__)
+- long pgsz, nump;
++#if (defined(_SC_AVPHYS_PAGES) && defined(_SC_PAGESIZE) && !defined(__CYGWIN__)) || defined(__FreeBSD__)
++#if defined(__FreeBSD__)
++ unsigned long nump;
++ size_t nump_size = sizeof(nump_size);
++#else
++ long nump;
++#endif
++ long pgsz;
+
+ pgsz = sysconf(_SC_PAGESIZE);
+ assert(pgsz > 0);
++#if defined(__FreeBSD__)
++ sysctlbyname("hw.availpages", &nump, &nump_size, NULL, 0);
++#else
+ nump = sysconf(_SC_AVPHYS_PAGES);
++#endif
+ assert(nump > 0);
+ Blocksize = pgsz;
+ Numblocks = nump/50;
+@@ -1664,6 +1678,8 @@
+ debugmsg("Verbose = %d\n",Verbose);
+ #if defined(_SC_AVPHYS_PAGES) && defined(_SC_PAGESIZE) && !defined(__CYGWIN__)
+ debugmsg("total # of phys pages: %li (pagesize %li)\n",nump,pgsz);
++#elif defined(__FreeBSD__)
++ debugmsg("total # of phys pages: %li (pagesize %li)\n",nump,pgsz);
+ #endif
+ debugmsg("default buffer set to %d blocks of %lld bytes\n",Numblocks,Blocksize);
+ } else if (!argcheck("-u",argv,&c,argc)) {
+@@ -1760,7 +1776,7 @@
Status = 0;
} else if (!strcmp("-c",argv[c])) {
debugmsg("enabling full synchronous I/O\n");
- OptSync = O_DSYNC;
+ OptSync = O_FSYNC;
- } else if (!argcheck("-a",argv,&c)) {
+ } else if (!argcheck("-a",argv,&c,argc)) {
Autoloader = 1;
Autoload_time = atoi(argv[c]);
-@@ -1202,7 +1207,14 @@
- fatal("multi volume support for input needs an explicit given input device (option -i)\n");
+@@ -1864,7 +1880,14 @@
+ /* SPW END */
/* check that we stay within system limits */
- mxnrsem = sysconf(_SC_SEM_VALUE_MAX);
@@ -72,4 +103,15 @@
+ }
if (-1 == mxnrsem) {
warningmsg("unable to determine maximum value of semaphores\n");
- } else if (Numblocks > (unsigned long long) mxnrsem)
+ } else if (Numblocks > (unsigned long long) mxnrsem) {
+@@ -1874,8 +1897,8 @@
+ if ((Blocksize * (long long)Numblocks) > (long long)SSIZE_MAX)
+ fatal("Cannot address so much memory (%lld*%d=%lld>%lld).\n",Blocksize,Numblocks,Blocksize*(long long)Numblocks,(long long)SSIZE_MAX);
+ /* create buffer */
+- Buffer = (char **) memalign(sysconf(_SC_PAGESIZE),Numblocks * sizeof(char *));
+- if (!Buffer)
++ err = posix_memalign(&Buffer,sysconf(_SC_PAGESIZE),Numblocks * sizeof(char *));
++ if (err || !Buffer)
+ fatal("Could not allocate enough memory (%d requested): %s\n",Numblocks * sizeof(char *),strerror(errno));
+ if (Memmap) {
+ infomsg("mapping temporary file to memory with %llu blocks with %llu byte (%llu kB total)...\n",(unsigned long long) Numblocks,(unsigned long long) Blocksize,(unsigned long long) ((Numblocks*Blocksize) >> 10));