Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp692422pxb; Wed, 20 Jan 2021 18:47:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJworDAeJpsAjJKAkFywdPXdbjynF6PMRz0NcHnNhArUqoYRroHmXtcUrAHfVVRP3L6q1Us4 X-Received: by 2002:a17:906:4143:: with SMTP id l3mr7637740ejk.306.1611197232531; Wed, 20 Jan 2021 18:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611197232; cv=none; d=google.com; s=arc-20160816; b=ykvy8J3v8esUrcxossBs4/5zoGOShVrhOIzWJvl9FEOYe72lZIJnK2d0R6vuw1HCnw 9jDbV0TwOyJLYBbDe5o7ptcusnpvXcYgsuG8zQrW32U5/LrchZ5YgAKfTHQi2GyRJFQh /VEua2V1sqQbToVm/EhOoJ8a7qeiQoi69mCHIYBaU2Yu9eLr3kDL6/eM40U0gAeC7KJM F3c2yEOtIRBIuHT7OnCQgFIFI1KTq7sb4OpA+LkAuhhXGqFW/ymLoCTkYPO5s7NzaOUu KR7Pwh7gPUmhc2KN1kGyA+rYudwsHHgeSusfffbfb0OyKN+o0vra6RYyfpvsvYnG+v6K tsCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=NIgQF6S8uuhj3yk0Eir3X8wLn9ERAo5MLL+6yeY+zF0=; b=GS4dJ4O6/KncbVd1GuL6Fy3moXm3xvSayF9VPLAeVVas/qW/KRqfPnpKMLmkIWZeR6 ETXgwJE1gCbzStkox3snOXbUn+oE/seGIgLwdUlie8EfT8J+p3gOErjvZeo3cscX1MiF 9gYDVKS8SCm2iJ/DBDVPmmqHLs1ZmdZKkoudufql/+AxtPJtuG3OujxE9soHZgMG6xsT mlEl4bbrVj/rMGRqneKygIH0qEUWPOSYzvsy0HuEbPeIxV1ahCObhZv6oDv/h+lKpzfP HJjhJYSYTFreYuzCN/z2qdRQs8K8K8JltBpVeTq3gwaB5r83P9QFXxkkQRxhMzfaZtrs +FeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si1660397edw.240.2021.01.20.18.46.49; Wed, 20 Jan 2021 18:47:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393067AbhAUA2m (ORCPT + 99 others); Wed, 20 Jan 2021 19:28:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404091AbhATXYS (ORCPT ); Wed, 20 Jan 2021 18:24:18 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65512C061342 for ; Wed, 20 Jan 2021 15:03:23 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1l2MV4-0041GW-6h; Wed, 20 Jan 2021 23:02:54 +0000 Date: Wed, 20 Jan 2021 23:02:54 +0000 From: Al Viro To: David Laight Cc: 'Linus Torvalds' , Christoph Hellwig , Johannes Berg , Oliver Giles , Linux Kernel Mailing List , Greg Kroah-Hartman Subject: Re: Splicing to/from a tty Message-ID: <20210120230254.GD740243@zeniv-ca> References: <20210118085311.GA2735@lst.de> <20210118193457.GA736435@zeniv-ca> <20210118195400.GC736435@zeniv-ca> <20210120162608.GB740243@zeniv-ca> <20210120191116.GC740243@zeniv-ca> <29625ab9f4f94b84aacf96ad9b5da828@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29625ab9f4f94b84aacf96ad9b5da828@AcuMS.aculab.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 10:25:56PM +0000, David Laight wrote: > I also wonder if pread/pwrite with offset == 0 should be valid > on things where the offset makes no sense. > > I'm rather surprised the offset isn't just silently ignored > for devices where seeking is non-sensical. > You might want to error it for mag tapes, but not pipes, > ttys, sockets etc. > > I really can't remember what SYSV, Solaris or NetBSD do. ... nor can you be arsed to RTFPOSIX. Why am I not surprised? In https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html (located by arcane action known as googling for pwrite POSIX): ============================== The pwrite() function shall fail if: [EINVAL] The file is a regular file or block special file, and the offset argument is negative. The file offset shall remain unchanged. [ESPIPE] The file is incapable of seeking. ==============================