From owner-freebsd-hackers@FreeBSD.ORG Wed May 21 12:12:03 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 807FA37B401 for ; Wed, 21 May 2003 12:12:03 -0700 (PDT) Received: from sccrmhc02.attbi.com (sccrmhc02.attbi.com [204.127.202.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA73043F75 for ; Wed, 21 May 2003 12:12:02 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by attbi.com (sccrmhc02) with ESMTP id <20030521191201002002leqoe>; Wed, 21 May 2003 19:12:02 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id MAA74265; Wed, 21 May 2003 12:12:01 -0700 (PDT) Date: Wed, 21 May 2003 12:11:59 -0700 (PDT) From: Julian Elischer To: Vijay.Singh@nokia.com In-Reply-To: <4D7B558499107545BB45044C63822DDE02C08E36@mvebe001.americas.nokia.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: sendfile in FreeBSD 2.2 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 May 2003 19:12:03 -0000 > Hello. Would it be possible to port the sendfile system call to a FreeBSD 2.2 based system? Has anyone done this? I am trying to port the code from a later FreeBSD release and I have been unable to find out what the VOP_GETVOBJECT() macro does and how/what should it be replaced with for my case. Any help is appreciated. > > Thanks > vijay > It's not impossible that you could do it. sendfile was introduced just after 3.0 and quite a bit before 3.1 I don't know however how much vm hacking was required to get it to work.. here is the actual commit message.. this will tell you what was changed.. and at what revision.. What are the chances Nokia would move to a newer version? :-) good luck dg 1998/11/05 06:28:27 PST Modified files: sys/conf options param.c sys/kern init_sysent.c syscalls.c syscalls.master uipc_syscalls.c sys/sys mbuf.h socket.h socketvar.h syscall-hide.h syscall.h syscall.mk sysproto.h sys/vm vm_object.c Log: Implemented zero-copy TCP/IP extensions via sendfile(2) - send a file to a stream socket. sendfile(2) is similar to implementations in HP-UX, Linux, and other systems, but the API is more extensive and addresses many of the complaints that the Apache Group and others have had with those other implementations. Thanks to Marc Slemko of the Apache Group for helping me work out the best API for this. Anyway, this has the "net" result of speeding up sends of files over TCP/IP sockets by about 10X (that is to say, uses 1/10th of the CPU cycles) when compared to a traditional read/write loop. Revision Changes Path 1.107 +2 -1 src/sys/conf/options 1.31 +7 -1 src/sys/conf/param.c 1.61 +1 -0 src/sys/kern/init_sysent.c 1.54 +1 -0 src/sys/kern/syscalls.c 1.54 +3 -1 src/sys/kern/syscalls.master 1.42 +403 -1 src/sys/kern/uipc_syscalls.c 1.30 +2 -1 src/sys/sys/mbuf.h 1.27 +12 -1 src/sys/sys/socket.h 1.30 +8 -1 src/sys/sys/socketvar.h 1.48 +1 -0 src/sys/sys/syscall-hide.h 1.52 +2 -1 src/sys/sys/syscall.h 1.7 +2 -1 src/sys/sys/syscall.mk 1.42 +10 -0 src/sys/sys/sysproto.h 1.135 +1 -3 src/sys/vm/vm_object.c dg 1998/11/05 06:36:38 PST Modified files: sys/i386/conf LINT Log: Document the new NSFBUFS option. Revision Changes Path 1.498 +8 -1 src/sys/i386/conf/LINT On Wed, 21 May 2003 Vijay.Singh@nokia.com wrote: