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 Feb 21, 2024, at 2:52 AM, Sad Clouds <cryintothebluesky%gmail.com@localhost> 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 work on macOS, either:

thorpej-mbp:thorpej 541$ sudo ./lseek /dev/disk4
Password:
lseek(fd, 4096, SEEK_SET) = 4096 bytes
lseek(fd, 0, SEEK_END)    = 0 bytes
thorpej-mbp:thorpej 542$ 

-- thorpej



Home | Main Index | Thread Index | Old Index