From owner-freebsd-current@freebsd.org Tue Dec 8 18:54:14 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58E8D9D3382; Tue, 8 Dec 2015 18:54:14 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 239881871; Tue, 8 Dec 2015 18:54:13 +0000 (UTC) (envelope-from des@des.no) Received: from desk.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id 2CEE5D6FD; Tue, 8 Dec 2015 18:54:13 +0000 (UTC) Received: by desk.des.no (Postfix, from userid 1001) id AA786482E5; Tue, 8 Dec 2015 19:54:06 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Konstantin Belousov Cc: Kirk McKusick , Maxim Sobolev , freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: posix_fallocate(2) && posix_fadvise(2) are somewhat broken References: <868u55rl96.fsf@desk.des.no> <20151208174259.GA82577@kib.kiev.ua> Date: Tue, 08 Dec 2015 19:54:06 +0100 In-Reply-To: <20151208174259.GA82577@kib.kiev.ua> (Konstantin Belousov's message of "Tue, 8 Dec 2015 19:42:59 +0200") Message-ID: <86poygrctt.fsf@desk.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 18:54:14 -0000 Konstantin Belousov writes: > Dag-Erling Sm=C3=B8rgrav writes: > > Maxim Sobolev writes: > > > Hi, while working on some unrelated feature I've noticed that at least > > > those two system calls are not returning proper value (-1) on error. > > > Instead actual errno value is returned from the syscall verbatim, > > > i.e. posix_fadvise() returns 22 on EINVAL. > > That's how syscalls work. > No, this is not how typical syscalls work, but is how the posix_fallocate= () > and posix_fadvise() are specified by Posix. The patch is wrong, see also > r261080 and r288640. Umm, I can't find the code ATM but syscalls store the actual return value in td_retval and return 0 or EWHATEVER and the syscall wrapper handles the translation. If that's not what Maxim was talking about, then please ignore me. Anyway, happy to hear that the X/Open group have found a new way to screw people over. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no