From owner-freebsd-current@freebsd.org Sun Aug 11 17:00:45 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 E29D9BD5DE for ; Sun, 11 Aug 2019 17:00:45 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4664x93l1hz49LH for ; Sun, 11 Aug 2019 17:00:45 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1565542844; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=MxkHds+nlohJg4w0Ml2qhNPQLRXoYNFCwp6D3xsoHtCuMSQ2Tap4sipGCxApIdFOfyln/mLgHmvUL B6ilM85cHxXUtV/gk1IHE4LPwdSu47lywt9cW+OoPqb7Y7UC5CsxVuKI8gOzzDe6NpbL2H7Spdsygk 1HhpZGxus9yITXPSG0HF3A2bt9HRMqUBG8MHl1Oflyk9kifbq5oMJqa0R8U27os/0K63qiug+1hLol L4P2V58qEgX7RePRcllNhdHODGGgg0LcLM8HVzfzMXDHnzhi6ybEAw3CHnEVoDgGc7diyE0CVpdlRU LXt1XXyRPBymYT0k26giPGWrovh12FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=PIFDt0J5QC1lROR1LH3LgkRvaCzVF/V+P6DVUZ28ssQ=; b=vRAVa3aW35ybqN59wc3wTUZkSSQ0LZiZjQuI1eJ9u0QHZ57OCfRXweYy7x4uP1cQkmHKc0K1fPd2l r+mgn5tqtGObqwy9LMQ0Ipw4XlGuhUw2r0ZQlYtPbprJ8I8OWzbRAkEM1+1jyprHJtLIb1pJewEiiL xrV1HpFU89YrPGFw7PLoYqpTH9Ko/b07xFK3x5EdDs2WhfRMTbb0G28xK/xT3OKfA9GkC7B+PQGA5q Z51n7n0WJG4NXSL6+ZKx3Ber/Fnf5pag6Yp4uXBy2CGcR6Ymps0wFOD0z4AoE7Q3nkPxLQbsB38pWF pttBLEHoJsGrqERH5UrSJzJ8quL6kXA== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=PIFDt0J5QC1lROR1LH3LgkRvaCzVF/V+P6DVUZ28ssQ=; b=jYUcCLMl40Q1JzPtJ/HsSOfKTnGCgQXp/QAYUa0SF2oAJUEbvUnMIs4L+sz5pWmlaRy8C0uVmYdSr dCYloogN9wxg1orhRmBP4BSyoNXdkAVzwvj+kLhzirV2DZTbK2WPpZgWDzc0wAs+1ZBUE05X1RawbJ vZEjSipJEsTPic3CC45eCKmSUMN0UbqxvXHHbPDKXXlymTM8bVRHGNiiOtQQymDHEkjhkjteBo9Z5g ZQgpyfBngnRfLXCVezYypD4WO3Km6LJcxzXUBr7glrJRy8PzQEOErUq20zjGouJAH0yH4xToXOFrz0 TwV8zX2JLvQgIeJHJa663YkFvIBujMA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 8d2a4b76-bc59-11e9-b67a-cdd75d6ce7a8 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 8d2a4b76-bc59-11e9-b67a-cdd75d6ce7a8; Sun, 11 Aug 2019 17:00:42 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x7BH0fw8042377; Sun, 11 Aug 2019 11:00:41 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: RFC: should lseek(SEEK_DATA/SEEK_HOLE) return ENOTTY? From: Ian Lepore To: Alan Somers Cc: gljennjohn@gmail.com, Rick Macklem , "freebsd-current@FreeBSD.org" Date: Sun, 11 Aug 2019 11:00:41 -0600 In-Reply-To: References: <20190811090405.50cc49b1@ernst.home> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4664x93l1hz49LH X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,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 17:00:45 -0000 On Sun, 2019-08-11 at 09:12 -0600, Alan Somers wrote: > 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. > Ahh, I wasn't aware of that. For option 2, lseek() has to not just return the info, but must also actually set the file position accordingly, and has to treat offset >= filesize as an error. -- Ian