开发者

How can a program measure device size in AIX?

开发者 https://www.devze.com 2023-01-18 02:10 出处:网络
My C program mounts a raw device, then lseeks to its end to find the length. This works well in Linux and Wi开发者_如何学Gondows, but fails in AIX - apparently you can seek to any location, even past

My C program mounts a raw device, then lseeks to its end to find the length. This works well in Linux and Wi开发者_如何学Gondows, but fails in AIX - apparently you can seek to any location, even past the end. Any idea on how to do it correctly in C?


I've never used AIX, but have you tried using read. It may fail either at or past the end, so you could do binary search for the end using seek and read, maybe.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号