From owner-svn-src-all@FreeBSD.ORG Tue Nov 26 07:35:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F527363; Tue, 26 Nov 2013 07:35:13 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2C9D5281B; Tue, 26 Nov 2013 07:35:12 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rAQ7Z7lR003679; Tue, 26 Nov 2013 09:35:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rAQ7Z7lR003679 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rAQ7Z70b003678; Tue, 26 Nov 2013 09:35:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 26 Nov 2013 09:35:07 +0200 From: Konstantin Belousov To: Adrian Chadd Subject: Re: svn commit: r258613 - head/sys/kern Message-ID: <20131126073507.GR59496@kib.kiev.ua> References: <201311260202.rAQ225Ux042665@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="02rv0UQOqTxuETXn" Content-Disposition: inline In-Reply-To: <201311260202.rAQ225Ux042665@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2013 07:35:13 -0000 --02rv0UQOqTxuETXn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 26, 2013 at 02:02:05AM +0000, Adrian Chadd wrote: > Author: adrian > Date: Tue Nov 26 02:02:05 2013 > New Revision: 258613 > URL: http://svnweb.freebsd.org/changeset/base/258613 >=20 > Log: > Refactor out the sendfile copyout in order to make vn_sendfile() > callable from the kernel. > =20 > Right now vn_sendfile() can't be called from anything other than > a syscall handler _and_ return the number of bytes queued. > This simply moves the copyout() to do_sendfile() so that any kernel > code can initiate vn_sendfile() outside of a syscall context. > =20 > Tested: > =20 > * tiny little sendfile program spitting things out a tcp socket > =20 > Sponsored by: Netflix, Inc. >=20 > Modified: > head/sys/kern/uipc_syscalls.c >=20 > Modified: head/sys/kern/uipc_syscalls.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/uipc_syscalls.c Tue Nov 26 01:30:10 2013 (r258612) > +++ head/sys/kern/uipc_syscalls.c Tue Nov 26 02:02:05 2013 (r258613) > @@ -1908,6 +1908,7 @@ do_sendfile(struct thread *td, struct se > struct file *fp; > cap_rights_t rights; > int error; > + off_t sbytes; > =20 > /* > * File offset must be positive. If it goes beyond EOF > @@ -1947,9 +1948,11 @@ do_sendfile(struct thread *td, struct se > } > =20 > error =3D fo_sendfile(fp, uap->s, hdr_uio, trl_uio, uap->offset, > - uap->nbytes, uap->sbytes, uap->flags, compat ? SFK_COMPAT : 0, td); > + uap->nbytes, &sbytes, uap->flags, compat ? SFK_COMPAT : 0, td); > fdrop(fp, td); > - > + if (uap->sbytes !=3D NULL) { > + copyout(&sbytes, uap->sbytes, sizeof(off_t)); > + } > out: > free(hdr_uio, M_IOV); > free(trl_uio, M_IOV); > @@ -2546,7 +2549,7 @@ out: > td->td_retval[0] =3D 0; > } > if (sent !=3D NULL) { > - copyout(&sbytes, sent, sizeof(off_t)); > + (*sent) =3D sbytes; > } > if (obj !=3D NULL) > vm_object_deallocate(obj); This breaks compat32 sendfile(2). --02rv0UQOqTxuETXn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSlE8qAAoJEJDCuSvBvK1BJFIP/2c7BJE4lMbe2PKQqSkqY9OV ZSJHPcVZfX53Jw1tBgx/RVDzA05G/4Iq2gecMWddLL5hJH+IV7KSrlvInAhdrI9B zawrHMC6FqaGdI2OFAqZYH7Atb+3cLR8dz2sd06s73JE2krO5QFkFAeyp5DSyZe4 F4W+MlJwctea/r6WL18uMnz3izgGsE4obUONvZQKUxlpmgwiqTbo88Wge2j1Lu1u F+2TmpWP+tBw5zG1nTnpmKBZ0NEuUzPJfoBuDyUoQ/MGf8lXXtt6sdUgB+SR0YIG wQnsTzw/MEiKxCT+Ca2h5Zyzx4nJveoXSChF9uJ9epWkb6PbYMrwkDegCD+ECB7K etEtFskvshyA8e8BNWvDiaWuOu12E2vztEheHXPitmygRdoHG8FBt1P0w9SNzCLr 3ZE4IQYPoifgavly0lj3P2C0dnAiSqU2qRbJTTH8zmog8v0sZgfXHm4j/+q8AxOe /GCzqGyWI0e8INoJ30kV9bfNA1JQn5RqhQiapJESYZrNadznyKPe1YTTFp6d/2Fi aHZ+fjiI8frAS5hE/QsXA3rjLtwQ+5bRUhGBGYr9zTo4m2q6LxKuBaVdcKvcxLLZ xYf8PK4KshxA/UD3OTflpxqhxU9chNfReGO9Nv4PpkOjz2V+uFAWLU1Ywx1NwbTz jsBD+fCgYFjJZDhStxeG =d6N4 -----END PGP SIGNATURE----- --02rv0UQOqTxuETXn--