Re: Issues with lseek(2) on a block device

2024-02-24 Thread David Holland
On Sat, Feb 24, 2024 at 04:28:28PM -0500, Thor Lancelot Simon wrote: > > Hello, thanks to everyone who responded with their suggestions. Using > > various non-portable ioctls I can device size on most platforms, for > > both block and raw devices. > > > > This is more convoluted than a

Re: Issues with lseek(2) on a block device

2024-02-24 Thread Michael van Elst
t...@panix.com (Thor Lancelot Simon) writes: >Probably not a good idea to start with lseek() because if you _do_ >encounter a tape device, seeking to SEEK_END could take you an extremely >long time. lseek() doesn't move the tape. But the open() or close() may trigger tape operations like loading

Re: Issues with lseek(2) on a block device

2024-02-24 Thread Taylor R Campbell
> Date: Sat, 24 Feb 2024 16:21:42 -0500 > From: Thor Lancelot Simon > > On Wed, Feb 21, 2024 at 09:20:55PM +, Taylor R Campbell wrote: > > I think this is a bug, and it would be great if stat(2) just returned > > the physical medium's size in st_size -- currently doing this reliably > >

Re: Issues with lseek(2) on a block device

2024-02-24 Thread Thor Lancelot Simon
On Thu, Feb 22, 2024 at 12:08:14PM +, Sad Clouds wrote: > Hello, thanks to everyone who responded with their suggestions. Using > various non-portable ioctls I can device size on most platforms, for > both block and raw devices. > > This is more convoluted than a single lseek() call, but it

Re: Issues with lseek(2) on a block device

2024-02-24 Thread Thor Lancelot Simon
On Wed, Feb 21, 2024 at 09:20:55PM +, Taylor R Campbell wrote: > > Date: Wed, 21 Feb 2024 10:52:55 + > > From: Sad Clouds > > > > Hello, for most operating systems determining the size of a block > > device can be done with: > > > > lseek(fd, 0, SEEK_END); > > > > However, on NetBSD

Re: Issues with lseek(2) on a block device

2024-02-24 Thread Thor Lancelot Simon
On Thu, Feb 22, 2024 at 05:47:55AM +, Sad Clouds wrote: > On Wed, 21 Feb 2024 12:48:34 -0800 > Jason Thorpe wrote: > > > > > > On Feb 21, 2024, at 2:52???AM, Sad Clouds > > > wrote: > > > > > > Hello, for most operating systems determining the size of a block > > > device can be done