Does any body knows how to find hard disk information using c proramg, like Total Size of disk, mounted partitions, unmounted partitions, unused size , serial no etc.
Printable View
Does any body knows how to find hard disk information using c proramg, like Total Size of disk, mounted partitions, unmounted partitions, unused size , serial no etc.
procfs is your friend ;)
Surf /proc and see partitions file and ide directory... and read the procfs documentation that comes with the kernel source.
Best regards
without using /proc pshedo file system i want to know the stuff using c proram.
The way you should gather system information is using procfs. It is it's purpose.
In addition, you have two alternatives:
- Execute the sysctl command: This is really dirty.
- Use the sysctl system call: If you carefully read the man page, at the bottom, you can find this:
Quote:
The object names vary between kernel versions. THIS MAKES THIS SYSTEM CALL WORTHLESS FOR APPLICATIONS. Use the /proc/sys interface instead.
Although it's possible to gather the information that you want by means of other system calls / functions, using procfs is what top, ps and other tools do. (and I'm not sure, but free and df probably do too)
Best Regards
Thanks for ur reply