diff -rnup filebench-1.4.8/INSTALL filebench-1.4.8-freebsd/INSTALL --- filebench-1.4.8/INSTALL 2009-06-08 17:18:00.000000000 +0000 +++ filebench-1.4.8-freebsd/INSTALL 2009-09-01 11:53:31.000000000 +0000 @@ -40,5 +40,17 @@ $ autoconf $ autoheader $ automake --add-missing --copy $ ./configure --prefix=/opt --exec_prefix=/opt/filebench --datadir=/opt +$ make $ sudo make install +Building on FreeBSD +-------------------- + +To compile: +$ aclocal +$ autoconf +$ autoheader +$ automake --add-missing --copy +$ ./configure --prefix=/usr/local +$ make +$ make install diff -rnup filebench-1.4.8/configure.in filebench-1.4.8-freebsd/configure.in --- filebench-1.4.8/configure.in 2009-06-08 17:18:00.000000000 +0000 +++ filebench-1.4.8-freebsd/configure.in 2009-09-01 11:49:37.000000000 +0000 @@ -74,6 +74,15 @@ case "$host_os$host_cpu" in FILEBENCHDIR=${prefix}/filebench FILEBENCHBIN=${prefix}/filebench/bin ;; + *freebsd*) + CC=cc + LDLIBS="-lpthread -lm -L/usr/local/lib -ltecla" + LFLAGS="-t" + CFLAGS="-g -DYYDEBUG=1 -I/usr/local/include" + YFLAGS="-d" + FILEBENCHDIR=${prefix}/share/filebench + FILEBENCHBIN=${prefix}/bin + ;; gnu*|linux*) CC=cc ### pthread_rwlock_t is only exposed if we define __USE_UNIX98 on Linux @@ -192,7 +201,7 @@ AC_FUNC_STRTOD AC_FUNC_VPRINTF # Check for general functions -AC_CHECK_FUNCS([basename close signal sigsend sleep sprintf strlen strncmp strncpy \ +AC_CHECK_FUNCS([basename close signal sigignore sigsend sleep sprintf strlen strncmp strncpy \ setrlimit strrchr strstr times unlink vfprintf vsprintf waitpid \ write stat stralloc strcat strcmp strcpy strerror pwrite \ read execl execname exit fflush fork fork1 fprintf free \ @@ -227,6 +236,7 @@ AC_CHECK_HEADERS([libaio.h]) AC_CHECK_HEADERS([aio.h]) AC_CHECK_HEADERS([sys/async.h]) AC_CHECK_HEADERS([sys/shm.h]) +AC_CHECK_HEADERS([inet/ip.h]) AC_CHECK_TYPES([uint_t, off64_t, hrtime_t, caddr_t]) AC_CHECK_FUNCS([cftime], [ AC_DEFINE(HAVE_CFTIME, 1, [ Define if you have cftime() ]) diff -rnup filebench-1.4.8/filebench/fb_localfs.c filebench-1.4.8-freebsd/filebench/fb_localfs.c --- filebench-1.4.8/filebench/fb_localfs.c 2009-06-08 20:23:59.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/fb_localfs.c 2009-09-01 10:01:09.000000000 +0000 @@ -30,16 +30,6 @@ #include "flowop.h" #include "threadflow.h" /* For aiolist definition */ -#ifndef HAVE_OFF64_T -/* - * We are probably on linux. - * According to http://www.suse.de/~aj/linux_lfs.html, defining the - * above, automatically changes type of off_t to off64_t. so let - * us use only off_t as off64_t is not defined - */ -#define off64_t off_t -#endif /* HAVE_OFF64_T */ - #include #include #include @@ -62,10 +52,6 @@ #include #endif /* HAVE_LIBAIO_H */ -#ifndef HAVE_AIOCB64_T -#define aiocb64 aiocb -#endif /* HAVE_AIOCB64_T */ - /* * These routines implement local file access. They are placed into a * vector of functions that are called by all I/O operations in fileset.c diff -rnup filebench-1.4.8/filebench/filebench.h filebench-1.4.8-freebsd/filebench/filebench.h --- filebench-1.4.8/filebench/filebench.h 2009-06-08 20:39:17.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/filebench.h 2009-09-01 10:15:14.000000000 +0000 @@ -54,6 +54,41 @@ typedef unsigned int uint_t; #define FALSE 0 #endif +/* For MacOS X and FreeBSD. */ +#ifndef HAVE_OFF64_T +#define off64_t off_t +#define mmap64 mmap +#define open64 open +#define stat64 stat +#define pread64 pread +#define pwrite64 pwrite +#define lseek64 lseek +#define fstat64 fstat +#endif /* !HAVE_OFF64_T */ + +/* For MacOS X and FreeBSD. */ +#ifndef HAVE_STATVFS64 +#include +#include + +#define statvfs64 statfs +#define f_basetype f_fstypename +#define FSTYPSZ MFSNAMELEN +#endif /* !HAVE_STATVFS64 */ + +#ifdef HAVE_AIO +#ifndef HAVE_AIOCB64_T +#define aiocb64 aiocb +#define aio_error64 aio_error +#define aio_return64 aio_return +#define aio_write64 aio_write +#endif /* !HAVE_AIOCB64_T */ +#endif /* HAVE_AIO */ + +#ifndef HAVE_SIGIGNORE +#define sigignore(sig) signal((sig), SIG_IGN) +#endif + #include "procflow.h" #include "misc.h" #include "ipc.h" @@ -135,18 +170,6 @@ void filebench_plugin_funcvecinit(void); #define FILEBENCH_ERROR -1 #define FILEBENCH_NORSC -2 -/* For MacOSX */ -#ifndef HAVE_OFF64_T -#define mmap64 mmap -#define off64_t off_t -#define open64 open -#define stat64 stat -#define pread64 pread -#define pwrite64 pwrite -#define lseek64 lseek -#define fstat64 fstat -#endif - #ifdef __cplusplus } #endif diff -rnup filebench-1.4.8/filebench/fileset.h filebench-1.4.8-freebsd/filebench/fileset.h --- filebench-1.4.8/filebench/fileset.h 2009-06-08 20:24:10.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/fileset.h 2009-09-01 09:58:59.000000000 +0000 @@ -27,17 +27,6 @@ #define _FB_FILESET_H #include "filebench.h" -#include "config.h" - -#ifndef HAVE_OFF64_T -/* - * We are probably on linux. - * According to http://www.suse.de/~aj/linux_lfs.html, defining the - * above, automatically changes type of off_t to off64_t. so let - * us use only off_t as off64_t is not defined - */ -#define off64_t off_t -#endif /* HAVE_OFF64_T */ #include #include diff -rnup filebench-1.4.8/filebench/multi_client_sync.c filebench-1.4.8-freebsd/filebench/multi_client_sync.c --- filebench-1.4.8/filebench/multi_client_sync.c 2009-06-08 20:23:59.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/multi_client_sync.c 2009-09-01 05:51:15.000000000 +0000 @@ -45,6 +45,9 @@ mc_sync_open_sock(char *master_name, int { struct sockaddr_in client_in; struct sockaddr_in master_in; +#ifdef __FreeBSD__ + struct hostent *mip; +#endif struct hostent master_info; int error_num; char buffer[MCS_MSGLENGTH]; @@ -65,11 +68,19 @@ mc_sync_open_sock(char *master_name, int return (FILEBENCH_ERROR); } +#ifdef __FreeBSD__ + if ((mip = gethostbyname(master_name)) == NULL) +#else if (gethostbyname_r(master_name, &master_info, buffer, MCS_MSGLENGTH, - &error_num) == NULL) { + &error_num) == NULL) +#endif + { filebench_log(LOG_ERROR, "could not locate sync master"); return (FILEBENCH_ERROR); } +#ifdef __FreeBSD__ + master_info = *mip; +#endif master_in.sin_family = AF_INET; master_in.sin_port = htons((uint16_t)master_port); diff -rnup filebench-1.4.8/filebench/multi_client_sync.h filebench-1.4.8-freebsd/filebench/multi_client_sync.h --- filebench-1.4.8/filebench/multi_client_sync.h 2009-06-08 20:24:11.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/multi_client_sync.h 2009-09-01 11:51:51.000000000 +0000 @@ -26,9 +26,13 @@ #ifndef _MULTI_CLIENT_SYNC_H #define _MULTI_CLIENT_SYNC_H +#include "config.h" + #include #include +#ifdef HAVE_INET_IP_H #include +#endif int mc_sync_open_sock(char *master_name, int master_port, char *client_name); int mc_sync_synchronize(int synch_point); diff -rnup filebench-1.4.8/filebench/parser_gram.y filebench-1.4.8-freebsd/filebench/parser_gram.y --- filebench-1.4.8/filebench/parser_gram.y 2009-06-10 15:16:26.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/parser_gram.y 2009-09-01 10:15:52.000000000 +0000 @@ -27,6 +27,8 @@ %{ +#include "config.h" + #include #include #include diff -rnup filebench-1.4.8/filebench/procflow.c filebench-1.4.8-freebsd/filebench/procflow.c --- filebench-1.4.8/filebench/procflow.c 2009-06-08 20:23:59.000000000 +0000 +++ filebench-1.4.8-freebsd/filebench/procflow.c 2009-09-01 10:16:03.000000000 +0000 @@ -682,11 +682,7 @@ procflow_shutdown(void) pid_t pid; pid = procflow->pf_pid; -#ifdef HAVE_SIGSEND - (void) sigsend(P_PID, pid, SIGUSR1); -#else (void) kill(pid, SIGUSR1); -#endif procflow_wait(pid); #else /* USE_PROCESS_MODEL */ diff -rnup filebench-1.4.8/workloads/build/Makefile.am filebench-1.4.8-freebsd/workloads/build/Makefile.am --- filebench-1.4.8/workloads/build/Makefile.am 2009-06-08 20:45:16.000000000 +0000 +++ filebench-1.4.8-freebsd/workloads/build/Makefile.am 2009-09-01 11:42:03.000000000 +0000 @@ -8,7 +8,7 @@ workloadsdir = $(FILEBENCHDIR)/workloads -workloads_DATA = BUILD \ +workloads_DATA = \ bringover.f \ compflow_demo.f \ copyfiles.f \ @@ -50,9 +50,7 @@ workloads_DATA = BUILD \ webproxy.f \ webserver.f -BUILD: - @for f in ../*.f ; do cat $$f |sed 's/$$Revision: //' | \ - sed 's/$$ $$Date: //'| \ - sed 's/$$ //' >`basename $$f`; \ - done; - +$(workloads_DATA): + @cat ../$@ | sed 's/$$Revision: //' | \ + sed 's/$$ $$Date: //' | \ + sed 's/$$ //' >$@