From 0b6df8f20a87a70b9d935d971a30d184d2028ad9 Mon Sep 17 00:00:00 2001
From: Renato Botelho <garga@FreeBSD.org>
Date: Wed, 26 Jul 2006 15:33:21 +0000
Subject: Xdd is a tool for measuring and characterizing disk subsystem I/O on
 single systems and clusters of systems. It is a command-line based tool that
 grew out of the UNIX world and has been ported to run in Windows environments
 as well. It is designed to provide consistent and reproducible performance
 measurements of disk I/O traffic. There are three basic components to xdd
 that include the xdd program itself, a timeserver program, and a gettime
 program. The timeserver and gettime programs are used to synchronize the
 clocks of xdd programs simultaneously running across multiple computer
 systems.

WWW: http://www.ioperformance.com/

PR:		ports/100833
Submitted by:	Gerhard Gonter <g.gonter at ieee.org>
---
 sysutils/xdd/Makefile                     | 37 ++++++++++++++++
 sysutils/xdd/distinfo                     |  3 ++
 sysutils/xdd/files/freebsd.makefile       | 69 ++++++++++++++++++++++++++++
 sysutils/xdd/files/patch-global_time.c    | 19 ++++++++
 sysutils/xdd/files/patch-initialization.c | 73 ++++++++++++++++++++++++++++++
 sysutils/xdd/files/patch-misc.h           | 29 ++++++++++++
 sysutils/xdd/files/patch-parse.c          | 20 +++++++++
 sysutils/xdd/files/patch-ticker.c         | 29 ++++++++++++
 sysutils/xdd/files/patch-ticker.h         | 11 +++++
 sysutils/xdd/files/patch-timeserver.c     | 32 +++++++++++++
 sysutils/xdd/files/patch-xdd.c            | 74 +++++++++++++++++++++++++++++++
 sysutils/xdd/files/patch-xdd.h            | 72 ++++++++++++++++++++++++++++++
 sysutils/xdd/pkg-descr                    | 16 +++++++
 13 files changed, 484 insertions(+)
 create mode 100644 sysutils/xdd/Makefile
 create mode 100644 sysutils/xdd/distinfo
 create mode 100644 sysutils/xdd/files/freebsd.makefile
 create mode 100644 sysutils/xdd/files/patch-global_time.c
 create mode 100644 sysutils/xdd/files/patch-initialization.c
 create mode 100644 sysutils/xdd/files/patch-misc.h
 create mode 100644 sysutils/xdd/files/patch-parse.c
 create mode 100644 sysutils/xdd/files/patch-ticker.c
 create mode 100644 sysutils/xdd/files/patch-ticker.h
 create mode 100644 sysutils/xdd/files/patch-timeserver.c
 create mode 100644 sysutils/xdd/files/patch-xdd.c
 create mode 100644 sysutils/xdd/files/patch-xdd.h
 create mode 100644 sysutils/xdd/pkg-descr

(limited to 'sysutils/xdd')

