Coding question: finding the size of a block device



Hello,

First off, is this the appropriate list for coding questions? I read
questions@, but I do not often see discussions about code there, so I
thought I might ask here instead. If not, please correct me.

I need to know the size of a block device in some code that I'm writing.
I checked the man pages, and I was thinking that I could use fstat(),
but after I call it on the device, stat->st_size is still 0. I tested
fstat()'s return value, and it's correct; there are no errors. So, I'm
thinking that this is not the correct way to do this.

So I guess my question is: is there a POSIX compatible function that
will allow me to check the size of a given block device?

Thanks,
-Andrew

_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: dd PATCH: add conv=direct
    ... >> when writing to a block device is to open the block device with ... >> reallocation of a single sector of an IDE disk with a media error ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: data loss on jffs2 filesystem on dataflash
    ... Block devices have the attribute that writing AAA... ... I do not thing behaviour on powerfail is part of block device definition. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)