From owner-freebsd-current@freebsd.org Sun Aug 11 15:13:13 2019 Return-Path: Delivered-To: freebsd-current@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 4BCDFBB443 for ; Sun, 11 Aug 2019 15:13:13 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4662Y5146Zz42vc; Sun, 11 Aug 2019 15:13:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f175.google.com with SMTP id z17so7755489ljz.0; Sun, 11 Aug 2019 08:13:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JIR2N0tnLvD+MSaDu7+7aYh3Ec2zFaFqQd1Z+yrjrSQ=; b=Frof5e4aA8e0bKVvkeO6FT6qe+IyDntiWvWtYn3HAoZOhxfbjj+VDF1Ghh00qC99kG LOx+jdBsog7wi03v0OVWKG65Iu8B2nRKXQJ6NinloQnRLWsjBw6oAxwK64pCd2Pu0C4J uWuhr5cAMTZsz5WRaXLDQayPWTQzeh+ci1NJERIu246a6NEhmecgCIhvSRoYZhoMcxpu 6T9MKKLb8fxxv3Ohk2LNyf4kAfSW71KKaks9t1vqSW0wFDn88+S18QvxLHQrPf9p2I76 QogbBMe6KNu0y7aHQoVN7nYhgaKSeifsQLM9MSO4XiXp7Ui2YmIEvIGie6Ta35K10Zxh 86pA== X-Gm-Message-State: APjAAAXd8kdHSxT6rNpkt0wihLvYE4iEzGQxtjuU9scqCSQnZjVafs+U uxGNAYuQXpgtyD7xhTgQV57w5EyINwliV6q0P6N3rBgT X-Google-Smtp-Source: APXvYqxMtMWkn5lYEvlN9X33Pd5hhjxZVcTuihd7fbhO8PzsIoo0RA7BiYz0ByxuCjw2jsIimaL+NtEtxBh0bi/4bN0= X-Received: by 2002:a2e:2c07:: with SMTP id s7mr6048290ljs.44.1565536390096; Sun, 11 Aug 2019 08:13:10 -0700 (PDT) MIME-Version: 1.0 References: <20190811090405.50cc49b1@ernst.home> In-Reply-To: From: Alan Somers Date: Sun, 11 Aug 2019 09:12:58 -0600 Message-ID: Subject: Re: RFC: should lseek(SEEK_DATA/SEEK_HOLE) return ENOTTY? To: Ian Lepore Cc: gljennjohn@gmail.com, Rick Macklem , "freebsd-current@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4662Y5146Zz42vc X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.987,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 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: Sun, 11 Aug 2019 15:13:13 -0000 On Sun, Aug 11, 2019 at 8:57 AM Ian Lepore wrote: > > On Sun, 2019-08-11 at 09:04 +0200, Gary Jennejohn wrote: > > On Sun, 11 Aug 2019 02:03:10 +0000 > > Rick Macklem wrote: > > > > > Hi, > > > > > > I've noticed that, if you do a lseek(SEEK_DATA/SEEK_HOLE) on a file > > > that > > > resides in a file system that does not support holes, ENOTTY is > > > returned. > > > > > > This error isn't listed for lseek() and seems a liitle weird. > > > > > > > ENOTTY is the standard error return for an unimplemented ioctl(2), > > and SEEK_HOLE ultimately becomes a call to fo_ioctl(). > > > > > I can see a couple of alternatives to this: > > > 1 - Return a different error. Maybe ENXIO? > > > or > > > 2 - Have lseek() do the trivial implementation when the VOP_IOCTL() > > > fails. > > > - For SEEK_DATA, just return the offset given as argument and > > > for SEEK_HOLE > > > return the file's size as the offset. > > > > > > What do others think? rick > > > ps: The man page should be updated, whatever is done w.r.t. this. > > > > > > > I also vote for option 2 > > > > If SEEK_DATA and SEEK_HOLE don't return the standard "ioctl not > supported" error code and return a fake result, how are you supposed to > determine at runtime whether SEEK_HOLE is supported or not? > > -- Ian pathconf(2) will tell you.