ports/135027: [Maintainer] www/gatling: update to 0.10

Thomas-Martin Seck tmseck at web.de
Thu May 28 15:40:11 UTC 2009


>Number:         135027
>Category:       ports
>Synopsis:       [Maintainer] www/gatling: update to 0.10
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 28 15:40:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Thomas-Martin Seck
>Release:        FreeBSD 7.1-STABLE i386
>Organization:
a private site in Germany
>Environment:
FreeBSD ports collection as of May 28, 2009.

	
>Description:
- update to 0.10
- introduce an rc.d and a gatling_wrapper script
- add a test for strndup(3) and provide 7.2's strndup(3) implementation
  in case strndup is missing from the base system to make the dl utility
  build on all supported FreeBSD versions
- retire the GATLING_ICONV option
- introduce a new GATLING_SMB option (default on)
- since tlsgatling and zlib do no longer cause build breakage (on
  supported FreeBSD versions anyway), change the default of GATLING_TLS
  and GATLING_ZLIB to "on"
- honor WITH_DEBUG

Added files:

files/extra-patch-disable_smb
files/gatling.in
files/gatling_wrapper
files/patch-bench.c
files/patch-dl.c
files/patch-http.c
files/patch-matchiprange.c
files/patch-rellink.c
files/patch-strndup.c

Removed files:

files/patch-gatling.c

	
>How-To-Repeat:
	
>Fix:
Apply this patch:

Index: Makefile
===================================================================
--- Makefile	(.../www/gatling)	(revision 1587)
+++ Makefile	(.../local/gatling)	(revision 1587)
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	gatling
-PORTVERSION=	0.9
+PORTVERSION=	0.10
 CATEGORIES=	www benchmarks ftp ipv6
 MASTER_SITES=	http://dl.fefe.de/
 
@@ -18,6 +18,7 @@
 USE_BZIP2=	yes
 USE_GMAKE=	yes
 USE_OPENSSL=	yes
+USE_RC_SUBR=	gatling
 
 CFLAGS+=	-I${LOCALBASE}/include/libowfat -I${OPENSSLINC}
 LDFLAGS+=	-L${LOCALBASE}/lib -L${OPENSSLLIB}
@@ -28,16 +29,18 @@
 bin=		dl
 sbin=		gatling
 MAN8=		gatling.8
-PORTDOCS=	CHANGES README README.cgi README.ftp README.htaccess \
+PORTDOCS=	CHANGES README README.antidos README.cgi README.ftp \
+		README.htaccess \
 		README.http README.performance README.prefetch README.proxy \
 		README.redirect
-PORTEXAMPLES=	run-gatling cgi acc hcat referrer
+PORTEXAMPLES=	run-gatling cgi acc getlinks hcat hitprofile matchiprange \
+		referrer
 
 OPTIONS=	GATLING_BENCHMARKS "Install some benchmark programs" on \
-		GATLING_ICONV "Use charset conversion" off \
-		GATLING_TLS "Install tlsgatling" off \
-		GATLING_ZLIB "Compress outgoing data" off \
-		GATLING_OPTIMIZED_CFLAGS "Use optimized CFLAGS" on
+		GATLING_SMB "Add (read only) SMB support" on \
+		GATLING_TLS "Build and install tlsgatling" on \
+		GATLING_ZLIB "Compress outgoing data" on \
+		GATLING_OPTIMIZED_CFLAGS "Add additional optimizations" on
 
 .include <bsd.port.pre.mk>
 
@@ -47,41 +50,53 @@
 bin+=		bindbench forkbench forksbench httpbench ioerr manymapbench \
 		mktestdata mmapbench pthreadbench
 examples+=	prep run-bench
+MAN1+=		bench.1
 MAKE_ENV+=	BENCHMARKS=1
 .endif
 
-.if defined(WITH_GATLING_OPTIMIZED_CFLAGS)
+.if defined(WITH_GATLING_OPTIMIZED_CFLAGS) && !defined(WITH_DEBUG)
 CFLAGS+=	-O2 -fomit-frame-pointer
 .endif
 
-.if defined(WITH_GATLING_ICONV)
+.if defined(WITH_GATLING_SMB)
 USE_ICONV=	yes
 CFLAGS+=	-I${LOCALBASE}/include
 MAKE_ENV+=	ICONV=1
