From owner-p4-projects@FreeBSD.ORG Sun Nov 12 14:49:58 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6ACDE16A47C; Sun, 12 Nov 2006 14:49:58 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 451DA16A40F for ; Sun, 12 Nov 2006 14:49:58 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C71FF43D7B for ; Sun, 12 Nov 2006 14:49:57 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kACEnvjZ007165 for ; Sun, 12 Nov 2006 14:49:57 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kACEnvnp007162 for perforce@freebsd.org; Sun, 12 Nov 2006 14:49:57 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sun, 12 Nov 2006 14:49:57 GMT Message-Id: <200611121449.kACEnvnp007162@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 109800 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Nov 2006 14:49:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=109800 Change 109800 by rdivacky@rdivacky_witten on 2006/11/12 14:49:41 Semi-working sendfile implementation. There are rough edges though. 1) linux permits SOCK_DGRAM sockets to be used too 2) we always return as if full load was sent more work to come Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linux/linux_socket.c#10 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_socket.c#10 (text+ko) ==== @@ -1302,5 +1302,30 @@ int linux_sendfile(struct thread *td, struct linux_sendfile_args *args) { - return (ENOSYS); + struct sendfile_args sa; + off_t off; + int error; + + if ((error = copyin(args->offset, &off, sizeof(off)))) + return (error); +#ifdef DEBUG + if (ldebug(sendfile)) + printf(ARGS(sendfile, "%d, %d, %d, %d"), args->in, args->out, (int) off, + args->count); +#endif + + sa.fd = args->in; + sa.s = args->out; + sa.offset = off; + sa.nbytes = args->count; + sa.hdtr = NULL; + sa.sbytes = NULL; + sa.flags = 0; + + error = sendfile(td, &sa); + if (error) + return (error); + + td->td_retval[0] = args->count; + return (0); }