From owner-svn-src-head@freebsd.org Sat Jul 27 13:48:14 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34D67BA4DE; Sat, 27 Jul 2019 13:48:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 992DC86341; Sat, 27 Jul 2019 13:48:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x6RDm5mO048122 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 27 Jul 2019 16:48:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x6RDm5mO048122 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x6RDm4np048121; Sat, 27 Jul 2019 16:48:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 27 Jul 2019 16:48:04 +0300 From: Konstantin Belousov To: Rick Macklem Cc: Rick Macklem , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r350315 - in head/sys: kern sys Message-ID: <20190727134804.GF2731@kib.kiev.ua> References: <201907250546.x6P5kHWq076756@repo.freebsd.org> <20190726215628.GE2731@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2019 13:48:14 -0000 On Sat, Jul 27, 2019 at 01:35:06AM +0000, Rick Macklem wrote: > Konstantin Belousov wrote: > >On Thu, Jul 25, 2019 at 05:46:17AM +0000, Rick Macklem wrote: > >> Author: rmacklem > >> Date: Thu Jul 25 05:46:16 2019 > >> New Revision: 350315 > >> URL: https://svnweb.freebsd.org/changeset/base/350315 > >> > >> Log: > >> Add kernel support for a Linux compatible copy_file_range(2) syscall. > > > >> Modified: head/sys/kern/syscalls.master > >> >=====================================================================>========= > >> --- head/sys/kern/syscalls.master Thu Jul 25 03:55:05 2019 (r350314) > >> +++ head/sys/kern/syscalls.master Thu Jul 25 05:46:16 2019 (r350315) > >> @@ -3175,6 +3175,16 @@ > >> int flag > >> ); > >> } > >> +569 AUE_NULL STD { > >> + ssize_t copy_file_range( > >> + int infd, > >> + _Inout_opt_ off_t *inoffp, > >> + int outfd, > >> + _Inout_opt_ off_t *outoffp, > >> + size_t len, > >> + unsigned int flags > >> + ); > >> + } > > > >I sat to write the compat32 shims, and only then noted that len has size_t > >type. Why is it size_t and not off_t ? > Well, that's what Linux did. > > Also, since it returns ssize_t, it can't do more than SSIZE_MAX > (generally 1/2 of SIZE_T_MAX). Returning ssize_t is also what Linux > does and is consistent with read(2)/write(2). If changing the length argument type to off_t, it is reasonable to change the return type to off_t as well. We already have the lseek(2) syscall that requires two return registers on 32bit. Note that it is reasonable for read(2) to take length as size_t-typed parameter, because size_t is the type for object sizes. There is no object in user address space for copy_file_range(2) API, so potentially wider off_t is acceptable and is in fact useful there. It is useful on 32bit machines where FreeBSD size_t is 32bit, while off_t is 64bit.