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

2024-02-21 Thread Michael van Elst
cryintotheblue...@gmail.com (Sad Clouds) writes: >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. The disk size is only retrieved at open time and stored in the cached vnode.

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); > > On what operating systems does this do what

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

2024-02-21 Thread David Holland
On Wed, Feb 21, 2024 at 09:20:55PM +, Taylor R Campbell wrote: > But it's a little annoying to make that happen because it requires > going through all the file systems that have device nodes and > convincing their VOP_GETATTR implementations to do something different > for block devices

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

2024-02-21 Thread Jason Thorpe
(This should really be on tech-kern…) > On Feb 21, 2024, at 1:20 PM, 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); >>

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

2024-02-21 Thread Taylor R Campbell
> 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 this does not seem to work. Internally, this is happens for more or less the same

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

2024-02-21 Thread Jason Thorpe
> 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); On what operating systems does this do what you claim? > However, on NetBSD this does not seem to work. It doesn’t

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 =