From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 351CEC43381 for ; Thu, 21 Jan 2021 00:29:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE68323770 for ; Thu, 21 Jan 2021 00:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393079AbhAUA2r (ORCPT ); Wed, 20 Jan 2021 19:28:47 -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. ==============================