+.else
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-disable_smb
 .endif
 
 .if defined(WITH_GATLING_TLS)
 MAKE_ENV+=	TLSGATLING=1
 sbin+=		tlsgatling
-portdocs+=	README.tls
+PORTDOCS+=	README.tls
 .endif
 
 .if defined(WITH_GATLING_ZLIB)
 MAKE_ENV+=	ZLIB=1
 .endif
 
-PLIST_FILES=	${bin:S,^,bin/,} ${sbin:S,^,sbin/,}
+.if defined(WITH_DEBUG)
+MAKE_ENV+=	DEBUG=1
+STRIP=
+.endif
 
+PLIST_FILES=	${bin:S,^,bin/,} ${sbin:S,^,sbin/,} sbin/gatling_wrapper
+
 pre-install:
 	@cd ${WRKSRC} && ${CP} gatling.1 gatling.8
 
 do-install:
 	cd ${WRKSRC} && ${INSTALL_PROGRAM} ${bin} ${PREFIX}/bin
 	cd ${WRKSRC} && ${INSTALL_PROGRAM} ${sbin} ${PREFIX}/sbin
+	${INSTALL_SCRIPT} ${FILESDIR}/gatling_wrapper ${PREFIX}/sbin
 .if !defined(NOPORTEXAMPLES)
 	${MKDIR} ${EXAMPLESDIR}
 	cd ${WRKSRC} && ${INSTALL_SCRIPT} ${PORTEXAMPLES} ${EXAMPLESDIR}
 .endif
