From owner-freebsd-ports-bugs Thu Jan 23 5:17:47 2003 Delivered-To: freebsd-ports-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD01937B401 for ; Thu, 23 Jan 2003 05:17:42 -0800 (PST) Received: from mailout04.sul.t-online.com (mailout04.sul.t-online.com [194.25.134.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 620C943F18 for ; Thu, 23 Jan 2003 05:17:36 -0800 (PST) (envelope-from corecode@corecode.ath.cx) Received: from fwd11.sul.t-online.de by mailout04.sul.t-online.com with smtp id 18bhEd-0006w1-08; Thu, 23 Jan 2003 14:17:35 +0100 Received: from pride.uni.stoert.net (320050403952-0001@[217.224.162.215]) by fmrl11.sul.t-online.com with esmtp id 18bhEI-2AhlPkC; Thu, 23 Jan 2003 14:17:14 +0100 Received: from terrorfish.uni.stoert.net (terrorfish.uni.stoert.net [10.150.180.178]) by pride.uni.stoert.net (Postfix) with ESMTP id 52EDB13560B; Thu, 23 Jan 2003 14:17:11 +0100 (CET) Received: from terrorfish.uni.stoert.net (localhost [127.0.0.1]) by terrorfish.uni.stoert.net (8.12.6/8.12.6) with ESMTP id h0NDHtag003326; Thu, 23 Jan 2003 14:17:55 +0100 (CET) (envelope-from corecode@terrorfish.uni.stoert.net) Received: (from corecode@localhost) by terrorfish.uni.stoert.net (8.12.6/8.12.6/Submit) id h0NDHnoI003325; Thu, 23 Jan 2003 14:17:49 +0100 (CET) Date: Thu, 23 Jan 2003 14:17:46 +0100 From: "Simon 'corecode' Schubert" To: "Daniel O'Connor" Cc: freebsd-ports-bugs@freebsd.org Subject: Re: ports/47348: New port for TeamSpeak Message-Id: <20030123141746.2c5ccf95.corecode@corecode.ath.cx> In-Reply-To: <1043317182.45633.1.camel@chowder.dons.net.au> References: <200301222310.h0MNA3Vd075145@freefall.freebsd.org> <20030123110828.1836d662.corecode@corecode.ath.cx> <1043317182.45633.1.camel@chowder.dons.net.au> X-Mailer: Sylpheed version 0.8.8claws (GTK+ 1.2.10; i386-portbld-freebsd5.0) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="=.6MjfO3HDTA53G_" X-Sender: 320050403952-0001@t-dialin.net Sender: owner-freebsd-ports-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --=.6MjfO3HDTA53G_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Lately Daniel O'Connor told: > > working. how about a (linux-so)library to preload that intercepts just > > ioctl and tests for this specific request (and then just returns 0)? > Hmm, well the idea has merit :) > > I'm not sure I'm that enthusiastic.. > > IMHO it's fine to require a certain FreeBSD version to run something. > > Do you have an example I could copy? *scribble* *code* uhm, yea. just wrote one: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # testpreloadioctl # testpreloadioctl/testioctl.c # testpreloadioctl/Makefile.lib # testpreloadioctl/testioctl.h # testpreloadioctl/preloadioctl.c # testpreloadioctl/Makefile # testpreloadioctl/Makefile.bin # echo c - testpreloadioctl mkdir -p testpreloadioctl > /dev/null 2>&1 echo x - testpreloadioctl/testioctl.c sed 's/^X//' >testpreloadioctl/testioctl.c << 'END-of-testpreloadioctl/testioctl.c' X#include X X#include X#include X#include X#include X X#include "testioctl.h" X Xvoid usage(); X Xint main(int argc, char *argv[]) X{ X int fd; X int one = 1; X int ret = 1; X X if (argc != 2) { X usage(argv[0]); X /* NOTREACHED */ X } X X if ((fd = open(argv[1], O_RDONLY)) == -1) { X perror(NULL); X exit(1); X /* NOTREACHED */ X } X X if (ioctl(fd, TESTIOCTL_REQ, &one) == -1) X fprintf(stderr, "error issuing TESTIOCTL_REQ: %s\n", strerror(errno)); X else { X printf("TESTIOCTL_REQ succeeded!\n"); X ret = 0; X } X X close(fd); X return ret; X} X Xvoid usage() X{ X fprintf(stderr, "usage: testioctl \n"); X exit(1); X} END-of-testpreloadioctl/testioctl.c echo x - testpreloadioctl/Makefile.lib sed 's/^X//' >testpreloadioctl/Makefile.lib << 'END-of-testpreloadioctl/Makefile.lib' XSRCS= preloadioctl.c XSHLIB_NAME?= preloadioctl.so X X.include END-of-testpreloadioctl/Makefile.lib echo x - testpreloadioctl/testioctl.h sed 's/^X//' >testpreloadioctl/testioctl.h << 'END-of-testpreloadioctl/testioctl.h' X#ifndef TESTIOCTL_REQ X# define TESTIOCTL_REQ 0x7654 /* some random number */ X#endif /* TESTIOCTL_REQ */ END-of-testpreloadioctl/testioctl.h echo x - testpreloadioctl/preloadioctl.c sed 's/^X//' >testpreloadioctl/preloadioctl.c << 'END-of-testpreloadioctl/preloadioctl.c' X#include X#include X#include X X#include "testioctl.h" X Xint ioctl(int fd, unsigned long req, char *param) X{ X if (req == TESTIOCTL_REQ) X return 0; X /* NOTREACHED */ X else { X static int (*orig_ioctl)(int, unsigned long, char *) = NULL; X X if (orig_ioctl == NULL) { X if ((orig_ioctl = (int(*)(int, unsigned long, char *)) X dlfunc(RTLD_NEXT, "ioctl")) == NULL) { X fprintf(stderr, "preloadioctl: %s\n", dlerror()); X return ENOSYS; X } X } X X return orig_ioctl(fd, req, param); X /* NOTREACHED */ X } X} END-of-testpreloadioctl/preloadioctl.c echo x - testpreloadioctl/Makefile sed 's/^X//' >testpreloadioctl/Makefile << 'END-of-testpreloadioctl/Makefile' XPROG= testioctl XSHLIB_NAME= preloadioctl.so X XTESTDEV?= /dev/dsp X X.DEFAULT: .MAKE X.for file in Makefile.lib Makefile.bin X ${MAKE} -f ${file} ${MAKEFLAGS} DEPENDFILE=.depend.${file} ${.TARGETS} X.endfor X Xtest: all X @${ECHO} "===> Testing without preload" X -${.CURDIR}/${PROG} ${TESTDEV} X @${ECHO} "===> Testing with preload" X -${ENV} LD_PRELOAD=${.CURDIR}/${SHLIB_NAME} ${.CURDIR}/${PROG} ${TESTDEV} X END-of-testpreloadioctl/Makefile echo x - testpreloadioctl/Makefile.bin sed 's/^X//' >testpreloadioctl/Makefile.bin << 'END-of-testpreloadioctl/Makefile.bin' XPROG?= testioctl XSRCS= testioctl.c XNOMAN= yes X X.include END-of-testpreloadioctl/Makefile.bin exit have fun cheers simon -- /"\ http://corecode.ath.cx/#donate \ / \ ASCII Ribbon Campaign / \ Against HTML Mail and News --=.6MjfO3HDTA53G_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+L+t9r5S+dk6z85oRAhMKAKCeExMcSKoiWYQRxo1njDs01kx2TgCg+ycS P3aJvy4MUIojQGxZIuRn88E= =KGru -----END PGP SIGNATURE----- --=.6MjfO3HDTA53G_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message