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

2024-02-26 Thread Sad Clouds
On Mon, 26 Feb 2024 09:20:21 -0500 Thor Lancelot Simon wrote: > On Sun, Feb 25, 2024 at 04:41:37PM +0000, Sad Clouds wrote: > > > > The whole idea of Unix was "everything is a file" and the sooner people > > get rid of magic ioctls the better. > > But every

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

2024-02-25 Thread Sad Clouds
On Sun, 25 Feb 2024 07:21:07 -0300 Crystal Kolipe wrote: > In most cases, unless we are talking about a low-level disk utility, if > userland code is trying to find out the size of a raw block device then it > seems like a design error. There are many valid reason why applications may want to wo

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

2024-02-25 Thread Sad Clouds
On Sat, 24 Feb 2024 16:28:28 -0500 Thor Lancelot Simon 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 > &g

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

2024-02-22 Thread Sad Clouds
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 followi

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

2024-02-21 Thread Sad Clouds
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 with: > > > > lseek(fd, 0, SEEK_END); > >

Issues with lseek(2) on a block device

2024-02-21 Thread 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 this does not seem to work. #include #include #include #include #include int main(void) { int fd; off_t offset; fd = open("/dev/s