+.if !empty(MAN1)
+	cd ${WRKSRC} && ${INSTALL_MAN} ${MAN1} ${MAN1PREFIX}/man/man1
+.endif
 	cd ${WRKSRC} && ${INSTALL_MAN} ${MAN8} ${MAN8PREFIX}/man/man8
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}
Index: distinfo
===================================================================
--- distinfo	(.../www/gatling)	(revision 1587)
+++ distinfo	(.../local/gatling)	(revision 1587)
@@ -1,3 +1,3 @@
-MD5 (gatling-0.9.tar.bz2) = bae9a695b7ced3ba0a4b359369273a66
-SHA256 (gatling-0.9.tar.bz2) = 6fa7c1278fd7d05422e073e4062cd931e10d2593fe73728fdcf0e2541db01bbe
-SIZE (gatling-0.9.tar.bz2) = 73831
+MD5 (gatling-0.10.tar.bz2) = 04e8434156d91657c77a8a038c5b27cf
+SHA256 (gatling-0.10.tar.bz2) = 1981ee8706a423e06e507c25202e83785595feabe68c148350818bc50380d416
+SIZE (gatling-0.10.tar.bz2) = 98422
Index: files/patch-gatling.c
===================================================================
--- files/patch-gatling.c	(.../www/gatling)	(revision 1587)
+++ files/patch-gatling.c	(.../local/gatling)	(revision 1587)
@@ -1,10 +0,0 @@
---- gatling.c.orig	Mon Aug 27 16:08:00 2007
-+++ gatling.c	Mon Aug 27 16:08:06 2007
-@@ -101,7 +101,6 @@
- #include <fcntl.h>
- #include <string.h>
- #include <ctype.h>
--#include <crypt.h>
- #include "havealloca.h"
- #include "havesetresuid.h"
- 
Index: files/patch-matchiprange.c
===================================================================
--- files/patch-matchiprange.c	(.../www/gatling)	(revision 0)
+++ files/patch-matchiprange.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,10 @@
+--- matchiprange.c.orig	2009-04-10 18:17:38.000000000 +0200
++++ matchiprange.c	2009-04-10 18:17:58.000000000 +0200
+@@ -17,6 +17,7 @@
+ #include <fmt.h>
+ #include <ctype.h>
+ #include <ip6.h>
++#include <string.h>
+ 
+ char _buf[8192];
+ 
Index: files/extra-patch-disable_smb
===================================================================
--- files/extra-patch-disable_smb	(.../www/gatling)	(revision 0)
+++ files/extra-patch-disable_smb	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,11 @@
+--- gatling_features.h.orig	2009-04-13 16:18:09.000000000 +0200
++++ gatling_features.h	2009-04-13 16:19:18.000000000 +0200
+@@ -6,7 +6,7 @@
+ // #define SUPPORT_BITTORRENT
+ 
+ #define SUPPORT_SERVERSTATUS
+-#define SUPPORT_SMB
++#undef SUPPORT_SMB
+ #define SUPPORT_FTP
+ #define SUPPORT_PROXY
+ /* #define DEBUG to enable more verbose debug messages for tracking fd
Index: files/patch-GNUmakefile
===================================================================
--- files/patch-GNUmakefile	(.../www/gatling)	(revision 1587)
+++ files/patch-GNUmakefile	(.../local/gatling)	(revision 1587)
@@ -1,7 +1,7 @@
---- GNUmakefile.orig	Wed Jan 31 18:05:38 2007
-+++ GNUmakefile	Mon Aug 27 16:49:36 2007
-@@ -1,21 +1,26 @@
- #DEBUG=1
+--- GNUmakefile.orig	2009-04-09 19:00:23.000000000 +0200
++++ GNUmakefile	2009-04-10 17:46:56.000000000 +0200
+@@ -1,24 +1,23 @@
+-#DEBUG=1
 -ZLIB=1
 -prefix=/opt/diet
 +prefix=${PREFIX}
@@ -10,34 +10,33 @@
  man1dir=$(MANDIR)/man1
  
 -TARGETS=gatling httpbench bindbench dl ioerr bench tlsgatling \
--pthreadbench cgi getlinks rellink acc hcat
+-pthreadbench cgi
 -TARGETS2=mktestdata mmapbench manymapbench forkbench forksbench
-+TARGETS=cgi dl gatling getlinks rellink acc hcat referrer
++TARGETS=gatling dl \
++cgi
 +TARGETS2=
 +ifdef BENCHMARKS
-+TARGETS+=httpbench bindbench ioerr pthreadbench
++TARGETS+=httpbench bindbench ioerr bench pthreadbench
 +TARGETS2+=mktestdata mmapbench manymapbench forkbench forksbench
 +endif
 +ifdef TLSGATLING
 +TARGETS+=tlsgatling
 +endif
+ ALLTARGETS=$(TARGETS) acc hcat referrer hitprofile matchiprange getlinks \
+ rellink $(TARGETS2)
  
--all: $(TARGETS) $(TARGETS2)
-+all: checklibs $(TARGETS) $(TARGETS2)
+ all: $(ALLTARGETS)
  
 -CROSS=
-+#CROSS=
- #CROSS=i686-mingw32-
+-#CROSS=i686-mingw32-
 -CC=$(CROSS)gcc
 -CFLAGS=-pipe -Wall
 -LDFLAGS=
-+#CC=$(CROSS)gcc
-+#CFLAGS=-pipe -Wall
-+#LDFLAGS=
- 
+-
  path = $(subst :, ,$(PATH))
  diet_path = $(foreach dir,$(path),$(wildcard $(dir)/diet))
-@@ -32,15 +37,11 @@
+ ifeq ($(strip $(diet_path)),)
+@@ -34,15 +33,11 @@
  # to build without diet libc support, use $ make DIET=
  # see http://www.fefe.de/dietlibc/ for details about the diet libc
  
@@ -55,7 +54,7 @@
  endif
  
  LDLIBS=-lowfat
-@@ -66,7 +67,7 @@
+@@ -68,7 +63,7 @@
  CC:=$(DIET) $(CC)
  
  pthreadbench: pthreadbench.o
@@ -64,16 +63,20 @@
  
  forksbench: forkbench.o
  	$(CC) -static -o $@ forkbench.o $(LDFLAGS) $(LDLIBS)
-@@ -74,7 +75,7 @@
- gatling.o: version.h havesetresuid.h
+@@ -86,9 +81,11 @@
+ gatling: gatling.o $(OBJS) md5lib
+ 	$(CC) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LDLIBS) `cat md5lib`
  
- tlsgatling: gatling.c ssl.o mime.o
--	-$(CC) -o $@ gatling.c ssl.o mime.o $(CFLAGS) -DSUPPORT_HTTPS $(LDFLAGS) -lssl -lcrypto $(LDLIBS)
-+	$(CC) -o $@ gatling.c ssl.o mime.o $(CFLAGS) -DSUPPORT_HTTPS $(LDFLAGS) -lssl -lcrypto $(LDLIBS)
- 
- gatling: gatling.o mime.o
- 	$(CC) $(LDFLAGS) $@.o mime.o -o $@ $(LDLIBS)
-@@ -107,9 +108,13 @@
++dl: dl.c havestrndup havestrndup.h
++	$(CC) $(CFLAGS) dl.c `cat havestrndup` $(LDFLAGS) -lowfat -o $@
++
+ httpbench: httpbench.o
+ bindbench: bindbench.o
+-dl: dl.o
+ ioerr: ioerr.o
+ bench: bench.o
+ getlinks: getlinks.o
+@@ -121,9 +118,13 @@
  	rm -f trysocket
  
  libiconv: tryiconv.c
@@ -81,7 +84,7 @@
 -	if $(CC) $(CFLAGS) -o tryiconv tryiconv.c -liconv >/dev/null 2>&1; then echo "-liconv"; \
 -	fi; fi > libiconv
 +ifdef ICONV
-+	if $(CC) $(CFLAGS) -L$(LOCALBASE)/lib -o tryiconv tryiconv.c -liconv >/dev/null 2>&1; then echo "-L$(LOCALBASE)/lib -liconv"; else \
++	if $(CC) $(CFLAGS) $(LDFLAGS) -o tryiconv tryiconv.c -liconv >/dev/null 2>&1; then echo "-L$(LDFLAGS) -liconv"; else \
 +	echo ""; \
 +	fi > libiconv
 +else
@@ -90,25 +93,14 @@
  	rm -f tryiconv
  
  libcrypt: trycrypt.c
-@@ -130,9 +135,11 @@
- 	ar q $@ dummy.o
- 	-ranlib $@
+@@ -144,6 +145,10 @@
+ 	if $(CC) $(CFLAGS) -o tryresuid $^ >/dev/null 2>&1; then echo "#define LIBC_HAS_SETRESUID"; fi > $@
+ 	-rm -f tryresuid
  
-+checklibs: libsocket libiconv libcrypt
++havestrndup havestrndup.h: trystrndup.c
++	if $(CC) $(CFLAGS) -o trystrndup $^ >/dev/null 2>&1; then echo "">havestrndup; echo "#define LIBC_HAS_STRNDUP">havestrndup.h; else echo "strndup.c">havestrndup; echo "">havestrndup.h; fi
++	rm -f trystrndup
 +
- LDLIBS+=`cat libsocket libiconv libcrypt`
+ dummy.c:
+ 	touch $@
  
--$(TARGETS): libsocketkludge.a libsocket libiconv libcrypt
-+$(TARGETS): libsocketkludge.a
- 
- install: gatling dl getlinks
- 	install -d $(DESTDIR)$(BINDIR) $(man1dir)
-@@ -144,7 +151,7 @@
- 	rm -f $(DESTDIR)$(BINDIR)/gatling $(DESTDIR)$(BINDIR)/tlsgatling $(DESTDIR)$(man1dir)/gatling.1 $(DESTDIR)$(man1dir)/bench.1
- 
- clean:
--	rm -f $(TARGETS) *.o version.h core *.core libsocket libsocketkludge.a dummy.c libiconv libcrypt havesetresuid.h
-+	rm -f $(TARGETS) $(TARGETS2) *.o version.h core *.core libsocket libsocketkludge.a dummy.c libiconv libcrypt havesetresuid.h
- 
- VERSION=gatling-$(shell head -n 1 CHANGES|sed 's/://')
- CURNAME=$(notdir $(shell pwd))
Index: files/gatling_wrapper
===================================================================
--- files/gatling_wrapper	(.../www/gatling)	(revision 0)
+++ files/gatling_wrapper	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,91 @@
+#!/bin/sh -T
+#
+#-
+# Copyright 2009 Thomas-Martin Seck. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted providing that the following conditions 
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# gatling_wrapper {gatling|tlsgatling} [options]
+#
+# A simple wrapper script for gatling (or any other program that does not
+# daemonize itself and logs to stdout).
+#
+# This wrapper tries to emulate part of the functionality usually supplied
+# by software like daemontools or runit.
+# It can be used by a FreeBSD port rc.d script to start a program
+# that does not daemonize itself and logs to stdout/stderr. It redirects stdout
+# and stderr to logger(1) via a fifo.
+#
+# Note: We need a shell that can offer us asynchronous trap handling in order
+# to be able to abort the infinite loop from outside.  FreeBSD's /bin/sh offers
+# the "-T" switch for this purpose.
+#
+# TODO: send fd 2 output to never-never land to get rid of "Terminated" when we
+# kill this script but provide a way for errx() to communicate with the outside
+# world via stderr.
+
+errx() {
+	echo "${me}: $@" >&2
+	exit 1
+}
+
+cleanup() {
+	rm -rf ${tmpdir}
+	rm -f ${pidfile}
+}
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+me=${0##*/}
+logger=/usr/bin/logger
+daemon_log_facility=daemon.notice
+self_log_facility=daemon.notice
+pidfile=/var/run/${me}.pid
+daemon_name=gatling
+daemon_program="$1"
+shift
+
+test -x "${daemon_program}" || errx "cannot execute ${daemon_program}!"
+test -x ${logger} || errx "cannot execute ${logger}!"
+test -f ${pidfile} && errx "${pidfile} is already present -- is another instance of ${me} running?"
+echo $$ >${pidfile} || errx "cannot write to ${pidfile}!"
+tmpdir=`mktemp -d /tmp/${me}.XXXXXXXXXX` || errx "cannot generate tmpdir!"
+
+logfifo=${tmpdir}/fifo
+mkfifo -m 0600 ${logfifo} || errx "cannot generate fifo!"
+
+while true; do
+	trap 'break' 1 2 3 6 9 15
+	${logger} -i -p ${daemon_log_facility} -t ${daemon_name} <${logfifo} &
+	log_pid=$!
+	"${daemon_program}" $@ >${logfifo} 2>&1 &
+	daemon_pid=$!
+	wait ${daemon_pid}
+	${logger} -i -p ${self_log_facility} -t ${me} "${daemon_program} died -- restarting..."
+	sleep 2
+done
+
+kill -TERM ${daemon_pid} 2>/dev/null
+wait
+cleanup
Index: files/gatling.in
===================================================================
--- files/gatling.in	(.../www/gatling)	(revision 0)
+++ files/gatling.in	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: gatling
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Set "gatling_enable=yes" in either /etc/rc.conf, /etc/rc.conf.local or
+# /etc/rc.conf.d/gatling to enable gatling.
+#
+# Set gatling_root if you want to serve files from other locations than
+# the default (%%PREFIX%%/www/data).
+#
+# Set gatling_ftp_enable=yes to make gatling serve files via FTP, too.
+#
+# Set gatling_ssl_enable=yes to serve files via HTTPS/SSL (needs tlsgatling).
+#
+# Additionally, you can set gatling_effective_user and gatling_flags; please
+# see gatling(8) for further information about possible gatling_flags.
+
+check_user() {
+	/usr/sbin/pw usershow -n ${gatling_effective_user} -q >/dev/null
+}
+
+. %%RC_SUBR%%
+
+name=gatling
+rcvar=`set_rcvar`
+
+load_rc_config ${name}
+
+gatling_enable=${gatling_enable-"NO"}
+gatling_root=${gatling_root:-%%PREFIX%%/www/data}
+# needed to bind privileged ports at startup:
+gatling_user=root
+gatling_effective_user=${gatling_effective_user:-www}
+gatling_flags="-u ${gatling_effective_user} -c ${gatling_root} ${gatling_flags}"
+case "${gatling_ftp_enable}" in
+	[Yy][Ee][Ss])
+	gatling_flags="-f ${gatling_flags}"
+	;;
+	*)
+	gatling_flags="-F ${gatling_flags}"
+	;;
+esac
+
+case "${gatling_ssl_enable}" in
+	[Yy][Ee][Ss])
+	which_gatling="%%PREFIX%%/sbin/tlsgatling"
+	;;
+	*)
+	which_gatling="%%PREFIX%%/sbin/gatling"
+	;;
+esac
+
+gatling_flags="${which_gatling} ${gatling_flags} &"
+command="%%PREFIX%%/sbin/gatling_wrapper"
+command_interpreter="/bin/sh -T"
+pidfile=/var/run/gatling_wrapper.pid
+required_dirs="${gatling_root}"
+required_files="${which_gatling}"
+
+start_precmd=check_user
+run_rc_command "$1"
+
Index: files/patch-bench.c
===================================================================
--- files/patch-bench.c	(.../www/gatling)	(revision 0)
+++ files/patch-bench.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,10 @@
+--- bench.c.orig	2009-04-10 18:15:06.000000000 +0200
++++ bench.c	2009-04-10 18:15:19.000000000 +0200
+@@ -13,6 +13,7 @@
+ #include <errno.h>
+ #include <buffer.h>
+ #include <fcntl.h>
++#include <string.h>
+ 
+ void usage() {
+   die(0,"usage: bench [-n requests] [-c concurrency] [-t timeout] [-k] [-K count]\n"
Index: files/patch-dl.c
===================================================================
--- files/patch-dl.c	(.../www/gatling)	(revision 0)
+++ files/patch-dl.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,13 @@
+--- dl.c.orig	2009-04-10 17:51:59.000000000 +0200
++++ dl.c	2009-04-10 17:56:31.000000000 +0200
+@@ -37,6 +37,10 @@
+ #include <assert.h>
+ #include <ctype.h>
+ #include <string.h>
++#include "havestrndup.h"
++#ifndef LIBC_HAS_STRNDUP
++char* strndup(const char*, size_t);
++#endif
+ 
+ int dostats;
+ 
Index: files/patch-http.c
===================================================================
--- files/patch-http.c	(.../www/gatling)	(revision 0)
+++ files/patch-http.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,9 @@
+--- http.c.orig	2009-04-10 16:01:37.000000000 +0200
++++ http.c	2009-04-10 16:01:57.000000000 +0200
+@@ -1,4 +1,6 @@
++/* this define breaks the build on FreeBSD:
+ #define _XOPEN_SOURCE 500
++*/
+ 
+ #include "gatling.h"
+ 
Index: files/patch-strndup.c
===================================================================
--- files/patch-strndup.c	(.../www/gatling)	(revision 0)
+++ files/patch-strndup.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,65 @@
+--- /dev/null	2009-04-10 17:44:00.000000000 +0200
++++ trystrndup.c	2009-04-10 17:01:00.000000000 +0200
+@@ -0,0 +1,6 @@
++#include <string.h>
++int main() {
++char* s;
++s=strndup("foo",3);
++return 0;
++}
+--- /dev/null	2009-04-10 16:55:00.000000000 +0200
++++ strndup.c	2009-01-08 10:50:20.000000000 +0100
+@@ -0,0 +1,53 @@
++/*      $NetBSD: strndup.c,v 1.3 2007/01/14 23:41:24 cbiere Exp $       */
++
++/*
++ * Copyright (c) 1988, 1993
++ *	The Regents of the University of California.  All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ * 4. Neither the name of the University nor the names of its contributors
++ *    may be used to endorse or promote products derived from this software
++ *    without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#include <sys/cdefs.h>
++__FBSDID("$FreeBSD: src/lib/libc/string/strndup.c,v 1.1.2.1 2009/01/08 09:50:20 kib Exp $");
++
++#include <stddef.h>
++#include <stdlib.h>
++#include <string.h>
++
++char *
++strndup(const char *str, size_t n)
++{
++	size_t len;
++	char *copy;
++
++	for (len = 0; len < n && str[len]; len++)
++		continue;
++
++	if ((copy = malloc(len + 1)) == NULL)
++		return (NULL);
++	memcpy(copy, str, len);
++	copy[len] = '\0';
++	return (copy);
++}
Index: files/patch-rellink.c
===================================================================
--- files/patch-rellink.c	(.../www/gatling)	(revision 0)
+++ files/patch-rellink.c	(.../local/gatling)	(revision 1587)
@@ -0,0 +1,10 @@
+--- rellink.c.orig	2009-04-10 18:15:33.000000000 +0200
++++ rellink.c	2009-04-10 18:15:46.000000000 +0200
+@@ -17,6 +17,7 @@
+ #include <fcntl.h>
+ #include <sys/mman.h>
+ #include <utime.h>
++#include <string.h>
+ 
+ static int canonicalize(stralloc* url,const char* baseurl) {
+   /* for the comments, assume baseurl is "http://www.fefe.de/x/y.html" */
	


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



More information about the freebsd-ports-bugs mailing list