diff --git a/sysutils/xdd/Makefile b/sysutils/xdd/Makefile
new file mode 100644
index 000000000000..7912418c8803
--- /dev/null
+++ b/sysutils/xdd/Makefile
@@ -0,0 +1,37 @@
+# New ports collection makefile for:	sysutils/xdd
+# Date created:				29.05.2006
+# Whom:					Gerhard Gonter <g.gonter@ieee.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME=	xdd
+PORTVERSION=	64
+CATEGORIES=	sysutils
+MASTER_SITES=	http://www.ioperformance.com/xddversions/
+DISTNAME=	xdd64.121805
+
+MAINTAINER=	g.gonter@ieee.org
+COMMENT=	Tool for measuring and characterizing disk subsystem I/O
+
+WRKSRC=		${WRKDIR}/${PORTNAME}${PORTVERSION}
+PLIST_FILES=	bin/xdd bin/timeserver bin/gettime
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+BROKEN=	Doesn't build on 4.x
+.endif
+
+post-extract:
+	${CP} ${FILESDIR}/freebsd.makefile ${WRKSRC}
+
+do-build:
+	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} -f freebsd.makefile
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/xdd.freebsd ${PREFIX}/bin/xdd
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/timeserver.freebsd ${PREFIX}/bin/timeserver
+	${INSTALL_PROGRAM} ${WRKSRC}/bin/gettime.freebsd ${PREFIX}/bin/gettime
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/xdd/distinfo b/sysutils/xdd/distinfo
new file mode 100644
index 000000000000..79142b9f8b58
--- /dev/null
+++ b/sysutils/xdd/distinfo
@@ -0,0 +1,3 @@
+MD5 (xdd64.121805.tar.gz) = 10cc5daeddb3853833f88d20cf6fda3e
+SIZE (xdd64.121805.tar.gz) = 1985205
+SHA256 (xdd64.121805.tar.gz) = cfa60804145bec2066b494cb47d734ae3d50a4d0344bd1cc5277214cada804df
diff --git a/sysutils/xdd/files/freebsd.makefile b/sysutils/xdd/files/freebsd.makefile
new file mode 100644
index 000000000000..71813707f637
--- /dev/null
+++ b/sysutils/xdd/files/freebsd.makefile
@@ -0,0 +1,69 @@
+# XDD Makefile for FreeBSD
+SHELL =		/bin/sh
+CC ?=		gcc
+CFLAGS +=	-DFreeBSD -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g 
+PROJECT =	xdd
+OBJECTS =	xdd.o access_pattern.o barrier.o global_time.o initialization.o parse.o pclk.o read_after_write.o results.o ticker.o time_stamp.o
+HEADERS = 	xdd.h pclk.h ticker.h misc.h 
+TSOBJECTS =	timeserver.o pclk.o ticker.o
+GTOBJECTS = gettime.o global_time.o pclk.o ticker.o
+
+all:	xdd timeserver gettime
+
+xdd:	$(OBJECTS) 
+	${CC}  -o xdd $(CFLAGS) $(OBJECTS) -lpthread -v
+	mv -f xdd bin/xdd.freebsd
+
+timeserver:	$(TSOBJECTS) 
+	${CC}  -o timeserver $(CFLAGS) $(TSOBJECTS) -lpthread -v
+	mv -f timeserver bin/timeserver.freebsd
+
+gettime:	$(GTOBJECTS) 
+	${CC}  -o gettime $(CFLAGS) $(GTOBJECTS) -lpthread -v
+	mv -f gettime bin/gettime.freebsd
+
+access_pattern.o:	access_pattern.c
+	${CC}  $(CFLAGS) -c access_pattern.c
+
+barrier.o:	barrier.c
+	${CC}  $(CFLAGS) -c barrier.c
+
+gettime.o: gettime.c
+	${CC} $(CFLAGS) -c gettime.c
+
+global_time.o:	global_time.c
+	${CC}  $(CFLAGS) -c global_time.c
+
+initialization.o:	initialization.c
+	${CC}  $(CFLAGS) -c initialization.c
+
+parse.o:	parse.c
+	${CC}  $(CFLAGS) -c parse.c
+
+pclk.o:	pclk.c 
+	${CC}  $(CFLAGS) -c pclk.c
+
+read_after_write.o:	read_after_write.c
+	${CC}  $(CFLAGS) -c read_after_write.c
+
+results.o:	results.c
+	${CC}  $(CFLAGS) -c results.c
+
+ticker.o:	ticker.c
+	${CC}  $(CFLAGS) -c ticker.c
+
+time_stamp.o:	time_stamp.c
+	${CC}  $(CFLAGS) -c time_stamp.c
+
+timeserver.o: timeserver.c
+	${CC} $(CFLAGS) -c timeserver.c
+
+xdd.o:  xdd.c 
+	${CC}  $(CFLAGS) -c xdd.c
+
+dist:	clean
+	tar cf ../dist.tar .
+clean:
+	-rm -f xdd timeserver gettime a.out $(OBJECTS) $(TSOBJECTS) $(GTOBJECTS)
+
+
diff --git a/sysutils/xdd/files/patch-global_time.c b/sysutils/xdd/files/patch-global_time.c
new file mode 100644
index 000000000000..26208e9008eb
--- /dev/null
+++ b/sysutils/xdd/files/patch-global_time.c
@@ -0,0 +1,19 @@
+--- global_time.c.orig	Mon May 29 04:12:29 2006
++++ global_time.c	Mon May 29 04:16:36 2006
+@@ -42,11 +42,15 @@
+ #else /* GENERIC_UNIX */
+ #include <netdb.h>
+ #include <sys/socket.h>
++#if (FreeBSD)
++#include <sys/types.h>
++#include <sys/unistd.h>
++#endif /* (FreeBSD) */
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
+ #include <arpa/inet.h>
+ #endif
+-#if (AIX || HPUX || SOLARIS)
++#if (AIX || HPUX || SOLARIS || FreeBSD)
+ #include <stdarg.h>
+ #endif
+ #include "xdd.h"
diff --git a/sysutils/xdd/files/patch-initialization.c b/sysutils/xdd/files/patch-initialization.c
new file mode 100644
index 000000000000..ea88eee2862b
--- /dev/null
+++ b/sysutils/xdd/files/patch-initialization.c
@@ -0,0 +1,73 @@
+--- initialization.c.orig	Mon May 29 04:17:28 2006
++++ initialization.c	Mon May 29 04:18:32 2006
+@@ -562,7 +562,7 @@
+ 	 * NOTE: This is not supported by all operating systems. 
+ 	 */
+ 	if (p->target_options & RX_SHARED_MEMORY) {
+-#if (AIX || LINUX || SOLARIS || OSX)
++#if (AIX || LINUX || SOLARIS || OSX || FreeBSD)
+ 		/* In AIX we need to get memory in a shared memory segment to avoid
+ 	     * the system continually trying to pin each page on every I/O operation */
+ #if (AIX)
+@@ -590,14 +590,14 @@
+ 		fprintf(xgp->errout,"%s: Shared Memory not supported on this OS - using valloc\n",
+ 			xgp->progname);
+ 		p->target_options &= ~RX_SHARED_MEMORY;
+-#if (IRIX || SOLARIS || HPUX || LINUX || AIX || ALTIX || OSX)
++#if (IRIX || SOLARIS || HPUX || LINUX || AIX || ALTIX || OSX || FreeBSD)
+ 		rwbuf = valloc(p->iosize);
+ #else
+ 		rwbuf = malloc(p->iosize);
+ #endif
+ #endif 
+ 	} else { /* Allocate memory the normal way */
+-#if (IRIX || SOLARIS || HPUX || LINUX || AIX || ALTIX || OSX)
++#if (IRIX || SOLARIS || HPUX || LINUX || AIX || ALTIX || OSX || FreeBSD)
+ 		rwbuf = valloc(p->iosize);
+ #else
+ 		rwbuf = malloc(p->iosize);
+@@ -684,7 +684,7 @@
+ 	newlim = liret - (PAGESIZE*8);
+ 	return;
+ #else
+-#if  (LINUX || SOLARIS || HPUX || OSX || AIX)
++#if  (LINUX || SOLARIS || HPUX || OSX || AIX || FreeBSD)
+ 	if (getuid() != 0) {
+ 		fprintf(xgp->errout,"(PID %d) %s: You must run as superuser to lock memory for %s\n",
+ 			getpid(),xgp->progname, sp);
+@@ -833,7 +833,7 @@
+ #endif
+ 	return;
+ #else
+-#if (IRIX || SOLARIS || HPUX || LINUX || ALTIX || OSX)
++#if (IRIX || SOLARIS || HPUX || LINUX || ALTIX || OSX || FreeBSD)
+ 	if (getuid() != 0) {
+ 		return;
+ 	}
+@@ -919,7 +919,7 @@
+                 return;
+ 
+ #if !(OSX)
+-#if (IRIX || SOLARIS || HPUX || AIX || LINUX || ALTIX || OSX)
++#if (IRIX || SOLARIS || HPUX || AIX || LINUX || ALTIX || OSX || FreeBSD)
+ 	if (getuid() != 0)
+ 		fprintf(xgp->errout,"%s: xdd_schedule_options: You must be super user to lock processes\n",xgp->progname);
+ #endif 
+@@ -933,7 +933,7 @@
+ 
+         /* reset priority */
+ 	if (xgp->global_options & RX_MAXPRI) {
+-#if (IRIX || SOLARIS || HPUX || AIX || LINUX || ALTIX || OSX)
++#if (IRIX || SOLARIS || HPUX || AIX || LINUX || ALTIX || OSX || FreeBSD)
+ 		if (getuid() != 0) 
+ 			fprintf(xgp->errout,"%s: xdd_schedule_options: You must be super user to max priority\n",xgp->progname);
+ #endif
+@@ -1063,7 +1063,7 @@
+ #endif
+ #if (IRIX || SOLARIS || HPUX || AIX || ALTIX)
+ 	struct stat64 statbuf; /* buffer for file statistics */
+-#elif ( LINUX || OSX )
++#elif ( LINUX || OSX || FreeBSD )
+ 	struct stat statbuf; /* buffer for file statistics */
+ #endif
+ 	int32_t  i; /* working variable */
diff --git a/sysutils/xdd/files/patch-misc.h b/sysutils/xdd/files/patch-misc.h
new file mode 100644
index 000000000000..f163e9bca1cb
--- /dev/null
+++ b/sysutils/xdd/files/patch-misc.h
@@ -0,0 +1,29 @@
+--- misc.h.orig	Mon May 29 04:04:19 2006
++++ misc.h	Mon May 29 04:12:05 2006
+@@ -35,7 +35,7 @@
+ /* -------- */
+ /* Includes */
+ /* -------- */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ #ifndef NDEBUG /* These are only needed if Assert() expands to something */
+ #include <stdio.h> /* fprintf(), stderr */
+ #include <unistd.h> /* pause() */
+@@ -60,7 +60,7 @@
+ /* --------- */
+ /* Constants */
+ /* --------- */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ #define MILLION  1000000LL /* 10^6, as opposed to 2^20 */
+ #define BILLION  1000000000LL /* 10^9, as opposed to 2^30 */
+ #define TRILLION 1000000000000LL /* 10^12, as opposed to 2^40 */
+@@ -77,7 +77,7 @@
+ #ifndef LLONG_MIN
+ #define LLONG_MIN (-LLONG_MAX - 1LL)
+ #endif
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ #ifndef LONGLONG_MIN
+ #define LONGLONG_MIN LLONG_MIN
+ #endif
diff --git a/sysutils/xdd/files/patch-parse.c b/sysutils/xdd/files/patch-parse.c
new file mode 100644
index 000000000000..9ca45648e169
--- /dev/null
+++ b/sysutils/xdd/files/patch-parse.c
@@ -0,0 +1,20 @@
+--- parse.c.orig	Thu Jun  1 14:48:28 2006
++++ parse.c	Thu Jun  1 14:56:44 2006
+@@ -697,7 +697,7 @@
+ xddfunc_delay(int32_t argc, char *argv[])
+ { 
+ 	xgp->passdelay = atoi(argv[1]);
+-    return(1);
++    return(2);
+ }
+ /*----------------------------------------------------------------------------*/
+ // Delete the target file when complete
+@@ -1101,7 +1101,7 @@
+ xddfunc_maxerrors(int32_t argc, char *argv[])
+ {
+ 	xgp->max_errors = atoi(argv[1]);
+-    return(1);
++    return(2);
+ }
+ /*----------------------------------------------------------------------------*/
+ // Set the maximum runtime priority
diff --git a/sysutils/xdd/files/patch-ticker.c b/sysutils/xdd/files/patch-ticker.c
new file mode 100644
index 000000000000..8ce4a109effd
--- /dev/null
+++ b/sysutils/xdd/files/patch-ticker.c
@@ -0,0 +1,29 @@
+--- ticker.c.orig	Mon May 29 04:23:53 2006
++++ ticker.c	Mon May 29 04:24:15 2006
+@@ -76,7 +76,7 @@
+     return;
+ }
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+-#elif (LINUX || SOLARIS || AIX || HPUX || OSX)
++#elif (LINUX || SOLARIS || AIX || HPUX || OSX || FreeBSD)
+ void
+ ticker_open(tick_t *tickp) {
+     uint32_t picos;
+@@ -161,7 +161,7 @@
+     return; /* Ticker not open, or error reading ticker */
+ }
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+-#elif (LINUX || SOLARIS || AIX || HPUX || OSX)
++#elif (LINUX || SOLARIS || AIX || HPUX || OSX || FreeBSD)
+ void
+ ticker_read(tick_t *tickp) {
+     struct timeval current_time;
+@@ -198,7 +198,7 @@
+  *
+  * Close the ticker.
+  */
+-#if (WIN32 || LINUX || SOLARIS || AIX || HPUX || OSX)
++#if (WIN32 || LINUX || SOLARIS || AIX || HPUX || OSX || FreeBSD)
+ void
+ ticker_close(void) {
+     ticker_period = 0;
diff --git a/sysutils/xdd/files/patch-ticker.h b/sysutils/xdd/files/patch-ticker.h
new file mode 100644
index 000000000000..43dd18b7aedd
--- /dev/null
+++ b/sysutils/xdd/files/patch-ticker.h
@@ -0,0 +1,11 @@
+--- ticker.h.orig	Mon May 29 04:02:17 2006
++++ ticker.h	Mon May 29 04:02:33 2006
+@@ -35,7 +35,7 @@
+ /* Types */
+ /* ----- */
+ /* A ticker value */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ typedef unsigned long long tick_t;
+ #else
+ typedef unsigned __int64  tick_t;
diff --git a/sysutils/xdd/files/patch-timeserver.c b/sysutils/xdd/files/patch-timeserver.c
new file mode 100644
index 000000000000..861d28138963
--- /dev/null
+++ b/sysutils/xdd/files/patch-timeserver.c
@@ -0,0 +1,32 @@
+--- timeserver.c.orig	Mon May 29 04:25:26 2006
++++ timeserver.c	Mon May 29 04:25:56 2006
+@@ -29,9 +29,9 @@
+ #include <stdarg.h> /* variable arguments stuff */
+ #include <string.h> /* strrchr(), strerror() */
+ #include <errno.h> /* errno stuff */
+-#if (IRIX || SOLARIS || AIX || HPUX || LINUX || OSX)
++#if (IRIX || SOLARIS || AIX || HPUX || LINUX || OSX || FreeBSD)
+ #include <unistd.h>
+-#if !(SOLARIS || AIX || HPUX || LINUX || OSX)
++#if !(SOLARIS || AIX || HPUX || LINUX || OSX || FreeBSD)
+ #include <bstring.h>
+ #endif
+ #include <limits.h> /* USHRT_MAX */
+@@ -57,7 +57,7 @@
+ /* ----- */
+ /* Types */
+ /* ----- */
+-#if !(IRIX || SOLARIS || AIX || HPUX || LINUX || OSX)
++#if !(IRIX || SOLARIS || AIX || HPUX || LINUX || OSX || FreeBSD)
+ /* SGI defines these in <netinet/in.h> */
+ typedef unsigned long in_addr_t; /* An IP number */
+ typedef unsigned short in_port_t; /* A port number */
+@@ -231,7 +231,7 @@
+ #if (AIX)
+     nd = sd + 1;
+ #endif
+-#if (SOLARIS || HPUX || OSX)
++#if (SOLARIS || HPUX || OSX || FreeBSD)
+ 	nd = FD_SETSIZE;
+ #endif
+     for (;;) {
diff --git a/sysutils/xdd/files/patch-xdd.c b/sysutils/xdd/files/patch-xdd.c
new file mode 100644
index 000000000000..6b39d23a4f9d
--- /dev/null
+++ b/sysutils/xdd/files/patch-xdd.c
@@ -0,0 +1,74 @@
+--- xdd.c.orig	Mon May 29 04:06:49 2006
++++ xdd.c	Mon May 29 04:24:54 2006
+@@ -60,7 +60,7 @@
+ 	/* Things used by the read-after-write operations */
+ #if (IRIX || SOLARIS || HPUX || AIX || ALTIX)
+ 	struct stat64 statbuf;
+-#elif (LINUX || OSX)
++#elif (LINUX || OSX || FreeBSD)
+     struct  stat    statbuf;
+ #endif
+ 	int64_t prev_loc; /* The previous location from a read-after-write message from the writer */
+@@ -114,11 +114,11 @@
+ 		sleep_time_dw = (int32_t)(p->start_delay/BILLION);
+ #ifdef WIN32
+ 		Sleep(sleep_time_dw);
+-#elif (LINUX || IRIX || AIX || ALTIX || OSX) /* Add OS Support to this line for usleep() */
++#elif (LINUX || IRIX || AIX || ALTIX || OSX || FreeBSD) /* Add OS Support to this line for usleep() */
+ 		if ((sleep_time_dw*CLK_TCK) > 1000) /* only sleep if it will be 1 or more ticks */
+ #if (IRIX || ALTIX)
+ 			sginap((sleep_time_dw*CLK_TCK)/1000);
+-#elif (LINUX || AIX || OSX) /* Add OS Support to this line for usleep() as well*/
++#elif (LINUX || AIX || OSX || FreeBSD) /* Add OS Support to this line for usleep() as well*/
+ 			usleep(sleep_time_dw*1000);
+ #endif
+ #endif
+@@ -384,14 +384,14 @@
+ 				p->my_current_byte_location = (uint64_t)((p->mynum * xgp->target_offset) + p->seekhdr.seeks[0].block_location) * p->block_size;
+ 		else    p->my_current_byte_location = (uint64_t)((p->mynum * xgp->target_offset) + p->seekhdr.seeks[current_op].block_location) * p->block_size;
+ 
+-#if (LINUX || IRIX || SOLARIS || HPUX || AIX || ALTIX || OSX)
++#if (LINUX || IRIX || SOLARIS || HPUX || AIX || ALTIX || OSX || FreeBSD)
+ 		if ((p->target_options & RX_READAFTERWRITE) && (p->target_options & RX_RAW_READER)) { 
+ // fprintf(stderr,"Reader: RAW check - dataready=%lld, trigger=%x\n",data_ready,p->raw_trigger);
+ 			/* Check to see if we can read more data - if not see where we are at */
+ 			if (p->raw_trigger & RX_RAW_STAT) { /* This section will continually poll the file status waiting for the size to increase so that it can read more data */
+ 				while (data_ready < p->iosize) {
+ 					/* Stat the file so see if there is data to read */
+-#if (LINUX || OSX)
++#if (LINUX || OSX || FreeBSD)
+ 					status = fstat(p->fd,&statbuf);
+ #else
+ 					status = fstat64(p->fd,&statbuf);
+@@ -472,11 +472,11 @@
+ 					sleep_time_dw = sleep_time;
+ #ifdef WIN32
+ 					Sleep(sleep_time_dw);
+-#elif (LINUX || IRIX || AIX || ALTIX || OSX) /* Change this line to use usleep */
++#elif (LINUX || IRIX || AIX || ALTIX || OSX || FreeBSD) /* Change this line to use usleep */
+ 					if ((sleep_time_dw*CLK_TCK) > 1000) /* only sleep if it will be 1 or more ticks */
+ #if (IRIX || ALTIX)
+ 						sginap((sleep_time_dw*CLK_TCK)/1000);
+-#elif (LINUX || AIX || OSX) /* Change this line to use usleep */
++#elif (LINUX || AIX || OSX || FreeBSD) /* Change this line to use usleep */
+ 						usleep(sleep_time_dw*1000);
+ #endif
+ #endif
+@@ -564,7 +564,7 @@
+ #else /* UUUUUUUUUUUUUUUU Begin Unix stuff UUUUUUUUUUUUUUUUU*/
+ #if (IRIX || SOLARIS || HPUX || AIX || ALTIX)
+ 		lseek64(p->fd,(off64_t)p->my_current_byte_location,0); 
+-#elif (LINUX || OSX)
++#elif (LINUX || OSX || FreeBSD)
+ 		/* In Linux the -D_FILE_OFFSET_BITS=64 make the off_t type be a 64-bit integer */
+                 if (!p->target_options & RX_SGIO) 
+ 		    lseek(p->fd, (off_t)p->my_current_byte_location, SEEK_SET);
+@@ -653,7 +653,7 @@
+             }
+         }
+         
+-#if (LINUX || IRIX || SOLARIS || HPUX || AIX || ALTIX || OSX)
++#if (LINUX || IRIX || SOLARIS || HPUX || AIX || ALTIX || OSX || FreeBSD)
+ 		if ((p->target_options & RX_READAFTERWRITE) && (p->target_options & RX_RAW_WRITER)) {
+ 			/* Since I am the writer in a read-after-write operation, and if we are using a socket connection to the reader for write-completion messages
+ 			 * then I need to send the reader a message of what I just wrote - starting location and length of write.
diff --git a/sysutils/xdd/files/patch-xdd.h b/sysutils/xdd/files/patch-xdd.h
new file mode 100644
index 000000000000..91fa36b6428f
--- /dev/null
+++ b/sysutils/xdd/files/patch-xdd.h
@@ -0,0 +1,72 @@
+--- xdd.h.orig	Mon Dec 19 03:13:28 2005
++++ xdd.h	Mon May 29 04:45:14 2006
+@@ -46,7 +46,7 @@
+ #include <sys/ipc.h>
+ #include <sys/sem.h>
+ #include <sys/times.h>
+-#if !(SOLARIS || HPUX || AIX || OSX)
++#if !(SOLARIS || HPUX || AIX || OSX || FreeBSD)
+ #include <sys/prctl.h>
+ #endif
+ #include <sys/param.h>
+@@ -68,6 +68,11 @@
+ #include <sys/procset.h>
+ #include <sys/utsname.h>
+ #endif
++#ifdef FreeBSD
++#include <inttypes.h>
++#include <sys/types.h>
++#include <sys/unistd.h>
++#endif
+ #ifdef AIX
+ #include <sys/processor.h>
+ #include <ulimit.h>
+@@ -90,7 +95,7 @@
+ #include <sys/utsname.h>
+ #endif
+ /* for the global clock stuff */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ #include <netdb.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+@@ -197,7 +202,7 @@
+ #ifdef HPUX
+ typedef unsigned short in_port_t;
+ #endif
+-#if (LINUX || SOLARIS || HPUX || AIX || OSX)
++#if (LINUX || SOLARIS || HPUX || AIX || OSX || FreeBSD)
+ #define MP_MUSTRUN 1 /* ASsign this thread to a specific processor */
+ #define MP_NPROCS 2 /* return the number of processors on the system */
+ typedef int  sd_t;  /* A socket descriptor */
+@@ -290,8 +295,13 @@
+ #define RX_SHARED_MEMORY    0x020000000  /* Use a shared memory segment instead of malloced memmory */
+ #define RX_VERBOSE          0x040000000  /* Verbose output */
+ #define RX_SEQUENCED_PATTERN 0x080000000  /* Sequenced Data Pattern in the data buffer */
++#if (FreeBSD)
++#define RX_NOMEMLOCK         0x100000000LL  /* Do not lock memory */
++#define RX_NOPROCLOCK        0x200000000LL  /* Do not lock process */
++#else
+ #define RX_NOMEMLOCK         0x100000000  /* Do not lock memory */
+ #define RX_NOPROCLOCK        0x200000000  /* Do not lock process */
++#endif
+ /* ts_options bit settings */
+ #define TS_NORMALIZE        0x00000001 /* Time stamping normalization of output*/
+ #define TS_ON               0x00000002 /* Time stamping is ON */
+@@ -330,14 +340,14 @@
+ /* XXX *//* This needs to be converted to use a config file */
+ /* Default flag values */
+ #define DFL_FL_SERVER false  /* Client by default */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || FreeBSD)
+ #define DFL_FL_ADDR INADDR_ANY /* Any address */  /* server only */
+ #else /* Windows */
+ #define DFL_FL_ADDR 0x8065b61b /* crystal 128.101.182.27 */
+ #endif
+ #define DFL_FL_PORT 2000  /* Port to use */
+ #define DFL_FL_COUNT 10  /* Bounce a hundred times */
+-#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX)
++#if (LINUX || AIX || IRIX || SOLARIS || HPUX || ALTIX || OSX || FreeBSD)
+ #define DFL_FL_TIME 99160##000000000000LL /* Zero means don't wait */
+ #else
+ #define DFL_FL_TIME 99160##000000000000I64 /* Zero means don't wait */
diff --git a/sysutils/xdd/pkg-descr b/sysutils/xdd/pkg-descr
new file mode 100644
index 000000000000..07d3c01fda52
--- /dev/null
+++ b/sysutils/xdd/pkg-descr
@@ -0,0 +1,16 @@
+From the Xdd User's Guide:
+
+About xdd
+
+Xdd is a tool for measuring and characterizing disk subsystem I/O
+on single systems and clusters of systems. It is a command-line
+based tool that grew out of the UNIX world and has been ported to
+run in Windows environments as well. It is designed to provide
+consistent and reproducible performance measurements of disk I/O
+traffic. There are three basic components to xdd that include the
+xdd program itself, a timeserver program, and a gettime program.
+The timeserver and gettime programs are used to synchronize the
+clocks of xdd programs simultaneously running across multiple
+computer systems.
+
+WWW: http://www.ioperformance.com/
-- 
cgit v1.2.3