From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: negative seek offsets in VFS Date: 30 May 2005 11:32:42 +0200 Message-ID: <20050530093242.GH86087@muc.de> References: <20050526192332.GW86087@muc.de> <20050527104311.GC86087@muc.de> <20050528123731.GA26151@mail.shareable.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Bryan Henderson , linux-fsdevel@vger.kernel.org, Paul Taysom , viro@www.linux.org.uk Return-path: Received: from colin.muc.de ([193.149.48.1]:54033 "EHLO mail.muc.de") by vger.kernel.org with ESMTP id S261571AbVE3Jcr (ORCPT ); Mon, 30 May 2005 05:32:47 -0400 Date: Mon, 30 May 2005 11:32:42 +0200 To: Jamie Lokier Content-Disposition: inline In-Reply-To: <20050528123731.GA26151@mail.shareable.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, May 28, 2005 at 01:37:31PM +0100, Jamie Lokier wrote: > Andi Kleen wrote: > > The linux system call interface on most (all?) architectures > > Actually that's not true on many architectures, including most of the > 64-bit ones. See (e.g.) the Alpha, MIPS32, MIPS64, IA64, PPC32 and > PPC64 versions of , which use a separate register to > indicate an error return. > > That's the reason for the `force_successful_syscall_return' macro, > defined in : > > /* > * System call handlers that, upon successful completion, need > * to return a negative value should call > * force_successful_syscall_return() right before returning. > * On architectures where the syscall convention provides for > * a separate error flag (e.g., alpha, ia64, ppc{,64}, > * sparc{,64}, possibly others), this macro can be used to > * ensure that the error flag will not get set. On > * architectures which do not support a separate error flag, > * the macro is a no-op and the spurious error condition needs > * to be filtered out by some other means (e.g., in > * user-level, by passing an extra argument to the syscall > * handler, or something along those lines). > */ > > > reserves -1 to -4095 for error returns. When such a error is detected > > it is converted to errno and -1. This applies to all system > > calls. > > > > Take a look at unistd.h of your favourite architecture if you > > dont believe me. > > Most unistd.h's are wrong by now, as they don't test against -4095. You are right, but at least glibc tests against -4095. I will fix x86-64. > > >From : > > #define ECANCELED 125 /* Operation Canceled */ > #define ENOKEY 126 /* Required key not available */ > #define EKEYEXPIRED 127 /* Key has expired */ > #define EKEYREVOKED 128 /* Key has been revoked */ > #define EKEYREJECTED 129 /* Key was rejected by service */ > > Spot the inconsistency :) Very nasty indeed. But fortunately near nobody uses the unistd.h macros anyways. -Andi