tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



On Sat, 24 Feb 2024 16:28:28 -0500
Thor Lancelot Simon <tls%panix.com@localhost> wrote:

> On Thu, Feb 22, 2024 at 12:08:14PM +0000, 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 is what it
> > is. If anyone wants to do something similar, then the following example
> > can give you a good start.
> 
> 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.
> 
> Thor

Hello, good point, however the software I'm developing is only meant to
work with storage devices like disks, capable of random I/O. If someone
decides to point it at the tape device, they get what they deserve :-)


Home | Main Index | Thread Index | Old Index